Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/27/04 08:14
Read: times


 
#69284 - RE: Oops, many people - many suggestions
Responding to: ???'s previous message
hi,

First of all, my suggestion is wrong - next line:
a = *((unsigned int *)DPTR_ADDR);
loads contents of DPTR as 'unsigned int' into variable 'a' but it exchanges high and low bytes of DPTR due Big/Little Endian discrepancy. As result, it takes DPL as high byte and DPH as low byte of unsigned int. So it is wrong; drop it.

Andrew, Andy,
The SFR definitions are contained in the reg51.h header file - so once you've #included it, you can use the SFRs like any other 'C' variable!

Sure, but DPTR is not defined in 'reg51.h'; only DPL and DPH. As result, we still need to use something like:
a = (DPH<<8)+DPL;

The way in Keil is to use 16-bit register definition:
sfr16 DPTR = 0x82;
// ...
a = DPTR;

The question: is there such way with Raisonance.

Regards,
Oleg

List of 22 messages in thread
TopicAuthorDate
how to access DPTR using Ride c            01/01/70 00:00      
   RE: how to access DPTR using Ride c            01/01/70 00:00      
      DO NOT access DPTR using C !            01/01/70 00:00      
   RE: how to access DPTR using Ride c            01/01/70 00:00      
      RTFM!            01/01/70 00:00      
   RE: how to access DPTR using Ride c            01/01/70 00:00      
      RE: Hack!?            01/01/70 00:00      
         RE: Hack!?            01/01/70 00:00      
            RE: Hack!?            01/01/70 00:00      
               Just ignore me - Im talking rubbish!            01/01/70 00:00      
                  Hello ALL THANK YOU            01/01/70 00:00      
         RE: Hack!?            01/01/70 00:00      
            RE: Oops, many people - many suggestions            01/01/70 00:00      
            RE: Hack!?Oleg            01/01/70 00:00      
               RE: Hack!?Oleg            01/01/70 00:00      
                  RE: THE LESSON OF IT ALL!!!!!!!!            01/01/70 00:00      
                     RE: THE LESSON OF IT ALL!!!!!!!!            01/01/70 00:00      
                     RE: THE LESSON OF IT ALL!!!!!!!!            01/01/70 00:00      
                        RE: Atmel - Why??!!            01/01/70 00:00      
   THANK YOU ALL            01/01/70 00:00      
      RE: THANK YOU ALL            01/01/70 00:00      
         RE: THANK YOU ALL            01/01/70 00:00      

Back to Subject List