"performance of a switch-case compared to an IF statement?" You have to see how the compiler built the switch statement, it could be a sorted table, it could be sequectials, it could be just a bunch of ifs. if you have a few or alot of things, "if" can be prioritized how you want them. the switch case will be redone by the compiler and put into different orders than you have in the switch statement.
FSMs and Petri-Nets are great abstractions for logic/sequential machinery, which most control/reactive systems are. There are some automatic code generation tools out there. IAR Visual State does a pretty good job.
Hi all -Audio is live! If you don't see the audio bar at the top of the screen, please refresh your browser. It may take a couple tries. When you see the audio bar, hit the play button. If you experience audio interruptions and are using IE, try using FF or Chrome as your browser. Many people experience issues with IE. Also, make sure your flash player is updated with the current version. Some companies block live audio streams, so if that is the case for your company, the class will be archived on this page immediately following the class and you can listen then. People don't experience any issues with the audio for the archived version.
When cases for a switch statement are contiguous (like the state machine IDs # define, or I like to use enums) many C compilers convert it to a quick vectored lookup table branch, like pointers usage and therefore same time regardless of state. This keeps the debuggable/readable single-steppable switch/case form and yet runs efficiently. Only a crude C compiler would implement it as series of chained if/then/elseif/else decision forks. That's why I usually use an enumeration for state ID codes so they are sequentially assigned.
-The streaming audio player will appear on this web page when the show starts at 2 PM Eastern time today. Note however that some companies block live audio streams. If when the show starts you don't hear any audio, try refreshing your browser. If that doesn't work, try using Firefox or Google Chrome as your browser. Some users experience audio interruptions with IE. If that doesn't work, the class will be archived immediately following our live taping.
I'm doing a similar project at the moment but slightly more complicated.
It has 16x2 HD44780 LCD, 16 key matrix keypad, RTC chip DS1307 to display time and date, a solenoid valve to turn water on or off and a flow meter to measure quantity of water flow and a serial printer to print report.
Need to be able to adjust time and enter qty of water to pass, display both final and instantaneous water flow on LCD as well as date and time. I have finished the hardware using PIC16F876A and in the middle of software. I'm doing it using state machines while counting flow meter pulses through 16 bit timer1 as a counter with external clock.
For industrial control applications, or even a simple assembly line, that machine can go almost 24/7 without a break. But what happens when the task is a little more complex? That’s where the “smart” machine would come in. The smart machine is one that has some simple (or complex in some cases) processing capability to be able to adapt to changing conditions. Such machines are suited for a host of applications, including automotive, aerospace, defense, medical, computers and electronics, telecommunications, consumer goods, and so on. This discussion will examine what’s possible with smart machines, and what tradeoffs need to be made to implement such a solution.