Keil Logo Arm Logo

Discussion Forum

Writing to 8051(CY7C6461) registers in C language

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Ashish Sin
Posted
21-Jan-2005 12:44 GMT
Toolset
C51
New! Writing to 8051(CY7C6461) registers in C language
How can I write to the CPU registers(PORTCCFG,PORTBCFG,etc) and the Input-Output Port Registers(OUTB,OUTC,OEB,OEC, etc) of the 8051 microcontroller of the Cypress CY7C64613 chip in 'C'(language).

I have the following lines in the header file:

EXTERN xdata volatile BYTE PORTBCFG _AT_ 0x7F94;
EXTERN xdata volatile BYTE PORTCCFG _AT_ 0x7F95;
EXTERN xdata volatile BYTE OUTB _AT_ 0x7F97;
EXTERN xdata volatile BYTE OUTC _AT_ 0x7F98;
EXTERN xdata volatile BYTE OEB _AT_ 0x7F9D;
EXTERN xdata volatile BYTE OEC _AT_ 0x7F9E;

Currently am writing in the following way:
PORTBCFG = 0x00;
but the Keil compiler gives a warning "UNRESOLVED EXTERNAL SYMBOL"

Actually what i want to do is get an quivalent of the following assembly code in C:

mov dptr,#0x7f95
clr a
movx @dptr,a

Any suggestions??
Read-Only
Author
Keil Reinhard
Posted
21-Jan-2005 14:30 GMT
Toolset
C51
New! RE: Writing to 8051(CY7C6461) registers in C language
You need to link with a file that defines the symbols as public. Take a look to:

http://www.keil.com/appnotes/docs/apnt_162.asp

It might use a different CPU, but still the technique used is identical.

Reinhard
Read-Only
Author
Hans-Bernhard Broeker
Posted
21-Jan-2005 17:19 GMT
Toolset
C51
New! RE: Writing to 8051(CY7C6461) registers in C language
Your snippet contains a keyword not predefined by any compiler: EXTERN.

There's a likely candidate as to what your source code may define this word to mean, but without knowing that context, it's impossible to know what's wrong with your source.

My guess is you overlooked this aspect yourself, and that that's exactly your problem.
Read-Only
Author
Al Bradford
Posted
22-Jan-2005 18:58 GMT
Toolset
C51
New! RE: Writing to 8051(CY7C6461) registers in C language
Look at the absacc.h file and manual entry for XBYTE[.....] macros.
Bradford

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.