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
My skills are always primed and ready for new opportunities to be put to work, and I am ever on the lookout to connect with individuals who share a similar mindset.
If you’re intrigued and wish to collaborate, connect, or simply indulge in a stimulating conversation, don’t hesitate! Drop me an email and let’s begin our journey. I eagerly anticipate our interaction!