注册会员
- 积分
- 179
- 威望
- 147
- 贡献
- 32
- 兑换币
- 0
- 注册时间
- 2011-11-24
- 在线时间
- 0 小时
|
#define N 800 其它省略
sbit KEY = P3^4; //in
sbit KEY2 = P3^3; //out
sbit reset = P3^2; //0
void main()
{
uint sumin = 0;
uint sumout = 0;
uint in = 0;
uint out = 0;
uint arrin[3] = {0,1,2};
uint arrout[3] = {5,6,7};
uint i;
for (i = 3;i >= 0; i--)
{
arrin[i] = arrin[i] + '0';
}
for (i = 3; i >= 0; i--)
{
arrout[i] = arrout[i] + '0';
}
while(1)
{
L1602_init();
L1602_string(1,1,"enter:");
L1602_string(1,8,"out:");
L1602_string(2,1, arrin);
L1602_string(2,8, arrout);
delay_ms(N);
}
}
请问加上for (i = 3;i >= 0; i--)
{
arrin[i] = arrin[i] + '0';
}
for (i = 3; i >= 0; i--)
{
arrout[i] = arrout[i] + '0';
}就什么都不能输出,删掉就可以,为什么啊,
正如这里,我想输出L1602_string(2,1, arrin);
L1602_string(2,8, arrout);两个数组的值,应该如何修改,不胜感激啊!
驱动:void L1602_string(uchar hang,uchar lie,uchar *p)
{
uchar a,b=0;
if(hang == 1) a = 0x80;
if(hang == 2) a = 0xc0;
a = a + lie - 1;
while(1)
{
wcmd(a++);
b++;
if((*p == '\0')||(b==16)) break;
wdata(*p);
p++;
}
} |
|