Here is a sample using the MCLR pin as an input to blink LEDs on the 5 remaining pins.
Code:
DEFINE OSC 4
@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_OFF & _CP_OFF
CMCON=7 :TRISIO = %001000
CHECK: GPIO = %000000
IF GPIO.3 = 1 THEN
GOSUB RUN
ENDIF :GOTO CHECK
RUN:
GPIO = %000001: PAUSE 50
GPIO = %000010: PAUSE 50
GPIO = %000100: PAUSE 50
GPIO = %010000: PAUSE 50
GPIO = %100000: PAUSE 50
RETURN
The weak pull-ups are automatically disabled on power up. Or when a pin is made an output.
TRMO thing is for setting the duration of the timer. How often an interrupt triggered by the timer happens.
The OSCCAL is just for fine tuning the internal OSC, I would say you only need to worry about it if you are doing some really time critical apps. But then you would be better off using an external OSC, needing more pins now, use different PIC....
BTW... When you do a link, do not put it in a code tag. No longer clickable
Bookmarks