fix correctly

This commit is contained in:
2018-05-22 22:13:06 +08:00
parent a86893d67d
commit 8883a68165
6 changed files with 51 additions and 121 deletions

53
.gitignore vendored
View File

@ -1,53 +0,0 @@
# ---> C
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
modules.order
Module.symvers
Mkfile.old
dkms.conf

View File

@ -1,9 +0,0 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

26
Objects/LED.hex Normal file
View File

@ -0,0 +1,26 @@
:04093100C180C101BF
:10088C007590FF120901A2019290120901A2019226
:10089C0091120901A2019292120901A201929312E2
:1008AC000901A2019294120901A201929512090167
:1008BC00A2019296120901A2019297120901A200BB
:1008CC009297120901A2009296120901A200929528
:1008DC00120901A2009294120901A200929312092A
:1008EC0001A2009292120901A2009291120901A296
:0508FC00009290808EC7
:10090100900000AF82AE83E4FCFD7BE87A80F9F8C9
:09091100D312091B4003A380EA84
:01091A0022BA
:03000000020800F3
:0C080000787FE4F6D8FD758120020847DF
:10091B00EB9FF5F0EA9E42F0E99D42F0EC6480C853
:06092B0064809845F022F3
:10080C0002088CE493A3F8E493A34003F68001F26E
:10081C0008DFF48029E493A3F85407240CC8C333ED
:10082C00C4540F4420C8834004F456800146F6DFBC
:10083C00E4800B0102040810204080900931E47E12
:10084C00019360BCA3FF543F30E509541FFEE493B1
:10085C00A360010ECF54C025E060A840B8E493A378
:10086C00FAE493A3F8E493A3C8C582C8CAC583CAA3
:10087C00F0A3C8C582C8CAC583CADFE9DEE780BE5B
:0109350000C1
:00000001FF

BIN
Objects/led.obj Normal file

Binary file not shown.

View File

@ -1,3 +0,0 @@
# 8051_LED
微算機作業,控制 LED 燈。

81
led.c
View File

@ -3,67 +3,36 @@
bit lightoff = 1;
bit lighton = 0;
sbit P1_0 = P1^0;
sbit P1_1 = P1^1;
sbit P1_2 = P1^2;
sbit P1_3 = P1^3;
sbit P1_4 = P1^4;
sbit P1_5 = P1^5;
sbit P1_6 = P1^6;
sbit P1_7 = P1^7;
char code LED_light[17] = {
~0x00,
~0x01,
~0x02,
~0x04,
~0x08,
~0x10,
~0x20,
~0x40,
~0x80,
~0x40,
~0x20,
~0x10,
~0x08,
~0x04,
~0x02,
~0x01
};
void delay_1500ms();
int main () {
P1 = 0xFF;
while (1) {
while (1)
// ********* <20><><EFBFBD>@ LED *********
for(LED_mode = 0; LED_mode < 16; LED_mode++) {
P1 = LED_light[LED_mode];
}
delay_1500ms();
P1_0 = lighton;
delay_1500ms();
P1_1 = lighton;
delay_1500ms();
P1_2 = lighton;
delay_1500ms();
P1_3 = lighton;
delay_1500ms();
P1_4 = lighton;
delay_1500ms();
P1_5 = lighton;
delay_1500ms();
P1_6 = lighton;
delay_1500ms();
P1_7 = lighton;
delay_1500ms();
P1_7 = lightoff;
delay_1500ms();
P1_6 = lightoff;
delay_1500ms();
P1_5 = lightoff;
delay_1500ms();
P1_4 = lightoff;
delay_1500ms();
P1_3 = lightoff;
delay_1500ms();
P1_2 = lightoff;
delay_1500ms();
P1_1 = lightoff;
delay_1500ms();
P1_0 = lightoff;
} // end of while(1)
} // end of main()