Menu

Problems with ReadAD on 18F4431 and 16F628A

2022-03-27
2022-03-29
  • David Russell

    David Russell - 2022-03-27

    Hi

    I am using the simple program as shown below and I have tried this with the 18F4431 and 16F628A microcontrollers and I am getting the error :- a-d.h (1786): Error: Incorrect parameters in Set, expected: Set variable.bit status

    PROGRAM

    #Chip 18F4431
    #OPTION Explicit
    
    Dim ADCIN as Byte
    
    Do Forever
    ADCIN = ReadAD(AN0)
    Wait 1 s
    Loop
    

    After the error the SynWrite program crashes and you have to Control Alt DEL to close it down and then restart it,

    I hope this is a simple problem to solve,

    Thanks

     

    Last edit: GCBASIC 2022-03-28
  • stan cartwright

    stan cartwright - 2022-03-27

    Change to #chip 328p.16 and it asm. Chip not supported??

    edit -it does crash the gcb ide, why gcb crashes?

     

    Last edit: stan cartwright 2022-03-28
  • David Russell

    David Russell - 2022-03-28

    Hi

    The installation was a bout a week old but I did just reinstall now using the latest version on the site and this still failed with the 18F4431 CPU,

    I have now updated the A-D.H file as recommended and this now compiles fine on the 18F3341 but for the 16F628A it still gives out the same error code and it crashes SynWrite again, I get Not Responding and have to Ctrl-Alt-Del and Close Program to get out of this,

    I can continue my experiments now on the 18F4431 IC and thanks for the fast response to this problem, this does look like its going to be a fantastic system for experimenting with PIC hardware,

    Thanks
    Dave

     
  • Anobium

    Anobium - 2022-03-28

    16F628A has no ADCs so the error is sort of correct.

    Adding the following line to a-d.h at about line 160 will help you.

    #option REQUIRED PIC ChipADC "a-d.h (0) This chip does not support ADC operations"
    

    This will force a check that ADC is supported, if not, issue an error message.

     

    Last edit: Anobium 2022-03-28
  • Anobium

    Anobium - 2022-03-28

    Re the SynWrite issue.. move to the new IDE.

     
  • David Russell

    David Russell - 2022-03-28

    Thanks for that update, I will update the A-D file now,

    Where can I locate the new IDE download ?,

    Thanks
    Dave

     
  • David Russell

    David Russell - 2022-03-28

    Thanks that download works fine, I have to admit I initially prefer the SynWrite layout and ease of use with the action buttons for things like produce hex and download to target etc but this new version of IDE does not crash on an error but I hope not to be getting many errors now, I got the PIC 18F4431 working OK today and the ADC library was working fine during the first tests I have done so things are looking up for GCB and thanks for your help so far on this

     
    • stan cartwright

      stan cartwright - 2022-03-28

      Hi David, I found gcstudio grows on you. Familiarity with SynWrite I agree.
      I have things I don't like about gcstudio and the developer is open to any feed back.
      What do you like and dislike using gcstudio sir?
      What does my head is it's not consistant ie 1 session seems different to another and I think I'm looseing the plot but I never thought like this using gcb@syn. Gcstudio seems to have a mind of it's own sometimes... imho

      and F4 key is the gcb stuff. very important.

       
      • David Russell

        David Russell - 2022-03-29

        Hi Stan

        YES its just I have been using the BasicMicroUK Nano Basic compiler for years and that interface studio software is much like SynWrite in format and so when using the new GCstudio it feels more like the old Wordstar 1.0 interface and juse does not inspire confidence like SynWrite and another problem was the old PC in my LAB at work is so old it running Windows Vista and the CGStudio will not even install on this where as the SynWrite will run on this and my home laptop so i think a visit to PCWorld at the weekend is in order, then I will have Windows 10 or 11 as well as GCStudio to get used to LOL, I am sure it will be a fun weekend, I have today ordered in some of the PIC16F18313 IC's and I am going to go through the LockDown You Tube series on GCB and just get used to the functions and then I will have a little more confidence with the PIC family and the compiler but so far I am loving it,

        Dave

         
    • Angel Mier

      Angel Mier - 2022-03-29

      the ADC library is coming on the next update along with action buttons. expect it in a few days. it will update automatically for you.

      Angel

       

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.