شباب انا كنت عملت موضوع عن نفس الحاجة ومحدش رد عليا ارجوا الاهتمام فأنا والله في ورتة كبيرة ارجوا ان تساعدوني بسرعة .....
انا في عجالة عاوز اعمل عداد للتردد احسب او بشكل اخر عاوز اعرف الزمن الدوري للنبضة اللي دخلة او بمعني اخر time of one circut or period
انا عارف اني المفروض اشتغل بالتيمر tmr0 بس مش عارف اتحكم فية ارجوا الافادة
//sbit
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
sbit fe at portc.b0;
//VAR
int x=0;
int y=0;
int flag=0;
char xtxt [15];
//moudule
void interrupt()
{
y++;
intcon.f2=0;
}
void main() {
//sutpe
intcon=0b10100000;
option_reg=0b10000000;
tmr0=0;
Lcd_Init();
Lcd_Cmd(_LCD_CURSOR_OFF);
while(1){
Lcd_Out(1,6,"RPM");
inttostr(x,xtxt);
lcd_out_cp(xtxt);
if(fe==0&&flag==0){
flag=1;
tmr0=0;
x=0;
y=0;
}
if(fe==1&&flag==1)
{
x=tmr0+(y*256);
flag=0;
}
}
}//main
|