Newhaven Products > Character LCDs

NHD-0420D3Z-FL-GBW-3V Dropping characters over I2c

(1/1)

camac881:
Hello All,
  I saw the other posts about losing characters over I2c due to firmware issues and tried the same fix by slowing it down. It has gotten better but I'm still dropping the occasional character. I am running the screen from an Arduino Uno and displaying data from an SPI A/D converter.

 My question is what is the correct way to code a speed correction for the Arduino? The line I'm using now is
#define TWI_FREQ = 100000L / 6; Is that correct?

Thanks,
Cam

Michael_L:
I'm not sure if this applies to the Uno as well as the Mega, but with the Arduino Mega I have used "TWBR = 152;" (sets I2C clock frequency to 50kHz) after I call "Wire.begin()" in the setup() function.
I would check the Arduino forums/documentation to confirm this works with the Uno too.

camac881:
Hello Michael,
  That worked perfectly. Thank you.

  I checked the Wire library reference at Arduino.cc and they referenced the data sheet at Atmel and a table that does not make this any clearer. How do you come up with the number? Do you gather all the pieces and run them through the formula? It seems like herding cats to me.

Thanks for your help!
Cam

Michael_L:
You're welcome!  This site should help:

http://www.gammon.com.au/forum/?id=10896

Navigation

[0] Message Index

Go to full version