diff --git a/homework3/.eide/eide.json b/homework3/.eide/eide.json index 777d686..8889ee1 100644 --- a/homework3/.eide/eide.json +++ b/homework3/.eide/eide.json @@ -18,7 +18,9 @@ }, "targets": { "Debug": { - "excludeList": [], + "excludeList": [ + "src/test1.c" + ], "toolchain": "Keil_C51", "compileConfig": { "options": "null" diff --git a/homework3/src/test1.c b/homework3/src/test1.c index 6eb37cb..2a555b1 100644 --- a/homework3/src/test1.c +++ b/homework3/src/test1.c @@ -13,7 +13,7 @@ void test1() ADDR0 = 0; while (true) { - P2 = ~(0x80 >> cnt); + P2 = ~(0x01 << cnt); Delay(20000); cnt++; if (cnt >= 8) { diff --git a/homework3/src/test2.c b/homework3/src/test2.c new file mode 100644 index 0000000..d49bb73 --- /dev/null +++ b/homework3/src/test2.c @@ -0,0 +1,31 @@ +// test2.c +// 右向流水灯(流水速度逐渐加快) +#include "homework3.h" + +unsigned char cnt = 0; + +void test2() +{ + ENLED = 0; + ADDR3 = 1; + ADDR2 = 1; + ADDR1 = 1; + ADDR0 = 0; + i = 100000; + + while (true) { + P2 = ~(0x80 >> cnt); + Delay(i); + cnt++; + if (cnt >= 8) { + cnt = 0; + } + if (i > 5000) { + i -= 1000; + } + } +} +void main() +{ + test2(); +} \ No newline at end of file