Long shift register


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Jerson View Post
    How about inline assembly enclosed by ASM....ENDASM statements?
    That would defeat my goal. I wanted to see if I could do it all (or mostly) in PBP.

    Thanks

    Joe

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe Rocci View Post
    That would defeat my goal. I wanted to see if I could do it all (or mostly) in PBP.

    Thanks

    Joe
    Are the picbasic commands 'shiftin' and 'shiftout' too slow for you ?

  3. #3
    Join Date
    Aug 2006
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Chris Barron View Post
    Are the picbasic commands 'shiftin' and 'shiftout' too slow for you ?

    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

  4. #4
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    well, I guess that you can only have bit arrays up to 256 elements, but I was thinking something like this..

    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
    Maybe with 4 big arrays you could shift through 1024 steps?
    Or have I missed the point entirely...

  5. #5
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    18F parts let you have arrays as large as memory.
    Charles Linquist

  6. #6
    Join Date
    Aug 2006
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Byte_Butcher View Post
    well, I guess that you can only have bit arrays up to 256 elements, but I was thinking something like this..

    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
    Maybe with 4 big arrays you could shift through 1024 steps?
    Or have I missed the point entirely...
    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

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe Rocci View Post
    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 !

  8. #8
    Join Date
    Aug 2006
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Chris Barron View Post
    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.
    -----------------

    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

Similar Threads

  1. Active low input?
    By CosMecc in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 8th August 2010, 20:31
  2. PIC16F877A pwm use for IR transmission
    By mcbeasleyjr in forum General
    Replies: 0
    Last Post: - 11th July 2009, 18:51
  3. Replacing shift register with PIC
    By TonyA in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 7th April 2008, 18:31
  4. Shift Register Woes, specifically the STP16DP05
    By elec_mech in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 11th November 2007, 23:22
  5. Replies: 15
    Last Post: - 30th January 2005, 03:58

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts