关于C8051F的资料太少了,有讲到它的论坛也不多,每次查资料什么都查不到,郁闷死我了,上个星期我买的那块C8051F120TBC加U-EC5的板子到现在不知道是怎么回事?我用的是KEIL,仿真测试板子上那个P1.6口灯的闪烁,程序能烧进去,也能在线仿真,但灯就是不闪烁,在线仿真发现实际寄存器的变化和程序要变化的数值完全不一样,都不知道是什么原因,搞了三天了,那位兄弟帮忙解决一下,本人感激不尽!!
程序:
#include <c8051f020.h> // SFR 声明
sbit LED=P1^6;
void Delay();
void PortInit();
void main()
{
int i=2;
P1MDOUT|=0xff;
PortInit();
while(1)
{
Delay();
LED=~LED;
}
}
void Delay()
{
long int i=6000;
while(i--) ;
}
void PortInit(void)
{
WDTCN = 0xde; // Disable watchdog timer
WDTCN = 0xad;
XBR0 = 0x01; // 使能UART0
XBR1 = 0x00;
XBR2 = 0x40; // 使能数据交叉开关和弱上拉
//P0MDOUT |= 0x01; // 允许TX0为推挽输出
// P1MDOUT |= 0x40; // 允许P1.6(LED)为推挽输出
P1MDOUT |= 0xff; // 允许P1.6(LED)为推挽输出
}
说实话,那个SILION IDE 实在做的太差了,
还有,我不知道怎么判断F120是否正在工作?像51系列很好判断,看ALE脚就知道了.
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
void Port_IO_Init()
{
// P0.0 - Unassigned, Open-Drain, Digital
// P0.1 - Unassigned, Open-Drain, Digital
// P0.2 - Unassigned, Open-Drain, Digital
// P0.3 - Unassigned, Open-Drain, Digital
// P0.4 - Unassigned, Open-Drain, Digital
// P0.5 - Unassigned, Open-Drain, Digital
// P0.6 - Unassigned, Open-Drain, Digital
// P0.7 - Unassigned, Open-Drain, Digital
// P1.0 - Unassigned, Push-Pull, Digital
// P1.1 - Unassigned, Push-Pull, Digital
// P1.2 - Unassigned, Push-Pull, Digital
// P1.3 - Unassigned, Push-Pull, Digital
// P1.4 - Unassigned, Push-Pull, Digital
// P1.5 - Unassigned, Push-Pull, Digital
// P1.6 - Unassigned, Push-Pull, Digital
// P1.7 - Unassigned, Push-Pull, Digital
// P2.0 - Unassigned, Open-Drain, Digital
// P2.1 - Unassigned, Open-Drain, Digital
// P2.2 - Unassigned, Open-Drain, Digital
// P2.3 - Unassigned, Open-Drain, Digital
// P2.4 - Unassigned, Open-Drain, Digital
// P2.5 - Unassigned, Open-Drain, Digital
// P2.6 - Unassigned, Open-Drain, Digital
// P2.7 - Unassigned, Open-Drain, Digital
// P3.0 - Unassigned, Open-Drain, Digital
// P3.1 - Unassigned, Open-Drain, Digital
// P3.2 - Unassigned, Open-Drain, Digital
// P3.3 - Unassigned, Open-Drain, Digital
// P3.4 - Unassigned, Open-Drain, Digital
// P3.5 - Unassigned, Open-Drain, Digital
// P3.6 - Unassigned, Open-Drain, Digital
// P3.7 - Unassigned, Open-Drain, Digital
SFRPAGE = CONFIG_PAGE;
P1MDOUT = 0xFF;
XBR2 = 0x40;
}
关于模拟部分,抗干扰,这些是靠自己的经验了,还是多看DATASHEET吧,细节的东西,说不了那么多
12fen 老齐
johnnypang
两位大哥能不能加我QQ聊一下,我不知道出了什么问题.感谢大家的回帖!!
一周热门 更多>