Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


A To D will not Compile on PIC 16F1823

  • I have used GCB on and off for a few years and generally it seems to work well.   I would class myself a beginner.
    The problem A To D problem has got me well and truly stuck.
    I striped out of the code to the bare minimum and still cannot get the  A To D to compile on the 16F1823/12F1822.
    The bare min code does compile on all my other pics of which the closest is the 16F688.
    I have try downloading the latest version of GCB and it made no difference.

    When I try to compile I get the following error message

    'Error in Library-a-d h: Incorrect Parameter in Set, expected: set variable.bit. status'
    This message is repeated 6 Times.

    The cut down code is

    ;Chip Settings
    #chip 16F1823,8


    Dim FRED As byte

    Dir PORTC.2 In


    If READad(AN2) > 2 Then

    FRED = 1

    End If

    Goto MAIN

    The code complies fine on a 16F688.

    I have tried chaging ports/AD Numbers but always get the same problem ?

    Has any one seen the problem before ? and please could you surgest a solution if you know one.

    Thanks Steve

    Thanks Steve

  • lhatch

    Maybe try this.  I did not test it.  But did a small project today this way.

    add a      #define ITEM AN2       under the #chip

    Change the    If READad(AN2) > 2 Then             TO             If READad(ITEM) > 2 Then

  • Hi Ihatch
    I tried your suggestion but got the same error message back from the GCB complier 'Error in Library-a-d h: Incorrect Parameter in Set.
    It was worth a try,
    Thanks  very much for the idea.

  • kent_twt4

    The easiest way would be to edit the COMPILE.bat file to use the internal GC assembler by adding the line:
    GCBASIC /NC /V %1 /O:compiled.asm /A:GCASM /P:download.bat
    Then REM  the line which I assume has the /A: makeasm.bat in it.

    IN MAKEASM.bat file add:
    REM the line which I presume has MPASM in it.

  • lhatch

    I pulled the code and got an error, I did not have the 16F1823 file, so I changed that to a 16F688 and compiled with no errors.  So tje problem is not in you program.

    Here is my gcbasic.ini  if you want to back yours up and try it.

    'Great Cow BASIC settings file
    'Used to specify default options, will replace compile.bat
    'Settings can be overridden by command line options
    'Rename to "gcbasic.ini" to use
    'A different settings file can be specified in GCBASIC using the /S:filename switch

    'Verbose mode?
    'Can use y/n, t/f, 1/0. Only the first character is read, so "yes", "no", etc work
    Verbose = y

    'Pause on errors?
    PauseOnError = y

    'GCBASIC will attempt to read messages from messages-.dat, then load any
    'missing ones from messages.dat.
    'If no language is specified, no extra messages will be loaded and English will be used

    'Assembler to use
    'MPASM settings
    'Filename, is relative to GCBASIC directory unless a full path is given
    Assembler = mpasm\mpasmwin
    AssemblerParams = /c- /o- /q+ /l+ /x- /w1 "%FileName%"
    'GCASM settings
    'Assembler = GCASM
    'No params needed for GCASM

    'IC-Prog settings
    Programmer = pickit2
    'Programmer = icprog
    ProgrammerParams = -l"%FileName%"
    'WinPIC settings
    'Programmer = C:\Program Files\WinPic\Winpic.exe
    'ProgrammerParams = /device=PIC%ChipModel% /p "%FileName%"

    'Name of output file
    'Comment out to make use the name of the input file
    Output = compiled.asm

    'Working directory, used to store compiled.asm
    'use "instdir" for the GCBASIC install dir, "tempdir" for the system temp directory
    WorkingDir = instdir

  • Hugh Considine
    Hugh Considine

    It sounds like a problem that is caused by a changed bit name in the newer chip. Please try downloading the patch from http://gcbasic.sourceforge.net/newfiles/update.zip and see if that helps!

  • Thanks the new ZIP did the trick, I now have A To D on ANO2 working fine, back in the orginal full code version, Thank you very much for your help.
    I now seem to have a similar problem on the H/W serial port (Did not get this far learlier due to first problem) ie it worked fine on the orginal PIC it was even talking to the pic uart tool, but on the 16F1823 there seems to be no output on PORTA.0
    I checked with a scope and it is setting at # 0V. Any Thoughts ?