Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

still no counter

still no counter

2007-08-13 by Thomas Keller

Well, I've checked the "Known Issues" in Help, and find nothing 
relevant.   I looked for service packs on www.atmel.com, and find none 
(I donwloaded the most resent build of AVRStudio when I rebuilt my 
system last week).

   As far as I can tell this program ought to work, but the 
counter/cimer ever counts:

;
;    begin file intialization

.include    "tn25def.inc"                ; include processor definition file

;------------------------------------------------------------------------------
;
;    define interrupt labels

.
.org        0x00

    rjmp    START                        ; reset vector
    rjmp    EXT_INT0                  ; external interrupt 0 vector
    rjmp    PCINT0V                    ; pin change interrupt 0 vector
    rjmp    TIM1_COMPA           ; timer/counter1 compare A match vector
    rjmp    TIM1_OVF                 ; timer/counter1 overflow vector
    rjmp    TIM0_OVF                 ; timer/counter0 overflow vector
    rjmp    EE_RDY                     ; EEPROM ready interrupt vector
    rjmp    ANA_COMP              ; analog comparator interrupt vector
    rjmp    ADC_COMP               ; analog-digital converter done vector
    rjmp    TIM1_COMPB            ; timer/counter1 compare match B vector
    rjmp    TIM0_COMPA            ; timer/counter0 compare match A vector
    rjmp    TIM0_COMPB            ; timer/counter0 compare match B vector
    rjmp    WDT                            ; watch dog timer interrupt 
vector
    rjmp    USI_START                 ; universal serial i/f start vector
    rjmp    USI_OVF                     ; universal serial i/f overflow


EXT_INT0:
PCINT0V:
TIM1_COMPA:
TIM0_OVF:
EE_RDY:
ANA_COMP:
ADC_COMP:
TIM1_COMPB:
TIM0_COMPA:
TIM0_COMPB:
WDT:
USI_START:
USI_OVF:                                ; dummy labels

;------------------------------------------------------------------------------
;
;    define registers

.def    TEMP    = r16



START:

;-------------------------------------------------------------------------------
;
;   set up timer/counter1



    ldi        TEMP,    0x01                    ; set for clock / 1
    out        TCCR1,    TEMP               ; save in appropriate register

    ldi        TEMP,    0x01                    ; set for clk/1024  TMP /1
    out        GTCCR,    TEMP              ; store in appropriate register

    ldi        TEMP,    0x02                    ; set time to 5 periods
    out        OCR1A,    TEMP             ; save in appropriate register
;
    ldi        TEMP,    0x04                    ; set interrupts enabled
    out        TIMSK,    TEMP              ; store in approproiate register
;------------------------------------------------------------------------------
;
;    set Stack Pointer to end of RAM

    ldi        TEMP,        0xdf            ; load end of RAM
    out        SPL,        TEMP            ; and save to stack pointer


    sei                                    ; enable global interrupts

LOOP:
    rjmp    LOOP                        ; go into infinite loop waiting 
for interrupts
    rjmp    LOOP                        ; go back to loop after 
interrupt handling cmmpletes

;------------------------------------------------------------------------------
;
;    timer handler

TIM1_OVF:

    inc        r20                            ; incremenrt count on 
number of interrupts
    reti                                ; return from interrupt

;------------------------------------------------------------------------------
;
;    end of code

Re: [AVR-Chat] still no counter

2007-08-13 by Richard Reeves

>     Well, I've checked the "Known Issues" in Help, and find nothing
> relevant.   
Not even this bit:
"Notes for ATtiny25/45/85 
Timer/Counter1, including the Dead Time Generator, is currently not 
supported in the AVR Simulator." ?




Richard
---
"Sve je bilo tako tiho a nemirno..."
   http://www.musicvangogh.com/

Re: [AVR-Chat] still no counter

2007-08-14 by Thomas Keller

DANG.  Nope, not even that bit.  ***DANG***    I just can't win.  now 
how do I debug this doggoned thing?

tom


Richard Reeves wrote:
Show quoted textHide quoted text
>
> > Well, I've checked the "Known Issues" in Help, and find nothing
> > relevant.
> Not even this bit:
> "Notes for ATtiny25/45/85
> Timer/Counter1, including the Dead Time Generator, is currently not
> supported in the AVR Simulator."
>

Re: [AVR-Chat] still no counter

2007-08-14 by John Samperi

At 10:07 AM 14/08/2007, you wrote:
>how do I debug this doggoned thing?

Not DOGGONE, it's called DRAGON :-)



Regards

John Samperi

********************************************************
Ampertronics Pty. Ltd.
11 Brokenwood Place Baulkham Hills, NSW 2153 AUSTRALIA
Tel. (02) 9674-6495       Fax (02) 9674-8745
Email: john@ampertronics.com.au
Website  http://www.ampertronics.com.au
*Electronic Design * Custom Products * Contract Assembly
********************************************************


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.476 / Virus Database: 269.11.17/951 - Release Date: 13/08/2007 10:15 AM

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.