پاسخ : سنسور دما smt160
من accounte rapidshare ندارم متاسفانه
من accounte rapidshare ندارم متاسفانه
#include <mega16.h> #include <stdio.h> #include <delay.h> #include <stdlib.h> /*............*/ // Declare your global variables here float T1,T2; bit edge=0; // External Interrupt 0 service routine interrupt [EXT_INT0] void ext_int0_isr(void) { // Place your code here if (edge) { T2=TCNT1; TCNT1=0; // INT0 Mode: Falling Edge MCUCR=0x02; edge=0; }else { T1=TCNT1; TCNT1=0; // INT0 Mode: Rising Edge MCUCR=0x03; edge=1; } } void main(void) { // Declare your local variables here float dc; float t; char strt[16],str[8]; /*............*/ while (1) { // Place your code here delay_ms(1000); dc=T1/(T1+T2); t=(dc-0.32)/0.0047; lcd_clear(); ftoa(t,2,str); sprintf(strt,"%s \XDF C",str); lcd_puts(strt); }; }
دیدگاه