PIC Vietnam

Go Back   PIC Vietnam > falleaf

Tài trợ cho PIC Vietnam
Trang chủ Đăng Kí Hỏi/Ðáp Thành Viên Lịch Bài Trong Ngày Vi điều khiển

Conversation Between falleaf and navypro
Showing Visitor Messages 1 to 1 of 1
  1. navypro
    03-06-2013 05:01 PM
    navypro
    chào anh falleaf em là nhập môn đệ tử thôi ngày trước thì còn các anh giỏi về pic nhưng ngày đó em chưa biết gì giờ bắt đầu làm rồi nhưng không có ai để hỏi cả. em có code trên 877a thì chạy ngon nhưng mà khi chuyển sang 887 thì không thấy gì ở đây là việ hiển thị LCD anh ah em code một đoạn bác xem chỉnh sửa giúp em ah em chuyển qua dùng 887 anh ah
    #include <16f887.h>
    #device *=16 ADC=10
    #fuses HS,NOBROWNOUT NOWDT
    #use delay (clock=10000000)
    #include "hienthiLCD.c"

    // dinh nghia port
    #byte Porta =0x05
    #byte Portb =0x06
    #byte Portc =0x07
    #byte Portd =0x08
    #byte Porte =0x09
    //dinh nghia cac chan cong nan tin hieu vao

    // khai bao cac bien
    int count;
    int32 d;
    int32 adc;
    float p,g;
    int16 duty;

    //chuong trinh con do ap suat tuc thoi tai chan AN0
    // chuong trinh ngat 1(s) de doc gia tri adc
    #int_timer0
    void interrupt_timer0()
    {
    set_timer0(2);
    ++count;

    if(count>=10)
    {
    disable_interrupts(int_timer0);
    set_adc_channel(0);
    delay_us(10);
    adc=read_adc();
    p=0.004887585*adc;

    }
    enable_interrupts(int_timer0);
    }

    void main()
    {
    lcd_init();
    set_tris_a(0xff);
    set_tris_e(0xff);
    set_tris_b(0x00);
    set_tris_c(0x0f);
    set_tris_d(0x00);
    output_d(0x00);
    enable_interrupts(int_timer0);
    setup_timer_0(RTCC_DIV_256);
    setup_adc_ports (sAN0) ;
    Setup_ADC ( ADC_CLOCK_INTERNAL );
    delay_ms(10);
    lcd_gotoxy(1,1);
    printf(lcd_putc "ap suat= %f",p);
    delay_us(20);



    }

Múi giờ GMT. Hiện tại là 09:36 AM.


Được sáng lập bởi Đoàn Hiệp
Powered by vBulletin®
Page copy protected against web site content infringement by Copyscape
Copyright © PIC Vietnam