Jump to content
43oh

Recommended Posts

Msp430 does not have hardware multi-tasking or multi-threading. The closest you can achieve is through the use of a timer interrupt to interrupt the main program and then execute some other code. When the interrupt has completed, control returns back to where the main code was when the interrupt triggered. Inside the interrupt, care needs to be taken to not call code which is not re-entrant, and be certain that it will finish the interrupt routine faster than the timer interrupt.

 

 

Sent from my iPhone using Tapatalk

Link to post
Share on other sites

Threading is taking the approach of multi-processing backward. Instead of trying to make your chip into a single sequential machine, observe that the peripherals allow you to do true multi-processing, albeit all except one be very simple tasks.

PWM for example is very well done with the timer. I personally would just apply the timer and use that to set PWM in the ISR (or directly PWM wit the timer if that serves the purpose enough). But Energia is claiming control of the timers, and altering them will affect some of the background stuff that's going on.

So in the case of Energia, you could attach to the millis interrupt (which is provided from a timer) and do SoftPWM in that function.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...