| ??? 10/08/03 19:22 Read: times |
#56367 - RE: 8051 & External Ram Responding to: ???'s previous message |
Mike,
Correction: ORG 00H AGAIN: MOV A, #0AAH ; LOAD A WITH AAh VALUE MOV DPTR, #0000H ; LOAD ADDRESS IN DPTR MOV 8EH, #00000011B ; SET EXTERNAL RAM ACCESS MOVX @DPTR, A ; MOV AA out to 0000h MOV P1,A CALL DELAY_50mSec MOV A, #00H ; clear out A MOVX A, @DPTR ; move AAh back into A MOV P1,A CALL DELAY_50mSec JMP AGAIN ; keep doing it END I use the serial port as a debug tool, instead of LEDs. You would send the value of the accumulator in ASCII hex out through the serial port. Call SENDVAL at the point where you wish to see what is going on. ;SENDVAL ; converts the hex value of A into two ASCII chars, and then spits ; these two characters up the UART. does not change the value of A. SENDVAL: MOV R7,A SWAP A CALL HEX2ASCII CALL SENDCHAR ; send high nibble MOV A,R7 CALL HEX2ASCII CALL SENDCHAR ; send low nibble MOV A,R7 RET ; HEX2ASCII ; converts A into the hex character representing the value of A's ; least significant nibble HEX2ASCII: ANL A,#00Fh CJNE A,#00Ah,$+3 JC IO0030 ADD A,#007h IO0030: ADD A,#'0' RET Have fun debugging ;) Jacob |



