Digital Electronics: Kit 74 DOS Commands

When controlling your electronic projects through a parallel port, the Kit 74 DOS software consists of three commands — RELAY, DELAY, and WAITFOR — that you can run from a command prompt.


The RELAY command


The RELAY command sends a single byte of data to the parallel port. Each of the eight output pins is set HIGH or LOW, depending on the byte you send. This command sets all eight pins to HIGH:


RELAY FF

And the following command sets all eight outputs to LOW:


RELAY 00

Unfortunately, most versions of the RELAY command available on the Internet have a bug that requires you to issue the command twice to get it to work. Thus, you must actually enter the command RELAY FF twice in sequence to turn on all the output pins.


You must specify the output data as a single hexadecimal number.







































Data PinHex Value
101
202
304
408
510
620
740
880

To turn all the pins on, use the value FF. To turn them all off, use the value 00.


To turn more than one pin on or off, you must first calculate the eight-bit binary number equivalent of the pins you want to set. To turn on pins 1, 2, 3, and 8, for example, you’d use the binary value 100000111. (Notice that pin 1 is represented by the rightmost bit of the binary number and that pin 8 is the leftmost bit.)


After you’ve concocted the binary number for the pins you want to set, split the binary number in half so that you have two four-bit numbers. In the example that sets pins 1, 2, 3, and 8, the first binary number is 1000, and the second is 0111.


Finally, look up each four-bit number in Table 4-3 to determine the single hexadecimal digit to use. For this example, the first four-bit number converts to 8, and the second four-bit number converts to 7. Combining these two numbers gives you the hexadecimal number 87. Thus, the command to turn on pins 1, 2, 3, and 8 is


RELAY 87

You must enter this command twice to get it to work.

























































Binary ValueHexadecimal DigitBinary ValueHexadecimal Digit
0000010008
0001110019
001021010A
001131011B
010041100C
010151101D
011061110E
011171111F

Control timing with DELAY and WAITFOR


The Kit 74 software includes two commands that let you add delays to your scripts. By incorporating delays, you can control the timing of the devices controlled by your parallel-port circuit. You could turn pin 1 on, wait 5 minutes, and then turn it off again, for example.


The most useful of the timing commands is DELAY, which simply causes your script to pause for a certain number of seconds. To delay your script for 10 seconds, for example, use this command:


DELAY 10

The following sequence shows how to turn all outputs on and off at 1-second intervals:


:LOOP
RELAY FF
RELAY FF
DELAY 1
RELAY 00
RELAY 00
DELAY 1
GOTO LOOP

This sequence starts by turning on all the output pins. Then it waits 1 second, turns all the outputs off, waits another second, and jumps to the LOOP label to start the sequence all over again.


You must always specify the delay period in seconds. To wait 1 minute, use this command:


DELAY 60

An hour contains 3,600 seconds, so the following command delays the script for 1 hour:


DELAY 3600

The second timing command is WAITFOR, which waits to execute until a certain time of day arrives. To stop your script until 10:30 AM, for example, use this command:


WAITFOR 10:30

Here’s a sequence that turns all outputs on at 10:30 AM every day, leaves them on for an hour, and turns them off:


:LOOP
WAITFOR 10:30
RELAY FF
RELAY FF
DELAY 3600
RELAY 00
RELAY 00
GOTO LOOP










dummies

Source:http://www.dummies.com/how-to/content/digital-electronics-kit-74-dos-commands.html

No comments:

Post a Comment