This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

time and interrupt

hi all!

i'm trying with EZ430-RF2500 to  transceiver signal from my simple keyboard(there are 8 putton) to another,in order control some devices.

but while i trying it, i believed some trouble my knowledge in time and interrupt. can you recomment me some documents which tell more about it. thankyou!

thank you!

 

  • What do you want to know in details? I could write a book without covering every aspect of timers and itnerrupts.

    The basic functionality is covered in the family users guide for your MSP. CPU, Clock module and Timer sections

  • thank Jens!

    i had read MSP430 Microcoltroller Basics-John H.Davies, but i don't know any more about timers and interrupts, i really need a book which has more simple examble(by C), and comment.

    i'm a beginer, so i need some easy examble.

    could you give me something like this!

    thank!

     

  • quyen anh nguyen said:
    could you give me something like this!

    Sory, my own book is not yet written. It will contain an introduction of timers and interrupts. It will, however, focus on the concepts, since the implementation of interrupts is very compiler specific (interrupts are outside the scope of the C language) and the implementation of timers is very application specific.

    For interrupts, a starting point would be your compiler documentation. It should tell you how to define ISRs (interrupt service routines) on this compiler. The MSP family users guide has a section about interrupts (it is small) and a section about the timers (covering every aspect from counting to PWM generation and event capturing). Both do not contain C code.
    However, there are many code examples available for different aspects of the various MSP variants. You'll find them from the MSP product page.

    If you have detail question, feel free to ask, but I cannot write a beginners tutorial here.

  • hi Jens!

    i have some trouble with timer, i don't know the principles of timer.

    can you tell me more about timer( all most registers using for timer and descript it). and give me an example using timer( for example: delay 1s).

    if you don't have freetime, send for me some documents on the timer,  please!.

    thank you!.

  • The timer is described (surprise!) in the tiemr section of the users guide.

    However, the guide seems to assume that you have at least a basic idea of what a timer is for. Well (surprise again!) it is for timing things.

    Basically, the timer is a pulse counter. It counts pulses it gets from a source. You can configure the source. It can be ACLK or SMCLK or an external clock signal on a specific I/O pin. You can also specify whether this clock signal shall be divided by a prescaler befor its pulses are counted.

    So if you look at the timer register, you can tell how many clock pulses have passed since you looked the last time at it. That's the basics. And it isn't much. So the timers have so-called capture/compare units. These individually programmable units can trigger an interrupt or issue a hardware signal once the tiemr counts to a certain, configurable value.

    Example: the timer clock source has 32768Hz (a typical ACLK configuration). The tiemr itself can count from 0 to 65535 adn then begins with 0 again (triggering an overflow interrupt).

    You can jsut set the timer to 0, and every 65536 clock ticks (2 seconds on 32768Hz clock) it will overflow and trigger an overflwo interrupt. Count the interrupt and you know how many seconds have passed.
    But the capture/compare units can do even more. If you write a value of 3277 to the compare register of a CC unit, the unit will trigger  an interrupt once the timer has counted to 3277, which happens after 1/10 second.
    The capture/compar eunit #0 has a special funciton: it can reset the timer to 0 if the timer hits its compare value. So the tiemr will count only from 0 to 3277 and then begins with 0, triggering an interrupt every 1/10 second.

    The other units can trigger on a different point alog this way. This is used to generate PWM signal outputs, where unit 0 (usually referred to as CCR0 = capure/compare register 0, while this originally only refers to the part of the CC unit that holds the comparison value) defines the cycle time and the others have a setting in this counting cycle for the duty cycle of their PWM output signals.

    The name capture/compare omes from this functionality (compare to a preset value) and the secondary use: the capture. Here an external signal makes the unit copying the current timer value to its CCR. The current tiemr count is captured with the external signal. And of yource you get an interrupt then :)

    So much about the timers. The different configuration allow a wider variety of usages. From a simple delay to a multi-channel PWM generator. it depends on you what you make of it.

**Attention** This is a public forum