|
To format for printing, click here.
Lamp/Relay Driver for the Handy Cricket
Features
How to Use the Lamp/Relay DriverPlugging It InThe Lamp/Relay Driver for the Handy Cricket is quite easy to use. Start off by plugging it into your Handy Cricket. You can use either bus port they're both the same. Setting and Clearing OutputsNow copy the following Logo driver procedures into your Cricket Programs window:
Download to put this program into the Cricket, and then try it out using the Command Center. Type: set 4 and you should see the output 4 light up on the driver board. The outputs are numbered from 1 to 7, slightly below and to the right of each output jack. To turn off an output, use the clear command: clear 4 Setting and Clearing All the OutputsThere are specific commands for setting and clearing all of the outputs at once. Copy these procedures into the Programs window:
That's all there is to it! Pretty much any device that could be plugged directly into the Handy Cricket's motor output may be used with the Lamp/Relay Driver Board. There are some advanced features, which are described below, but for basic use, you are all set.
Advanced FeaturesThis section explains advanced modes of the Handy Cricket LED Lamp Driver Board:
Load, Toggle, Rotate, and Shift CommandsThe load command allows writing to all 7 outputs at once:
The low bit of the input is output 1, bit 6 of the input is output 7, and all other input bits are ignored. There is a toggle command. This causes outputs to change state: outputs that are on turn off, and outputs that are off turn on:
There are a pair of rotate commands. These cause the output state to rotate to the left or right by one position. When rotating left, the state of output 1 moves to 2, 2 moves to 3, etc., and 7 wraps around to 1. When rotating right, 7 moves to 6, 6 to 5, etc., and 1 wraps around to 7.
There are four shift commands. These cause the output state to rotate to the left or right by one position. When rotating left, the state of output 1 moves to 2, 2 moves to 3, etc., and output 7 is lost. There are two variants of the left-shift command. One variant shifts a "1" (output on) into output 1; the other shifts a "0" (output off) into this output. The two right-shift commands work in an analogous fashion, shifting either 1 or a 0 into output 7 and moving all other outputs to the right.
Using Multiple Driver Boards on One CricketEach Lamp/Relay Driver Board may be hardwired to have an address number from 1 to 15. When the Driver Board ships from the factory, its address is set to 1. By changing the address (described below), multiple driver boards may be controlled from a single Handy Cricket. Any combination of boards with unique addresses may be used on a given Cricket. All boards respond to an address of zero; that how the driver procedures given above function. The address is set by cutting traces and wiring jumpers in the 4x3 bank of address bits illustrated below: To set the address, each pad in the middle row of four pads is wired either to the logic "1" pad above it or the logic "0" pad below it. The left-most pad is the high bit of the address (bit 3, worth 8); the right-most pad is the low bit (bit 0, worth 1). The default wiring has the low bit set to 1 and the other three address bits set to 0, yielding an address of 1. To set the board to a different address, cut the printed trace between the address pad and the logic pad, and then jumper the address pad to the desired logic pad. For example, to set the address to 9, cut the trace between the left pad and the logic 0, and jumper from the left pad to logic 1. This sets the high bit to 1, and leaves the remaining bits as they are, yielding an address of binary 1001, or 9 decimal. Each of the commands shown above may be sent to a driver board with a particular address. The 4-bit address value is stuffed into the upper four bits of the command number. The following modifications to the set and clear driver procedures show how to communicate with the Lamp/Relay Board by specific address. These new procedures, seta and cleara commands, take a board address along with the output to set or clear:
Reading Output StateThe following procedure reads the current output state of the driver board as a value from 0 to 127. Output 1 is bit 0 of the result (on=1; off=0); output 7 is bit 6 of the result:
Please note that you must use a non-zero address with the ledstate? command. In other words, you must refer to a specific board when requesting its state. This is to prevent more than one board from responding in the case of two or more boards plugged into the same Cricket. Shift-and-Query CommandsWhen using the four shift commands described above, the bit being shifted "off the end" of the board is lost. There are four other shift commands that cause the driver board to report the state of the bit being shifted out. These commands must be used with a specific non-zero driver board address. This is for the same reason as the ledstate? queryto prevent the case of multiple board responding at the same time.
With these commands, it is possible to make a light-chasing sequence that spans multiple boards. For example, suppose one Lamp/Relay Driver Board is address 1 and another is address 2. Then the following Logo statements will light up the low bit of board 1 and shift it up to the high bit of board 2: seta 1 1 repeat 13 [ifelse shift-left-0? 1 [shift-left-1a 2][shift-left-0a 2] wait 1]
Technical SpecificationsThe Lamp/Relay Driver Board measures 2.45 x 1.05. There are four mounting holes at the corners of a 2.25 x 0.85 rectangle. The Driver Board uses a ULN2003 darlington transistor array device. Each output is rated for a maximum current of 500 mA, with total power dissipation for all outputs combined limited to 950 mW. The Driver Board can be used with an external power supply by cutting the marked trace on the underside of the board and applying the supply voltage to the pads labeled EXT PWR + . A voltage supply of up to 12v may be used. Please note that the trace on the underside of the board MUST be cut if external power is attached. Otherwise, the voltage will flow back into the main Cricket's supply and potentially burn out the circuits that require no more than 5v. |