keil MDK通过ulink2烧写LPC2138后LPC2138 GPIO输出不对?
程序编译,flash设置都没错误,烧写erase和program都没错,但从新上电后ARM的IO输出完全不是我设置的。
#include "LPC21xx.H" /* LPC21xx definitions */
typedef unsigned char uint8; // ???8?????
typedef signed char int8; // ???8?????
typedef unsigned short uint16; // ???16?????
typedef signed short int16; // ???16?????
typedef unsigned int uint32; // ???32?????
typedef signed int int32; // ???32?????
typedef float fp32; // ??????(32???)
typedef double fp64; // ??????(64???)
int main(void)
{
PINSEL0 = 0x00000000;
PINSEL1 = 0x00000000;
//PINSEL0 = (PINSEL0 & 0x0f0030ff); //p0.4 0.5 0.7 0.8 0.9 0.10 0.11 0.14 0.15
//PINSEL1 =( PINSEL1 & 0xC00300fc); //p0.16 0.20 0.21 0.22 0.23 0.25 0.26 0.27 0.28 0.29 0.30
//IO0DIR = IO0DIR|0x7ef1cfb0; //all output
IO0DIR = 0xFFFFFFFF; //all output
IO0CLR = 0xFFFFFFFF; //all low
//IO0SET = 0x00800800; //p0.11 and p0.23 are default high
IO0SET = 0xffffffff; //all high
return 0;
}
此帖出自
小平头技术问答
一周热门 更多>