Welcome, Guest
Username: Password: Secret Key Remember me
  • Page:
  • 1
  • 2

TOPIC: Using the HLVD Module in Swordfish Basic

Re: Using the HLVD Module in Swordfish Basic 5 years 11 months ago #13413

  • RangerBob
  • RangerBob's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 18
  • Thanks received: 48
Good article again Jon!
It can only be used to measure VDD, so it cannot be used to monitor a battery supplying power through a voltage regulator.

Not through the Voltage regulator, but can be darn useful to watch *around* the regulator!

On some (most?) devices HLVD can use an external pin (for example on 18F27J50 its RA5/AN4/C1INC/SS1/HLVDIN/RCV/RP2). Set HLVDL<3:0> to ‘1111’. Then you can connect an external voltage source before your voltage regulator to HLVDIN using a external voltage divider to get it to the correct 1.2V trip point.

I typically use this setup to monitor an external DC supply in battery backed devices, whereby the PIC can select and control its own power sources (either DC or Battery). As an interrupt is fired when HLVD is triggered you can respond very quickly in switching from the DC supply to the battery, before the voltage regulator bulk capacitance is exhausted.

I have some example code for this here: http://www.sfcompiler.co.uk/forum/viewt ... light=hlvd

Re: Using the HLVD Module in Swordfish Basic 5 years 11 months ago #13415

  • Jon Chandler
  • Jon Chandler's Avatar
  • Offline
  • Moderator
  • Posts: 365
  • Thanks received: 352
Hmmmm.... Looking at the data sheet for the 18F4550 shows the internal voltage reference as 1.2 volts.

I remember considering the possibility of using the external input to the HLVD module to monitor a battery pre-regulator but I concluded that the absolution maximum rating of Vdd +0.3 volts would be exceeded if the voltage divider was sized to the proper range. In looking at the 18F2520 data sheet, it says the HLVD input is compared against " the internal voltage reference" but does not specify what the voltage is (in my brief search using an iPad). It seems like I was thinking the trip point was 4.096 or something like that...

If the reference voltage is 1.2 volts, the voltage divider can be scaled so that a fully charged battery voltage won't exceed Vdd and this should work great. Check what the reference voltage is – it may vary between chips.

Re: Using the HLVD Module in Swordfish Basic 5 years 11 months ago #13419

  • RangerBob
  • RangerBob's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 18
  • Thanks received: 48
Yup. In every 18F device I've used with HLVD it's been 1.2V for the bandgap reference which like you say, when carefully scaled with an external divider works a treat!
The following user(s) said Thank You: Jon Chandler

Re: Using the HLVD Module in Swordfish Basic 5 years 11 months ago #13420

  • Jon Chandler
  • Jon Chandler's Avatar
  • Offline
  • Moderator
  • Posts: 365
  • Thanks received: 352
I clearly had a brain fart on using the external HLVD input. I think I had the mistaken notion that the input was compared to Vdd, which would make it unless without exceeding absolute maximum ratings.

Comparing against a 1.2v reference leaves plenty of room to accommodate higher battery voltage. You do lose use of a port pin (for the HLVD input) and you have a voltage divider drawing some power so you do give up some of the advantages of the HLVD module.j
  • Page:
  • 1
  • 2
Time to create page: 0.257 seconds