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.


Topics - jfahlman

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

Pages: [1]