Continue to Site

SDCC 8051 programming....

Status
Not open for further replies.

davorin

Advanced Member level 3
Advanced Member level 3
Joined
Jun 7, 2003
Messages
901
Helped
11
Reputation
22
Reaction score
4
Trophy points
1,298
Location
Switzerland
Activity points
7,349
read port c sdcc 8051

Sorry for maybe stupid question but never did any '51/52 programming before in C (o;


I see that ports can be directly read and writtn to just with a single statement like "P2_2 = 0" or "value = P0"...

So I do not need to setup input/output before accessing the pins..right?
 

sdcc 8051

Hai,
if you want to read PORT0,you can configure PORT0 as input by writing 0xFF into the port register first. If you want a port as output just watch the pull up status of the port. If no internal pullups,connect external pullups and write 0xFF you will get high on pins,write 0x00 you will pull down pins.
Picstudent
 

8051 manual sdcc programming

I can add that Port 0 is a little different from Ports 1-3.

If you write a 1 to any pin of Port 0, it will go into tri-state mode.
If you write a 1 to any pin of Ports 1-3, it will go high using a weak internal pull-up.
This pull-up is easily overdriven by external circuits.

So writing a 1 to any pin will both make it an input and output a weak
logic high state.

/Rambo
 

davorin said:
Sorry for maybe stupid question but never did any '51/52 programming before in C (o;


I see that ports can be directly read and writtn to just with a single statement like "P2_2 = 0" or "value = P0"...

So I do not need to setup input/output before accessing the pins..right?

Simple answer "YES"

SphinX
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top