Low VDD detector

I have added a small additional pcb for my diy amp project, which is dedicated to detect the drop of VDD voltage level and saving the data to EEPROM at reaching of the certain threshold. All how I described here, I used the built-in comparator from PIC168f877a.

additional pcb on top of main diy amp pcb

It is a pity that I have not added this feature to the main pcb, so now all solutions looks unaesthetic.

Reminding how the schematic should look like:

the level detector schematic

Now to the code, firstly, setting the interrupts by comparator event:

if (CMIF)
 __delay_ms(20);           //антидребезг
   if (C1OUT)              //Сработал компаратор в сторону <
      SaveStatusFlag = 1;  //переменная флаг
  CMIF = 0;

The flag variable is being monitored in the main code:

if (SaveStatusFlag)
 SaveStatusFlag = 0;

The SaveState() function is a function which saves the data to EEPROM, I described it here.

A short demonstration of the work:

There is a bug with temperature which is obvious from the video – it can’t be equal to 58C, will see.

Leave a Reply

Your email address will not be published.