This project demonstrates how a PSoC 5LP can integrate analog and digital functionality in one device. This is done by creating an analog alarm system. The Alarm measures an analog input voltage and based on the voltage range controls an LED. Here is the truth table of how the LED should behave
0-250 mV LED OFF
250-500 mV LED Breathe on and off
500-750 mV LED Flashing
+750 mV LED On
To accomplish this 3 Analog comparators are used, the non-inverting inputs are tied to the input voltage. Then a voltage DAC is connected to the inverting input of each comparator. The DACs are programmed to output 250mV, 500mV, and 750mV.
The LED is controlled by digital logic. When the LED is off it is driven with a logic zero. When the LED is breathing it is controlled by two PWMs that are xor'd together. When the LED is blinking the LED is controlled by one PWM, and when the LED is on it is controlled by a logic 1. A digital mux is used to control which function is driving the LED.
This mux is controlled by a Look Up Table (LUT). the LUT takes the outputs from the comparators and creates control signals for the MUX.
All of this is done is hardware with no CPU intervention.
For a video explanation of this watch this
Comments