fix the delay time

This commit is contained in:
2018-05-14 01:36:01 +08:00
parent 1f1b94deb3
commit 27a8a7ef23
10 changed files with 29 additions and 26 deletions

0
.gitignore vendored Normal file → Executable file
View File

0
LICENSE Normal file → Executable file
View File

0
Listings/TimerDelay_1.lst Normal file → Executable file
View File

0
Listings/TimerDelay_1.m51 Normal file → Executable file
View File

0
Objects/TimerDelay_1 Normal file → Executable file
View File

0
Objects/TimerDelay_1.build_log.htm Normal file → Executable file
View File

0
Objects/TimerDelay_1.lnp Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

View File

@ -92,8 +92,8 @@ void delay_1ms(void) {
//<2F>]<5D>w<EFBFBD><77><EFBFBD>l<EFBFBD><6C>
TF1 = 0;
TR1 = 0;
TL1 = (65536 - 9) % 256;
TH1 = (65536 - 9) / 256;
TL1 = (65536 - 921) % 256;
TH1 = (65536 - 921) / 256;
//<2F>}<7D>ҭp<D2AD>ɾ<EFBFBD>
TR1 = 1;
@ -110,21 +110,24 @@ void delay_1ms(void) {
// <20><><EFBFBD><EFBFBD> 1500ms
void delay_1500ms(void) {
int k = 0;
//<2F>]<5D>w<EFBFBD><77> mode1
TMOD = 0x10;
//<2F>]<5D>w<EFBFBD><77><EFBFBD>l<EFBFBD><6C>
TF1 = 0;
TR1 = 0;
TL1 = (65536 - 13824) % 256;
TH1 = (65536 - 13824) / 256;
//<2F>}<7D>ҭp<D2AD>ɾ<EFBFBD>
TR1 = 1;
//<2F><> TF1 <20>S<EFBFBD><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while(TF1 == 0);
while(k < 150) {
//<2F>]<5D>w<EFBFBD><77><EFBFBD>l<EFBFBD><6C>
TF1 = 0;
TR1 = 0;
TL1 = (65536 - 9216) % 256;
TH1 = (65536 - 9216) / 256;
//<2F>}<7D>ҭp<D2AD>ɾ<EFBFBD>
TR1 = 1;
//<2F><> TF1 <20>S<EFBFBD><53><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while(TF1 == 0);
k = k + 1;
}
//<2F><><EFBFBD><EFBFBD><EFBFBD>p<EFBFBD>ɾ<EFBFBD>
TR1 = 0;

File diff suppressed because one or more lines are too long