Chris
SHIFTOUT is an I/O function that toggles an output port with the bitwise contents of a data variable. SHIFTIN does the same thing in the other I/O direction.
What I want to do is set up a 'virtual' 1000 tap shift-register in the PIC's memory and be able to clock data through it. It's basically a digital delay line in memory, commonly used for digital signal processing applications. I need to clock it at a well-defined rate and also be able to read any of the 1000 tap points at any time.
It's quite straightforward in assembler, but I wanted to try to incorporate it into an existing PBP program using PBP's ">>" (shift right) and or "<<" (shift left) instructions instead of using assembler. I was hopng someone would tell me there are secret PBP system variables that capture the bits that are shifted OUT of an array variable so they can be shifted back IN to the next variable in the array. This way, a 63-word array could be set up as the 1000-bit shift-register, and bits could be clocked through the 1000 bits as though it were one long shift-register.
Joe
well, I guess that you can only have bit arrays up to 256 elements, but I was thinking something like this..
Maybe with 4 big arrays you could shift through 1024 steps?Code:bigarray var bit[256] 'Large array to hold data newdata var bit 'newest bit to be shifted in index var byte for 0 to 255 bigarray[index] = bigarray[index +1] next index bigarray[255] = newdata 'put the newest data bit into the array
Or have I missed the point entirely...
18F parts let you have arrays as large as memory.
Charles Linquist
Byte_Butcher,
I hadn't thought about a bit array. My thinking was stuck on word arrays, ">>" functions, and being able to get the bit that falls out the end of one word and automatically put it into the input of the next word in the array. In assembler. this is almost trivial.
Your idea seems very doable, except that every bit has to be handled individually. I'm concerned about time, since I want to shift all 1000 bits in 100usec or less. Actually, I'd like to do 2000 bits in that time if I could.
Joe
Perhaps if you gave a few more clearer details other than you want to make a 1000 byte long virtual bit array. Some explanation about how many of the bits you need to read, how often, if you need to skip any chunks (as in filtering and the application of maths series) It seems that you might not be clear enough answers because yoiur application isn't obvious.
If you can do it in assembler you should, regardless of what esoteric reason you might have for not wanting to do it, life is too short sometimes !
-----------------
Actually Chris......
I really don't know what else I can proactively offer in the way of explanation, but if you'd like to help out, feel free to ask questions.
If you re-read the thread, I think you'll find pretty clear explanations of what I'm trying to do:
1) I need a 1000 tap shift register for a DSP-like application
2) I need to be able to read the state of any or all bits
3) I want to clock things into it at about a 10 khz rate
4) I'm looking for one of the PBP experts in the group to tell me whether the "<<" shift operation results in setting any system variables that can be clocked into the next word in an array.
BTW, I really got a kick out of this part:
"If you can do it in assembler you should, regardless of what esoteric reason you might have for not wanting to do it, life is too short sometimes !" Sort reminds me of the old sales cliche that says "If you can find it cheaper somewhere else, buy it!" Oh yeah...uhhh, sure. Thanks
Joe
Bookmarks