Hello
I am trying to send data from my atmega32 to these
TLC5947 chips from TI.
Basically these are 24 channel PWM led drivers .
The pwm is 12 bit on each channel.
They recieve data serially and work like SIPO shift registers , where you have to raise and lower a latch pin after you've transfered all the data to all the channels.
I've managed to make it work by manually sending data (bitbanging??) through the i/o port and it works fine. That is if I send binary data.
I don't know how I can convert decimal values into binary and then the data bit by bit .
I could probably do it but it would be very inefficient.
Problem:
What if I want to send the data using the AVR SPI ?
The issue is that the SPI sends data in 8 bit chunks and the TLC driver has 12 bit registers for each one of the 24 channels .
Let's say my data is stored in a 24 element long array where the numbers range from 0 to 4096 in decimal (12bits). How would I have my SPI peripheral take that data in chunks of 8 bits and send it?
I would even be satisfied with an 8 bit pwm accuracy but the problem is that the communication is serial and I HAVE to shift all 12 bits to get to the next channel so I can't just send 8 bits and skip to the next channel etc ( this is probably obvious but thought I'd say it anyway)
Would something like this be more efficient to do manually with software(bitbanging?)rather than coverting the data to the SPI?
I really can't think of a way to convert a 12x 24 string of bits into chunks of 8 . Anyone have experience with this?
Thanks in advance
I am trying to send data from my atmega32 to these
TLC5947 chips from TI.
Basically these are 24 channel PWM led drivers .
The pwm is 12 bit on each channel.
They recieve data serially and work like SIPO shift registers , where you have to raise and lower a latch pin after you've transfered all the data to all the channels.
I've managed to make it work by manually sending data (bitbanging??) through the i/o port and it works fine. That is if I send binary data.
I don't know how I can convert decimal values into binary and then the data bit by bit .
I could probably do it but it would be very inefficient.
Problem:
What if I want to send the data using the AVR SPI ?
The issue is that the SPI sends data in 8 bit chunks and the TLC driver has 12 bit registers for each one of the 24 channels .
Let's say my data is stored in a 24 element long array where the numbers range from 0 to 4096 in decimal (12bits). How would I have my SPI peripheral take that data in chunks of 8 bits and send it?
I would even be satisfied with an 8 bit pwm accuracy but the problem is that the communication is serial and I HAVE to shift all 12 bits to get to the next channel so I can't just send 8 bits and skip to the next channel etc ( this is probably obvious but thought I'd say it anyway)
Would something like this be more efficient to do manually with software(bitbanging?)rather than coverting the data to the SPI?
I really can't think of a way to convert a 12x 24 string of bits into chunks of 8 . Anyone have experience with this?
Thanks in advance