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.
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
Hello Rene,
many thanks for the quick response.
I think that's what I was looking for.
I was able to compile the code shown without any errors.
I still need to create my C program.
But I still have one question at the moment:
Where can I get the syntax information about Keil-C, e.g. the assignment of the functions to the include file (absacc.h → XBYTE)?
Hi Juergen,this is from the library reference:https://developer.arm.com/documentation/101655/0961/Cx51-User-s-Guide/Library-Reference/Macros/XBYTE
Or, when in uVision, move the caret over XBYTE and hit F1.Anyway, if you aren't comfortable with these macros, you can always do it directly:
#define LCD_ADR *((unsigned char volatile xdata*)0xF800)