- #include"reg51.h"
- #define uchar unsigned char
- uchar cishu;
- void delay(void)
- {
- uchar a, b, c;
- for (a = 0, a < 5, a++)
- {
- for (b = 0, b < 200, b++)
- {
- for (c = 0, c < 200, c++)
- {
- ;
- }
- }
- }
- }
- void delay10ms(void)
- {
- uchar a, b;
- for (a = 0, a < 5, a++)
- {
- for (b = 0, b < 200, b++)
- {
- ;
- }
- }
- }
- void cswx()
- {
- uchar i;
- i = 0x01;
- for (i = 0, i < 8, i++)
- {
- i <<= 1;
- P1 = ~i;
- }
- delay;
- }
- void cxws ()
- {
- uchar i;
- i = 0x80;
- for (i = 0, i < 8, i++)
- {
- i >>= 1;
- P1 = ~i;
- }
- delay;
- }
- void cwwl()
- {
- uchar huayang[4] {0x81, 0x42, 0x24, 0x18};
- uchar i;
- for (i = 0, i < 4, i++)
- {
- P1 = ~huayang[i];
- }
- delay;
- }
- void main(void)
- {
- EA = 1;
- EX0 = 1;
- IT0 = 1;
- switch (cishu)
- {
- case cishu=1: cswx(); break;
- case cishu=2: cxws(); break;
- case cishu=3: cwwl(); break;
- }
- }
- void int_0 () interrupt 0
- {
- delay10ms();
- if (INT0 == 0)
- {
- cishu++;
- if (cishu > 3)
- {
- cishu = 1;
- }
- }
- }
复制代码
总是提示错误代码c141 syntax error near')'
c211 non-constant case/dim expressio怎么解决??
|