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 | =?iso-8859-1?Q?RE=3A_=5B68HC12=5D_Problem_initialise_timer_for_1=B5s_cycl?= =?iso-8859-1?Q?e?=

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

=?iso-8859-1?Q?RE=3A_=5B68HC12=5D_Problem_initialise_timer_for_1=B5s_cycl?= =?iso-8859-1?Q?e?= - Sven K - May 18 8:38:45 2009

Hello,

>Because of character problems on the mail I received, I can't see if you
>want=20
interrupt each micro-second.=20
>If so, it seems very very fast for that=20
processor.
I need to increment a variable every micro-sencond. I am implementing an CA=
Nopen stack at the controller. For this I need to increment a variable ever=
y micro-second.
I have written a test programm to test the timer. The timer basically works=
.. The interrupt works etc. but I do not know how to configure the timer re=
gisters so that I get an interrupt every micro-second.
You can find attached the programm files. Perhaps someone can tell me how =
to configure the timer to get an interrupt every micro-second.
Perhaps an additional question. How can I test the Interrupt? I toggle some=
LED's every interrupt but I think when using a one micro-second interrupt =
you can not see toggling the LED's any more ;).
It is all written in C.
Thank you very much!Best regards
--- f...@yahoo.com schrieb am Fr, 1.5.2009:
I find just this morning your problem about Timer.
Because of character=20
problems on the mail I received, I can't see if you
want interrupt each=20
micro-second...=20
If so, it seems very very fast for that=20
processor.

With 12 Mhz quartz, no PLL, I use an empty function (in C) to=20
delay 2.5
micro-seconds=A0:

void Delay_2_5_micro (void)
{ //=20
nothing to do
}

That means just call and return from this empty=20
function take 2.5
micro-seconds, measured with oscilloscope.

Hope this=20
helps.

Joel
Von: f...@yahoo.com
Betreff: [68HC12] Problem initialise timer for 1=B5s cycle
An: 6...@yahoogroups.com
Datum: Freitag, 1. Mai 2009, 13:56

Hello,

I have a problem with using the Timer on a MC9S12DP512. I want to create 1=
=B5 second cycles. Every =B5s I want to increment a variable, but I do not =
know how to initialise the timer, so that I get a timer interrupt every =B5=
s.
I hope that someone can help me.
Best regards

=20=20=20=20=20=20

[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 )


=?iso-8859-1?Q?RE:_=5B68HC12=5D_Problem_initialise_timer_for_1=B5s_cycle?= - jpdi - May 18 11:09:57 2009

Hi,=20

As I told you in my precedent mail, I think you can't increment a character
each micro-second.
The reason is this delay is too short for that processor.
As I explained, an empty function (quartz 12 MHz, CPU frequency 6 Mhz) take=
s
2.5 micro-seconds :

EmptyFunction (void)
{ // nothing to do !
}

void main (void)
{ while (1)
{ led =3D 0;
EmptyFunction ();
led =3D 1;
}
}
The led will flash about 2.5 micro-second.
The micro-processor just have to (Core user guide, instructions JSR and RTS=
)
- (SP) - $0002 -> SP // JSR instruction
- RTNh:RTNl -> (Msp):(Msp+1)
- subroutine add -> PC
- do nothing
- (Msp):(Msp+1) -> PCh:PCl // RET instruction
- (SP) + $0002 -> SP

An interrupt function will take more time, because of some additional thing=
s
to do : save registers for example...
I don't know what is the sequence for interrupt call, but I can see, JUST
FOR the RTI instruction (return from interrupt) :
- (Msp) -> CCR // recover flags
- ((SP) + $0001 -> SP
- (Msp):(Msp+1) -> B:A // recover A and B registers
- ((SP) + $0002-> SP
- (Msp):(Msp+1) -> Xh:Xl // recover X register
- ((SP) + $0002-> SP
- (Msp):(Msp+1) -> PCh:PCll // recover PC register
- ((SP) + $0002-> SP
- (Msp):(Msp+1) -> Yh:Yl // recover Y register
- ((SP) + $0002-> SP
That means RTI restores CCR, B, A, X, PC, and Y.=20
Where RET has 2 things to do, RTI has 5 !=20

You can see, with the same core frequency, interrupt function will be slowe=
r
than empty function, because interrupt function has more things to do.

So, if you use PLL of the micro-processor, I say for example 24 Mhz core
freq, your empty function will take 2.5 / 4 micro-second, 0.63 micro-second=
.
BUT :
- because your interrupt function has more thing to do, I can suppose it
can't do in less than 1 micro-second.
- even if it is ok, your micro-processor will only run under its interrupt
service routine.

So, for me, forget to increment your character each micro-second : it's too
quick.

Of course, your timer will interrupt your main process... Even with RTI
timer, or the other timers T0...T7. But at which period ? Certainly not at =
1
micro-second, I think !=20

I hope this helps.

Joel

-----Message d'origine-----
De=A0: 6...@yahoogroups.com [mailto:6...@yahoogroups.com] De la part de
Sven K
Envoy=E9=A0: lundi 18 mai 2009 14:38
=C0=A0: 6...@yahoogroups.com
Objet=A0: RE: [68HC12] Problem initialise timer for 1=B5s cycle

Hello,

>Because of character problems on the mail I received, I can't see if you
>want=20
interrupt each micro-second.=20
>If so, it seems very very fast for that=20
processor.
I need to increment a variable every micro-sencond. I am implementing an
CANopen stack at the controller. For this I need to increment a variable
every micro-second.
I have written a test programm to test the timer. The timer basically
works.. The interrupt works etc. but I do not know how to configure the
timer registers so that I get an interrupt every micro-second.
You can find attached the programm files. Perhaps someone can tell me how
to configure the timer to get an interrupt every micro-second.
Perhaps an additional question. How can I test the Interrupt? I toggle some
LED's every interrupt but I think when using a one micro-second interrupt
you can not see toggling the LED's any more ;).
It is all written in C.
Thank you very much!Best regards
--- f...@yahoo.com schrieb am Fr, 1.5.2009:
I find just this morning your problem about Timer.
Because of character=20
problems on the mail I received, I can't see if you
want interrupt each=20
micro-second...=20
If so, it seems very very fast for that=20
processor.

With 12 Mhz quartz, no PLL, I use an empty function (in C) to=20
delay 2.5
micro-seconds=A0:

void Delay_2_5_micro (void)
{ //=20
nothing to do
}

That means just call and return from this empty=20
function take 2.5
micro-seconds, measured with oscilloscope.

Hope this=20
helps.

Joel
Von: f...@yahoo.com
Betreff: [68HC12] Problem initialise timer for 1=B5s cycle
An: 6...@yahoogroups.com
Datum: Freitag, 1. Mai 2009, 13:56

Hello,

I have a problem with using the Timer on a MC9S12DP512. I want to create 1=
=B5
second cycles. Every =B5s I want to increment a variable, but I do not know
how to initialise the timer, so that I get a timer interrupt every =B5s.
I hope that someone can help me.
Best regards

=20=20=20=20=20=20

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

------------------------------------

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


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