Jump to content
IGNORED

Vorticon's Blog - Parallel Port Interfacing Using Extended Basic On The


RSS Bot

Recommended Posts

As some of you know, I am constantly experimenting with interfacing the TI 99/A computer to the real world, and I am very fond of using the parallel port for that purpose because it is very easy to interface and program. That said, that kind of use of the parallel port does require low level programming, generally using assembly language, although one could achieve the same thing using either TurboForth or FbForth. This means that you are essentially out of luck unless you know how to program in assembly or Forth. But not anymore!
I have written a set of assembly language routines accessible directly from Extended Basic which allow you to communicate at the low level with the parallel port, thus allowing you to focus on the interfacing part. In this blog entry, I will detail the hardware as well as the software required to achieve successful interfacing.

First off, before we start discussing the software side of things, we need to have some sort of physical experimentation set up connected to the parallel port. The parallel connector on the RS232 card is a 16 pin proprietary connector primarily meant to connect to a Centronics parallel printer. The easiest way to go about this is to get hold of a TI printer cable which you can purchase here: http://www.connectworld.net/cgi-bin/cabled/L0810?. However, it is pricey, and you might check Ebay or AtariAge as an alternative. You can of course make your own as well if you are so inclined.
Next cut off the Centronics end, strip the ends of the wires, and solder them to a DB25 connector (either male or female) just so:


You can also use crimp type DB25 connectors if you don't want to solder, but I find that the latter provides a more sturdy connection. Pin 1 is the wire with the red stripe, and pin 16 is the last wire on the other side. The DB25 connector pins are numbered from 1 to 25, so you will only use 16 of them. Match the pin numbers with the proper wire on the cable. It is fiddly work, but well worth the effort. Once completed, you can get a parallel port breakout connector off of Amazon or Ebay, making sure that it mates with the sex of the connector on the cable:




Now you should have easy access to all the parallel port pins. Just connect jumper cables from the breakout connector to a breadboard and off you go. Let's briefly describe the pinouts of the parallel port:

 
Spoiler


Replace the x with the drive number where the file resides. These statements load up the utilities needed to control the parallel port. The following is a description of the actual control statements you will have available:

CALL LINK("DATOUT",n)
n is an integer between 0 and 255 and can be an explicit number or a numeric variable. The number is converted to binary and put out on the 8 data lines of the parallel port. This will allow you to control any or all of the data lines just by selecting the appropriate number. A discussion of the conversion between decimal and binary is beyond the scope of this blog, but the information is easy to obtain online and to understand.

CALL LINK("DATIN",var)
var is a numeric variable. This call will read the data lines of the parallel port, convert them to a decimal number, and place it in the variable. Based on the number returned, you will be able to tell which data lines were active.

CALL LINK("SPROUT",n)
n can be either 0 or 1, thus making the SPROUT line either low or high respectively.

CALL LINK("SPRIN",var)
var is a numeric variable. This call returns the logic state of the SPRIN line, 1 for high, 0 for low.

CALL LINK("HSKOUT",n)
n can be either 0 or 1, thus making the HSKOUT line either low or high respectively.

CALL LINK("HSKIN",var)
var is a numeric variable. This call returns the logic state of the HSKIN line, 1 for high, 0 for low.


That's it! With these calls, you will be able to take complete control of the parallel port at the low level.

Now for the fun part I'm going to demonstrate all these routines in action. I created a setup using LED's connected to the parallel port which will provide a visual demonstration of the XB commands. Here's the basic circuit:





There is no need for an external power supply in this case because the circuit draws very little current. However, for more advanced interfacing, an external power supply will likely be needed. Note that the LED labeled D9 in the picture above should actually be D7.

For starters, here's a simple XB program that asks you to input a number between 0 and 255, and outputs it to the parallel port, lighting up the appropriate LED. It's a good way to brush up on your decimal to binary conversion knowlege
The main thing to understand here is that each data LED, from the LSB to the MSB, is represented by the value 2x, with x going from 0 to 7 for an 8 bit data bus. So 20 is 1, and the LSB LED lights up. Next, 21 is 2, and the second LED lights up, etc... Again this is basic binary notation. So in the program, line 50 lights up the HSKOUT LED and shuts off the SPROUT LED. Then it turns off the HSKOUT LED and starts a sequential lighting of the data LED's from 20 to 27. Once it gets to the end, the SPROUT LED lights up, then it turns off and the data LED's are sequentially lit in reverse from 27 to 20, then the cycle starts over.

This last program demonstrates the HANDSHAKEIN AND SPAREIN lines:
 


You should now have all the needed information and tools to go ahead and start experimenting with connecting your TI to the real world. You are only bound by your imagination! Feel free to ask for help if you run into any snags.

Attached thumbnail(s)
  • blogentry-25753-0-20029400-1484683366_th
  • blogentry-25753-0-05755100-1484273137_th
  • blogentry-25753-0-82045200-1484702828_th
  • blogentry-25753-0-56127300-1484702816_th
Attached File(s)


http://atariage.com/forums/blog/659/entry-13589-parallel-port-interfacing-using-extended-basic-on-the-ti-994a-computer/
  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...