NPEDUCATIONS, Electronic circuits development, electronics tutorials, microcontroller tutorials and projects, advanced microcontroller (ARM) based tutorials and projects, Embedded c development, Embedded c for ARM cortex M, Intel IoT based projects, IoT projects, CC3200 launch pad projects, MSP430 Launchpad tutorials and projects, Tiva C launch pad tutorials and projects, 8051 tutorials and projects, sensor interfacing with microcontroller tutorials, data communications and networking tutorials, peripheral interfacing with microcontroller, led message scrolling display, arduino based tutorials and projects, intel galileo based tutorials and project, ADC interfacing tutorials, LED Blinking, LCD interfacing, Embedded System tutorials and projects, B.tech projects, M.tech projects, online Embedded C training

Embedded C program to interface 16x2 Character LCD in 4-bit mode with ARM Cortex M processor LPC17xx

                In this tutorial, we are going to see how to write an Embedded C program to drive the 16x2 character LCD display. Here we are not going to use any processor supporting header files, everything is written,  developed, tested using LPC1768-Xplorer base board (from NGX technologies) along with Mbed –Xpresso base board as  development board. The entire code for LCD is developed in embedded c without using processor header files.

Step1: look into Schematic for hardware connections to 16x2 LCD


LPC1768-Xplorer is a ARM CORTEX-M3 processor based stamp board which is attached on the Mbed-Xpresso base Board. The Stamp board itself provides some connections to 16x2 Character LCD interface. From the Schematic diagram, there are eight LCD pins are given, LCD_D4 to LCD_D7 as data lines of LCD from Port 0 pins (P0.19 to P0.22) of LPC1768 respectively. LCD control lines (LCD_RS, LCD_RW, LCD_EN) are taken from Port2 pins (P2.5, P2.6, P2.7) and lastly P4.29 is given as LCD back light LCD_BL, but in this tutorial it is not used. Download the LPC1768 schematic diagram here. Once the hardware connections are completed, we will readily jump to the Embedded C program to drive the hardware.

Figure 1: LPC17xx Schematic showing LCD pins


Step 2 : Enable the GPIO hardware using PCONP register.

We start the Embedded C program by identifying the appropriate special function registers and configuring them.
The PCONP is referred as power control for peripherals and is used to ON or OFF the power or clock of different hardware subsections of the processor to reduce the power consumption and PCONP is located address 0x400FC0C4 of the LPC17xx Memory map. PCGPIO bit in PCONP register is used to enable the GPIO hardware in the processor. Enabling 15th bit in the PCONP register will activate the GPIO hardware, through which we can make LCD connections.

Figure 2: PCONP register Configuration


Step 3: Configure the GPIO Port0 Pins as digital pins

16x2 Character LCD is a simple output device which can easily driven with GPIO pins of the ARM cortex processor, but in ARM Cortex M Processor LPC17xx each I/O pin has multiple functionalities. By using Pin Function Select registers (PINSEL0 – PINSEL10), we can select the LCD pins as simple GPIO pins. In this tutorial Port0, Port2, and Port4 are used to interface.

0 comments :

Post a Comment

Thanks for visiting NPEDUCATIONS. We will contact you soon

0 comments :

Post a Comment

Thanks for visiting NPEDUCATIONS. We will contact you soon

If you really like this tutorial, Don't forget to give the comment or please subscribe to the RSS feed by submitting your E-mail or like our Facebook page.
Related Posts Plugin for WordPress, Blogger...

 
Powered by Blogger