ASYNC software timers on separate hardware timers

Status
Not open for further replies.

jasaleja

New Member
Hello everyone,

I wrote a little code for my MSP432 to use two software timers on two separate hardware timers.

The first hardware timer runs on SMCLK 3Mhz/64 and counts to 46875 before the interrupt. That is 1 second. And on that timer runs a software timer that counts 2 seconds, and then it triggers a red LED.

The second hardware timer runs on SMCLK 3Mhz and counts to 3000 before the interrupt. That is 1 m second. And on that timer runs a software timer that counts 500 m seconds, and then it triggers a blue LED.

So after i run the program the blue and red LED should both turn off after 4 seconds. But after a few minutes the 2 LEDS get async and i dont know why.

Does someone have an explanation?

I think it's because no 2 hardware timers can be in sync.
 

Attachments

  • main.c
    4.7 KB · Views: 459
I think it's because no 2 hardware timers can be in sync.
Both hardware timers are running from the same 3mhz clock. They should stay lock together.

I can not see your code here. (my computer)
I have seen code where a divide by 3000 is actually 3001 or 2999 (one count off) because I did not understand numbers. LOL
But after a few minutes the 2 LEDS get async
After more time do the two LEDs get back together? I am trying to determine if they are off by 1/3000 or 1/46875.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…