All pastes #285464 Raw Edit

Unnamed

public text v1 · immutable
#285464 ·published 2006-12-19 21:15 UTC
rendered paste body
#include <16F877A.h>
#use delay(clock=4000000)
#use rs232 (baud = 4800, xmit=PIN_C6, rcv=PIN_C7)
	int velocidade;
  	int angulo ;
  	int i;
  	int r;
  	int c;

 void main()
{
	setup_adc_ports (RA0_analog);
	setup_adc (adc_clock_internal);
	set_adc_channel (0);

	setup_timer_0 (RTCC_EXT_L_TO_H | RTCC_DIV_1);
	setup_timer_1 (RTCC_EXT_L_TO_H | RTCC_DIV_1);
	
	output_low (PIN_B3); // garantir que  o sinal de podes ler esta a zero
	
	
	while (true)
      { 
	      
	   
		set_timer0 (0);	                                                     
	
		output_high (PIN_B0);
		delay_ms(4500);
		velocidade= get_timer0();
		output_low(PIN_B0);
		angulo = read_adc();

		delay_ms(500);
		
		if (bit_test(input_b(),1))  //pedido de interrupção
		   {
			set_timer1 (0); //RESET TIMER 1
			
			for (i=0; i<8 ; i++)
				{ 
					r= bit_test(velocidade,i);
					if (r) output_high(PIN_D7);
					if (!r) output_low(PIN_D7);	
			  		 
					output_high (PIN_B3); //envio do sinal podes ler  
					

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// here is my but i9 got a clock o pin b7 i have a clock to increase //timer 1 but its in a infinite loop
do
	{	output_high (PIN_B7);
		output_low(PIN_B7);
		c=get_timer1();
	}while (i<=c); 

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@



			 		//delay_ms(2000); 
			 
				}; 
			 
			 //finalização
			 	output_low (PIN_B3);  // reset do podes ler 
			};