Hi Jan,

> When compiling the following snippet for mcs51, both *px translates to
> 
>  mov dptr,#_x
>  movx a,@dptr
> 
> i.e. *x, which may not be true.
> 
> Is this an error or just me being stupid?

Hmmm, the latter ;-): As px is obviously modified in an interrupt
routine, you need to declare px as volatile:

> --- code snippet ---
> xdata unsigned char *px;

volatile __xdata unsigned char *px;

should do the job, otherwise

> void main(void) {
>   px = x;
> 
>   if (px == x) {

*is* always true.

Regards,
Raphael



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to