#i nclude "HT46R065.h"
void delayms(unsigned int ms);
bit flag_p7;
void main()
{
_pac=0; //配置PA口为输出
_pa = 0xfe;
while(1)
{
if(_pa7) //判断{zg}位,钻存{zg}位状态
{
flag_p7 = 1;
}
else
{
flag_p7 = 0;
}
_pa = _pa<<1; //左移一位
if(flag_p7) //低位填移位前的{zg}位,实现汇编的 RLC指令
{
_pa0 = 1;
}
else
{
_pa0 = 0;
}
delayms(500);
}
}
void delayms(unsigned int ms)
// 延时子程序
{
unsigned char i;
while(ms--)
{
for(i = 0; i < 200; i++);
}
}