CITROEN Saxo Vehicle Touch Sensitive switches using PIC16F84A

Vehicle Touch Sensitive switches (1)

Project Summary

The CITROEN Saxo Vehicle Touch Sensitive switches For operating Hazards and two peripheral devices If you want to change the look of your dash board inside a vehicle, maybe just fancy some of modern electronics This could be the design for you

Vehicle Touch Sensitive switches (1)

Project Description

Faced with a challenge last year a young lad came and spoke to me re his vehicle

Of course the challenge was obviously to fit a car stereo and car amplifier but also to illuminate the rear shelf which held his speakers create some under car vehicle lighting , different colors of course and do away with the Hazard light switch such that he had touch sensitive switches to operate Relays

The task had to achieve the following
A: Switch the hazards lights on
B: use switches to ether switch under car lighting on in the form of LED’s and operate the rear Led’s independently
C: If the hazards were on they would flash at regular intervals keeping the front led’s on or the rear led’s on or both
D: Single touch to turn on visa versa to turn off

Nice easy Microchip to develop small applications for anybody that might be interested a good start to Micro Processors, wanting to learn how to handle interrupts and deal with sensing switches as well as Timer interrupts

The circuits comprises A power supply derived from the 13.8 volt Battery of the vehicle A cpu which uses port A as inputs which rely purely on the fact that our body potential is higher thanthat of ground potential i.e Zero volts combined with fet characteristics of PORTA

An output side comprising PORTB which is connected to relay’s 1 to 4 via npn transistors , pulling the relay’s in

Protection to the input i.e PORT A is set to 5V6 this ensures that any static voltages are suppressed and protects PORT A from spikes D1 to D4, D11

Ignition sense is sensed on Porta RA4.

This ensures that we cant turn on the relays except the hazard lights which must be operable even when the car ignition is off

The relay’s simply short out the links on the back of the hazard switch which has been removed
See Diagram in PDF File for explanation

Schematic Touch Sensitive switches (1)

D9 to D13 provide back EMF protection for the transistors Q1 to Q 4 of the relay drive circuitry
R1 to R4 , R17 ensure that PORTA is held at Zero potential when switches are not being touched
D20 ensures reverse polarity protection as does D23 on the 5volt regulator for the cpu which comprises Q5 , R13, D18

D14 to D17 provide luminous indication that a switch has been activated, current limited through the led’s via R9,R10,R11,R12

D5 to D8 ensure that should the transistors break down that we don’t end up destroying PORTB in the case of Collector, Base short circuit fault symptoms

R5 to R8 ensure that we limit the base current to Q1 to Q4

D21 and R15 ensure only 5 volts to PORTA, RA4, which forms the ignition sense line

Finally D24 flashes in accordance with the normal hazard light indicator

Explanation of interrupts and code

An interrupt is an unscheduled input, which interrupts the normal flow of a program, causing it to temporarily suspend what it is doing and perform a specified sequence of instructions required by the interrupting agent before returning to its original point in the program

An interrupt is a signal originating in peripherals

In PIC microcontrollers, these peripherals need not necessarily be external devices, although they usually are,

In the PIC16F84A these interrupts are as follows

A rising or falling voltage pulse on pin RB0 / INT41

2. A change in one or more of the voltage levels on the group of pins RB4 to RB7
3. An overflow of the timer registers TMR0 from 0xFF to 0x0 Decimal 255
4. A ‘write complete’ signal generated when writing to the EEPROM is complete

There are four interrupt flags, namely TOIF, INTF, RBIF and EEIF which are bits in the INTCON register and are set whenever that particular interrupt triggers, irrespective of whether it has been enabled by setting its corresponding enable flag.

The interrupt enable flags are TOIE,INTE, RBIE and EEIE

When an interrupt occurs, the processor immediately pushes the return address onto the stack, branches to the interrupt vector at address 0x4 in program memory and starts executing the code at that address. The sequence of instructions executed is called the interrupt service routine.

When the system is switched on, the program begins at the reset vector address hex 0x00

We enable the interrupts through the intcon register. This is one many of what we call special function registers inside the CPU

The SFR or Special function registers are responsible for setting the ports direction
In other words whether its input or output
Other SFR’s deal with the timer register which overflows every 256 clock count inside the CPU

Looking at the code we can now see what “ON_INTERRUPT GoTo INTPROC” does

This should now begin to make the subject a little clearer

When the timer overflows execution of code at the interrupt vector begins i.e hex 0x04

Read more: CITROEN Saxo Vehicle Touch Sensitive switches using PIC16F84A

Leave a Comment

Your email address will not be published. Required fields are marked *