PIC 18 HLVD — Voltage Detection Intro

What results from a catastrophic error on an MC? — HLVD — Pic Episode #01

J3
Jungletronics
3 min readDec 26, 2019

--

Terms like Graceful Degradation or Fault-Tolerant Technology have the purpose to prevent catastrophic failure of a system (a PIC program as an example:).

Fig 1. Catastrophic scenario recovery with PIC PIC18F4520

Well, in this post we will deal with this peripheral: High Low Voltage Detection (HLVD) let’s make a backup procedure or escape route in our program so we can immediately take action of saving program’s criticals variables states before any negative impact whatsoever (power blackout) blows our project up 💥.

In this first program, we will write to LED (representing our critical variables) from the HLVD interrupt routine and simulate a power outage by disconnect our wall plug power source to our development board and see how HLVD works;)

Here is the program:

Fine! So far so good!

Let’s continue studying this peripheral, now by saving the buttons (de)increment counting in the 7-segment; here is the second code:

More about Systems Protections

The purpose of graceful degradation is to prevent catastrophic failure. Ideally, even the simultaneous loss of multiple components does not cause downtime in a system with this feature.

These types of systems are designed to compensate for multiple failures. Such systems automatically detect a failure of the computer processor unit, I/O subsystem, memory cards, motherboard, power supply or network components.

The failure point is identified, and a backup component or procedure immediately takes its place with no loss of service.

Well-engineered computers and networks are designed so that localized faults rarely precipitate catastrophic failures.

Engineering practices such as graceful degradation and fault tolerance are elements of a sound fault-management platform.

Graceful degradation is the ability of a system or network to maintain limited functionality even when a large portion of it has been destroyed or rendered inoperative.

Fault-tolerant describes a computer system or component designed so that, in the event that a component fails, a backup component or procedure can immediately take its place with no loss of service.

Brown-out meaning

Brownout is an important safety feature in electronics and microcontrollers. There are two main tasks of brown-out function in microcontroller — hardware and software.

  • Hardware brown-out feature resets the microcontroller and keeps it until the power supply is returned to the operating range. This ensures that all parts of the circuit work correctly.
  • Software brown-out part — an interrupt based functionality that detects falling voltage, which allows the software to take care of critical components like saving vital information to non-volatile memory before resetting.

That’s all for this episode.

J3 is signing off…

Bye!

Credits & References

--

--

J3
Jungletronics

😎 Gilberto Oliveira Jr | 🖥️ Computer Engineer | 🐍 Python | 🧩 C | 💎 Rails | 🤖 AI & IoT | ✍️