Fish4Fun
So long, and Thanks for all the Fish!
My Dyslexia is killing me and I need some help .... I can't remember the relationship between time and left-right orientation in the timing diagram ... I know this seems ridiculous, but it is the world I live in. In an effort to make clear what I am asking here are the two most likely scenarios as I see them:
****************************************************************************************************
One:
With Respect To the diagram below, assuming I want to send the 32-bit word $F1020408 (11110001 00000010 00000100 00001000) via a bit-bang routine do I send the lowest bit in the lowest byte first like so:
****************************************************************************************************
Two:
With Respect To the diagram below, assuming I want to send the 32-bit word $F1020408 (11110001 00000010 00000100 00001000) via a bit-bang routine do I send the Highest bit in the lowest byte first like so:
****************************************************************************************************
Of course the other two permutations (not detailed above) involve using one of the above two scenarios except sending the High Byte First, but I am 99.99% sure these are NOT the case ....
***AND NO, this is NOT the actual code, just didactic attempts to clarify the order of operations to comply with the protocol in the below diagram.***
Here is the Two-Wire serial timing Diagram (taken from the SK9822 data sheet):
I know this seems silly, and I could certainly figure it out experimentally; however, it would be a kindness if someone could simply tell me the answer .... (The irony of asking for the answer to **Time** is not lost on me.)
If anyone is still reading ... the bit-bang routine I am working on is going to be used to control arrays of SK9822 RGB LEDs .... The SK9822's arrays are "daisy chained" together the "Start Sequence" is 32 zeros followed by 32 bits of data for each LED in the array and then terminated by 32 ones ....
I am **assuming** that a routine optimized for refresh rate would immediately begin sending the next "frame" of data immediately following the termination bits .... ie:
Assuming 1024 LEDs in an array ...
Frame.0:
Start = $00000000
Data = 1024 * $xxxxxxxx data bytes
Termination = $FFFFFFFF
Frame.1:
Start = $00000000
Data = 1024 * $xxxxxxxx data bytes
Termination = $FFFFFFFF
.
.
.
.
Frame.N
Start = $00000000
Data = 1024 * $xxxxxxxx data bytes
Termination = $FFFFFFFF
.
.
etc
.
etc
(8256 Total Bits/Frame ... ~4.128mS/Frame (~240 Frames/Sec) @ 2mbps)
But to send a "Static" Frame one would do the following:
Start = $00000000
Data = 1024 * $xxxxxxxx data bytes
Termination = 1024 * $FFFFFFFF
(16416 Total Bits ... ~8.2mS @ 2mbps)
I have three of these 32x8 arrays on order: ( https://www.ebay.com/itm/WS2812B-RG...var=454012843559&_trksid=p2057872.m2749.l2649 ) to experiment with .... I will start a new thread specifically about these ... for now I just wanted to make sure I get the protocol straight in my head so I can get the bit-bang code written before the panels arrive ...
Thanks!
Fish
****************************************************************************************************
One:
With Respect To the diagram below, assuming I want to send the 32-bit word $F1020408 (11110001 00000010 00000100 00001000) via a bit-bang routine do I send the lowest bit in the lowest byte first like so:
Code:
;Assume io Pins are Initialized
Tx_F1020408:
sbi PORT_io, Pin_cki ;Set Clock Line High
call TxLSB
call TxByte2
call TxByte3
call TxMSB
ret
Tx_LSB: ;00001000
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_One
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_Zero
ret
Tx_Byte2: ;00000100
call Tx_Zero
call Tx_Zero
call Tx_One
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_Zero
ret
Tx_Byte3: ;00000010
call Tx_Zero
call Tx_One
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_Zero
ret
Tx_MSB: ;11110001
call Tx_One
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_One
call Tx_One
call Tx_One
call Tx_One
ret
Tx_Zero:
;Tx 0
cbi PORT_io, Pin_sdi ;Set sdi = 0
cbi PORT_io, Pin_cki ;Clock = Low
sbi PORT_io, Pin_cki ;Clock = High
ret
Tx_One:
sbi PORT_io, Pin_sdi ;Set sdi = 0
cbi PORT_io, Pin_cki ;Clock = Low
sbi PORT_io, Pin_cki ;Clock = High
ret
****************************************************************************************************
Two:
With Respect To the diagram below, assuming I want to send the 32-bit word $F1020408 (11110001 00000010 00000100 00001000) via a bit-bang routine do I send the Highest bit in the lowest byte first like so:
Code:
;Assume io Pins are Initialized
Tx_F1020408:
sbi PORT_io, Pin_cki ;Set Clock Line High
call TxLSB
call TxByte2
call TxByte3
call TxMSB
ret
Tx_LSB: ;00001000
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_One
call Tx_Zero
call Tx_Zero
call Tx_Zero
ret
Tx_Byte2: ;00000100
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_One
call Tx_Zero
call Tx_Zero
ret
Tx_Byte3: ;00000010
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_One
call Tx_Zero
ret
Tx_MSB: ;11110001
call Tx_One
call Tx_One
call Tx_One
call Tx_One
call Tx_Zero
call Tx_Zero
call Tx_Zero
call Tx_One
ret
Tx_Zero:
;Tx 0
cbi PORT_io, Pin_sdi ;Set sdi = 0
cbi PORT_io, Pin_cki ;Clock = Low
sbi PORT_io, Pin_cki ;Clock = High
ret
Tx_One:
sbi PORT_io, Pin_sdi ;Set sdi = 0
cbi PORT_io, Pin_cki ;Clock = Low
sbi PORT_io, Pin_cki ;Clock = High
ret
Of course the other two permutations (not detailed above) involve using one of the above two scenarios except sending the High Byte First, but I am 99.99% sure these are NOT the case ....
***AND NO, this is NOT the actual code, just didactic attempts to clarify the order of operations to comply with the protocol in the below diagram.***
Here is the Two-Wire serial timing Diagram (taken from the SK9822 data sheet):
I know this seems silly, and I could certainly figure it out experimentally; however, it would be a kindness if someone could simply tell me the answer .... (The irony of asking for the answer to **Time** is not lost on me.)
If anyone is still reading ... the bit-bang routine I am working on is going to be used to control arrays of SK9822 RGB LEDs .... The SK9822's arrays are "daisy chained" together the "Start Sequence" is 32 zeros followed by 32 bits of data for each LED in the array and then terminated by 32 ones ....
I am **assuming** that a routine optimized for refresh rate would immediately begin sending the next "frame" of data immediately following the termination bits .... ie:
Assuming 1024 LEDs in an array ...
Frame.0:
Start = $00000000
Data = 1024 * $xxxxxxxx data bytes
Termination = $FFFFFFFF
Frame.1:
Start = $00000000
Data = 1024 * $xxxxxxxx data bytes
Termination = $FFFFFFFF
.
.
.
.
Frame.N
Start = $00000000
Data = 1024 * $xxxxxxxx data bytes
Termination = $FFFFFFFF
.
.
etc
.
etc
(8256 Total Bits/Frame ... ~4.128mS/Frame (~240 Frames/Sec) @ 2mbps)
But to send a "Static" Frame one would do the following:
Start = $00000000
Data = 1024 * $xxxxxxxx data bytes
Termination = 1024 * $FFFFFFFF
(16416 Total Bits ... ~8.2mS @ 2mbps)
I have three of these 32x8 arrays on order: ( https://www.ebay.com/itm/WS2812B-RG...var=454012843559&_trksid=p2057872.m2749.l2649 ) to experiment with .... I will start a new thread specifically about these ... for now I just wanted to make sure I get the protocol straight in my head so I can get the bit-bang code written before the panels arrive ...
Thanks!
Fish