Radio Button Switch Control using PIC12F629




Overview

The original purpose behind this circuit was to provide manual switching of three relays such that only one relay was on at any time.  It was also a requirement that there was a specific overlap (or make-before-break) period.  The code was then further developed to provide deadband (break-before-make) as well as overlap switching.  The mode and timing delay are stored as parameters in the PICs EEPROM memory making editing of these straightforward without the need to reassemble the source code.

Switch Control

This circuit controls up to three outputs using a ‘radio button’ type switching control.  When any one of the channel inputs is selected, the corresponding output is turned on and all other outputs are turned off.

In addition to this the controller features adjustable deadband or overlap of the outputs during switchover.

  • With dead band delay or break-before-make operation the active output is turned off before the new output is turned on.
  • With overlap or make-before-break operation the new output is turned on before the active output is turned off.

The delay is configurable in 0.512mS intervals from 0 to 130.56mS

The control inputs also feature a configurable debounce timer with the same range of timings making it suitable for use with simple switches directly attached to the PIC or logic interface.

Although designed to control relays the firmware is quite generic and can be used in any application where ‘radio button’ functionailty is needed.

(14/11/2012 – Source code and firmware for 8 Channel version for PIC16F628A)

schematic #3

The schematics above are intended to show the general application of the Radio Button Switch Control. Schematic #1 and #3 in particular can be used to build a simple firmware evaluation circuit.


Mode Examples

In this section I’ve used a Saleae Logic tool to illustrate the output operating modes and effect of input switch debounce delay.


Make-before-break




In the example below Output 3 turns on before Output 2 turns off.  The overlap is 99.36mS as the T1-T2 marker flags show

Firmware notes:

  • All timings are derived from the PICs internal RC oscillator and accuracy is dependant on the same.

  • The main code is interrupt driven so all switching events are synchronous with the interrupt interval of 512uS (0.512mS)

  • The switch inputs are only sampled at each interrupt so even with the switch debounce timer set to zero there may be a delay of up of up to 512uS before a output switching event occurs.

  • Within the interrupt handler there are additional delays depending on the mode and switch debounce timing. These are not specified but fall in the range of 10-30 microseconds and are deterministic.

    Since the firmware code was originally written to operate mechanical relays under the control of manual push button switches this timing accuracy was considered sufficient and is likely to be so for any similar application.
    However, you should take this into account when considering it for use in a specific application.

 

For more detail: Radio Button Switch Control using PIC12F629




Current Project / Post can also be found using:

  • 12F629 sample
  • button radio circuit
  • pic radio button circuit

Leave a Comment

*
= 5 + 8

Read previous post:
DC Motor Controller
PWM DC Motor Controller for PIC12F683

Description There are lots of designs on the Internet for DC power controllers using Pulse Width Modulation (PWM) to control...

Close
Scroll to top