BLF -Software

The BLF runs (at the moment) in a PIC12F510 processor.

The Source code was written in XC8 and is still test code 21-5-16 – downloadable here.

The HEX can be obtained via an email to

I program the processor using a PIC KIT V3, but any compatible PIC programmer should be fine.

I intend to try the 12F675 soon, please note the settings for this processor are untried at present.


Software Description

The software runs around a loop running these routines in order.

void DoEyes(void);

Takes the inout from the two proximity sensors and applies debounce and a time domain shmitt function to get a clear Black/White signal for each

void MotorLogic(void);

Turns on the correct motor, or motors depending on the Shmitted Eye information. Applyes a wait condition if both Eyes have been black for a number of seconds.

void DoWait(void);

If wait has been applied Stop both motors and check for one or both Eyes to see White again.

void DoLed(void);

Show the current status using the led cadence.

void DoPulsing(void);

Apply a pulse to each motor in turn. (runs better than continuous)

void DoPWM(void);

Allows for the intensity of each motor to be varied

void DoTest(void);

Useful routine to add in code for testing. Normally the call for this is commented out.

Later versions (20-5-16 onwards) have the ability to do automatic calibration if you are using the PIC12F675

Details of the calibration software routines will come later.