manipulating bits
Archiver
Posts: 46,084
I am using a UCN6818EA serial latch chip with a BS2 and version 2
editor to turn a series of LED. The LED's represent the pattern of
constellations. So, big dipper has 7 stars occuping output lines 0 -
6, little dipper (7 stars) occupy lines 7 - 13, bootes (9 stars)
occupy lines 14 - 22, cassiopia (5 stars) lines 22 - 26. I am
sending the information in the form of 2 words.
for example: to turn the little dipper on with the other three
constellation off, the two words are:
word1 = %0011111110000000
word2 = %0000000000000000
shiftout DataP,clock,msbfirst,[noparse][[/noparse]words1\16,word2\16]
pulsout latch,10
this works great and that constellation is lit.
But I also want to be able lite the stars within the big dipper or
in any other constellation for that matter in a sequence. That
means I want the first star in the little dipper to light up (bit
8), then bit 9 etc. Which means I have to construct a new word for
each star with only that bit being high. I don't know how to do
that.
My program is quite large and I am already out of variable space.
This means that I cannot dedicate a word to each star.
Any suggestion for how to do that?
I know this message is long but that's the only way I can explain it
Many thanks
Al
editor to turn a series of LED. The LED's represent the pattern of
constellations. So, big dipper has 7 stars occuping output lines 0 -
6, little dipper (7 stars) occupy lines 7 - 13, bootes (9 stars)
occupy lines 14 - 22, cassiopia (5 stars) lines 22 - 26. I am
sending the information in the form of 2 words.
for example: to turn the little dipper on with the other three
constellation off, the two words are:
word1 = %0011111110000000
word2 = %0000000000000000
shiftout DataP,clock,msbfirst,[noparse][[/noparse]words1\16,word2\16]
pulsout latch,10
this works great and that constellation is lit.
But I also want to be able lite the stars within the big dipper or
in any other constellation for that matter in a sequence. That
means I want the first star in the little dipper to light up (bit
8), then bit 9 etc. Which means I have to construct a new word for
each star with only that bit being high. I don't know how to do
that.
My program is quite large and I am already out of variable space.
This means that I cannot dedicate a word to each star.
Any suggestion for how to do that?
I know this message is long but that's the only way I can explain it
Many thanks
Al