pic16f628a ile 0-99 dakika zamanlayıcı devresi

pic16f628 ile 0-99 zamanlayıcı timer devresi
Pic16f628a ile tasarlanmış bir zamanlayıcı devresi. Proje tasarımcısı devre şemasını eliyle a4 kağıdına çizmiş. Böyle çizimler hoş oluyor. Projenin pcb'si yok ancak devre şeması işinize yarabilir. Devre delikli pertinaks üzerine kurulmuş. Kaynak kodu ve devre şemasını ayrıca aşağıdaki linkten indirebilirsiniz. Kaynak site burada.

pic16f628a 0-99 dakika zamanlayıcı devresi dosyalar download

Alternatif link:

pic16f628a 0-99 dakika zamanlayıcı devresi dosyalar download

Devre şeması:

pic16f628 ile 0-99 zamanlayıcı timer devre şeması

C kaynak kodu:

/*
############################################
Project: 00-99 Minutes Programmable Timer
Written By: Rajendra Bhatt
Date: Sep 14, 2010
############################################

LCD Data D4-D7 connected to RB4-RB7
LCD RS -> RA0
LCD E -> RA1
Start/Stop Time Select -> RB0
Unit Min Switch -> RB1
Tens Min Switch -> RB2
Relay -> RA3
*/

// LCD module connections
sbit LCD_RS at RA0_bit;
sbit LCD_EN at RA1_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_RS_Direction at TRISA0_bit;
sbit LCD_EN_Direction at TRISA1_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
// End LCD module connections

// Tact switches and Relay ports
sbit Relay at RA3_bit;
sbit SS_Select at RB0_bit; // Start Stop Select
sbit Unit_Button at RB1_bit;
sbit Ten_Button at RB2_bit;


// Messages
char Message1[]="00-99 min Timer";
char Message2[]="Device ON";
char Message3[]="Device OFF";
char Message4[]="Set Time: min";
char Message5[]="Time Left: min";
unsigned short i, j, unit=0, ten=0, ON_OFF=0, index=0, clear, time;
char *digit = "00";
// 100ms Delay
void Delay_300(){
Delay_ms(300);
}

void Display_Digits(){
digit[1]=unit+48;
digit[0]=ten+48;
Lcd_Out(2,11,digit);
}

void start_timer(unsigned short minvalue){
unsigned short temp1, temp2;
Relay = 1;
ON_OFF = 1;
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,1,Message2);
Lcd_Out(2,1,Message5);
OPTION_REG = 0x80 ;
INTCON = 0x90;
for (i=0; i
temp1 = (minvalue-i)%10 ;
temp2 = (minvalue-i)/10 ;
Lcd_Chr(2, 12, temp2+48);
Lcd_Chr(2, 13, temp1+48);
j=1;
do {
Delay_ms(1000);
j++;
} while(((j<=60) && (Clear ==0))); if (Clear) { Relay = 0; Delay_ms(500); Lcd_Out(1,1,Message3); INTCON = 0x00; goto stop; } } stop: Relay = 0; ON_OFF = 0; unit = 0; ten = 0; clear = 1; } void interrupt(void){ if (INTCON.INTF == 1) // Check if INTF flag is set { Clear = 1; INTCON.INTF = 0; // Clear interrupt flag before exiting ISR } } void main() { CMCON |= 7; // Disable Comparators TRISB = 0b00001111; TRISA = 0b11110000; Relay = 0; Lcd_Init(); // Initialize LCD start: clear = 0; Lcd_Cmd(_LCD_CLEAR); // Clear display Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off Lcd_Out(1,1,Message1); Lcd_Out(2,1,Message4); Display_Digits() ; do { if(!Unit_Button){ Delay_300(); unit ++; if(unit==10) unit=0; Display_Digits(); } // If !Unit_Button if(!Ten_Button){ Delay_300(); ten ++; if(ten==10) ten=0; Display_Digits(); } // If !Ten_Button if(!SS_Select){ Delay_300(); time = ten*10+unit ; if(time > 0) start_timer(time);
} // If !SS_Select

if(clear){

goto start;
}

} while(1);
}

Yorumlar

Popüler Yayınlar:

grup priz ara kablo yapımı

elektrikli fırın devre bağlantı şeması

gsm sinyal seviyesi asu dbm nedir

dc motor yönü değiştirme devresi

chrome ile programsız video nasıl indirilir

fan aspiratör motoru dönüş yönü değiştirme