9600 Baud LCD Display vs I2C LCD

jackberg

New Member
Hello, Happy New Year to everyone,

a simple question about two 2 kind of 1602 LCD display mode, a serial 9600 baud and a I2C interface.

from my perspective both have serial input mode one with Rx Tx, and the 2nd SDA,SCL but witch one is faster from sending to display data on LCD


Thanks to everyone.
 
If you're starting out, I suggest using the serial 9600 baud version. The i2c interface can get a bit complicated.

If you're into high speed updates using the 4-bit LCD/OLED interface, then have a look at this interface and code that I developed a few years ago. Async serial speeds up to 76800 baud or two different i2c modes. The entire 16x2 screen can be updated in just over 19 milliseconds. Either method uses a dedicated PICAXE 20X2 for hosting the LCD/OLED.
 
on hand I have 1: serial 9600 baud, and I2C form this witch one should be faster as per your experience.

I saw you r 4-bit LCD/OLED interface, that you design, and it's a very interesting project, since you manage to get both interface serial/I2C
under the same hood.

maybe I'll get some 20x2 from my parts bin, and get going making this project. BTW , witch line is optional pin 5 RW, pin 6 En at OLED
is a Hitachi HD44780U the same

You did an excellent job with this one.
 
Last edited:
Hi,

In principle, I2C (at up to 400 kbits/sec) is much faster than "RS232", but basically only over a cable distance of a metre or two (which could be extended somewhat if necessary). However, in practice the speed will probably be limited by the PICaxe's processing speed, or by the "Receiver". In particular, many of the Low Cost "I2C" displays use a "Bus Expander" with 4 bits employed for Data and 4 for Control, so each byte must be sent in two stages. If each "character" is stored as two bytes, then the I2C might be faster than 9600 Baud, but if the PICaxe needs to convert each Character Byte into the Data Pair "On the Fly" then it will probably be slower. Generally, most displays do not use/need the RS232 "Return Channel" (TXD) and sometimes not even the I2C types (particularly the Bus Expander type).

If the Display has an "intelligent" Native I2C Receiver, then it may be faster than 9600 Baud, but otherwise I would be temped to use 9600 Baud (or higher if available) for ASCII displays, but I2C for "Graphic"/ Bit-Mapped displays such as the SSD1306 OLED Displays. It wasn't specifically intended to compare RS232 (4800 baud) UART and I2C protocols, but I posted a Logic Analyser comparison in a Thumbnail in the thread HERE.

Cheers, Alan.
 
Hello Alan,

your description and explications are well detailed and easy to understand, (wish more forum user can do the same)
my main IC is a 28x2, and for the TTL serial to an Hitachi LCD 1602 / 2004 do you know any link that I can find
some code that work at 38400 at least.

on hand I have the LCD117 from Modern Device at 9600 baud, and the AXE113 that work at 4800 baud.
neither one can be modified for higher baud rate.

Thanks again Alan.
 
If you have 6 output pins available on your 28X2 to dedicate to LCD communication, you can use the 4-bit interface method for connecting directly to the display. Some more information on your overall project would be helpful.
 
For now I have this program that emulates basic serial operation of the popular AXE033 module
I'm able to run the serial at 9600, but higher that 9600 it wont work.

it's use pin C.0 of a 20x2 to get the Serin data since the portb is set to output.
the LCD display is a 1602 Hitachi do I have to use the 'calibfreq' in this case.

let me know any tip, thanks again

Code:
' LCD SERIE picaxe 20X2 06/08/12 MM
' Emulates basic serial operation of the popular AXE033 module
'
' Display Line  16      20 car/line
' Line 1: 128-  143    147
' Line 2: 192-  207    211
' Line 3: 144-  159    163
' Line 4: 208-  223    227
' Supported Commands
' 0-7, 8-15    CGRAM characters
' 16-252    normal ASCII characters, according to selected character map table
' 253, X    display 16 character pre-saved message from EEPROM memory, X can be 0-15
' 254, X    LCD command, X can be 0 to 255
' 255, X    control outputs C.3,C.4,C.5et C.7 (from function bit X)
'        Ex; X= %00010000 le port C.4 = 1 (5v) 
' LCD data pins are on B.0 to B.7
' Please remember 4 line displays always use the strange 1-3-2-4 layout.

setfreq M64
#no_data
#no_table

symbol line_length = 20      ' replace by 20 = LCD 20 caract?res
'symbol baud = N4800_32      ' 32MHz est N4800_XX baud use : pulsout enable,2
symbol baud = N9600_64      ' 64MHz est N9600_XX baud use : pulsout enable,2
'symbol baud = N19200_64  ' 64MHz est N9600_64 baud use : pulsout enable,2

symbol RX        = C.0      ' serial receive pin
symbol enable     = C.2      ' LCD enable
symbol rs         = C.1      ' LCD RS

'initialise LCD
init:
gosub LCD_init           ' initialise LCD
      
main:
    serin RX,baud,b1      ' wait for the next byte 

' NB keep character mode test as first item in this list to optimise speed
    if b1 < 253 then          ' Char
        pinsB = b1           ' output the data
        pulsout enable,2     ' pulse the enable pin to send data.
        goto main        ' quickly loop back to top
      
    else if b1 = 254 then    ' command to excecute
        low rs              ' rs command mode
        serin RX,baud,b1    ' wait command byte
        pinsB = b1           ' output the data
        pulsout enable,2     ' validation 
        high rs        ' RS mode     
        goto main        ' quickly loop back to top
      
    else if b1 = 253 then    ' EEPROM message
        serin RX,baud,b1    ' wait for the next byte
        ;gosub msg        ' do the 16 character message
        goto main        ' back to top
    else                    ' 255 not in use
        serin RX,baud,b1    ' wait for the next byte
      
        pinsC =b1 & %10111000 |%00000010     ' Port : C.3; C.4; C.5; C.7
                                 ' RS (C.2)
        goto main                        ' back to top
    end if

'**********************************************************************
; power on LCD initialisation sub routine
LCD_init:
    dirsC = %10111110    ; PortC C.6 C.0 In
    dirsB = %11111111    ; PortB all outputs 

    ; Standard LCD Module Initialisation

    pause 15             ' Wait 15ms for LCD to reset.

    pinsB = %00110000     ' 8 bit, 2 line
                      ' Send data by pulsing enable
    pause 5             ' Wait 5 ms  4800 baud

    pulsout enable,1          ' Send data 48 again
    pulsout enable,1      ' Send data 48 again
      
    setfreq m64            ' now change to 16Mhz

    pinsB = %00111000     ' LCD  - 8 bit, 2 line, 5x8
    pulsout enable,1
          
    pinsB = %00000001        ' Clear Display
    pulsout enable,1   
  
    pause 8            ' 8 = 2ms at 16MHz 4800 baud
 
    pinsB = %00000010     ' return home
    pulsout enable,1

    pinsB = %00000110        ' Entry mode
    pulsout enable,1   


    pause 1            ' 4800 baud

    pinsB = %00001100        ' Display on, no cursor, no blink
    pulsout enable,1
    high rs            ' Leave in character mode
  
    return
20x2 LCD Circuit.jpg
 
Last edited:
SerIn will limit you to 9600 baud due to how it works: SerIn is a "bit banged" command: it works in the foreground: bit timing for asunc is critical and the chip must disable all background tasks (system interrupts). That means that, once the chip has received a character and starts processing it, it (the chip) can't receive another. 9600 baud is the fastest baud rate that it can handle a string of characters. That limitation is the reason I developed my solution.

I see that you are now using a 20X2, which supports background serial data reception via an internal UART into the chip's scratchpad RAM. If you use the hSerial input pin (B.6 / Leg 12), you can utilise the UART and data rates as high as 76800 baud or even 115200 baud. The project that I referred to in Post #2, above, has code for handling higher baud rates. I see that your circuit above uses the 8-bit interface method. By using just B.0 to B.3 and 4-bit interface mode, this will free up the hSerIn pin B.6. You can omit the code for i2c functionality, since you wouldn't be using it.
 
Back
Top