Mình code cho 89C2051 sử dụng KeiC nhưng tạo ra file hex phần mềm PL51L cứ báo hơn 2Kb.
file hex (ko nạp được-báo lỗi):
thử với file hex khác thì nạp được, không báo lỗi
Cụ thể code của mình:
Thạch anh 12Mhz. Ai biết xin mách dùm.
file hex (ko nạp được-báo lỗi):
Code:
:10085B00E4FDFCC3ED9FEC9E5015E4FBFA0BBB00D3 :0F086B00010AEB647B4A70F50DBD00010C80E4BF :01087A00225B :04087B008E0E8F0F3F :10087F00900000C3E582950FE583950E50097FE840 :07088F007E03115BA380EC66 :01089600223F :040836008E0A8F0B8C :10083A00E4F50CF50DC3E50D950BE50C950A501082 :10084A007F3C7E00117B050DE50D70E9050C80E506 :01085A00227B :10080000E4F508F509C290D2917F057E00117BC204 :1008100091D2907F057E00117B0509E509700205E4 :1008200008C39406E508940040DBC290C2917F02A1 :060830007E00113680CAB3 :030000000208975C :0C089700787FE4F6D8FD75810F020800A0 :00000001FF
Code:
:1001D300E4FEFDEE25E0FEA291E4334206C290EF79 :1001E30030E702D290EF25E0FFD29200C2920000E6 :0601F3000DBD08DFAF06A0 :0101F90022E3 :10024900758920438780758BFF758DFF759850D20E :020259008E22F3 :0A027800C2998F993099FDC29922B6 :070282003098FDAF99C2980E :010289002252 :10025B001201FA30980612028212016E12023480D9 :01026B00F2A0 :1001FA00750B01D290D291C292C293E4F509F50827 :10020A00120249438901758C3C758AB0C28DD28C21 :01021A0022C1 :10023400308D11E50B6005A2B2B392B2C28D758CFC :050244003C758AB022A8 :10016E00EF24B7601924F9601824FE601D14601482 :10017E0024FB6013146016240E7015020291020007 :10018E00030200670200C802021B02011B02028A60 :04019E001202962291 :050291007F4F0202781E :1000C800C293E4F50BC2B2C292758C3C758AB0C279 :1000D8008DD28C308DFDC28DD290D291C28C758C10 :1000E8003C758AB0C28DD293D28C308DFDC28D7F83 :1000F800AC1201D37F531201D37FFF1201D37FFFCC :100108001201D3BF69047F018002E4FF12027875EF :020118000B01D9 :01011A0022C2 :07028A00C2937F59020278C4 :10006700C2B2E4F50B7F501202781202828F0C1293 :1000770002781202828F0D850D101201A27F501295 :1000870001D3AF0A1201D3AF10120278E4F50EF5CF :100097000F1202828F0C1202781202828F0D850DC9 :1000A700101201A2AF0A1201D3AF10120278050F86 :1000B700E50F7002050EC3E50E940140D4750B01E0 :0100C7002216 :10011B00C2B2E4F50B7F521202781202828F0C12DC :10012B0002781202828F0D850D111201A27F3012FF :10013B0001D3AF0A1201D3AF11120278E4F50EF519 :10014B000F1202828F0C7FFF1201D38F10120278D5 :10015B00050FE50F7002050EC3E50E940140E27525 :02016B000B0186 :01016D00226F :10021B007FAC1201D37F801201D37FFF1201D37FFA :09022B00FF1201D37F5802027892 :10000300D2B2E4F50B7F281201D3E4FF1201D3E44B :10001300FF1201D37FFF1201D38F0E7F281201D36A :100023007F011201D3E4FF1201D37FFF1201D38FAB :100033000F7F281201D37F021201D3E4FF1201D3F1 :100043007FFF1201D38F10AF0E1202781202828F3C :100053000EAF0F1202781202828F0FAF10120278C6 :03006300750B0119 :010066002277 :010296002245 :1001A20074D0250CF50CD39409400674F9250CF58E :1001B2000C74D0250DF50DD39409400674F9250D64 :1001C200F50D850C0AE50AC454F0F50AE50D420A5C :0101D200220A :0300000002026C8D :0C026C00787FE4F6D8FD75811102025B7A :00000001FF
Code:
#include <REG2051.H> void Delay_ms(unsigned int t) { unsigned int x ,y; for (x=0;x<t;x++) { for (y=0;y<123;y++) { } } } void Delay_s(unsigned int t) { unsigned int x; for (x=0;x<t;x++) { Delay_ms(1000); //tre 1s *t } } void Delay_phut(unsigned int t) { unsigned int x; for (x=0;x<t;x++) { Delay_s(60); //tre 1 phut*t } } void main() { unsigned int x; while(1) { for (x=0;x<6;x++) { P1_0=0; P1_1 = 1; Delay_s(5); //------chay xong 5s-------// P1_1 = 0; P1_0=1; Delay_s(5); //------chay xong 5s------// } P1_0 = 0; P1_1=0; Delay_phut(2); //Nghi 30s } }
Comment