Menu

Error in ReadAD(an0)

Help
2008-05-18
2013-05-30
  • Nobody/Anonymous

    Hi! avery body:
    My problem is that the following program give the errors listed down, Tanks you.

    #chip 16F628, 4
    #config CP_OFF, DATA_CP_OFF, PWRTE_OFF, WDT_OFF, LVP_OFF, MCLRE_OFF, INTRC_OSC_NOCLKOUT
    dir porta.0 in
    dir portb b.3 out
    dim ar as byte  
    do
      ar = ReadAD(an0)   
      HPWM 1, 2, ar  ' HPWM chanel, frecuency in KHz, working cycle
      wait 5 ms
    loop

    a-d.h (178): Error: Missing bit in SET command
    a-d.h (179): Error: Missing bit in SET command
    a-d.h (180): Error: Missing bit in SET command

     
    • Hugh Considine

      Hugh Considine - 2008-05-18

      The 16F628 doesn't have an A/D converter in it, so ReadAD won't work. You need to use the Pot command (http://gcbasic.sourceforge.net/help/pot.htm), or upgrade to a 16F819, 16F88, or some other chip with an A/D module.

      Also, you have a typo - replace "dir portb b.3 out" with "dir portb.3 out".

       
    • Nobody/Anonymous

      Hugh thanks again for your help, see you...

       

Log in to post a comment.