Select Page

TRISA register controls the direction of a pin or an entire port. Think of it this way, setting a bit in the register as a 0 – think output. Setting a bit as a 1 – think input.

After a power on or reset – the Pins are set to Input mode.

To make pin RA0, an output we would..

ANSELAbits.ANSA0 = 0; //Disable Analog – This is important disable analog because it is enabled by default.
TRISAbits.TRISA0 = 0; //Set Pin 0 PortA.0 as output

Once it is set as an output we can write to the associated LATA register to make it high or low.

LATAbits.LATA0 = 1; //Sets the pin A.0 high
LATAbits.LATA0 = 0; //Sets the pin A.0 low

(Note**) Pin RA3 can only be an input pin you can not set it as an output..


Have a Project or Idea!?

I am Available for Freelance Projects

I am always looking for opportunities to put my technical skills to work.
I am always looking to connect with like minded people.

Want to connect? – Drop me a message

jamie@jamiestarling.com