BS2 and shift registers
Joms
Posts: 279
I am working on a little more advanced project and having problems on where to start with the code.· Basically what I am trying to do is intercept signal that is going between two sets of shift registers (one an in and the other an out).· There are three signals that go between the shift registers, data, clock, and clear.· In this system there are three 8-bit input shift registers and three 8-bit output shift registers for a total of 24 bits of data.
What I am trying to accomplish is tie into the data, clock, and/or clear lines and store that information in a variable on the stamp.· I have found a document in the nuts and volts section about using shift registers on the input, but that is using the stamp to create the clock signal.· In this application I need the stamp to actually follow the clock signal but not produce it.
If you have any ideas on where I need to start with the code or can point me in the right direction to more information about this problem I would greatly appreciate it.· I am not going to give up on this project... Thanks in advance...
What I am trying to accomplish is tie into the data, clock, and/or clear lines and store that information in a variable on the stamp.· I have found a document in the nuts and volts section about using shift registers on the input, but that is using the stamp to create the clock signal.· In this application I need the stamp to actually follow the clock signal but not produce it.
If you have any ideas on where I need to start with the code or can point me in the right direction to more information about this problem I would greatly appreciate it.· I am not going to give up on this project... Thanks in advance...
Comments
What you need to do is tie in to the clock and clear signals, so that the FPGA sends an 8-bit 'snapshot' into a 2K fifo from the parallel outputs of the shift register, every 8 bits.
Once the data is in there, you can use 8 data pins of the BS2, and a 'read' signal, to read the data from the FIFO chip and send it via RS-232 wherever you need it to go.
Otherwise, you're right -- the BS2 makes a lousy 'slave' SPI device.
In any event, the BS2 is going to be a little speed limited for this application -- it'll only do 2000 Basic Instructions Per Second (up to 10,000 for some BS2 'flavors').
I kind of think of using FPGAs as 'FPGA hell' If there is anything lower than programing in machine code, it is constructing a program from FPGA modules. It is interesting, but can be a whole new subject that is far beyond BasicStamps.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
PLEASE CONSIDER the following:
Do you want a quickly operational black box solution or the knowledge included therein?······
Post Edited (Kramer) : 2/28/2008 5:00:47 PM GMT
So then you have to 'mask' off the bits that are NOT in the 12 you wanted to read. Shift the result up or down, and there's your 12 bit value (in a 16 bit Word).