1. 单色流水灯测试
硬件准备:8P杜邦线1根
接线说明:使用1根8P杜邦线连接ARM核心板P019~P026接底板单色流水灯模块的JP15。
跳线说明:无
分别为:P019-I1,P020-I2,P021-I3,P022-I4,P023-I5,P024-I6,P025-I7,P026-I8.
实验现象:8个LED灯依次熄灭
源码资源如下:
/*****************LPC2103 GPIO流水灯实验***************
系统设置: Fosc、Fcclk、Fcco、Fpclk
#define Fosc 12000000
#define Fcclk (Fosc * 5)
#define Fcco (Fcclk *4)
#define Fpclk (Fcclk / 4) * 4
Fpclk=60000000
接线说明:使用 1根 8P杜邦线连接 ARM 核心板 P019~P026接底板单色流水灯模块的
JP15,分别为:P019-I1,P020-I2,P021-I3,P022-I4,P023-I5,P024-I6,P025-I7,P026-I8.
现象:LED灯依次熄灭
技术网站:http://www.eeskill.com
淘宝店铺:http://cepark.taobao.com
作者:eeskill
时间:2017.07.01
******************************************************/
#define IN_MAIN
#include "config.h"
#include "LPC2103_lian.H"
#include "ADC.h"
#include "ExtInterrupt.h"
#include "I2C.h"
#include "IAP.h"
#include "Legacy_GPIO.h"
#include "RTC.h"
#include "SPI.h"
#include "SSP.h"
#include "Time.h"
#include "UART.h"
#include "WatchDog.h"
#include "ISR.h"
#pragma import(__use_no_semihosting_swi)
const uint32 tab[]={
0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80,
0x40,0x20,0x10,0x08,0x04,0x02,
};
uint32 i;
void IRQ_Exception(void)
{
}
//**********************函数定义************************
void delay(uint32 dly);
//**********************主函数**************************
void Main(void)
{
TargetInit(VPBDIV_DATA, PLLCFG_DATA, MAMTIM_DATA); // don't delete
while((PLLSTAT & (1 << 10)) == 0); // can delete
p019_gpio; //将端口设置为gpio口
p020_gpio;
p021_gpio;
p022_gpio;
p023_gpio;
p024_gpio;
p025_gpio;
p026_gpio;
//p019-p026设置为输出
gpio_out(p019|p020|p021|p022|p023|p024|p025|p026);
delay(1);
while(1)
{
for(i=0;i<14;i++)
{
IO0PIN=(IO0PIN&0xF807FFFF)|(uint32)(tab[i]<<19);
delay(900);
}
}
}
//************************延时**************************
void delay(uint32 dly)
{
uint32 i;
for(;dly>0;dly--)
{
for(i=0;i<5000;i++);
}
}