I'm throwing this out to see if anyone else can make sense of this...
Some background: I'm "playing" around with a PIC 12F615 microcontroller. Ultimately, if I can make it do what I want it to do, it'll control a remote control toy. I've written a fair bit of code that works in a simulator. Except for one small part. As the "user interface" of the device is actually an IR transmitter, I need to be able to receive IR pulses. The code I'm using is using one of the timers to time how long a pulse is, in order to determine if it's a zero or a one.
Due to the way the pins are set up, I need to use an alternate pin function for timer 1 gate (T1G). However, when I try this in the simulator (MPLAB SIM), it doesn't appear to work how I expect it to work. A small sample of code is below:
Code:
; Alt !T1G Testing
;
#include <P12F615.INC>
__CONFIG h'3CD4'
org 0
Start:
; IO Port Setup
; T1G is GPIO4
BANKSEL ANSEL
CLRF ANSEL ; Digital I/O, ADC off.
; Timer1 gate setup
; !T1G is normally GP4
; Select alt !T1G - GP3 input
BANKSEL APFCON
BSF APFCON,T1GSEL
BANKSEL T1CON
MOVLW b'11000001' ; Gate active high and enabled, timer on
MOVWF T1CON ; Let's go!
GOTO $ ; And go...
END
Am I just stupid, or is something else going on here? All the software needed can be downloaded for free from this page:
MPLAB Integrated Development Environment.