The PIC10F322 has 4 general purpose I/O Pins. RA0, RA1, RA2, RA3 – That is assuming you are not using any other peripherals connected to the device and MCLR is disabled.
All 4 I/O pins are on the same port – A
The registers we need to modify to get a pin into output mode are, ANSELA and TRISA
The ANSELA register controls the analog function of a pin – The ANSELA bits default to the Analog mode after Reset. To use any pins as digital general purpose or peripheral inputs, the corresponding ANSEL bits must be initialized to ‘0’ by user software.
TRISA register controls the direction of a pin. 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 reset – the Pins are set to Input mode. To make pin RA0, an output we would..
ANSELAbits.ANSA0 = 0; //Disable Analog
TRISAbits.TRISA0 = 0; //Set Pin 0 PortA.0 as output
If we wanted to do the same for RA2..
ANSELAbits.ANSA2 = 0; //Disable Analog
TRISAbits.TRISA2 = 0; //Set Pin 0 PortA.0 as output
Or if we wanted all the pins*(see note below) to output..
ANSELA = 0;
TRISA2 = 0;
(Note**) Pin RA3 can only be an input pin you can not set it as an output..
Once the pin you want is set as an output – you can set it high or low, by writing to the associated data latch register.
To make RA0, which we set as output high, we would
LATAbits.LATA0 = 1;
To turn it off, or make it low..
LATAbits.LATA0 = 0;
The same for RA2
LATAbits.LATA2 = 1; //high
LATAbits.LATA2 = 0; //low