I2C LCD driver

nick12ab

Senior Member
Is there any real advantage of using I2C over serial for LCD's?
If you're already using i2c devices then it doesn't use up any additional pins to add the i2c LCD. Plus multiple i2c LCDs can be used without increasing the number of pins required because the one you linked allows you to pick one of eight addresses with the solder bridges on the PCB.
 

westaust55

Moderator
Pity the backlight brightness control potentiometer is on the side towards the LCD.
Not so convenient when you have the LCD and backpack module close-coupled.
 

MPep

Senior Member
Pity the backlight brightness control potentiometer is on the side towards the LCD.
Not so convenient when you have the LCD and backpack module close-coupled.
Just saw that photo. Would be simple to remove and resolder on the other side, but should have been thought about a bit better :).

MPep
 

premelec

Senior Member
John, that would mean that China's production unit has failed! They've re-listed on their store... :)
 

westaust55

Moderator
Both "serial" and i2c are serial.

The PiCAXE serial (Serout) uses a single pin without a click and therefore is asynchronous so the timing must be more precise. It is also unidirectional (one way).

I2C is synchronous and uses a clock signal thus 2 wires but that does also the signal speed to vary.
I2C is bidirectional so you can read data back via the same pins and the nature of i2c using a device space address allows many (often 4 or 8) chips or modules of the same type to be used on the same i2c bus.

The asynchronous serial have only start and stop bits as overheads so at a speed to 9600 baud you would sent 960 bytes/characters per second.

I2c has two speeds for PiCAXE 100 or 400 KHz
But each transmission sequence must send a byte as a space address and maybe 1 or 2 bytes as a location register address before the data is send. That means from 8 to 24 extra bits pre group of data bytes. Plus there is some hand shaking and acknowledgement bits to handle.
So to send 1 byte of data you might be transferring around 40 bits of information.
But for 8 bytes of data there would be around 80 to 96 bits of data.
Considering the clock speed as 100 kHz, we send 1 bit per clock so for our 8byte case the speed roughly equates to 1000 bytes per second - but slower if we have to consider delYs between each transmission.
Obviously at 400 kHz the data transmit can be up to 4 times faster.

Hardware SPI (HSPI) comms by comparison can have clock speeds in the MHz so many times faster again.
 

nick12ab

Senior Member
I2c has two speeds for PiCAXE 100 or 400 KHz
I2c has other speeds as well.

The PICAXE can also have faster i2c by increasing the clock speed of the PICAXE using setfreq then using the incorrect speed keyword for the clock speed (e.g. i2cfast_4 at 32MHz) but if a slower device is used on the bus then the slower speed should still be used.

Unfortunately PICAXE won't support some features required by newer i2c revisions.
 
Top