SPI Timing Issue - NHD-0420D3Z-FL-GBW-V3
Hello,
I am having a timing issue trying to send a full line (20 characters) to the display via SPI. I can write the characters fine however I must delay 100us between characters. I tried using the demo code below, but the delay_us(5) is too short. If I change to delay_us(100) it works but is too slow for my application:
case 2: // SPI
spi_ss = 0;
delay_cycles(5);
for (ix = 0; ix < x; ix++) {
SSPBUF = tx_packet[ix];
while(!BF);
temp = SSPBUF;
delay_us(5); // reduce effective clock rate
}
delay_cycles(5);
spi_ss = 1;
break;
The datasheet lists the execution time as 100us for the character write thus I was able to detemine that 100us was needed. Is this correct or is there something else I am doing wrong? Can the onboard PIC not buffer the 20 bytes transmitted, or I must indeed wait 100us for every byte transmitted?
Regards,
Jason
-
Hi,
It will take 100 µs (Max) to execute a write instruction. This means that you will have to wait 100µs between character writes. The 5µs is the wait to generate the longer clock pulse.0
Please sign in to leave a comment.
Comments
1 comment