74hc595 shift register
dr_eggman198
Posts: 15
so, If you have a 74hc595 shift register to increase the number of i/o pins, do you treat them as you would a normal i/o pin in the programming. like, you would assign the first pin of the 74hc595 to a variable, a1, and then use a1 in the program like you would use a pin on the basic stamp?
Comments
leds··· VAR··· Byte
alarm·· VAR··· leds.BIT7
Main:
· leds = %00000001········' turn on output A
· GOSUB Update_Leds
· PAUSE 500
· leds.BIT1 = 1···········' now turn on output B (A still on)
· GOSUB Update_Leds
· leds =·%00000000······· ' clear leds
· alarm = 1·············· ' turn on alarm LED (output H)
· GOSUB Update_Leds
· END
Update_Leds:
· SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]leds]
· PULSOUT Latch, 3
· RETURN
See the BASIC Stamp help file under SHIFTOUT for the circuit details.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
·· No, the pins on the 74HC595 would be stored in a single BYTE variable if you were using one '595, and that variable would be SHIFTED out to the '595 using the SHIFTOUT command.· This would place the value in the BYTE variable (8 bits) on the 8 output lines.
EDIT: Jon beat me, but there's a second analogy...·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com