|
我想用移位的方法是3个LED 循环点亮 可是调试的时候不能进入if语句中
-
-
- #include "inc\44b.h"
- #include "inc\option.h"
- /***************************************************************************
- 【功能说明】通用延时函数,延时time个100us
- ****************************************************************************/
- static int delayLoopCount = 400;
- void Delay(int time)
- {
- int i,adjust=0;
- if(time==0)
- {
- time=200;
- adjust=1;
- delayLoopCount=400;
- rWTCON=((MCLK/1000000-1)<<8)|(2<<3);
- rWTDAT=0xffff;
- rWTCNT=0xffff;
- rWTCON=((MCLK/1000000-1)<<8)|(2<<3)|(1<<5);
- }
- for(;time>0;time--)
- for(i=0;i
- if(adjust==1)
- {
- rWTCON=((MCLK/1000000-1)<<8)|(2<<3);
- i=0xffff-rWTCNT;
- delayLoopCount=8000000/(i*64);
- }
- }
- /****************************************************************************
- 【功能说明】I/O端口功能、方向设定
- ****************************************************************************/
- void Port_Init(void)
- {
- //PORT C GROUP
-
- rPDATC = 0x0000;
- rPCONC = 0xfff5ff55;
- }
- void Main(void)
- {
- /* unsigned char Tab[] = {0x02,0x04,0x08};
- unsigned char i;
- Port_Init(); //IO端口功能、方向设定
- while(1)
- {
- for(i = 0;i < 3;i ++)
- {
- rPDATC = Tab[i];
- Delay(6000);
- }
- }
- */
- Port_Init();
- rPDATC = 0x02; //赋初值
- Delay(6000);
- while(1)
- {
- rPDATC = rPDATC << 1;
- Delay(6000);
- if (0x10 == rPDATC) //不能进入
- {
- rPDATC = 0x02;
- Delay(6000);
- }
- }
- }
-
复制代码
在那里可以查看rPDATC的至
|
|