We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I am looking for a way to write some C51 functions to set or clear bits stored in the 8051 external data memory. For example, the following code was done in the 8051 assembly language:
;******************************* SYSTEM_TROUBLE1 XDATA 1000H AC_FAIL ACC.0 LOW_BAT ACC.1 . . SYSTEM_TROUBLE2 XDATA 1001H TELCO1_FAIL ACC.0 TELCO2_FAIL ACC.1 . . ;******************************* . . MOV DPTR, #SYSTEM_TROUBLE1 MOVX A, @DPTR SETB AC_FAIL MOVX @DPTR . .
try:
xdata struct { char AC_FAIL :1; char LOW_BAT :1; } SYSTEM_TROUBLE1 _at_ 0x1000; void main( void ) { SYSTEM_TROUBLE1.LOW_BAT = 1; } ; FUNCTION main (BEGIN) 0000 901000 MOV DPTR,#SYSTEM_TROUBLE1 0003 E0 MOVX A,@DPTR 0004 4402 ORL A,#02H 0006 F0 MOVX @DPTR,A 0007 22 RET ; FUNCTION main (END)