CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Noisy clock pulses

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
TL



Joined: 15 Sep 2003
Posts: 75

View user's profile Send private message

Noisy clock pulses
PostPosted: Tue Apr 03, 2007 12:45 pm     Reply with quote

Hi, I'm trying to communicate an 18F2620 with a 16-bit ADC chip using bit banging. The PIC pin C0 is connected to the clock input pin of the ADC chip. I found the clock pulses produced by the PIC at PIN C0 have overshoots and undershoots at the edges (i.e. lo to hi, hi to lo). How can I get rid of, or reduce these overshoots and undershoots so that the clock pulses become smooth? Any comments (hardware or software) would be appreciated.

I use PCWH V3.249 and 4MHz system clock.

Thanks.


Code:

void write_adc16(long data)
{
   int8 i;

   for(i=0; i<16; i++)
   {
      output_low(ADC_CLK);
      output_bit(ADC_DI, shift_left(&data,2,0));
      output_high(ADC_CLK);
   }
   output_high(ADC_DI);
}

long read_adc16(void)
{
   int8 i;
   long data=0;

   for(i=0; i<16; i++)
   {
      output_low(ADC_CLK);
      shift_left(&data,2,input(ADC_DO));
      output_high(ADC_CLK);
   }

   return data;
}

kevcon



Joined: 21 Feb 2007
Posts: 142
Location: Michigan, USA

View user's profile Send private message

PostPosted: Tue Apr 03, 2007 12:50 pm     Reply with quote

A series resistor might solve your problem, try a 22-47 ohm for starters.
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Tue Apr 03, 2007 2:34 pm     Reply with quote

kevcon is on to something. This reduces the output current from the PIC pin as seen by the distributed capacitance of your leads plus the input capacitance of the ADC clock pin.

However, be very sure that the overshoot and undershoot you are seeing at your ADC is NOT an artifact of your oscilloscope probing technique. If you are using the long grounding wire with aligator clip, then you may actually be seeing the inductive ringing of your scope's ground.

Google around for CMOS termination resistor. TI and Fairchild and Motorola (back before they spun out logic to ONSemi) used to have some very nice application notes on CMOS interfacing techniques including how to terminate clock lines to minimize ringing.

Furthermore, keep your clock lines SHORT.

http://www.edn.com/archives/1998/021698/04df_04.htm
http://www.fairchildsemi.com/an/AN/AN-610.pdf
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Tue Apr 03, 2007 3:06 pm     Reply with quote

I asked a similar question recently, but I can't find the response. It may have been on electronics.design.

The point was made... Who cares? Is it causing a problem with the AD reading or something else?

I had done the same thing. Put a scope on a project and saw the overshoot and thought, wow... that needs to be fixed, even though everything worked fine. In the end I didn't fix it because it showed no signs of being broken.

I'm a perfect example of 'a little knowledge can be dangerous.' I'll be interested to see what the pros have to offer...

FWIW,

John
TL



Joined: 15 Sep 2003
Posts: 75

View user's profile Send private message

PostPosted: Wed Apr 04, 2007 1:27 am     Reply with quote

Thank you so much to Kevcon and rwyoung for all your suggestions. I actually tried a series 100R before I started this thread, and the problem was still there. So I will try 47R and see what happens.

I have read some of the articles on the web on termination resistors and clamping diodes. I think adding the clamping schottky diodes is a good choice.

Yes, the noise on the clock line affected the vdd line of the ADC chip and therefore, I believe this has increased the fluctuation of the ADC output count. This is why I'm seeking ways to reduce the noise on the clock line.
kevcon



Joined: 21 Feb 2007
Posts: 142
Location: Michigan, USA

View user's profile Send private message

PostPosted: Wed Apr 04, 2007 6:55 am     Reply with quote

Is this a hand wired board or an actual PCB?

Hand wired boards can be very noisy.

If it's a hand wired board try soldering a 0.1uf capacitor accross the power pins of the ADC and the processor keeping the leads as short as possible.

Kevin
TL



Joined: 15 Sep 2003
Posts: 75

View user's profile Send private message

PostPosted: Wed Apr 04, 2007 9:06 am     Reply with quote

It's an in-house manufactured PCB which uses star connections for 0V and 5V but without a ground plane. Yes there are already 0.1uF ceramic and 10uF tantalum caps between Vdd and ground at ADC and PIC. I'll also add ferrite beads at the power supply and the ADC vdd pin. Thanks.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed Apr 04, 2007 11:07 am     Reply with quote

How are you looking at the clock line? If you use a scope probe with a 6" flying ground connection that enters the middle of the probe you will get lots of overshoot. Use the coil spring type ground clip that slips over the ground collar 1/2" from the probe tip and see if the overshoot gets LOTS smaller. Use a true coaxial test point to get the REAL story!
_________________
The search for better is endless. Instead simply find very good and get the job done.
TL



Joined: 15 Sep 2003
Posts: 75

View user's profile Send private message

PostPosted: Thu Apr 05, 2007 4:23 pm     Reply with quote

Thanks for the scope probe tip. Yes I'll check it after the Easter break.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group