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

Memory Mapping Peripheral registers

I am using a Rix51 board with 8xc251TB and SAB82526 HDLC controller. I want to memory map the HDLC registers so that I can easily read-write to them in C code.
For example to write to a FIFO register addressable at 0x40 location internally in SAB82526 I do the following :

#define FIFO *(volatile unsigned char far *)(0x01FD40)

FIFO = 0x01;

Is the above incorrect in any way because I am unable to write in the above manner . Though there are no errors/warnings during building but while running on the simulator (uvision2) , I dont get the expected values at expected addresses.
Can anyone help?
Thanks
Puneet

Parents
  • Try this:
    volatile unsigned char near HWData _at_ 0x000800;

    This is what we use in our 251 application. You may need to change the modifiers (unsigned char, near) to match your application, but the key part is the _at_. This defines a fixed address location at the specified address.

Reply
  • Try this:
    volatile unsigned char near HWData _at_ 0x000800;

    This is what we use in our 251 application. You may need to change the modifiers (unsigned char, near) to match your application, but the key part is the _at_. This defines a fixed address location at the specified address.

Children