Searching \ for 'TMR0 problems' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/index.htm?key=tmr0+problems
Search entire site for: 'TMR0 problems'.

Truncated match.
PICList Thread
'TMR0 problems'
2000\03\01@144228 by Heinz Czychun

flavicon
face
Hi all,

       I've just been playing with the TMR0 on a 16F84, and found that he
OPTION command does not work.

       It was my understanding that the TRIS, and OPTION instructions,
although obsoleted by uChip were still supported on the 'F84. The TRIS
instructions still work.

       Is it my understanding that is in error, or has uChip started to
remove support for these instructions from their chips ?

Heinz

2000\03\01@153620 by Dwayne Reid

flavicon
face
<x-flowed>At 02:45 PM 3/1/00 -0500, Heinz Czychun wrote:
>Hi all,
>
>         I've just been playing with the TMR0 on a 16F84, and found that he
>OPTION command does not work.
>
>         It was my understanding that the TRIS, and OPTION instructions,
>although obsoleted by uChip were still supported on the 'F84. The TRIS
>instructions still work.

In what way does OPTION fail to work?  Please provide details and code
snippits.

dwayne



Dwayne Reid   <spam_OUTdwaynerTakeThisOuTspamplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 16 years of Engineering Innovation (1984 - 2000)

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

</x-flowed>

2000\03\01@174042 by Heinz Czychun

flavicon
face
Hi Dwayne,
       I had similar code to that shown below working using bank
switching. When I used it for another project, but wanted to economize, and
use the OPTION and TRIS commands it stopped working. It took quite a while
to find that changing back to bank switching fixed the problem. The code
below was designed so that the only change is the bank switching for the
OPTION instruction. I tested it and it works/ doesn't work as indicated.

At 1:25 PM 3/1/2000, Dwayne Reid wrote:
{Quote hidden}

       The code below will flash an LED on Port B, Pin 0, and it uses bank
switching to adjust the Option Register.

       When the code segment at the bottom is switched into the program,
the LED no longer flashes, and Port B, Pin 0, stays high. I have assumed
that TMR0 is not incrementing so the subroutine never returns to toggle the
LED.

       What can you make of it?

;______tmr0 Demo_______________________________
;
;Program to demonstrate the use of tmr0
;timer/counter (no interrupts)
;Flashes LED on Port B Pin 0 @ 3.5kHz
;_____________________________________________
;
;Chip & Number system declaration
;
       Processor       16F84
       radix           hex
;_____________________________________________
;       cpu equates (memory map)
;Special function registers on PIC16C6x/7x/8x chip
;
tmr0    equ     0x01            ;Timer/Counter register
status  equ     0x03            ;MCU status register
portA   equ     0x05            ;PIC16F84 port A
portB   equ     0x06            ;PIC16F84 port B
opt_reg equ     0x81            ;Option Reg
;
;Other required Registers
;
;       bit equates
rp0     equ     0x05            ;register file select bit
carry   equ     0               ;MCU carry flag
zflag   equ     2               ;MCU zero flag
led     equ     0               ;led output pin
;___________________________________________
;
;Entry point when MCU is reset
;
   org   0x000                 ;start program at address 0
   goto  start                ;jump to start of main program
;___________________________________________
;
Demoinit
;
;*****************************************************************
;changed code see below
;
       bsf     status, rp0     ;point to register bank at 80h
       clrwt                   ;prep for prescaler assignment
       movlw   b'11011111'     ;clock source internal,
       movwf   opt_reg         ;no prescaler
       bcf     status, rp0     ;point to register bank at 00h
;
;*****************************************************************
;
       movlw   0x00            ;make Port A & B  all outputs
       tris    portA
       tris    portB

;
       bsf     portB,led       ;turn LED off
       return
;___________________________________________
;
;Variable Delay routine
;
TMR_delay
       clrf    tmr0            ;clear TMR0 & start counting
TMR_loop
       btfss   tmr0,7          ;has timer reached terminal
                               ;count
       goto    TMR_loop        ;no, loop again
       return
;___________________________________________
;
start
       call    Demoinit
;
mainloop
       bsf     portB,led
       call    TMR_delay
       nop
       nop
       bcf     portB,led
       call    TMR_delay
       goto    mainloop
;
       End

;changed code in program that doesn't work
;Led pin on Port B stays high.

;*****************************************************************
;
       clrwt                   ;prep for prescaler assignment
       movlw   b'11011111'     ;clock source internal,
       option                  ;no prescaler
;
;*****************************************************************

Heinz

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...