| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		
			John Kennedy Guest
 
 
 
 
  
			
			
			
			
			
			
			
			
			
			
  
		  | 
		
			
				| Output Pin Oscillating | 
			 
			
				 Posted: Tue Nov 06, 2001 10:12 am     | 
				     | 
			 
			
				
  | 
			 
			
				I have written my 2nd Program for the 16C710 and have encountered output pins oscillating when given the output_low or output_high command. I have 10K pullups to the 5V rail on each pin. I'm using a 200Khz RC Oscillator the frequency the output pins oscillate at is 3.9Khz does anyone have any idea how to correct this. I have included a portion of the code that I have used to see if you can spot what I'm missing.
 
 
#define connect 125
 
#define vmin 50
 
#define minamp 3
 
#define almost 72
 
int batt,volt,amp;
 
int charged();
 
 
void main() {
 
 
   setup_adc_ports(ALL_ANALOG);
 
   setup_adc(ADC_CLOCK_DIV_2);
 
   setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
 
 
start:
 
 
   output_high(PIN_B1);
 
   output_high(PIN_B2);
 
   output_high(PIN_B3);
 
   output_high(PIN_B4);
 
   output_high(PIN_B5);
 
   output_low(PIN_B6);      //pin works as it should here
 
 
   do
 
   {
 
   set_adc_channel(0);
 
   delay_us(100);
 
   batt = read_adc();
 
   }
 
   while (batt > connect);
 
 
   output_high(PIN_B6);
 
 
   do
 
   {
 
   set_adc_channel(1);
 
   delay_us(100);
 
   volt = read_adc();
 
   }
 
   while (volt < vmin);
 
//all these pins oscillate at this point
 
   output_low(PIN_B1);            
 
   output_low(PIN_B2);
 
   output_low(PIN_B4);
 
 
 
Any help appreciated
 
 
Thanks
 
 
John Kennedy
 
___________________________
 
This message was ported from CCS's old forum
 
	Original Post ID: 982 | 
			 
		  | 
	
	
		  | 
	
	
		
			PCM programmer
 
 
  Joined: 06 Sep 2003 Posts: 21708
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				| Re: Output Pin Oscillating | 
			 
			
				 Posted: Tue Nov 06, 2001 1:23 pm     | 
				     | 
			 
			
				
  | 
			 
			
				:=I have written my 2nd Program for the 16C710 and have encountered output pins oscillating when given the output_low or output_high command.
 
----------------------------------------------------------
 
 
What do you have connected to each of the port B pins ?
 
(list all components).
 
___________________________
 
This message was ported from CCS's old forum
 
	Original Post ID: 986 | 
			 
		  | 
	
	
		  | 
	
	
		
			John Kennedy Guest
 
 
 
 
  
			
			
			
			
			
			
			
			
			
			
  
		  | 
		
			
				| Re: Output Pin Oscillating | 
			 
			
				 Posted: Wed Nov 07, 2001 2:11 am     | 
				     | 
			 
			
				
  | 
			 
			
				:=I have written my 2nd Program for the 16C710 and have encountered output pins oscillating when given the output_low or output_high command. I have 10K pullups to the 5V rail on each pin. I'm using a 200Khz RC Oscillator the frequency the output pins oscillate at is 3.9Khz does anyone have any idea how to correct this. I have included a portion of the code that I have used to see if you can spot what I'm missing.
 
:=
 
:=#define connect 125
 
:=#define vmin 50
 
:=#define minamp 3
 
:=#define almost 72
 
:=int batt,volt,amp;
 
:=int charged();
 
:=
 
:=void main() {
 
:=
 
:=   setup_adc_ports(ALL_ANALOG);
 
:=   setup_adc(ADC_CLOCK_DIV_2);
 
:=   setup_counters(RTCC_INTERNAL,RTCC_DIV_2);
 
:=
 
:=start:
 
:=
 
:=   output_high(PIN_B1);
 
:=   output_high(PIN_B2);
 
:=   output_high(PIN_B3);
 
:=   output_high(PIN_B4);
 
:=   output_high(PIN_B5);
 
:=   output_low(PIN_B6);      //pin works as it should here
 
:=
 
:=   do
 
:=   {
 
:=   set_adc_channel(0);
 
:=   delay_us(100);
 
:=   batt = read_adc();
 
:=   }
 
:=   while (batt > connect);
 
:=
 
:=   output_high(PIN_B6);
 
:=
 
:=   do
 
:=   {
 
:=   set_adc_channel(1);
 
:=   delay_us(100);
 
:=   volt = read_adc();
 
:=   }
 
:=   while (volt < vmin);
 
:=//all these pins oscillate at this point
 
:=   output_low(PIN_B1);            
 
:=   output_low(PIN_B2);
 
:=   output_low(PIN_B4);
 
:=
 
:=
 
:=Any help appreciated
 
:=
 
:=Thanks
 
:=
 
:=John Kennedy
 
 
 
----------------------------------------------------------
 
 
I don't have anything at the moment only a 10K pullup resistor to the 5V rail. I'm just testing the program to get it to do what I want it to. When it works the pins will be connected as follows.
 
 
RB1 - series 4k7 resistor to a gate of a 2N7000 signal mosfet.
 
RB2 - connected to the reset pin of a HEF4521 binary counter.
 
RB3 - connected to the output pin of the HEF4521.
 
RB4 - Cathode of an LED(LED on when pin low).
 
RB5 - as RB4.
 
 
All other pins floating.
 
 
If you can see any other potential problems please let me know.
 
___________________________
 
This message was ported from CCS's old forum
 
	Original Post ID: 995 | 
			 
		  | 
	
	
		  | 
	
	
		
			Sherpa Doug Guest
 
 
 
 
  
			
			
			
			
			
			
			
			
			
			
  
		  | 
		
			
				| Re: Output Pin Oscillating | 
			 
			
				 Posted: Wed Nov 07, 2001 8:17 am     | 
				     | 
			 
			
				
  | 
			 
			
				:=   while (volt < vmin);
 
:=//all these pins oscillate at this point
 
:=   output_low(PIN_B1);            
 
:=   output_low(PIN_B2);
 
:=   output_low(PIN_B4);
 
 
Is your +5 supply stable?  Maybe one of these outputs is shorted to +5, or one of the pullups is much smaller than 10k, and the output going low causes the processor to hiccup.  Try only setting one pin at a time to see which one is the culprit.
 
___________________________
 
This message was ported from CCS's old forum
 
	Original Post ID: 1000 | 
			 
		  | 
	
	
		  | 
	
	
		 |