OC is Output Compare, the name doesn't seem all that obvious to me unless you know how the OC pin works. In general, an output compare works by comparing a period timer to a counter value.
First, you set up a timer to run at some frequency, a good rule of thumb for a motor is 20kHz.
Set your period register to some value
The hardware will compare the timer value to the period register and set/clear the output pin based on if the timer is greater than, equal to, or less than the period register.
When you want to change the duty cycle, you just change the period register.
I've only used OC on PIC24 and PIC32 so I can't help with absolute specifics on PIC16, but it should work the same way. It
may be called something other than OC on PIC16.
As for the errors in your code, you may need to post more of the code. The only thing I see wrong with what you have is that you're missing a '{' after void main(). Also, ADCON1 I
think should be set to 0xFE as you only need RA0 to be analog. TRISA should be set to 0x01 to make RA0 an input and the rest an output.
With a digital input that is floating, if the pin is say 2.5v, then both the PFET and the NFET on the input gate will be partially on, which will cause additional current to flow through the chip. It won't hurt anything, but in general, it is good practice to set all unused pins to output high/low or input with pull-ups or pull-downs.
Of course, read your datasheet and make sure I'm not telling you wrong about this
Hmm.... I don't use names like "unsigned short" so I don't know how many bits wide it is (I know I
should as that is fairly basic...) but I
think it is 8 bit. The ADC's in PICs are generally 10 bits, which means if your function adc_read() returns a 16 bit value, you are probably losing the 2 most significant bits. What you should do is change the ADC setup to left adjust the ADC result and return only the high byte of the value (if you don't need 10 bits of resolution). This could also be done by simply shifting the result to the right by 2, but it is more efficient to have the ADC module left adjust the result and read only one byte. The datasheet will have more information on this and explain it in detail.