Can a SHIFT REGISTER , 74HC165N be used to read two BCD PushWheels?
Hi,
Q1) Can a SHIFT REGISTER ( such as the 74HC165N ) be used to read the BCD data pins from two BCD PUSH-WHEELS? used in a pair.
I wish to dial up any number 0-99 ( as each wheel is 0-9 used in a pair) and call the push-wheels at anytime to check its value?
What data type is best to hold this value in the propellers memory? INTEGER?
Q2) what code ( if available ) is there to read in shift register the 74HC165N Parallel to serial for the propellor?
Thanks
Dave M
Q1) Can a SHIFT REGISTER ( such as the 74HC165N ) be used to read the BCD data pins from two BCD PUSH-WHEELS? used in a pair.
I wish to dial up any number 0-99 ( as each wheel is 0-9 used in a pair) and call the push-wheels at anytime to check its value?
What data type is best to hold this value in the propellers memory? INTEGER?
Q2) what code ( if available ) is there to read in shift register the 74HC165N Parallel to serial for the propellor?
Thanks
Dave M
Comments
2) Probably the easiest for someone possibly familiar with Stamps would be to use the BS2 compatibility library (downloadable from the Object Exchange. I think there's already sample code in some of the Stamp tutorials for using a 74HC165N and that can be easily adapted for the Propeller using the BS2 library.
There are lots of other I/O expanders you could use (like the Philips PCF8574 8-bit or PCF8575 16-bit). These attach to an I2C bus like that used for the boot EEPROM (and can be connected there). You would use the I2C driver library from the Object Exchange to access it.
Post Edited (Mike Green) : 2/10/2007 5:49:56 AM GMT
A2) try the BS2 emulation library, but here is the pseudo code:
Use three lines, call them:
PL - parallel load
CP - clock line
DS - data line
then simply
bring PL low
bring PL high
that will load the shift register from the inputs
then for each of the eight bits
bring CP low
bring CP high
read DS bit
accumulate the bits into a byte, and voila! you are done!
I've got a pile of '165's that I will be using as input expanders.
-
-- edited after posting... mike is absolutely right, the BS2 library should work!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com - a new blog about microcontrollers
Geez, you guys are quick at responding to questions, I am really impressed here!
I did see the BS2 library of functions, and I do believe there is something in there for the shift registers. I will have a look and have a go.
Thanks for the tips,
regards
Dave M
What you have to be aware of as well is that BCD data is different to Binary data.
So you have to do some nibble manipulation ( a nibble is 4 bits ..)
ie you can shift data like 10011001 ( BCD 99 on your thumwheels ) but in binary /dec this is 153..
cheers
Ronald Nollet Australia
Thanks Again,
I found the function
"SHIFTIN" as part of the BS2 library.
Can I just use this function as my own object for the shift register?
I know I need the CONSTANTS as well, basically I want to use just a subset for testing.
I also know that I need to be aware that the 8 bits will be two nibbles and that one of the nibbles has to be multiplied by ten and added to the second nibble.
I also found a sample wiring diagram so I can no get my bits and my breadboard and have a go!
wish me luck!
Dave M