Opened 2 years ago

Closed 2 years ago

Last modified 16 months ago

#1 closed task (fixed)

ATMEGA8A: 8-bit Timer/Counter0 simulation

Reported by: dsl Owned by: dsl
Priority: major Milestone: MCUSim-0.2
Component: avr Keywords: planned-in-0.2.0
Cc:

Description

  • Internal and external clock sources
  • Normal mode (the only mode here)
  • Prescaling
  • Generate interrupts: TIMER0 OVF

Attachments (1)

0001-patch-0.1.48-External-clock-source-for-ATmega8A-Time.patch (4.8 KB) - added by dsl 2 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 Changed 2 years ago by dsl

Milestone: 0.2.0Work in Progress

comment:2 Changed 2 years ago by dsl

Keywords: planned-in-0.2.0 added

comment:3 Changed 2 years ago by dsl

Milestone: Work in Progress0.2.0

comment:4 Changed 2 years ago by dsl

Milestone: 0.2.0Work in Progress

comment:5 Changed 2 years ago by dsl

This is a short quote from ATmega8A datasheet about external clock source of the Timer/Counter0:

The clock source is selected by the clock select logic which is controlled by
the clock select (CS02:0) bits located in the Timer/Counter Control Register (TCCR0).

CS2:0 = 110 - External clock source on T0 pin. Clock on falling edge.
CS2:0 = 111 - External clock source on T0 pin. Clock on rising edge.

Important: If external pin modes are used for the Timer/Counter0, transitions
on the T0 pin will clock the counter even if the pin is configured as an output.
This feature allows software control of the counting.

T0 pin is PD4 for every types of packages.

Last edited 2 years ago by dsl (previous) (diff)

comment:6 Changed 2 years ago by dsl

It could be a good idea to create a mechanism to test firmware, some kind of template where initial state, expected values and terminal cases would be described. I'd use it to check external source support implemented in this patch 0.1.48, for instance. Hmm...

comment:7 Changed 2 years ago by dsl

Test for Timer/Counter0 external clock source added in https://github.com/dsalychev/mcusim/commit/cfd7fbeddcdf47a5c6232d93fef398eb12170d73. It helped me to fix implementation a bit. I'll mark this ticket as done and closed now.

comment:8 Changed 2 years ago by dsl

Milestone: Work in Progress0.2.0
Resolution: fixed
Status: newclosed

comment:9 Changed 20 months ago by dsl

Milestone: 0.2.00.2

Milestone renamed

comment:10 Changed 20 months ago by dsl

Milestone: 0.2MCUSim-0.2

Milestone renamed

comment:11 Changed 17 months ago by dsl

Milestone: MCUSim-0.2MCUSim 0.2

Milestone renamed

comment:12 Changed 17 months ago by dsl

Milestone: MCUSim 0.2mcusim 0.2

Milestone renamed

comment:13 Changed 16 months ago by dsl

Milestone: mcusim 0.2MCUSim-0.2

Milestone renamed

Note: See TracTickets for help on using tickets.