Introduction to Programmable Components
Welcome! In this chapter, we are looking at the "brains" of modern products. Have you ever wondered how a microwave knows exactly when to stop, or how a sensor-activated nightlight knows when it’s dark enough to turn on? They use programmable components.
A programmable component (like a microcontroller or PIC) is a small chip that can be given a set of instructions to follow. Instead of building a new circuit every time you want to change how a product works, you can simply change the program. It’s flexible, smart, and used in almost everything today!
1. Flowcharts: The Map of the Program
Before a designer writes any code, they draw a flowchart. This is a visual map that shows exactly what the system should do and when. Each shape in a flowchart has a specific meaning. You need to know these four main symbols for your exam:
1. Start/Stop (The Oval/Terminator): Every flowchart must start and end with this shape. It marks the beginning and the finish line of your program.
2. Process (The Rectangle): This represents an action or a command. For example: "Switch on LED" or "Wait 5 seconds". It is something the system does.
3. Input/Output (The Parallelogram): This is used whenever the system is receiving information (Input) or sending a signal (Output). For example: "Read LDR sensor" or "Sound the Buzzer".
4. Decision (The Diamond): This is where the "thinking" happens. It usually asks a question that can be answered with Yes or No. For example: "Is it dark?". One arrow goes in, and two arrows come out (one for Yes, one for No).
Key Takeaway: Flowcharts must follow a logical path. If you follow the arrows, you should always be able to get from the "Start" to the "Stop" (or back into a loop).2. Switching Outputs Based on Inputs
The main job of a programmable component is to look at an input and decide what to do with an output.
Example: A Basic Alarm System
1. The Input is a push-to-make (PTM) switch on a door.
2. The Decision is: "Is the switch pressed?"
3. If Yes, the Output (a buzzer) is switched ON.
4. If No, the Output is switched OFF.
In a flowchart, the "No" line usually loops back up to the top to check the input again. This is called "polling" the sensor.
3. Processing Analogue Inputs
In the "Electronic Systems" chapter, you learned about LDRs (light) and Thermistors (heat). These are Analogue Inputs.
Unlike a switch (which is just ON or OFF), analogue sensors provide a range of values. For example, an LDR doesn't just say "Light" or "Dark"—it says "Very Bright," "Dim," or "Pitch Black."
A programmable component can be told to look for a specific threshold.
Example: "If the light level is less than \(40\%\), turn on the lamp."
The program "processes" the variable signal and converts it into a simple decision for the output.
4. Simple Routines: Delays, Loops, and Counts
To make a product useful, we use "routines." These are standard patterns in programming:
Delays (Timing)
A delay tells the system to wait for a specific amount of time before moving to the next step.
Real-world example: An electric toothbrush that runs for exactly \(2\) minutes and then stops.
Loops
A loop is a path in the flowchart that sends the program back to a previous step so it can repeat an action.
Real-world example: A flashing hazard light on a road sign. The program says: Turn on -> Delay -> Turn off -> Delay -> Go back to start.
Counts
A count allows the program to remember how many times something has happened.
Real-world example: A turnstile at a football stadium. Every time the sensor is triggered (Input), the program adds \(1\) to the total count. It might be programmed to stop letting people in once the count reaches \(500\).
Summary Checklist
✓ Flowchart Shapes: Do you know your Ovals, Rectangles, Parallelograms, and Diamonds?
✓ Input/Output: Can you identify which components provide information (sensors) and which do the work (LEDs, buzzers, motors)?
✓ Decisions: Does your diamond shape have a clear Yes/No path?
✓ Logic: Can you explain the difference between a simple ON/OFF switch and a variable analogue sensor (like an LDR)?
Top Tip for the Exam: If you are asked to draw a flowchart, always use a ruler for the boxes and arrows. Make sure your arrows have heads on them to show the direction of "flow"—examiners hate "floating" lines!