Sign in

username:

password:



Not a member?

Search 68hc12



Search tips

Subscribe to 68hc12



68hc12 by Keywords

68HC1 | 812A4 | 9S12DP256 | Bootloader | CodeWarrior | D60A | Debugger | DP256 | ECT | EEPROM | EVB | Flash | HC1 | HCS12 | I2C | IAR | ICC1 | Interrupts | LCD | M68KIT912DP256 | MC9S12DP256 | MC9S12DP256B | Metrowerks | Motor | MSCAN | Multilink | PLL | Quadrature | SDI | SPI | Transceiver | XFC


Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | 68HC12 | Re: Re: OC function for S12DP256B

Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).

Re: Re: OC function for S12DP256B - Shane Shepherd - Nov 4 11:46:20 2006


why is the output compare more accurate then the rti function. If you remember my problem I was trying to store bits in serially through a port and store the eight bit values in in an array(1 byte). The bits are coming over a carrier frequency of 2400Hz can I use the output compare to read in the values.Or should I use the rel time interrupt.
----- Original Message ----
From: Jefferson Smith
To: 6...@yahoogroups.com
Sent: Friday, November 3, 2006 3:37:14 PM
Subject: [68HC12] Re: RTI function for S12DP256B

--- In 68HC12@yahoogroups. com, Shane Shepherd wrote:

> Can you explain the output compare for me

===== Here is something I've written recently =======

General Use of Timer Module for the MC9S12 Family

The Timer module's Output Compare (TOC) gives an amazingly simple

method of setting an accurate and fast timer. There are typically 8

TOCs in the ECT of the MCU, and each can trigger an Interrupt Service

Routine (ISR). Refer to the ECT documentation for official

descriptions of features. While the fundamental concept of TOC is very

simple, keep in mind that there are enhanced features added, and some

tricks to learn in real-world situations.

INITIALIZE

Writing 0x80 to the TSCR1 register enables the main timer called TCNT

(16 bits). That is a free running counter, which means that after it

counts to max (0xffff) it starts over again.

Writing 1 to TIOS will enable only timer 0 (TC0) as OC. If an ISR is

written to handle this event, then its address should be placed in the

vectors table. Write 1 to TIE to enable the interrupt. The output pin

(IOC0/PT0) can be set to do certain things by setting the mode in

TCTL2 (bits 1,0).

SIMPLE CONCEPT

This function is called "Output Compare" because it is simply

comparing the timer (in this case TC0) with the system counter, TCNT.

Each time the register TC0 is the same value as TCNT, the timer

triggers, and sets the flag (bit 0 of TFLG1). If the TIE bit is set,

that also calls the ISR. If the right mode is set (TCTL2), the output

pin (IOC0) will change accordingly. The flag bit (C0F) will stay set

until you clear it. That is typically done by: (1) Read TFLG1 to see

that the flag is set; (2) write a new value to TC0.



[Non-text portions of this message have been removed]



(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )