Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

18F1320 internal OSC doubling itself

Status
Not open for further replies.

Oznog

Active Member
OK, my circuit is in fact not out of the water. This one has me stumped again.
PIC is driving a pair of N-channel MOSFETs which make a half bridge for a transformer. The center tap of the primary is connected to +12v and it alternately grounds the other 2 wires. Standard and unremarkable half-bridge. The ground trace for the FETs and and PIC run in two different directions from the power supply ground, so there are no voltage drops that will affect the PIC. Same is true of the +12v going to the transformer center tap.

PIC is configured as an internal oscillator and set to 4MHz, RA6/RA7 are outputs. (OSCCON=0b11100010) MCLR is internal. Reg now has the correct capacitor on its output (actually 3x more). PIC has a 0.1uF ceramic from Vdd to Vss pins.

This is the problem. I ran it without the +12v wire connected to the center tap and I get the expected 62KHz frequency and 50% duty cycle on the PWM pins. The instant I connect the 12v, the square wave on the PWM doubles in frequency! Duty cycle remains the same. After a few cycles the PWM goes to 0 and I assume it's because the PIC reset, it keeps popping back up with a few more cycles and disappearing over and over. It's a bit more noisy but the PWM output is still clearly a proper square wave rather than some induced harmonic oscillation. As best I can tell the PIC oscillator just arbitrarily doubled itself. Remove the 12v power from the transformer center tap so the MOSFETs are no longer switching power and it goes back to 62KHz.

This is major weird. There's a bit of 12v and 5v noise, 5v goes down to 4.5v though I'm not certain why. All pins are outputs except for an ADC pin to read the voltage output and that one remains at a few mV. Electrically I don't see how the connection of a MOSFET load could relate in any way to the PIC so I'm stumped. Any ideas?
 
Hey I think I have it. If I put a diode between the 12v power and the reg input and its input cap, then take power for the transformer off the other side of the diode, all is well!

It looks like that transformer requires so much power it drained the 330uF 12v cap on the reg's input so fast it made a transient that fed through the reg and glitched the 5v line. The chip should have been able to run at 4.5v but I guess the speed of that glitch made a worse issue.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top