Advertise here

Liquid crystal Display (LCD) control Using SAMD21 Xplained pro

Liquid crystal Display (LCD) control Using SAMD21 Xplained pro


as simple as it sounds , LCD like 1602 or 2002 or 2004 which is based on HD44780 or equivalent chips are so common in the electronics community.

 yet it's hard to find a library or an example for it using ASF4 or even older ASF3 officially, so I write a full library and tested code for it thanks to arduino  Liquid crystal  which was my reference to write it so you would find it familiar to you if you are using arduino.





this library would work for any other boards support ASF4 , all you need is to map the GPIO to match your board.




Connection:

You can use this Library with 4bit/8bit mode so this connection will be for 8 bit mode , but you can use the same connection for 4 bit mode and enable it from the code 

   LCD                    SAMD21 Xplained pro

   VSS  ............................  GND
   VDD ............................  3.3V(or 5V)
    RS    ............................  PB03
    R/W ............................ PB02(or to GND)
    EN    ............................ PB04
     D0   ............................ PA10(8bit only)
     D1    ............................ PA11(8bit only)
     D2   ............................ PA20(8bit only)
     D3   ............................ PA21(8bit only)
     D4   ............................ PB00
     D5   ............................ PB01
     D6   ............................ PB06
     D7   ............................ PB07
     A      .................      To VDD via 330 resistor
     K      .................              GND



Code 


You could find a simple reference to how to use this library from (here) just keep in mind if you are going to use 4 bit mode to use

Liquid_Crystal_setup(&lcd1602,LCD_4BITMODE,
LCD_RS,LCD_WR,LCD_EN,Data_pin_4,Data_pin_5,Data_pin_6,Data_pin_7,0,0,0,0);

or use this if you want to use 8 bit mode 

Liquid_Crystal_setup(&lcd1602,LCD_8BITMODE,
LCD_RS,LCD_WR,LCD_EN,Data_pin_0,Data_pin_1,Data_pin_2,Data_pin_3,Data_pin_4,Data_pin_5,Data_pin_6,Data_pin_7);


and I tested with LCD 2004 successfully as in the images below



  

No comments

Powered by Blogger.