SDCC compiler and assembler dallas DStini400 kit (DS80c400 processor) 24 bit adressing mode.
I wrote an assembly language routine to gather data off serial port 2 as an interrupt driven background task. All the variables are 1 byte stored in low ram (DATA). I have tried declaring the variables in both assembly and
data unsigned char in the beginning of my main program. Either works fine accept that the data is unreachable in my http server routines, but can be reached in other ares of the program. The compiler generates mov rx,_data but it doesn't work. As a work around I wrote an assembly language routine to copy the bytes in (DATA) to bytes in locations in (XDATA). It works but has data scrambles and eventually crashes. I suspect that the culprit is the extended byte of the movx address, since I an only dealing with 16 bits. I don't realy know how to handle this....yet ... any suggestions?
data unsigned char rawWindSpeed;
data unsigned char rawOutsideTemp;
data unsigned char rawWindDirection;
data unsigned char rawRainFall;
data unsigned char rawMaxWind;
data unsigned char rawMaxDirection;
data unsigned char wnTippingBucket;
data unsigned char wnBuildTemp;
data unsigned char wnBuildSpeed;
data unsigned char wnOldWindSpeed;
unsigned char windSpeedRaw;
unsigned char outsideTempRaw;
unsigned char windDirectionRaw;
unsigned char rainFallRaw;
; copy scratch pad variable in 8051 internal ram (DATA) to external ram. This is done
; to make the globals reachable to all areas of the program which are not now....possibly
; due to a bug that I can not solve. called from within the interrupt routine
found the problem...the 24 bit mode uses dpx that I didn't push onto the stack so I was writting over the data pointer with my interrupt routine.. My brain was still in the 16 bit mode.