Menu

Using PIC-AS

2023-03-21
2023-04-06
1 2 > >> (Page 1 of 2)
  • Paul Gorton

    Paul Gorton - 2023-03-21

    I've installed the latest version of GCB and looked at the YouTube tutorial about using PIC-AS. In the tutorial a file 'USE.INI' is modified. Problem is, this file doesn't exist on my PC. Any ideas?

     
  • Paul Gorton

    Paul Gorton - 2023-03-21

    I now seem to have created the missing file by running the demo...

     
  • Paul Gorton

    Paul Gorton - 2023-03-21

    OK. There are two versions of USE.INI. It was neccessary to convert both before the .S file could be produced but now, when I ask to create a HEX file, I get this error and the GCB hangs.

    C:\Program Files\Microchip\xc8\v2.41\pic\lib\c99\htpic-dZ.a:0:: error: (141) can't open library file "C:\Program Files\Microchip\xc8\v2.41\pic\lib\c99\htpic-dZ.a": Invalid argument
    (908) exit status = 1

    I'm using 'first-start-sample' to try this out. Processor changes have no effect on the failure.

    Any help would be appreciated.

     
  • Anobium

    Anobium - 2023-03-21

    Some basics.

    When did you install Great Cow BASIC ? the latest installer has USE.INI installed automatically. So, know when you install is important.

    Why is PIC-AS important to you ? PIC-AS has two use cases 1) validate GCASM 2) specific use case for bootloader production. There are many constraints when using PIC-AS as no-one to my knowledge has really tried it (apart from the key users).

    Depending when you instal. To set PIC-AS is very simple. A few clicks. There is NO conversion of USE.INI to anything.

    So, a few questions from me.

     
  • Anobium

    Anobium - 2023-03-22

    A short video showing how to config and use PIC-AS.

    The video also explain the process of generating the HEX in the context og GCASM and PIC-AS.

     
  • Paul Gorton

    Paul Gorton - 2023-03-22

    I donwloaded the latest version and installed it on Monday. The reason for wanting to use it is because I'm writing software for a PIC18F04Q40 which only PIC-AS supports.
    I normally write in assembler with MPASM using MPLabX but the change to PIC-AS has brought a level extra complexity thsat I can do without. Hence, the desire to use GCB (back to basics?).

    Thanks for the video. I'll take a look at it and see if it throws any light on my problem,

     
  • Paul Gorton

    Paul Gorton - 2023-03-22

    I see the error of my ways. I'm using Great Cow Basic installed in the directory GCB@syn. The video is using GC studio which I've just downloaded. Obviously, I was looking at an old tutorial which I found by Googleing 'using PIC-AS with Great Cow Basic' whichexplains a lot.
    I will try Studio and see if it resolves the problem,

     
  • Anobium

    Anobium - 2023-03-22

    Paul - use GCBASIC natively.

    Here is a private video - it is a deep dive into PIC-AS. It is not for the novice.

    PLEASE SUBSCRIBE to my channel I need the subscriptions else I could end up paying for YouTube.

    The video is long, the subject is vast.


    Yes, you can use GCBASIC as your compiler - that is the easiest. The intent of Great Cow BASIC is mask the complexity of MPASM and PIC-AS etc. The video shows how to do PIC-AS and the many, many hidden things that GCBASIC can do.

    Rational for using GCBASIC with PIC-AS.

    1. Validation that GCASM is working as expected. Debugging issues with MPLAB-X simulator.
    2. Extremely complex assembly project where the user has a huge amount of control of the .S produced... so, much that you will need MPLAB-X to debug the code. :-)
     

    Last edit: Anobium 2023-03-22
  • Anobium

    Anobium - 2023-03-23

    Here is a follow on video

    This video compares three tools GCASM, MPASM and PIC-AS. The video explains the differences and talks through the use cases for each.

    GCASM - the Great Cow BASIC assembler/linker
    MPASM - the legacy PIC Microchip assembler/linker
    PIC-AS - the modern PIC & AVR Microchip assembler/linker

    I would not expect users to use PIC-AS / MPLAB-X unless there is extreme bug, and, there are far better ways to dedug than using PIC-AS / MPLAB-X. :-)

     
  • Paul Gorton

    Paul Gorton - 2023-03-23

    Thanks for the link to the video.

    My current project involves the use of the CWG in the 18F04Q40. Does an #include file exist for this?

    I'm curious about your comment that there are better ways to debug. My reason for using MPLabX is that I can run code on the hardware and examine registers during development. If you know a better way I would be pleased to be aware of it.

     
    • Anobium

      Anobium - 2023-03-23

      The easiest way.. dump the registers via serial, but, MPLAB-X is good.

      Re CWG. If you are using MPLAB-X ( or standalone Microchip MCC) then complete the required setup in either tool and then create a GCBASIC sub routine - dead easy.

       
  • Paul Gorton

    Paul Gorton - 2023-03-30

    I'm back and able to concentrate on GCBasic today. I have installed both Great Cow Basic and GC Studio. I was intending to use Studio and, have started a single file project but in all the tutorials Great Cow Basic seems to be used and, looking at it, the environment seems to be more use-friendly.

    So, why the difference between the two and which would you recommend using?

    Thanks

     
    • Anobium

      Anobium - 2023-03-30

      GCODE the new IDE has far more features and it where we are focusing the new features.
      SynWrite is fully supported however as this editor is no longer supported the functionality is now locked.

      GCCode has the <f4> menu with many. many IDE features. Easy acess to the many and growing number of tools in the tool chain. In the SynWrite IDE these are installed but you have to hunt around to find them. </f4>

      GCStudio the front end will update either SynWrite or GCODE. And, from within GCStudio you can select GCODE or SynWrite as your code editor.

      I now exclusively use GCODE.


      I still do not know why using PIC-AS has any benefit. GCASM is faster. You will be the first person to use PIC-AS beyond myself and Bill Roth - good luck.

       
  • Paul Gorton

    Paul Gorton - 2023-03-30

    The only benefit in using PIC-AS is that it supports all the new devices. Beyond that, it's a complete pain as I know from having to update assembler code compiled with MPASM to PIC-AS.

    My suspicions are that Microchip is determined to force folks who write in assembler into using C.

    Thanks for your advice.

     
  • Anobium

    Anobium - 2023-03-30

    GCBASIC with GCASM supports all the new devices. We are actually ahead of Microchip in supporting the new 8-bit chips.

    Currently, PIC-AS is limited to Instructions supported by GCBASIC. So, passing raw ASM may fail when using PIC-AS. I am working with Microchip at the moment to resolve many 18F PIC-AS issues we have uncovered.

     
  • Paul Gorton

    Paul Gorton - 2023-04-04

    Is there a list, somewhere, of the raw ASM instructions that are supported by GCBasic and do I have to explictly tell GCBASIC that a section is raw ASM?
    The documentation seems to imply that it will be automatically recognised but I realise that this was written before the advent (burden?) of PIC-AS.
    I suppose that my alternative is to generate the .S file and then insert the ASM sections.

     
  • Paul Gorton

    Paul Gorton - 2023-04-04

    Please don't waste time in replying as I've got my head round how to insert ASM and also found a way of doing it in BASIC - which is a bonus. Thanks.

     
  • Paul Gorton

    Paul Gorton - 2023-04-04

    Good afternoon,

    I now have a simple-ish program of mixed basic and asm which produces .s file without error. I tred to assemble the .s file in MPLabX 6.05 but it produces errors as follows:-

    CLEAN SUCCESSFUL (total time: 6ms)
    make[2]: No rule to make target 'build/default/production/_ext/570541465/Rochester S28X.o', needed by 'dist/default/production/S28X.X.production.hex'. Stop.
    make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
    make[1]:
    [.build-conf] Error 2
    make[1]: Entering directory 'C:/Users/paulr/My Drive/MPLabX/Rochester/S28X.X'
    make: *** [.build-impl] Error 2
    make -f nbproject/Makefile-default.mk dist/default/production/S28X.X.production.hex
    make[2]: Entering directory 'C:/Users/paulr/My Drive/MPLabX/Rochester/S28X.X'
    make[2]: Leaving directory 'C:/Users/paulr/My Drive/MPLabX/Rochester/S28X.X'
    nbproject/Makefile-default.mk:85: recipe for target '.build-conf' failed
    make[1]: Leaving directory 'C:/Users/paulr/My Drive/MPLabX/Rochester/S28X.X'
    nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

    BUILD FAILED (exit value 2, total time: 82ms)

    I'm not clear why it would be missing the rule. Can you provide any illumination?

    Thanks.

     
  • Anobium

    Anobium - 2023-04-04

    Did it compile using PIC-AS in GCBASIC IDE?

    Post the source please.

     
  • Paul Gorton

    Paul Gorton - 2023-04-04

    It did. The source is attached. I'll send you the resultant .s file in a second post

     
    • Anobium

      Anobium - 2023-04-05

      A very quick code review to help you.

      You can only have one #startup in each source file. Build 1228 will not warn users when more that one exists.

      Just call the subs.
      You should retain INITPPS()

          #startup InitNCO
          #startup InitAD
      

      See the demo (listed below) to use ALIASing to address the NCO registers. It is a robst method.


      Also, this is puzzling me. It may be my lack of knowledge/good practice.

      'RA4 > Analogue input
      MOVLW   (B'0001000')
      MOVWF   ANSELA
      

      You could use ANSELA.3 = 1 as this is specific to the bit. But, the comment refers to RA4 then sets RA3 ( MCLR) to an analogue input?

       
  • Paul Gorton

    Paul Gorton - 2023-04-04

    .s file attached.

     
  • Paul Gorton

    Paul Gorton - 2023-04-04

    ....clearly it wasn't. Sorry

     
  • Anobium

    Anobium - 2023-04-04

    MPLAB-X support may not be aligned to PiC-AS support. Probably, the chip (the chip family) is not yet support.

    Open a ticket with Microchip. They are about to release v6.10 and they can let you know when it is coming out.

     
  • Paul Gorton

    Paul Gorton - 2023-04-04

    Thanks, that's most helpful.

     
1 2 > >> (Page 1 of 2)

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.