This project arises from the need to develop control of analog and digital variables of the circuit in order to control other circuit variables. The microcontroller used is a PIC16F876 and is Programmed with MikroC. The microcontroller has been programmed with a philosophy by states, so adapting it to our applications is very easy, since it is a question of reducing states, expanding them, and for each state modifying their outputs.
The basic circuit consists of the microcontroller, a quartz crystal of 10 MHz and 2 capacitors of 20 pF for the watch, a mixer for the acoustic signals, switches for the digital control signals, a Pushbutton for the reset of the microcontroller, LEDs with their corresponding resistances for the luminous signals (both diagnostic and test the outputs), potentiometers that simulate analog variables (or can be battery levels , Sensors, ..).
Figure 1: Basic circuit
For the elaboration of the firmware, the first thing to do is to develop the desired state table with its corresponding states, inputs and outputs. This firmware also has acoustic signals, so we will also use a microcontroller timer for this purpose (a beep has been programmed to be more accurate).
A la hora de programar los estados, para que sea mas fácil la programación y mantenimiento de la aplicación como adaptación de la misma para otras finalidades, lo primero que se ha hecho es una clasificación de estados a partir de las variables analógicas (para diferenciar distintos niveles de carga de una batería, marcar rangos de temperatura,..) y posteriormente, en función de cada modo, definimos cada submodo con sus correspondiente salidas.
This very simple circuit allows us great versatility in projects such as diagnostics of a battery and combinational control, control through analog variables (by temperature sensors, pressure sensors, Analogue output) and digital (pushbuttons, switches, ... or some element that serves us to switch signals). This same circuit could be part of some robot for example.