PROGRAMAÇÃO

11/12/2011 18:06

    Você podera pedir a programação em linguagem c que você quiser, ou um prototipo que você presissa para sua empresa, veja um exennplo de programação:

    Programação do chuveiro eletrônico.

 

#include <16F877A.h>
#device adc=8
 
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES XT                       //Crystal osc <= 4mhz for PCM/PCH , 3mhz to 10 mhz for PCD
#FUSES PUT                      //Power Up Timer
#FUSES PROTECT                  //Code protected from reads
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                    //No EE protection
#FUSES NOWRT                    //Program memory not write protected
#FUSES RESERVED                 //Used to set the reserved FUSE bits
 
#use delay(clock=4000000)
 
//------------------defines-----------------------------//
#define  sensor_presenca  pin_c3
#define  agua  pin_c0
#define  led pin_b2
//-----------------vaiaveis----------------------------//
int8 gas=0;
 
void main()
{
   setup_adc_ports(AN0);
   setup_adc(ADC_CLOCK_INTERNAL);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
    
   set_adc_channel(0);
   
while(TRUE){
 
   gas=read_adc();
   
   IF(input(sensor_presenca)==0){
      output_high(agua);
   }else{
      output_low(agua);
   }
 
   IF(gas>=180 && (sensor_presenca)==0){
      output_high(led);
   }else{
      output_low(led);
   }
}
}