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..

Something You Might Be Intrested In


10F32X Rapid Prototype Board

Make The PIC10F322 and other PIC10F Processors Breadboard Friendly for Quick and Easy Prototyping.

{Click to learn more}

PIC10F322 Understanding the TRISA Register XC8