Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 // initialize system clock #include "LPC214x.h" void init() { PLL0CFG=0x24; // MSEL = 4,PSEL = 2 PLL0FEED=0xAA; // Feed process PLL0FEED=0x55; PLL0CON=0x1; PLL0FEED=0xAA; // Feed process PLL0FEED=0x55; while(!(PLL0STAT & 0x400)) ; // Wait until PLL Locked PLL0CON=0x3; // Connect the PLL as the clock source PLL0FEED=0xAA; // Feed process PLL0FEED=0x55; MAMCR=0x2; // Enabling MAM and setting number of clocks used for Flash memory fetch (4 cclks in this case) MAMTIM=0x4; VPBDIV=0x02; // PCLK at 30 MHz } #include "LPC214x.h" //header file for LPC2148 init(); int main(void){ // starting main loop int j; //variable declaration IODIR0= 0x00400000; //setting port 0.22 as output while(1){ //endless while loop for (j=0;j<1000000;j++) { //delay loop } IOSET0= 0x00400000; //TURN ON LED AT PO.22 for (j=0;j<1000000;j++) { //delay loop } IOCLR0= 0x00400000; //Turn off led at P0.22 } }
#include <lpc213x.h>
int main(void)
{
PINSEL0 = 0X00000000;
IO0DIR |= (1<<0);
while(1)
{
if (IO0PIN & 0X00000080)
{
IO0SET |= 0X00000001;
}
else IO0CLR |= 0X00000001;
}
}
#include <lpc213x.h>
int main(void)
{
PINSEL0 = 0X00000000;
PINSEL2 = 0X00000000;
IO0DIR = 0X00000000; //SWITCH P0.7
IO0DIR |= 0X00000001; //LED P0.0
IO1DIR = 0X00000000; //SWITCH P1.23
IO1DIR |= 0X00010000; //LED P1.16
while(1)
{
if (IO0PIN & 0x00000080)
{
IO0SET |= (1<<0);
}
else IO0CLR |= (1<<0);
if (IO1PIN & 0x00800000)
{
IO1SET |= (1<<16);
}
else IO1CLR |= (1<<16);
}
}
hello friends i wrote the program in KEIL it compiles succesfulyy bt it doesnt works..I connected my led at port 0.22
program is here
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 // initialize system clock #include "LPC214x.h" void init() { PLL0CFG=0x24; // MSEL = 4,PSEL = 2 PLL0FEED=0xAA; // Feed process PLL0FEED=0x55; PLL0CON=0x1; PLL0FEED=0xAA; // Feed process PLL0FEED=0x55; while(!(PLL0STAT & 0x400)) ; // Wait until PLL Locked PLL0CON=0x3; // Connect the PLL as the clock source PLL0FEED=0xAA; // Feed process PLL0FEED=0x55; MAMCR=0x2; // Enabling MAM and setting number of clocks used for Flash memory fetch (4 cclks in this case) MAMTIM=0x4; VPBDIV=0x02; // PCLK at 30 MHz } #include "LPC214x.h" //header file for LPC2148 init(); int main(void){ // starting main loop int j; //variable declaration IODIR0= 0x00400000; //setting port 0.22 as output while(1){ //endless while loop for (j=0;j<1000000;j++) { //delay loop } IOSET0= 0x00400000; //TURN ON LED AT PO.22 for (j=0;j<1000000;j++) { //delay loop } IOCLR0= 0x00400000; //Turn off led at P0.22 } }
gyus i dont know whats the mistake here...so plz help me...it frustrates me too much...TIA
Code C - [expand] 1 2 3 for (j=0;j<1000000;j++) { //delay loop }
IO0SET |= 0X00000001;
IO0CLR |= 0X00000001;
IO0SET = 0X00000001;
IO0CLR = 0X00000001;
**broken link removed**
This is the board which i am using ...
Does keil 4 works with this or should i use keil 3?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?