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.

setting port pins

Status
Not open for further replies.

P.Copper

Member level 5
Joined
Mar 18, 2013
Messages
82
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,807
Hi all

I'm a beginner when it comes to coding in C. How do i set a single port pin as output using C. i know in assembly we set it using "bsf PORTB,0 " syntax. how do i do the same thing using C? thanks
 

If you are using C30 compiler then, TRIS registers are there which are used as direction registers. If you want to use 0th pin of PORTB as a output then TRISBbits.TRISB0=0;
for input TRISBbits.TRISB0=1; same for other ports. But check first that default setting for pins.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top