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.

Looking for sample C program for initializing ports in PIC

Status
Not open for further replies.

akhileshchidare

Member level 3
Joined
Oct 4, 2005
Messages
59
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Activity points
1,758
help needed for PIC

i am in starting stage of implementing C with PIC

i want to initialize ports as input or output in C language...

can any one send me a smple program in C for initilising ports?

for example:
for SPI mode i need to confihure the bits SCK,DIN,DOUT.. how can i do that...

Akhilesh
 

Re: help needed for PIC

akhileshchidare said:
i am in starting stage of implementing C with PIC

i want to initialize ports as input or output in C language...

can any one send me a smple program in C for initilising ports?

for example:
for SPI mode i need to confihure the bits SCK,DIN,DOUT.. how can i do that...

Akhilesh

What compiler are using?
for individual bits:
TRISCbits.TRISC0 = 1; //set RC0 as input
TRISCbits.TRISC1 = 1; //set RC1 as output

for the whole port:

TRISC = 0x81; //set portC bits 7 and 0 as input, others as output
 

Re: help needed for PIC

why you don't use ASM? It look simple
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top