In this Post, I am going to show you that how can you Keil for LPC 2148 which is an ARM-based microcontroller
In this post, I am interfacing 7 segments with LPC 2148
LPC 2148 datasheet can be downloaded from here
pin connection of 7-seg
data P0.16 to P0.23
control P0.8 to P0. 15
C Code for programming LPC 2148 using Keil uVision 4 MDK
#include"lpc214x.h"
int main()
{
int a;
unsigned char arr[] = {0xbf, 0x86, 0xdb, 0xcf, 0xe6, 0xed, 0xfd, 0x87, 0xff, 0xef};
IODIR0 = 0xffffffff;
while(1)
{
for(a=0;a<=9;a++)
{
IOCLR0 = 0xffffffff;
IOSET0 = arr[a]<<16 | 0x0f00;
delay_ms(1000);
}
}
}
void delay_us(unsigned int count)
{
volatile unsigned int j,k;
for (j=0;j<count;j++)
{
for (k=0;k<10;k++)
{
__asm
{
nop;
}
}
}
}
void delay_ms(unsigned int count)
{
volatile unsigned int j,k;
for (j=0;j<count;j++)
{
for (k=0;k<6000;k++)
{
__asm
{
nop;
nop;
}
}
}
}
In this post, I am interfacing 7 segments with LPC 2148
LPC 2148 datasheet can be downloaded from here
pin connection of 7-seg
data P0.16 to P0.23
control P0.8 to P0. 15
C Code for programming LPC 2148 using Keil uVision 4 MDK
#include"lpc214x.h"
int main()
{
int a;
unsigned char arr[] = {0xbf, 0x86, 0xdb, 0xcf, 0xe6, 0xed, 0xfd, 0x87, 0xff, 0xef};
IODIR0 = 0xffffffff;
while(1)
{
for(a=0;a<=9;a++)
{
IOCLR0 = 0xffffffff;
IOSET0 = arr[a]<<16 | 0x0f00;
delay_ms(1000);
}
}
}
void delay_us(unsigned int count)
{
volatile unsigned int j,k;
for (j=0;j<count;j++)
{
for (k=0;k<10;k++)
{
__asm
{
nop;
}
}
}
}
void delay_ms(unsigned int count)
{
volatile unsigned int j,k;
for (j=0;j<count;j++)
{
for (k=0;k<6000;k++)
{
__asm
{
nop;
nop;
}
}
}
}