Menu

a-d.h Problem

Help
Steve Hall
2011-04-12
2013-05-30
  • Steve Hall

    Steve Hall - 2011-04-12

    I tried to write a simple PWM routine to brighten and dim a LED.   The code would not compile and the error file showed the following:

    a-d.h (422): Error: Incorrect parameters in Set, expected: Set variable.bit status

    I looked at the file  with the Crimson Editor and of course had no idea how to fix it.

    I have installed the updated files and reinstalled the GCBASIC just in case just in case the latest version is better than the updated files.

    Here is my code.  If something in the code is causing this problem please let me know.

    #chip 16f627a, 4
    #define PWM_Out1 PORTB.3
    dir PORTB.3 out

    dir PORTA.0 in
    dim  measure as byte
    dim  old as byte
    old =0
    do
      measure = ReadAD(AN0)
    if measure <> old then
       PWMOut 1, measure,100
    old = measure
    end if

    loop

    If the include file is bad can someone please tell me how to fix it.

    Steve

     
  • Mauried

    Mauried - 2011-04-12

    Your code looks OK.
    The problem is that the chip you are using , 16F627 doesnt have an A to D converter
    so the READAD command wont work.
    User something like a 16F88 or 16F886.

     
  • Steve Hall

    Steve Hall - 2011-04-13

    Thanks.

    That fixed it.

     

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.