HV series PIC

julianE

Senior Member
Looks like the microchip famine is passing, I just got a big shipment of 08M2 chips, albeit they are labeled 12F1840, I have to be careful not to confuse them with my small cache of non picaxe types. My experimentation with basic compilers is winding down, way too buggy and documentation is poor compared with what I got used to with picaxe. I'll use up the chips i have on hand as helper chips to picaxe.
,
During the shortage of PIC chips I ordered a very odd chip based on the fact it's 8 pin and was available for shipment instead of a year wait. It's a 12HV752 and it's an odd duck. HV stands for high voltage, chip has a built in shunt regulator, all that's needed to power it is a resistor at Vcc. The chip seems to be meant for driving LEDs or thyristors. It's also odd because it can supply 50 ma of current and all sort of specialized driving that I don't fully understand.

here is the link to the data sheet.

I have had very little luck programming the chip, can't even get it to flash an led, I can turn on the led but that's as far as I got with the basic compiler. I'll give it a try with MPLAB IDE once I remember how to use it.

Anyone tried the HV series? It might only be an odd chip to me and everyone else on the forum has always been aware of it.

Thanks, I realize this is off topic and fully understand if it's removed.
 

Goeytex

Senior Member
You should be able to rather easily program this chip to blink an LED (and much more) using one of the many BASIC compilers out there. You will probably need a Pickit2/3 for programming. I have never had any issues with any PIC doing such a simple task as blinking an LED using GCB or others.

Interestingly, I have not found other BASIC compilers to be any more "buggy" than Picaxe, just different. However, in some cases I do agree that the documentation is not as good as Picaxe.

Addendum:
It seems that the PIC12HV752 is only supported in Microchip MPLAB by Pickit 3 and later programmers. So you should be able to develop code (ASM) and program this chip with MPLABX ver 5.35 along with a Pickit3 Programmer.

MPLAB versions above 5.35 no longer include MPASM and instead use PIC-AS which replaces MPASM. So if you can write code in PIC-AS or in XC8 you could use the latest version of MPLABX whatever it is now.

Personally I would use GCB and a PK3 for this particular chip if I had some in my basket.
 
Last edited:

julianE

Senior Member
Thanks Goeytex I have tried GCB and PK3 and no luck, as a sanity check i tried a 12F1840 (of course changed #chip for a different pic) and all worked well, it's the first chip i have had issues with using GCB. haven't found many examples for 12HV752 on the web. I'll fire up MPLABX and see if I can figure it out, it has been at least 10 years since I used assembler. I only bought 5 of the HV chips so no biggie if I can't get it working. Every day I appreciate picaxe basic more. I have managed to replicate most used commands in picaxe and got serial comm and I2C working on raw pics. I struggle with Sleep command which i find essential for battery operation, I can't get consistent sleep times unlike picaxe which makes putting the pic to sleep and more important waking from sleep a breeze. Picaxe is one superior system and I regret spending money on a paid basic compiler, money better spent on buying more picaxe chips. For me GCB is better than the paid compiler. Oh well, live and learn.

My last shipment of 08M2 came from Robotshop, thanks again for recommending them, very good people to do business with.
 

hippy

Technical Support
Staff member
It's a 12HV752 and it's an odd duck.
I had not heard of it before. The shunt regulator is an interesting idea, effectively a 'crowbar' across the supply rails which, rather than shorting the supply to blow a fuse in a fault condition, it varies whatever and however to keep the supply voltage constant.

That could presumably have been implemented outside the chip. It's generous of Microchip to bring it on-chip but otherwise doesn't appear to make the chip any different to any other PICmicro device; the "HV" is the "F" with just this addition. This shunt is not programmable and has no configuration options as far as I could tell.

Other than the chip registers maybe having slightly different layout, configuration bits, or programming algorithm - I haven't checked any of that - I can't see why it wouldn't be as usable as any other PICmicro device.

The only thing I can see which may be different is that it doesn't appear to me that VDD can be connected directly to a 5V or other supply, which would mean it isn't a drop-in replacement for other 8-pin parts, needs the via-RC supply as detailed.

But, from AN1035, either my maths is wrong or the R will be an extremely low value, perhaps zero, so maybe direct connection is okay
 
Last edited:

julianE

Senior Member
I can get the LED to turn on or off when it's connected to 5v directly and programming with pickit3 completes fine.
It has a 13 bit program counter and can only address 8K which isn't a big deal. I have to reinstall MPLAB X and try my luck.
 

Goeytex

Senior Member
I can get the LED to turn on or off when it's connected to 5v directly and programming with pickit3 completes fine.
So where is the actual issue? Under what conditions?

Are you using a shunt resistor, If so what value ?
What Voltage is applied to the shunt resistor?
What value is the bypass cap?

Are you supplying 5V directly to the VDD pin with no shunt ( 0 ohm)?
What value Bypass Cap ?

Also this chip can only run at up to 8 Mhz with its internal oscillator so to ensure correct operation in GCB
you should use #chip 12HV752, 8 in the header . This forces the internal clock to its max 8 Mhz

I noticed in the ASM that it was using PORTA,2 to set the pin state. This should more properly be done with LATA,2 and could be a bug in the compiler for this chip.

So the minimum code I would test would be:
Code:
#chip 12HV752, 8
#config OSC=FOSC0_INT
#config WDTE=OFF

Dir PORTA.2 OUT           '// Must set pin Direction

#Define LED LATA.2      '// Instead of PORTA.2

Do
   Set LED On
   Wait 200 ms
   Set LED OFF
   Wait 200 ms
Loop
I would at least try this before wading into MPLAB
 
Last edited:

julianE

Senior Member
I have been using a Vcc of 5V direct but did try it with a 10 ohm in series between 5V and Vcc pin and got same result.
I have a .1 uF bypass cap.

Thanks for the program snippet, I ran it and all it does is turn the LED on and it stays on, no flashing.

In my program I was using,

Set PORTA.2 On

and was getting the same result as your program.

I have tried different chips just in case I had a defective one.

My other basic compilers do not support this chip.
 

Goeytex

Senior Member
Try adding

#config CLKOUTEN = ON

Then scope RA4 (Pin3) for a 4MHz clockout signal. If no signal then the HFINTOSC is not operating or has stopped.
If the signal is in the 7KHz range then the micro is operating at 31Khz.
 

julianE

Senior Member
Try adding

#config CLKOUTEN = ON

Then scope RA4 (Pin3) for a 4MHz clockout signal. If no signal then the HFINTOSC is not operating or has stopped.
If the signal is in the 7KHz range then the micro is operating at 31Khz.
I will give that a try later today.

I have some success to report, MPLAB X and XC8 installed and LED blinking away. I will dissect the asm file and compare it with the GCB. All I did was modify an example blink program I found on the web and made adjustments for the 12HV752 chip. Took some tweaking but she's a blinking.

The MPLAB X is a monster of an IDE, very complicated but the price is right.

Thanks for all the help, it's very much appreciated.
 

Goeytex

Senior Member
JulianE,

You should go to GCB help forum and report your Issue and findings as they need to know all of this.
 

julianE

Senior Member
JulianE,

You should go to GCB help forum and report your Issue and findings as they need to know all of this.
Will do. Honestly, reason I posted it here is because of sheer level of brilliance, friendliness and kindness. Nothing like this forum anywhere.

My communication is strictly read only on the rest of the internet.
 

tmfkam

Senior Member
The MPLAB X is a monster of an IDE, very complicated but the price is right.

Thanks for all the help, it's very much appreciated.
I despise MpLabX. With a passion. Never got any single program to compile!
That's how I got started with PicAxe, it works.

Should add that I've usually managed to figure things out in GCB on the very, very rare occasions when it hasn't just worked.
 

julianE

Senior Member
Try adding

#config CLKOUTEN = ON

Then scope RA4 (Pin3) for a 4MHz clockout signal. If no signal then the HFINTOSC is not operating or has stopped.
If the signal is in the 7KHz range then the micro is operating at 31Khz.
I finally got around to scoping RA4 with the CLKOUTEN=ON,
I'm measuring 2 MHz.

After that I went and removed the two WAIT commands and measured the frequency at A2 (pin 5) measured 333 KHz.

I went another step and instead of using WAIT commands I used an empty loop instead

Code:
#chip 12HV752, 8
#config OSC=FOSC0_INT
#config WDTE=OFF

#config CLKOUTEN = ON

Dir PORTA.2 OUT           '// Must set pin Direction

#Define LED LATA.2      '// Instead of PORTA.2

Do
   Set LED On
   for count=1 to 255
   nop
   next count
   Set LED Off
   for count=1 to 255
   nop
   next count

Loop
The LED went solid on and all I measured with the scope on A4 is DC.

Looks like it's not executing the WAIT command and probably other commands as well.

Before I reach out to the GCB folk I wanna download the very latest version of GCB mine is a few months old.
 

julianE

Senior Member
I despise MpLabX. With a passion. Never got any single program to compile!
That's how I got started with PicAxe, it works.

Should add that I've usually managed to figure things out in GCB on the very, very rare occasions when it hasn't just worked.
Full agreement about Picaxe, I'm pretty much done with the compiler adventure, it's good to have it as a helper chip to picaxe, for driving complex lcd displays or fancy LEDs, maybe for math functions, no way will it be for daily use or when I want to put together something quick. Picaxe people were very smart for using a limited number of chips and also for freezing the design, I think M2 is more than sufficient to serve me the rest of my days.

Like most people on this forum I'm no spring chicken and time is more precious each day, no time to learn intricacies of compilers or the very bloated MPLAB X. I don't despise it yet but I can see why I might.

As always thanks for all the help.
 
Top