اطلاعیه

Collapse
No announcement yet.

نمایش فرکانس اعمال شده به میکرو روی lcd

Collapse
X
 
  • فیلتر
  • زمان
  • Show
Clear All
new posts

    نمایش فرکانس اعمال شده به میکرو روی lcd

    نمایش فرکانس اعمال شده به میکرو روی lcd
    http://www.4shared.com/file/194464404/b349c74f/frequency_900.html
    فایل های پیوست شده

    #2
    پاسخ : نمایش فرکانس اعمال شده به میکرو روی lcd

    میشه در مورد پروژه بیشتر توضیح دهید
    اگه من زمان شمارش را به جای 1s تبدیل به 1ms بکنم بازم جواب می گیرم ؟
    #include <mega16.h>
    #include <delay.h>
    #include <stdio.h>
    #include <lcd.h>

    #asm
    .equ __lcd_port=0x1B ;PORTA
    #endasm

    unsigned long int timer0_ov;
    unsigned long int in_freq;
    unsigned char lcd_buff[20];

    interrupt [TIM0_OVF] void timer0_ovf_isr(void)
    {
    timer0_ov ++;
    }

    void main(void)
    {

    // Timer/Counter 0 initialization
    // Clock source: T0 pin Falling Edge
    // Mode: Normal top=FFh
    // OC0 output: Disconnected
    TCNT0=0x00;
    OCR0=0x00;
    TCCR0=0x00;

    // Timer(s)/Counter(s) Interrupt(s) initialization
    TIMSK=0x01;

    // LCD module initialization
    lcd_init(16);

    while (1)
    {
    TCCR0=0x06; // Start Timer T0 pin Falling Edge
    #asm("sei&quot // Global enable interrupts
    delay_ms(1000);
    #asm("cli" // Global disable interrupts
    in_freq = timer0_ov * 256 + TCNT0;
    sprintf(lcd_buff,"Freqency=%d",in_freq);
    lcd_clear();
    lcd_puts(lcd_buff);
    TCCR0=0x00; //Stopt Timer0
    timer0_ov=0; //Prepare for next count
    TCNT0=0; //Clear Timer0
    };
    }
    ^^^^^^^^^^^^^
    خواستن توانستن است

    ^^^^^^^^^^^^^

    دیدگاه

    لطفا صبر کنید...
    X