Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

BYTE and BIT addressable registers for c compiler HELP

Status
Not open for further replies.

RFdata

Newbie level 6
Joined
Nov 27, 2008
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,407
Hi, I need some help with declaring adress in c compiler for a 89S8253:

80h P0 11111111
81h SP 00000111
82h DP0L 00000000
83h DP0H 00000000
84h DP1L 00000000
85h DP1H 00000000
86h SPDR ########
87h PCON 00XX0000

This are the default byte addressable registers in the data sheet of the 89S8253,
for example this means that all the pins of the P0 are at 1 ??
If I want to have like 10101010 in port 1 what i have to do in the compiler?

sfr at (0x80) P0 //indicates the P0 adress

P0= 10101010b //send data to P0

Is this procedure correct? How can I declare the P0 output or input?
I´m confused about byte addressable registers and bit addressable registers
sfr at (0x80) P0 or sbit at (0x80) P0_0 they have the same andress , or for example sbit at (0x81) P0_1 is it adress the same adress of the SP that is at 81h?

Any help is welcome

Tanks :)
 

The addressing of SFRs and SFR bits is using tool dependant C language extensions and can't be answered generally. You should consult the tools manual.
E. g. Keil has this syntax to declare SFR bit variables
Code:
sbit LED1 = P0^0;
The SFR registers ususally have predefined names as P0 in include files.

8051 standard IO ports (I guess, this also applies to 89S2253) have no direction registers, cause the pins are open drain respectively open drain with a pull-up. They are basically bi-directional.
 

Hi,
In addition to what FVM has mentioned, 89S8253 is an 8051 variant and all bit/ byte addressability is derived from 8051 architecture. Apart from the registers mentioned, RAM area 0x20 to 0x2F are also bit addressable. In 8051, to make a port an input port,it is sufficient to set the porbits high. The bit addressing uses the overlapping addresses of some ports, but the instructions for bit level being different from those for port level CPU is able to distinguish between them.

sfr at (0x80) P0 or sbit at (0x80) P0_0

Yes, you are right, but the variable class sfr ( a byte variable ) and sbit (a bit variable) makes the difference.

Regards,
Laktronics
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top