[PIC] PIC18F1320, ICD2 (Official), and Timer1

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PIC] PIC18F1320, ICD2 (Official), and Timer1

dave.w.turner
Hi all,

I am trying to make a real-time-clock.  I am using timer1 on a
PIC18F1320, hooked up to a 32.768KHz watch-type crystal.  The code
didn't seem to do anything, so I tryed to step through with the ICD2
stepper.  It stepped fine through the initialization, until it got to
the command where it moved b'10111111' into T1CON.  Then, it started
saying: unable to complete operation - target not in debug mode in the
output window, and it stopped stepping.  Does anyone know why TMR1
would cause the ICD2 to stop working?

Here is my OSCCON setup:
11110000

T1CON setup:
10111111

It stops on the second line of this:
        movlw b'10111111'
        movwf T1CON

BTW, in the config bits, the oscillator is set to C9 - INT RC-CLKOUT
on RA6, Port on RA7.

BTW2, here is my wait till next second function:  (Any ideas whether
it will work?)
wait1sec
_1secloop1
        movlw 0h
        addwf TMR1H,w
        btfss STATUS,Z ; hold until rollover
        goto _1secloop1
       
_1secloop2
        movlw 0h
        addwf TMR1H,w
        btfsc STATUS,Z ; don't let us out until no longer rollover
        goto _1secloop2
       
        return

Thanks in advance for any help.

--

Dave
All us base are belong to you.

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist