Multi Tasking/Multi Threading

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
AqaFlow
Posts: 34
Joined: Mon May 16, 2016 2:03 pm
Has thanked: 6 times
Been thanked: 9 times
Contact:

Multi Tasking/Multi Threading

Post by AqaFlow »

Please advice how to create code for multi threading, I mean do different task same time, ie BlinK 2 different Led in different frequency.
Thanks

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Multi Tasking/Multi Threading

Post by Benj »

Hello,

There are a number of ways to do this. The easiest is probably using a timer interrupt. Here is an old example showing how to bit bang several PWM outputs.

http://www.matrixtsl.com/article.php?a=52

Using this approach you could have different LED flash rates.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Multi Tasking/Multi Threading

Post by medelec35 »

Moved post from Programming Tips & Tricks.
You are starting off with a question and not sharing a tip or trick.

Martin
Martin

Post Reply