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.

[PIC] How to set input output pins of pic12F675

Status
Not open for further replies.

darryl_co

Member level 1
Joined
Feb 23, 2011
Messages
34
Helped
6
Reputation
12
Reaction score
5
Trophy points
1,288
Activity points
1,521
How do I set I the configuration which pin of the pic is input and which pin is output.I do understand that setting a pin to 0 makes it output and 1 makes it Input. But I still dont get it
Code:
set_tris_a( 0b11111001 );
what does the above code mean?
can someone please explain with reference to PIC12F675 and give some more examples like GP0 and GP3 inputs and rest outputs.Does MCLR pin reset the code and starts from the start or temporary code halt.I am using MPLAB and CCS pic C compiler
 

Hi,

I don't k ow the PIC, and I don't know your compiler syntax...

But portA probably has 8 pins, each of them can be input or output.
Each of the 8 port pin directions need to be configured with 0 or 1

0b11111001

Here you send the 8 bits for the 8 port directions.

Klaus
 

I will crash your mind completly
TRISA &= ~((1<<2)|(1<<3)); //this will enable pin 2 and 3 of port A for output
PORTA |= (1<<2)|(1<<3); //will set pin 2 and 3 of port A
 

These are the images from the datasheet of the PIC. The pic is a 8 bit PIC. GP0 to GP5. GP3 is the MCLR pin
 

Attachments

  • GPIO.jpg
    GPIO.jpg
    55.3 KB · Views: 128
  • TRISIO.jpg
    TRISIO.jpg
    81.1 KB · Views: 142
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top