I am using 8x of these for my large LED matrix.
Each controls 16x6 LEDs with 4bit for each LED.
The only possibility to transfer data serially fast into the chip I saw was to code it in assembler.
It is not so good to use on the sender side:
There must be additional delay between each byte.
Actually I even want to try hardware serial buffer with one smaller 14pin PIC for 2 16f59.
The clocking scheme transfers a bit on rising and falling edge- saving time. And I have built in a timeout, this is reducing the speed a lot. Maybe I have to remove it somehow.
There is not much time left, about 1mSec, to clock in 376 bits.
Clock is 18 MHz.
3uSec.bit / 200nSec MCU cycle (approx.)
Here the source code:
(for transfering 8bits)
I could speed it up a little by transfering 16 bits each time.
Maybe I also need to change some parts of the display control to assembler because it is too slow in C.
I get 30 Hz for 96 LEDs / 16 brightness levels, but that is free running as fast as possible.
Some speed is lost since I expand from 4bits storage to 8bit for each LED in a line.
Each controls 16x6 LEDs with 4bit for each LED.
The only possibility to transfer data serially fast into the chip I saw was to code it in assembler.
It is not so good to use on the sender side:
There must be additional delay between each byte.
Actually I even want to try hardware serial buffer with one smaller 14pin PIC for 2 16f59.
The clocking scheme transfers a bit on rising and falling edge- saving time. And I have built in a timeout, this is reducing the speed a lot. Maybe I have to remove it somehow.
There is not much time left, about 1mSec, to clock in 376 bits.
Clock is 18 MHz.
3uSec.bit / 200nSec MCU cycle (approx.)
Here the source code:
(for transfering 8bits)
I could speed it up a little by transfering 16 bits each time.
Maybe I also need to change some parts of the display control to assembler because it is too slow in C.
I get 30 Hz for 96 LEDs / 16 brightness levels, but that is free running as fast as possible.
Some speed is lost since I expand from 4bits storage to 8bit for each LED in a line.
Rich (BB code):
unsigned char asm_status @0x10;
unsigned char asm_x @0x11;
unsigned char asm_y @0x12;
void receive_bits(unsigned char x)
{asm_x=x;
asm("banksel _asm_y");
asm("movf _asm_y,w");
asm("movwf FSR");
asm("movf _asm_x,w");
asm("addwf FSR,f");
asm("clrf TMR0");
asm("clrf INDF");
asm("reloop0:");
asm("btfss PORTB,1");asm("goto reloop0"); // wait for clock to go H
asm("btfss PORTB,0");asm("bsf INDF,0");// get data bit
asm("reloop1:");asm("btfsc TMR0,7");asm("goto timeout");asm("clrf TMR0");
asm("btfsc PORTB,1");asm("goto reloop1"); // wait for clock to go L
asm("btfss PORTB,0");asm("bsf INDF,1");// get data bit
asm("reloop2:");asm("btfsc TMR0,7");asm("goto timeout");asm("clrf TMR0");
asm("btfss PORTB,1");asm("goto reloop2"); // wait for clock to go H
asm("btfss PORTB,0");asm("bsf INDF,2");// get data bit
asm("reloop3:");asm("btfsc TMR0,7");asm("goto timeout");asm("clrf TMR0");
asm("btfsc PORTB,1");asm("goto reloop3"); // wait for clock to go L
asm("btfss PORTB,0");asm("bsf INDF,3");// get data bit
asm("reloop4:");asm("btfsc TMR0,7");asm("goto timeout");asm("clrf TMR0");
asm("btfss PORTB,1");asm("goto reloop4"); // wait for clock to go H
asm("btfss PORTB,0");asm("bsf INDF,4");// get data bit
asm("reloop5:");asm("btfsc TMR0,7");asm("goto timeout");asm("clrf TMR0");
asm("btfsc PORTB,1");asm("goto reloop5"); // wait for clock to go L
asm("btfss PORTB,0");asm("bsf INDF,5");// get data bit
asm("reloop6:");asm("btfsc TMR0,7");asm("goto timeout");asm("clrf TMR0");
asm("btfss PORTB,1");asm("goto reloop6"); // wait for clock to go H
asm("btfss PORTB,0");asm("bsf INDF,6");// get data bit
asm("reloop7:");asm("btfsc TMR0,7");asm("goto timeout");asm("clrf TMR0");
asm("btfsc PORTB,1");asm("goto reloop7"); // wait for clock to go L
asm("btfss PORTB,0");asm("bsf INDF,7");// get data bit
asm("btfsc TMR0,7");asm("goto timeout");asm("clrf TMR0");
asm("bcf _asm_status,0");
asm("goto rdy");
asm("timeout:");
asm("bsf _asm_status,0");
asm("rdy:");
}