necati
Guest
|
|
« Reply #3 on: October 22, 2007, 06:44:54 18:44 » |
|
#include <12F675.h> #use delay (clock=4000000)//ccs #fuses INTRC_IO,noWDT,PUT,NOBROWNOUT,noPROTECT,NOPUT,NOCPD,MCLR
#define led1 PIN_A0//yes led 220R +V #define led2 PIN_A1//mavi led 220R +V #define led3 PIN_A2//kirm led 220R +V
#ROM 0x3ff = {0x3480}
BYTE CONST TABLE [120]= { 250,80,0,220,70,0,200,30,0, 180,0,30,150,0,60,120,0,80, 100,0,120,80,0,150,60,0,180, 30,0,200,20,0,230,0,20,250, 0,40,220,0,60,200,0,80,170, 0,100,150,0,120,120,00,150,100, 0,180,80,0,200,60,0,220,40, 0,250,20,10,220,0,20,200,0, 30,200,0,40,170,0,50,10,0, 250,0,0,220,0,0,200,0,0, 180,0,0,150,0,0,120,0,0, 0,0,100,0,0,120,0,0,140, 0,0,180,0,0,200,0,20,250, 0,40,220, }; //////////////////////////////////////////////////////////////////////// void main() {
int16 titrval, dampval; int led1val,led2val,led3val, deger,tablsay,lighthed1,lighthed2,lighthed3; SET_TRIS_A (0b00001000); SETUP_TIMER_1(T1_DISABLED ); setup_comparator(NC_NC_NC_NC); setup_ADC_ports(NO_ANALOGS);
tablsay = 0; ///////////////////////////////////////////////////////////////////////// while(1){
deger++; titrval++; dampval++; ////////////////////////////////////// if (titrval == 2000){ //tablodan set say al titrval = 0; if (tablsay >= 98) tablsay = 0; lighthed1 = table [tablsay]; lighthed2 = table [tablsay+1]; lighthed3 = table [tablsay+2]; tablsay+=3;} /////////////////////////////////////// if (dampval ==600){//soft dampval = 0; if (led1val < lighthed1) led1val++; if (led1val > lighthed1) led1val--; if (led2val < lighthed2) led2val++; if (led2val > lighthed2) led2val--; if (led3val < lighthed3) led3val++; if (led3val > lighthed3) led3val--;} //////////////////////////////////////// if( deger < led1val ) { output_low(led1); } else { output_high(led1); }
if( deger < led2val ) { output_low(led2); } else { output_high(led2); }
if( deger < led3val ) { output_low(led3); } else { output_high(led3); } }
}
|