EmbeddedRelated.com
Forums

About timers

Started by Ing juan manuell April 10, 2006
Hi Friends,
   
  I am new in this of MSP430, and i am trying to do something with TIMERB that i
don't know if this could be posible. Until now i couldn't do it.
  I am working with F169 at 8Mhz
  I would like to do send out like a clock of 500Khz but without interrupt. It
is done is easy. The hard part it is that i need a 500hz interrupt timer inside
and if could be posible send out too. This part doesn't work in any way.
   
  Have any one made something like that. I saw the examples and saw that it
could be done but the frecuencies are more similar 2000,200, 40, 6hz
   
  Thanks in advance

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam gratis! 
Abrtu cuenta ya! - http://correo.yahoo.com.ar




Beginning Microcontrollers with the MSP430

Hi Juan,

One possibility perhaps is this :

1. 500 kHz

You can output all system clocks, but only at fixed pins.
So if you don't need another clock such as 32.768 kHz, and can afford to
set SMCLK to 
1, 2 or 4 MHz (in the example of 8 MHz crystal), then you can output the SMCLK
of 1/2/4 MHz on
the reserved SMCLK pin.
Now route this - DC coupled - to the XIN pin, and leave XOUT open (ie. LFXTAL
in/out).
Now you can nominate the ACLK signal to be a divided SMCLK .
These would be the settings with 8 MHz:
SMCLK = Div/2 = 4 MHz   =>  ACLK = XIN/8 = 500 kHz.
SMCLK = Div/4 = 2 MHz   =>  ACLK = XIN/4 = 500 kHz.
SMCLK = Div/8 = 1 MHz   =>  ACLK = XIN/2 = 500 kHz.
Now set the reserved ACLK pin to output the 500 kHz signal and voila.
Note that for most cases, MCLK (your CPU clock) doesn't need to be precise
and can be the DCO
running at up to max. speed. (~ 9.5 - 10 MHz with ext res).
Also note that if your crystal is for example 4 MHz, then you don't need to
route SMCLK to XIN,
since 4 MHz / 8 = 500 kHz. Just output SMCLK as 500 kHz then.

These choices depend on what clock signals you will need, and whether you can
allow for that.
(also, current will be slightly higher)

NOTE : if you do this on a 44X family part, make sure you RESET the fault flag
for the externally
generated input to the XIN pin after init of XT2.... otherwise it won't
generate ACLK !!!!

2. 500 Hz interrupt

You can use TIMERB in UP mode.
Set the output unit to toggle at a compare event on any Timer_B channel you
want, and that
channel's compare unit CCRBx value to the appropriate value to generate 500
Hz.
The output unit will toggle the corresponding CCRBx pin, and if you want you can
enable the
proper interrupt for it too (although you don't have to, to output the 500
Hz signal).

The 500 kHz solution depends on whether you can set up the SMCLK, ACLK and MCLK
to function that
way... !
Note that it will take more current to externally generate a 500 kHz signal if
you really need it.

B rgds
Kris



-----Original Message-----
From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of Ing juan manuell
Sent: Tuesday, 11 April 2006 2:19 AM
To: msp430
Subject: [msp430] About timers

Hi Friends,
   
  I am new in this of MSP430, and i am trying to do something with TIMERB that i
don't know if
this could be posible. Until now i couldn't do it.
  I am working with F169 at 8Mhz
  I would like to do send out like a clock of 500Khz but without interrupt. It
is done is easy.
The hard part it is that i need a 500hz interrupt timer inside and if could be
posible send out
too. This part doesn't work in any way.
   
  Have any one made something like that. I saw the examples and saw that it
could be done but the
frecuencies are more similar 2000,200, 40, 6hz
   
  Thanks in advance

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam gratis! 
Abrtu cuenta ya! - http://correo.yahoo.com.ar





.

 
Yahoo! Groups Links



 






Thanks i will try it.

Microbit <microbit@micr...> escribi  Hi Juan,

One possibility perhaps is this :

1. 500 kHz

You can output all system clocks, but only at fixed pins.
So if you don't need another clock such as 32.768 kHz, and can afford to
set SMCLK to 
1, 2 or 4 MHz (in the example of 8 MHz crystal), then you can output the SMCLK
of 1/2/4 MHz on
the reserved SMCLK pin.
Now route this - DC coupled - to the XIN pin, and leave XOUT open (ie. LFXTAL
in/out).
Now you can nominate the ACLK signal to be a divided SMCLK .
These would be the settings with 8 MHz:
SMCLK = Div/2 = 4 MHz   =>  ACLK = XIN/8 = 500 kHz.
SMCLK = Div/4 = 2 MHz   =>  ACLK = XIN/4 = 500 kHz.
SMCLK = Div/8 = 1 MHz   =>  ACLK = XIN/2 = 500 kHz.
Now set the reserved ACLK pin to output the 500 kHz signal and voila.
Note that for most cases, MCLK (your CPU clock) doesn't need to be precise
and can be the DCO
running at up to max. speed. (~ 9.5 - 10 MHz with ext res).
Also note that if your crystal is for example 4 MHz, then you don't need to
route SMCLK to XIN,
since 4 MHz / 8 = 500 kHz. Just output SMCLK as 500 kHz then.

These choices depend on what clock signals you will need, and whether you can
allow for that.
(also, current will be slightly higher)

NOTE : if you do this on a 44X family part, make sure you RESET the fault flag
for the externally
generated input to the XIN pin after init of XT2.... otherwise it won't
generate ACLK !!!!

2. 500 Hz interrupt

You can use TIMERB in UP mode.
Set the output unit to toggle at a compare event on any Timer_B channel you
want, and that
channel's compare unit CCRBx value to the appropriate value to generate 500
Hz.
The output unit will toggle the corresponding CCRBx pin, and if you want you can
enable the
proper interrupt for it too (although you don't have to, to output the 500
Hz signal).

The 500 kHz solution depends on whether you can set up the SMCLK, ACLK and MCLK
to function that
way... !
Note that it will take more current to externally generate a 500 kHz signal if
you really need it.

B rgds
Kris



-----Original Message-----
From: msp430@msp4... [mailto:msp430@msp4...] On Behalf Of Ing juan manuell
Sent: Tuesday, 11 April 2006 2:19 AM
To: msp430
Subject: [msp430] About timers

Hi Friends,
   
  I am new in this of MSP430, and i am trying to do something with TIMERB that i
don't know if
this could be posible. Until now i couldn't do it.
  I am working with F169 at 8Mhz
  I would like to do send out like a clock of 500Khz but without interrupt. It
is done is easy.
The hard part it is that i need a 500hz interrupt timer inside and if could be
posible send out
too. This part doesn't work in any way.
   
  Have any one made something like that. I saw the examples and saw that it
could be done but the
frecuencies are more similar 2000,200, 40, 6hz
   
  Thanks in advance

__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam gratis! 
Abrtu cuenta ya! - http://correo.yahoo.com.ar





.


. 

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



__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam gratis! 
Abrtu cuenta ya! - http://correo.yahoo.com.ar