This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Can you help me?Compiler program is error

hello:
I compiled the following program with Keil6.14 compiler with 8th
optimization, an error occured.the result is the "write" to the variable
bit has net been sent ti the output port. Is this error caused by a bug
of the compiler?
No error occured when comping the program with 2rd optimzation.However
because of the complication of the whole program and that many operations
to port are needed,we can't use lower lever of optization.How can I do?
Please ansrwer me quickly.Thank you.

Email:zsz123@371.net

Example:
souce zs.c
#pragma src
#include <reg51.h>
unsigned char bdata output;
sbit prcck=output^3;
void main (void)
{
unsigned char xdata *px;
output=0x00;
for(;;)
{
prcck=0;
*px=output;
prcck=1;
*px=output;
}
}



; .\zs.SRC generated from: .\zs.c
$NOMOD51
?PR?main?ZS SEGMENT CODE
?DT?main?ZS SEGMENT DATA OVERLAYABLE
?BA?ZS SEGMENT DATA BITADDRESSABLE
EXTRN CODE (?C_STARTUP)
PUBLIC prcck
PUBLIC output
PUBLIC main

RSEG ?DT?main?ZS
?main?BYTE:
px?040: DS 2

RSEG ?BA?ZS
output: DS 1
prcck EQU (output+0).3
; #pragma src
; #include <reg51.h>
;
; unsigned char bdata output;
; sbit prcck=output^3;
;
; void main (void)

RSEG ?PR?main?ZS
main:
; SOURCE LINE # 7
; {
; SOURCE LINE # 8
; unsigned char xdata *px;
; output=0x00;
; SOURCE LINE # 10
CLR A
MOV output,A
; for(;;)
; SOURCE LINE # 11
?C0001:
; {
; SOURCE LINE # 12
; prcck=0;
; SOURCE LINE # 13
CLR prcck
; *px=output;
; SOURCE LINE # 14
MOV DPL,px?040+01H
MOV DPH,px?040
MOV A,output
MOVX @DPTR,A
; prcck=1;
; SOURCE LINE # 15
SETB prcck
;*px=output;
; SOURCE LINE # 16
MOVX @DPTR,A ;this line is wrong
; }
; SOURCE LINE # 17
SJMP ?C0001
; END OF main

END

0