Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #include <LPC213X.H> void delay(int); int main(void) { IO0DIR = 0x00000080; while(1) { IO0SET=0x00000080; } return 0; } void delay(int a) { unsigned int i; for(i=0;i<=a;i++); //return 0; }
/******************************************************************************/
/* This file is part of the uVision/ARM development tools */
/* Copyright KEIL ELEKTRONIK GmbH 2002-2004 */
/******************************************************************************/
/* */
/* BLINKY.C: LED Flasher */
/* */
/******************************************************************************/
#include <stdio.h> /* standard I/O .h-file */
[B]#include <LPC21xx.H> /* LPC21xx definitions */[/B]
extern void init_serial (void); /* Initialize Serial Interface */
void sendhex (int hex) { /* Write Hex Digit to Serial Port */
if (hex > 9) putchar('A' + (hex - 10));
else putchar('0' + hex);
}
void sendstr (char *p) { /* Write string */
while (*p) {
putchar (*p++);
}
}
[B]void delay (void) { /* Delay function */
unsigned int cnt;
unsigned int val;
ADCR |= 0x01000000; /* Start A/D Conversion */
do {
val = ADDR; /* Read A/D Data Register */
} while ((val & 0x80000000) == 0); /* Wait for end of A/D Conversion */
ADCR &= ~0x01000000; /* Stop A/D Conversion */
val = (val >> 6) & 0x03FF; /* Extract AIN0 Value */
sendstr ("\nAIN0 Result = 0x"); /* Output A/D Conversion Result */
sendhex((val >> 8) & 0x0F); /* Write 1. Hex Digit */
sendhex((val >> 4) & 0x0F); /* Write 2. Hex Digit */
sendhex (val & 0x0F); /* Write 3. Hex Digit */
val = (val >> 2) << 12; /* Adjust Delay Value */
for (cnt = 0; cnt < val; cnt++); /* Delay */
}
int main (void) {
unsigned int n;
IODIR1 = 0x00FF0000; /* P1.16..23 defined as Outputs */
ADCR = 0x002E0401; /* Setup A/D: 10-bit AIN0 @ 3MHz */[/B]
init_serial(); /* Initialize Serial Interface */
[B] while (1) { /* Loop forever */
for (n = 0x00010000; n <= 0x00800000; n <<= 1) {
/* Blink LED 0, 1, 2, 3, 4, 5, 6, 7 */
IOSET1 = n; /* Turn on LED */
delay(); /* Delay */
IOCLR1 = 0x00FF0000; /* Turn off LEDs */
}
}
}[/B]
I am using proteus 7.4 and just beginning ARM. Here is my basic circuit. In properties i have set the clock freq to 12MHz.
I just want to blink an LED, at present just to set P0.7 high. But is not getting high, instead it stays in indiffterent state.
While an input signal of 50-50 duty cycle within a frequency range from 1 MHz to 50 MHz
can be used by the LPC213x if supplied to its input XTAL1 pin, this microcontroller’s
onboard oscillator circuit supports external crystals in the range of 1 MHz to 30 MHz only.
If the on-chip PLL system or the boot-loader is used, the input clock frequency is limited to
an exclusive range of 10 MHz to 25 MHz.
use two 1.5v cells in series
The Vcc triangle symbol has only one label and if you set it to +3.3 then the voltage it provides becomes 3.3vI think he just changed the label to +3.3V or maybe he added a text showing 3.3V not power properties.
Code fixed.
I just want to blink an LED, at present just to set P0.7 high. But is not getting high, instead it stays in indiffterent state.
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?