Difference between revisions of "Lcd 4-bit with Explore M3"
Line 20: | Line 20: | ||
|- | |- | ||
|5 || 6 || 7 || P_NC || P_NC || P_NC || P_NC || 12 || 13 || 14 || 15 | |5 || 6 || 7 || P_NC || P_NC || P_NC || P_NC || 12 || 13 || 14 || 15 | ||
− | } | + | |} |
*P_NC: Pin Not Connected | *P_NC: Pin Not Connected | ||
<br><br><br> | <br><br><br> |
Revision as of 15:10, 28 April 2016
In this tutorial we will see how to interface lcd in 4-bit mode using the explore Embedded bare metal libraries.
At the end will see how to use the libraries for 1x16, 2x16 and 4x20 LCD's.
The libraries can be used on different platforms like Keil, ARM GCC, GCC And Eclipse etc.
Contents
[hide]Prerequisites
Please check this tutorial for detailed explanation on LCD.
If you are doing it for the first time, then check the below links to setup the project for generating the .bin file.
Hardware Connection
RS | RW | EN | D0 | D1 | D2 | D3 | D4 | D5 | D6 | D7 |
---|---|---|---|---|---|---|---|---|---|---|
5 | 6 | 7 | P_NC | P_NC | P_NC | P_NC | 12 | 13 | 14 | 15 |
- P_NC: Pin Not Connected
Code
Below is the sample code the blink the LED connected to pin 13.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "delay.h" | |
#include "gpio.h" | |
#include "stdutils.h" | |
#define LED 13 //LED is connected to pin 13 on Explore M3 board | |
int main() | |
{ | |
SystemInit(); //Clock and PLL configuration | |
GPIO_PinFunction(LED,PINFUN_GPIO); // Configure Pin for Gpio | |
GPIO_PinDirection(LED,OUTPUT); // Configure the pin as OUTPUT | |
while(1) | |
{ | |
GPIO_PinWrite(LED,HIGH); // Turn ON the Led | |
DELAY_ms(100); // Wait for some time | |
GPIO_PinWrite(LED,LOW); // Turn OFF the Led | |
DELAY_ms(100); // Wait for some time | |
} | |
} |