help with 74hc165 shift register
remmi870
Posts: 79
im having problems getting my 74hc165 parallel to serial shift register to work with my bs2, ive connected it up the way i think it should be with the data line, clock line, and load input.
here is my code
CS············· PIN···· 0······················ ' chip select
AData·········· PIN···· 1······················ ' data pin
Clk············ PIN···· 2······················ ' clock pin
adcRes········· VAR···· Byte··················· ' result
Setup:
HIGH CS······································
Main:
· DO
··· LOW· cs
··· SHIFTIN AData, Clk, LSBPOST, [noparse][[/noparse]adcRes\9]···· ' shift in the data
··· HIGH cs
··· DEBUG HOME
··· DEBUG DEC ? adcRes
··· PAUSE 1000································· ' wait one second
· LOOP········································· ' repeat
· END
right now when i run the program if i connect a pin to logic high, i get a random number output, if i disconnect the pin it stays at 255, any help?
here is my code
CS············· PIN···· 0······················ ' chip select
AData·········· PIN···· 1······················ ' data pin
Clk············ PIN···· 2······················ ' clock pin
adcRes········· VAR···· Byte··················· ' result
Setup:
HIGH CS······································
Main:
· DO
··· LOW· cs
··· SHIFTIN AData, Clk, LSBPOST, [noparse][[/noparse]adcRes\9]···· ' shift in the data
··· HIGH cs
··· DEBUG HOME
··· DEBUG DEC ? adcRes
··· PAUSE 1000································· ' wait one second
· LOOP········································· ' repeat
· END
right now when i run the program if i connect a pin to logic high, i get a random number output, if i disconnect the pin it stays at 255, any help?
Comments
First it looks like you’re using the example code for the ADC0831, which won’t work here…not exactly. Another issue is if you’re input on your 74xx165 are floating, you can’t be sure of what value they will read when shifted in. All 8 inputs must be defined before the shift for you to get the expected data.
The Stamp Works manual has an example of reading the 74xx165 shift register. You can download the manual and example code free at the following link. I hope this helps. Take care.
http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/txtSearch/StampWorks/List/1/ProductID/329/Default.aspx?SortField=ProductName%2cProductName
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering