Chris Kelly
Well-known member
Hi everyone
This is my first post. I'm new to programming, my background is diy electronics, and my latest project uses 8No shift registers to make a 64-step 'loop'. The data is input at the first step and gets fed back into the register from another of the steps (which therefore sets the length of the loop). This idea takes up alot of real estate and I was hoping to use a Picaxe chip instead.
I'm willing to learn the code myself but I was hoping I could describe what I think is needed so that someone could tell me if I'm approaching it correctly?:
- For an 8 step loop this would need 1 byte.
- on the rising edge of a clock pulse, check whether the input pin is high
- if so, add 1 to the byte (e.g it becomes 00000001)
- check if the MSB is a 1
- if so, make a temporary variable = 1
- double the byte value to shift the data to the left
- add the temporary variable to the byte
- reset the temporary variable to 0 again
This should keep the data looping around, and i could expand this idea up to 8 bytes to get a 64 bit register.
Is this the correct idea? My way of setting the loop length works via a binary counter which counts while a button is pressed, and uses a 16 gate switch to select a position on the shift register to 'tap' into the data for feedback. This is obviously more complex so for now I just wanted to see if using a number of bytes is the right approach.
Sorry for the long winded explanation!
Chris
This is my first post. I'm new to programming, my background is diy electronics, and my latest project uses 8No shift registers to make a 64-step 'loop'. The data is input at the first step and gets fed back into the register from another of the steps (which therefore sets the length of the loop). This idea takes up alot of real estate and I was hoping to use a Picaxe chip instead.
I'm willing to learn the code myself but I was hoping I could describe what I think is needed so that someone could tell me if I'm approaching it correctly?:
- For an 8 step loop this would need 1 byte.
- on the rising edge of a clock pulse, check whether the input pin is high
- if so, add 1 to the byte (e.g it becomes 00000001)
- check if the MSB is a 1
- if so, make a temporary variable = 1
- double the byte value to shift the data to the left
- add the temporary variable to the byte
- reset the temporary variable to 0 again
This should keep the data looping around, and i could expand this idea up to 8 bytes to get a 64 bit register.
Is this the correct idea? My way of setting the loop length works via a binary counter which counts while a button is pressed, and uses a 16 gate switch to select a position on the shift register to 'tap' into the data for feedback. This is obviously more complex so for now I just wanted to see if using a number of bytes is the right approach.
Sorry for the long winded explanation!
Chris