Shift registers working in paralel

Thank you for your answers, i realy did some nice things. Now there is another problem. What if i want to make a simple binary counter? In my point of view this isn't no longer an easy problem, not at all, like 1 byte binary counter because of the splitting data at the middle. Now the first part of the data is in connexion with the second one and i can't send one byte of 0 when i'm done with first part. What do you say? I realy want to send 16 bits without splitting them.

alexmath: Thank you for your answers, i realy did some nice things. Now there is another problem. What if i want to make a simple binary counter? In my point of view this isn't no longer an easy problem, not at all, like 1 byte binary counter because of the splitting data at the middle. Now the first part of the data is in connexion with the second one and i can't send one byte of 0 when i'm done with first part. What do you say? I realy want to send 16 bits without splitting them.

In the method I suggested (creating a 16 bit shift out function that sits on top of the Arduino 8 bit shiftOut() function) , the data is always 16 bit so there isn't any sort of split of the data.

In order to output a binary number on the pins, all you do is declare and initialized a uint16_t variable and send it to the 16 bit shift out routine. Increment it and send it again, etc... Easy peasy.

--- bill

think about it like the base ten decimals... you are not really 'splitting the data in the middle'

you are counting from zero to 255 on one register with all zeroes on the 2nd... and then for each increment of the 2nd, counting up again.

B00000000, B00000000 B00000000, B00000001 B00000000, B00000010 B00000000, B00000011 .... .... B00000000,B11111111 B00000001, B00000000 B00000001, B00000001 B00000001, B00000010 B00000001, B00000011 ... ... and so on...

It is a math problem, not really a programming problem, yeah?

pseudo code:

for b= 0 to 255;
  {
   for a = 0 to 255
   {
     display b and increment and display a
   }
  increment b
}

alexmath: Thank you for your answers, i realy did some nice things. Now there is another problem. What if i want to make a simple binary counter? In my point of view this isn't no longer an easy problem, not at all, like 1 byte binary counter because of the splitting data at the middle. Now the first part of the data is in connexion with the second one and i can't send one byte of 0 when i'm done with first part. What do you say? I realy want to send 16 bits without splitting them.

You want to make a feed the registers function that does nothing else but take unsigned 16 bits and send.

You make completely separate code that prepares the 16 bit words to send, knows nothing about splitting.

You do not put the lines to do the one thing in with the lines to do the other. Debug each piece on its own, using test sketches as needed. When they mix, 2 things to go wrong makes debug 4 times harder.

GoForSmoke:
You want to make a feed the registers function that does nothing else but take unsigned 16 bits and send.

You make completely separate code that prepares the 16 bit words to send, knows nothing about splitting.

You do not put the lines to do the one thing in with the lines to do the other.
Debug each piece on its own, using test sketches as needed.
When they mix, 2 things to go wrong makes debug 4 times harder.

I agree. That is the approach I suggested.
However, that is a very different approach than in your psuedo code examples in response #18 :wink:

bperrybap: I agree. That is the approach I suggested. However, that is a very different approach than in your psuedo code examples in response #18 ;)

Which was to show something else to someone else in the thread.

BTW, either way it's not a problem to me since what I showed was trivial.