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 - dstover

Pages: [1]

I'm communicating with the C0220BiZ through its I2C interface, and having a problem with the "Clear Display" (chip 0x3C (7-bit), register 0x00, data 0x01) command executing consistently. Subsequent I2C writes to data (0x40) append text to the existing contents of DDRAM, as though the Clear command were never received.

I would greatly appreciate any thoughts on why this is happening. I'm willing to provide more scope captures or run further tests if that helps remove entropy from the discussion.

  • My I2C commands appear well-formed (see attached oscope grabs).
  • My I2C master doesn't sense a NACK or time out (it would set a sticky flag in my debugger, which it has not done).
  • Slowly stepping through my program proves that it is not a matter of wait time between transmissions; I have observed persistent text after oscope confirmation that a Clear Display command was sent and the LCD did ACK all frames.

Program notes:
My test program initializes the display as per the ST7036 datasheet (see code below), and loops through a simple clear-write-wait routine:
  • The clear function waits 2 ms after transmission, before allowing data to be written to the display. In fact, all writes to the command register (0x40) wait 2 ms after transmitting.
  • Writes to the command register are formed as single I2C writes (start/chip/reg/data/stop for each instruction).
  • Writing data to the display is formed as a repeated write (same concept as sample code from the Newhaven datasheet).
  • A wait time of 100 ms is issued after writing data to the display, before looping back to the Clear Display command

Code: [Select]
#define lcdSlave    0x3C
#define lcdCmd      0x00
#define lcdDat      0x40
void lcdInit( void ) {
   lcdWriteCmd(0x38); // Function Set:: 8b; 2Line; SingleHeight; InstrTable 00b
   lcdWriteCmd(0x39); // Function Set:: 8b; 2Line; SingleHeight; InstrTable 01b
   lcdWriteCmd(0x14); // Bias Set:: 1/5 bias
   lcdWriteCmd(0x78); // Contrast Set:: C[3:0] is data[3:0]
   lcdWriteCmd(0x5E); // Pwr/Contrast Set:: ICON.on; Boost.on; C[5:4] = data[1:0]
   lcdWriteCmd(0x6D); // Follower Control:: Follower.on; ratio = data[2:0]
   lcdWriteCmd(0x0C); // Display:: Display on, cursor off
   lcdWriteCmd(0x01); // Clear Display
   lcdWriteCmd(0x06); // Entry Mode Set:: Cursor.incrementDirection; Shift.disabled
void lcdWriteCmd( u8 outCmd ) {
   i2cMasterWrite(lcdSlave, lcdCmd, outCmd);

[attachment deleted by admin]

Pages: [1]