cảm biến áp suất

Collapse
X
 
  • Giờ
  • Show
Clear All
new posts
  • boy_friend102vu
    Nhập môn đệ tử
    • Sep 2009
    • 1

    #1

    cảm biến áp suất

    các bác xem dùm em đoạn code đo cảm biến áp suất này. ccs cứ báo lỗi dòng" else" và "||"


    #define <16f877a.h>
    #include "16F877A.h"
    #device *=16 adc=8
    //#device PIC16F877A *=16
    #use delay(clock=12000000)

    #FUSES NOWDT, HS, NOPUT, NOPROTECT, NODEBUG, NOBROWNOUT, NOLVP, NOCPD, NOWRT
    //#use rs232(baud=115200,parity=N,xmit=PIN_C6,rcv=PIN_C7, bits=9)
    #include <LCD.C>

    int8 read;
    void main(void)
    {
    // set_tris_b(0);
    set_tris_a(0xFF);
    set_tris_d(0x00);




    //Khoi tao ADC
    setup_adc_ports(AN0);
    setup_adc(ADC_CLOCK_INTERNAL);
    delay_ms(50);



    while(TRUE)
    {
    lcd_init();
    read=read_adc();
    read =read*0.436 + 10.6;
    if (read>115) || (read<15)
    {
    printf(lcd_putc,"!!");
    }
    else
    {
    printf(lcd_putc,"\rNhiet do: %u",read);
    }
    delay_us(20);
    }

    }
  • pk178
    Đệ tử 5 túi
    • Jan 2009
    • 100

    #2
    Lỗi cú pháp thôi bạn.

    Bạn sửa đoạn
    Code:
    if (read>115) || (read<15)
    Thành

    Code:
    if ((read>115) || (read<15))

    Comment

    Working...