Strange behaviour - Oscillator, PIC and COMMON GROUND

Status
Not open for further replies.

Neyolight

Full Member level 5
Joined
Aug 29, 2011
Messages
306
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
World
Activity points
3,624
Hi

Let me begin by explaining what I have: LC Oscillator , PIC , UART.

The LC Oscillator oscillates at a frequency (120 KHz in my case) --> This frequency is converted to a digital wave for PIC to read ---> PIC reads the rising edges of the digital wave in a fixed time ( Frequency) ---> This value is sent to my laptop.

Ok now to the strange part, previously I had no common ground b/w the LC oscillator ( which is on a breadboard right now) and my PIC ( on a PICDEM2 PLUS board). I use to read random values , much lower my current frequency (120Khz).

Today ( infact just now) I added a common ground b/w the LC oscillator ( on breadboard) and the PIC by connecting the Vss of the PIC to -ve end of the breadboard. The PIC is powered by 9V DC ( AC_DC regulator) and the breadboard is powered by 9V battery (Energizer).

So with the common ground I see '0' on my UART output and without a common ground I get 1500 -1800 values on my laptop!

Why is having a common ground giving me 0s ?

The input I see on PIC hasnt changed after common ground, its still 2.4 V with 120 Khz.....then is UART affected so badly by common ground?

Any idea as to why that is happening?
Thanks
 
Last edited:

With no ground (i.e. just a single wire connected between oscillator and PIC), you will see random values, since the input impedance is high and it is floating (check to see if the PIC input is connected to ground via a resistor or not).
It would have nothing to do with if the ground was connected, so you cannot really correlate.
With the ground connected, how are you doing this - is the PIC input an interrupt input? And the oscillator output is definitely 0V/2.4V, right? (i.e. not -2.4V/+2.4V which
could damage your PIC). Is the LC oscillator output from a logic gate or comparator? Might need to see a screenshot of your circuit diag.
 

Hey the input on the PIC is 0 - 2.4 V DC. Its a square wave! Square wave is produced via a voltage comparator!

The LC Oscillator is made from a NPN transistor. Seeing 0 is so discouraging!

---------- Post added at 14:39 ---------- Previous post was at 14:29 ----------

With grounds connected....Why 0?
 

It is weird.. does the demo board have decoupling capacitors on the power rails, in case there is some strange interaction? (I guess since it is
a demo board, it already does have the capacitors).
I've many times forgotten to properly decouple (maybe 100nF and 10uF) and seen strange effects, so now I always make sure I double-check any IC decoupling requirements when designing a board. I can't really think what else it might be : (
I suppose it could be a software fault, if it is interpreting 120kHz as a zero value (or did you mean the UART is at 0 volt, or that it is printing the zero char?).
Maybe make it pulse a port or flash an LED as it detects the interrupt, and check the frequency of the pulse to confirm it really is seeing the input change?
Strange problem..
 
Thanks sky, I will try to FLASH led on the interrupts and see how it goes.

This board is from microchip and I'm using an internal oscillator with my code - I don't need to check any decoupling capacitor ..do I?
 

You're probably alright regarding decoupling, if the board is from Microchip.
I hope the led flashing reveals a clue!
 

Here is my input at the PIC pin....i dont know why its not being detected!
 

Attachments

  • IMG_0445.JPG
    544 KB · Views: 105

I suppose it could be a software fault, if it is interpreting 120kHz as a zero value (or did you mean the UART is at 0 volt, or that it is printing the zero char?).

Its giving out zero. I am using Timer1 to capture the input edges of the input ( the picture that i uploaded). When i debug the PIC, I see timer 1 register has a value 0 as well. Clueless as to why its not reading the input
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…