Jump to content
43oh

ControlEasy GUI


Recommended Posts

Seems like it would be simple enough to port for other OSs, all the msp expects is certain single characters to set some pins. lower case letter to enable, upper case to disable. A Bit more complicated for the pwm outputs.

 

The msp code uses alot of if/elseif/elseif/elseif for the incoming serial data though. I've always been told that it would be better to use case/switch for better performance, especially in this simple multi option case. Can anyone confirm?

Link to post
Share on other sites

I have noticed that if I use a lot of If/elseif statements that you do see a performance hit, but only if you have more then 5 in a row, and if your at that cusp, I would hope that the person is considering switch/case instead.

 

When I first started with my RGB flower pot, I had a bunch of if/elseif statements, the rgb lights would flicker when going through all the colors, after switching to switch case, the flicker stopped.

 

If i get time maybe I should run a small test to see the difference in performance really is.

Link to post
Share on other sites
I have noticed that if I use a lot of If/elseif statements that you do see a performance hit, but only if you have more then 5 in a row, and if your at that cusp, I would hope that the person is considering switch/case instead.

 

When I first started with my RGB flower pot, I had a bunch of if/elseif statements, the rgb lights would flicker when going through all the colors, after switching to switch case, the flicker stopped.

 

If i get time maybe I should run a small test to see the difference in performance really is.

 

They have about 37 (if/elseif) in one section, then an additional 20 to 30 (repeated IF statements) in another, and a set of 6 in another.

Link to post
Share on other sites

The msp code uses alot of if/elseif/elseif/elseif for the incoming serial data though. I've always been told that it would be better to use case/switch for better performance, especially in this simple multi option case. Can anyone confirm?

 

If there is (any) performance problem, solution is assembler. If there is a lot of if/elseif/elseif (or case switch, whatever) this can be solved using the same way as TI using for interrupt vectors tables (old, not original stuff, that can be used with any uC), to increase PC by incoming value (that can be calculated depending of incoming data), and then jump to desired function. Using this algorithm each selection will have the same cost.

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...