Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - jfahlman

Pages: [1]
Character LCDs / SPI Timing Issue - NHD-0420D3Z-FL-GBW-V3
« on: March 22, 2016, 12:38:46 PM »

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;
         for (ix = 0; ix < x; ix++) {
            SSPBUF = tx_packet[ix];
            temp = SSPBUF;
            delay_us(5);      // reduce effective clock rate
         spi_ss = 1;

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?


Pages: [1]