Menu

ADC issues...error in line 225 of a-d.h

2008-02-24
2013-05-30
  • Nobody/Anonymous

    Hi all. I'm a relatively new user to pics. I have a 16F74 which i'm trying to use the peripherals on.

    The pwm and simple code is working well, but I'm having the following problem with the adc:

    My code is very simple:

    #chip 16f74, 20

    #include <lowlevel\a-d.h>
    #byte adcresult

    main:

    adcresult = ADRead(AN0)

    end

    When I compile I get a syntax error in line 225 of a-d.h, which is 'ADRead = ADRES', which is where the return value of the function is written (I think). Is there something I'm doing wrong???

    Thanks,

    Chay

     
    • Nobody/Anonymous

      Hi,

      in the line "adcresult = ADRead(AN0)" try a zero instead of the "AN0"
      Like:   "adcresult = ADRead(0)"

      Has worked for me on the 16F887.

      Mike

       
    • Nobody/Anonymous

      Agreed. This is part of the solution. The other part is to use the corret '\' rather than '/' in the include statement. Doh!

      Chay

       
    • Hugh Considine

      Hugh Considine - 2008-02-27

      This is strange, as using the latest update (http://gcbasic.sourceforge.net/newfiles/update.zip) the only thing I had to do was use ReadAD instead of ADRead. Using ADRead gave me an array/function not declared error. No trouble otherwise.

      There are a few things you've done in your program which GCBASIC does for you automatically:
      - #byte isn't a directive in GCBASIC. All byte variables are automatically declared.
      - There's no need to include anything in the lowlevel directory - GCBASIC does this by default.
      - "end" is added by GCBASIC at the end of a program

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.