AMC Practical 1-8
AMC Practical 1-8
#include<lpc21xx.h>
void delay();
int main()
while(1)
int i,j;
for(i=0;i<1275;i++)
for(j=0;j<1275;j++);
Exp 2:-
#include<lpc214x.h>
void PLL_Init(void);
void main()
PLL_Init();
while(1)
delay(1000);
void PLL_Init(void)
T0TCR=0x01; //timer On
#include<lpc214x.h>
void PLL_Init(void);
void main()
PLL_Init();
while(1)
{
delay(1000);
delay(1000);
void PLL_Init(void)
T0TCR=0x01; //timer On
T0TCR=0x00; //timer O
Exp 3:-
#include<lpc214x.h>
Void LCD_init(void);
Inti,j;
For(i=0;i<time;i++)
For(j=0;j<200;j++);
IOCLR1=LCD_PORT;
IOSET1 = ch<<LCD_SHIFT; //shift data and set only the data bits
IOSETO = EN;
Lcd_delay(100);
IOCLR1 = LCD_PORT;
IOSET1 = ch<<LCD_SHIFT;
IOCLRO = RW;//RW=0
IOSETO=EN;
Lcd_delay(100);
Void LCD_init(void)
{
PINSELO &= 0xFF0FFFFF;//Pins P0.10 and P0.11 as GPIO
IODIRO=RS | EN | RW;
IODIR1 = LCD_PORT;
LCD cmd(0x06);
LCD_cmd(0x0C);
LCD_cmd(0x01);
LCD_cmd(0x80);
If(row==1)
Else
LCD_cmd(temp);
While(*ch)
Unsigned inti,j;
For(i=0;i<time;i++)
For(j=0;j<5000;j++);
Int main()
LCD_init();
While(1)
LCD display(1,4,”SANIKA”);
Delay(20);
Exp 4:-
/* Interfacing:
**
** RW -> P0.11
** EN -> P0.10
*/
#include"lpc214x.h"
#define EN 1<<10
#define RS 1<<25
#define RW 1<<11
#define LCD_SHIFT 16
};
};
};
int i,j;
for(i=0;i<time;i++)
for(j=0;j<50;j++);
int i,j;
for(i=0;i<time;i++)
for(j=0;j<5000;j++);
IO0SET = EN;
delay(5);
IO0CLR = EN;
delay(5);
IO1CLR = LCD_PORT;
IO1SET = ch<<LCD_SHIFT;
IO1SET = RS;
LCD_strobe();
IO1CLR = LCD_PORT;
IO1SET = ch<<LCD_SHIFT;
IO1CLR = RS;
LCD_strobe();
void GLCD_init()
int i;
PINSEL1 = 0;
PINSEL2 = 0;
IOCLR1 = LCD_PORT;
IOSET1 = GRST | CS1 | CS2;
IOCLR0 = RW | EN;
IOCLR1 = RS;
for(i=0;i<10;i++)
GLCD_cmd(0x3F); //Display ON
int i,j;
for(i=0;i<8;i++)
IO1CLR = CS2;
GLCD_cmd(0xB8 | i);
GLCD_cmd(0x40);
GLCD_data(temp1[(i*128)+j]);
IO1SET = CS2;
GLCD_cmd(0xB8 | i);
GLCD_cmd(0x40);
GLCD_data(temp1[(i*128)+j]);
int main()
GLCD_init();
GLCD_disp(temp);
ldelay(4000);
while(1)
GLCD_disp(LED_OFF);
ldelay(2000);
GLCD_disp(LED_ON);
ldelay(2000);
}
}
Exp 5:-
#include “lpc214x.h”
#include <stdio.h>
Int main(void)
UartInit(9600);
Printf(“\r\nThis is a Demonstration for \r\nUART peripheral for LPC2148\r\nDone on SBC_ARM7 Board \r\n”);
While(1)
UART_PutChar(UART_GetChar());
U0LCR = 0x83;
U0LCR = 0x03;
U0TER = 0x80;
Return(U0RBR);
}
Int UART_PutChar(unsigned char Ch)
Return (UART_PutChar(ch));
Struct __FILE
{ int handle;
};
FILE __stdout;
Exp 6:-
#include “lpc214x.h”
#include “UART.h”
#include “stdio.h”
#include “string.h”
For(i=0;i<time;i++)
For(j=0;j<5000;j++);
Printf(“\r\ncommand: %s”,cmd);
Printf(“response: “);
UART1_PutS(cmd);
Delay(100);
Int main()
Uart0Init(9600);
Uart1Init(9600);
Printf(“GSM program\r\n”);
Delay(3000);
Delay(20000);
GSM_cmd(“ATH0\r”);
//disconnect call
Delay(3000);
Delay(1000);
Delay(1000);
NUMBER)
Delay(1000);
Delay(1000);
UART1_PutChar(0x1A);
While(1);
Return 0;
Exp 7:-
Name : LCD.c
Interface :
D0 – P1.16
D1 – P1.17
D2 – P1.18
D3 – P1.19
D4 – P1.20
D5 – P1.21
D6 – P1.22
D7 – P1.23
EN – P0.10
RS – P0.11
RW – P0.20
#include<lpc214x.h>
#include <stdio.h>
Int I,j;
For(i=0;i<time;i++)
For(j=0;j<200;j++);
IOSET0 = EN;
lcd_delay(100);
IOCLR0 = EN;
IOCLR1 = LCD_PORT;
IOSET1 = ch<<LCD_SHIFT;
lcd_delay(100);
IOCLR0 = EN;
void LCD_init(void)
IODIR1 = LCD_PORT;
if(row==1)
else
LCD_cmd(temp);
LCD_data(*ch++);
} void ADCInit(void)
ad1_data n display in mV
return ad1_data;
for(i=0;i<time;i++)
for(j=0;j<5000;j++);
int main()
char buf[16];
LCD_init();
ADCInit();
while(1)
in a buffer
delay(20);
Exp 8:-
Void delay()
Int I;
For(i=0;i<600000;i++);
Int main(void)
Value=0;
While(1)
Value=1023;
DACR = (1<<16)|(value<<6);
Delay();
Value=0;
DACR = (1<<16)|(value<<6);
Delay();
void delay()
int i;
for(i=0;i<60000000;i++);
int main(void)
value=0;
while(1)
while(value!=1023)
{
DACR = (1<<16)|(value<<6);
value++;
while(value!=0)
DACR = (1<<16)|(value<<6);
value--;