@tomboalogo, I agree, but in some applications, I've come up with problems improving the code on a system that was already previously designed. I have hit the memory limits of the microcontroller. So at times, it does become an issue.
Again, I enjoy the discussions on programming style and I am learning from you as you learn (hopefully) from me and from each other. I hope to give insight into the methodology rather than the programming. I admit that even I am appalled at the program structure but I am trying to be compact. I work with OTHER people's code almost daily and against a number of companies' style books... Bottom line - keep the cards and letters coming, folks!
The choice to complicate things by adding the wash flag was to save code space. An example of a 'pure' state machine would mirror the diagram yesterday that has fill, run, and drain for wash AND for rinse. IMO neither answer is 'perfect' - but I am looking at this design from a tiny 8-bit world.
@danlafleur, That is why I asked about the implementation. Couldn't the on/off behavior be the same for the solenoid as with the motor and just compare whether it is to be On/Off as a parameter and simple activate the correct solenoid?
The code for what the motor and solenoid functions do will be included and we may look briefly at them tomorrow. Remember that I am simulating these real-life functions (including a motor driver) so that the outputs will be pretty much the same as the defines (one bit on or off for solenoid and two bits for the motor - one power and one direction).
@JGuernsey, our company used to build a control system that operated pulse latching solenoid valves. One solenoid opened the valve, the other solenoid closed it. This was for power saving on battery powered sites.
Is it typical to not use abstraction when working with 8-bit systems? Suppose FF or BB needed to be used in the future to indicate a fault - if the value for indicating the 7-segment display was to be blanked were a # define value, you could change the value in one place and not have to worry that you missed an instance in your code.
Q: Charles, is your source code going to include the functions for the motor and the solenoid, so I can investigate the reasoning behind using the 2 separate on/off water functions vs. the motor direction on/off single function?
use #defines to set LED values. therefore the value set is human readable and obvious. The #define maps the port pattern to create the expected display (assuming the 2 LEDs are mapped to (1) 8-bit port.
Q: Why do you have a function to setMotor direction which also turns it on/off, but for the solenoid you have separate on/off functions? My audio is not streaming properly atm, so I can't hear answers. I will reload the audio at the end when it's archived.
@andrewcrlucas char is typically signed, but you are correct it is compiler dependant. That's why he uses uc for unsigned. We typically have an iso file that defines the variables as uint8_t for unsigned char, and int8_t for signed.
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.
Charles: I posted a question yesterday that never showed up. Is the distinction of a state machine a software approach that captures each state in isolated blocks of code, or the processing pathway where the code moves from one state to the next in a predetermined fashion, instead of jumping randomly from state to state ( depending on what's going on)?
Again, this is your instructor - due to issues on my end, I was very very late sending today's slides (like right NOW)... they are uploading them to the website now. A THOUSAND apologies!!! There have been some big challenges on my end the last 24 hours... but let's get some coffee and have this class! See you in 15 minutes!
-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.
Fifty-six-year-old Pasquale Russo has been doing metalwork for more than 30 years in a tiny southern Italy village. Many craftsmen like him brought with them fabrication skills when they came from the Old World to America.
Focus on Fundamentals consists of 45-minute on-line classes that cover a host of technologies. You learn without leaving the comfort of your desk. All classes are taught by subject-matter experts and all are archived. So if you can't attend live, attend at your convenience.