??? 04/13/11 21:56 Modified: 04/13/11 22:03 Read: times |
#181873 - Experimenting with 8051 embedded Responding to: ???'s previous message |
Since you started experimenting with 8051-like embedded controllers, take a look at this, it might help.
;-------------------------------------- RESET Startup -------------------------- org 0x0100 Start: mov SP, #SPstart ; if 128 bytes iRAM may use upper 32bytes acall sys_init acall uart_init ljmp main ;-------------------------------------- main ----------------------------------- main: mov DPTR, #msg1 ; point to msg1 mov R2, #msgsize ; message size acall send_msg ; send msg to FIM (25bytes) mov R0, #buf ; start of receive buffer in iRAM mov R2, #bufsize ; fixed size reply from FIM acall recv_msg ; get reply from FIM (25bytes) to buf mov R0, #buf ; start of receive buffer in iRAM mov R2, #bufsize ; fixed size reply from FIM acall show_buf ; show reply on P2 with 1s delay mov DPTR, #msg2 ; point to msg2 mov R0, #buf ; start of msg buffer in iRAM mov R2, #bufsize ; fixed size of msg received acall cmp_msg ; compare msg to buf, eq A=0, ne A=1 jz case_eq ; decide program execution based on A case_ne: ; ... when not equal case_eq: ; ... when equal jmp $ ; STOP http://www.8052.com/users/angelis/fim_main.txt |