You have no items in your shopping cart.

Subtotal: 0.00

How to interface ADC-LCD with ARM9 Stick board

ARM9-LPC2929 STICK BOARD

 

ARM9-LPC2929 STICK BOARD

The is specifically designed to help students to master the required skills in the area of embedded systems. The board is designed in such way that all the possible features of the microcontroller will be easily used by the students. The board supports Keil µVision 4 compilers with Keil ULink2.

 

NXP Microcontroller,ARM9-LPC2929 stick board is proposed to smooth the progress of developing and debugging of various designs encompassing of speed 32-bit Microcontrollers. It integrates CAN, LIN, UART, ADC, PWM, I2C, SPI, Timer, Interrupt etc., to create a stand-alone versatile test platform.

 

ARM9 Stick Board having more no of I/O line for user access able. Its consists of 64 GPIO pins, CAN0/1, LIN1, I2C0/1, UART0/1, SPI0/1, USB, ADC0/1/2, PWM, Timer and more features. Users can easily access the controller and develop more application by using

ARM9 Stick Board.

 

ADC (Analog to Digital Converter)

 

ADC is used for converting the analog signal into digital signal, where the analog signal in the form of voice (continuous signal) or DC signal. ARM9 Stick board consists of 5V reference ADC and 3.3V reference ADC.

 

Interfacing ADC_LCD

 

The circuit and Pin diagram shows how to interface the LCD to microcontroller and display the ADC value. The 2x16 character LCD interface card with supports both modes 4-bit and 8-bit interface, and also facility to adjust contrast of LCD using trim pot (R3).

 

In 8-bit interface 11 lines needed to create 8-bit interface; 8 data lines (D0 – D7), three control lines, address bit (RS), read/write bit (R/W) and control signal (EN).

 

Here the analog signal is 0V to 5V variable DC signal. For varying the trim pot (R4) get the digital output in the form of decimal value (0000 to 1023) at LCD Display.

 

Circuit and Pin Diagram for ARM9 Stick Interface




circuit-and-pin-diagram-for-arm9-stick-interface-with-adc-lcd


Example for ARM9 Stick Interface with ADC_LCD




arm9-stick-interface-with-adc-lcd


C Program to display a ADC value in LCD using ARM9 Stick Board

 

Title: Program to ADC_LCD display
#include  //Register Description Header for LPC2929

 

#define RS 0x0020 // Register Select

#define RW 0x0040 // Read Write Select

#define EN 0x0080 // Enable

#define D7 0x8000 // Data Line 7

#define D6 0x4000 // Data Line 6

#define D5 0x2000 // Data Line 5

#define D4 0x1000 // Data Line 4

#define D3 0x0400 // Data Line 3

#define D2 0x0300 // Data Line 2

#define D1 0x0200 // Data Line 1

#define D0 0x0100 // Data Line 0

 

void lcd_cmd (char);

void lcd_data (char);

void lcd_initialize (void);

void lcd_display (void);

void LCD4_Convert (char);

 

void Delay (unsigned int);

void ADC_Conversion (void);

void ADC_Init (void);

void delay (unsigned int);

void Disp_Calc (unsigned int);

 

char cmd[4] = {0x38,0x0C,0x06,0x01}; // LCD Comments

char msg[] = {"ARM STICK V 1.0"}; // First Line of LCD

char msg1[] = {"ADC VALUE ="}; // Second Line of LCD

 

int main(void) // Main function

{

unsigned int ADC_VALUE,A,B,C,D,E,F,i;

GPIO3_DR = 0xFFFF; // P3.0 to P3.15 select as Input Direction

lcd_initialize();

lcd_display();

ADC_Init();

while(1)

{

ADC_Conversion();

ADC_VALUE = ADC0_ACD10;

 

 

 

 

lcd_cmd(0xc0); // Command for second Line of LCD

for(i=0;msg1[i]!='\0';i++)

{

delay(2);

lcd_data(msg1[i]);

}

delay(2);

 

A = ADC_VALUE /1000; // ADC Value Calculation

B = ADC_VALUE %1000;

lcd_data(A+0x30);

delay(1);

C = B /100;

D = B %100;

lcd_data(C+0x30);

delay(1);

E = D /10;

F = D %10;

lcd_data(E+0x30);

delay(1);

lcd_data(F+0x30);

delay(1);

}

}

 

void lcd_initialize(void) // LCD Initialize function

{

int i;

for(i=0;i<4;i++)

{

lcd_cmd(cmd[i]);

delay(5);

}

}

void lcd_cmd(char data)

{

GPIO3_OR &= ~RS; // set RS as Low

GPIO3_OR &= ~RW; // set RW as Low

LCD4_Convert(data);

}

void lcd_data (char data)

{

GPIO3_OR |= RS; // set RS as High

GPIO3_OR &= ~RW; // set RW as Low

LCD4_Convert(data);

}

 

 

 

 

void lcd_display (void)

{ char i;

lcd_cmd(0x80); // Command for first Line of LCD

for(i=0;msg[i]!='\0';i++)

{

delay(5);

lcd_data(msg[i]);

}

delay(5);

}

void LCD4_Convert(char c)

{

if(c & 0x80) GPIO3_OR |= D7; else GPIO3_OR &= ~D7; // Set data for Data Line 7

if(c & 0x40) GPIO3_OR |= D6; else GPIO3_OR &= ~D6; // Set data for Data Line 6

if(c & 0x20) GPIO3_OR |= D5; else GPIO3_OR &= ~D5; // Set data for Data Line 5

if(c & 0x10) GPIO3_OR |= D4; else GPIO3_OR &= ~D4; // Set data for Data Line 4

if(c & 0x08) GPIO3_OR |= D3; else GPIO3_OR &= ~D3; // Set data for Data Line 3

if(c & 0x04) GPIO3_OR |= D2; else GPIO3_OR &= ~D2; // Set data for Data Line 2

if(c & 0x02) GPIO3_OR |= D1; else GPIO3_OR &= ~D1; // Set data for Data Line 1

if(c & 0x01) GPIO3_OR |= D0; else GPIO3_OR &= ~D0; // Set data for Data Line 0

GPIO3_OR |= EN; // set EN as High

delay(10);

 

 

GPIO3_OR &= ~EN; // set EN as Low

}

void ADC_Init(void)

{

SFSP3_0 = 1; // Funtion Select P3.0 as ADC IN

ADC0_ACC10 = 0XA; // ADC0 config channel 10 and 10 bit

ADC0_CONFIG = 0; // ADC0 config as continuous scan or single scan

}

void ADC_Conversion(void)

{

ADC0_CTRL = 0x5; // ADC1 is update and start conversion

while((ADC0_STATUS & 0x1) == 1);

ADC0_CTRL = 0x2; // ADC1 is stop conversion

delay(10);

}

void delay(unsigned int n) // Delay function

{

unsigned int i,j;

for(i=0;i<n;i++)

{

for(j=0;j<2000;j++)

{;}

}

}