??? 05/10/07 21:37 Read: times |
#139010 - assembly to c |
I change assembly code to c, but it is not working. I cant find the fault.Would you give me a feedback?
Assembly code: BlinkPin EQU 90h ;Port1.0 PMR EQU 0C4h ;Declare PMR register. org 0h start: MOV 0C4h, #90h ;Set default clock mode (the slow blink). Switching from ; frequency multiplier to non-multiplier mode requires no ; steps other than changing CD1:0 to 10b. call Blink_8_times ;Blink slowly 8 times. ;============================ ; Now activate the 2x multiplier ;============================ MOV PMR, #90h ;CD1:0=10b (default clock mode) ;CTM=0 (turn off clock multiplier) ;4X/2X\=0 (choose desired 4X or 2x) ORL PMR, #10h ;Start crystal multiplier warmup_wait: ;Wait for multiplier warm up. CKRDY is always bit 3 of SFR, MOV A, 91h ; 91h although the name of the SFR may vary between devices. JNB 0E3h, warmup_wait ;Move SFR into ACC and poll bit 3, loop until CKRDY is set. ANL PMR, #3Fh ;Clear CD1,CD0 to 00h to switch on multiplier. call Blink_8_times ;Blink fast 8 times. sjmp start ;loop and continue cycle Blink_8_times: mov r5, #10h ;Blink r5/2 times. This clumsy looking delay loop was cloop: ; chosen for its simplicity. cpl BlinkPin delay: djnz r7, $ djnz r7, $ djnz r7, $ djnz r7, $ djnz r7, $ djnz r7, $ djnz r7, $ djnz r7, $ djnz r7, $ djnz r7, $ djnz r6, delay djnz r5, cLoop RET end ////////////////////////// C code: PMR = 0x90; msdelay(200); PMR = PMR|0x10; while(EXIF < 0xE3) { } PMR = PMR&0x3F; msdelay(200); |
Topic | Author | Date |
assembly to c | 01/01/70 00:00 | |
WHY? | 01/01/70 00:00 | |
why? | 01/01/70 00:00 | |
have not done Dallas for a long whole | 01/01/70 00:00 | |
How? | 01/01/70 00:00 | |
Calling Conventions | 01/01/70 00:00 | |
8051 Specifics | 01/01/70 00:00 | |
startup code![]() | 01/01/70 00:00 |