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

Address in the C program

Hello ,

I would like to control an LCD display with a microcontroller AT89C51RC2.

The hardware address of the LC display is: “0xF800”.

With the assembler code:

LCD_ADR EQU  0F800H      ; Basisadresse LCD

MOV  DPTR,#LCD_ADR

I can go to the relevant address.

But how can I implement this in the C program.

My compiler: Keil-C with C51.exe

Kind Regards

Juergen B.

Parents
  • Assuming that the display is somehow mapped into the xdata space:

    // In the H file
    #include <absacc.h>
    #define LCD_ADR XBYTE[0xF800]
    
    // In the C file
    LCD_ADR = 0x12;
    
    // Translates to:
    // MOV     DPTR,#0F800H
    // MOV     A,#012H
    // MOVX    @DPTR,A

    Did I get you right, is this what you are looking for?

    Rene

Reply
  • Assuming that the display is somehow mapped into the xdata space:

    // In the H file
    #include <absacc.h>
    #define LCD_ADR XBYTE[0xF800]
    
    // In the C file
    LCD_ADR = 0x12;
    
    // Translates to:
    // MOV     DPTR,#0F800H
    // MOV     A,#012H
    // MOVX    @DPTR,A

    Did I get you right, is this what you are looking for?

    Rene

Children