Menu

serialize in programming time

Christos
2021-02-24
2021-02-25
  • Christos

    Christos - 2021-02-24

    Hello

    can somehow have a data variable where this number will be increased every time i program a chip ?
    a production serial numbering

     
  • Chris Roper

    Chris Roper - 2021-02-25

    The PICKit3 programmer can do it but you would have to read the Manual to find out how.
    I know that it works, having used it in the past, but that was on 32 BIT PIC devices.
    Not all, if any, 8 Bit devices may be able to support it.

     
  • William Roth

    William Roth - 2021-02-25

    You may be able to write incremental serial numbers using MPLAB IPE with "SQTP". Suggest you download MPLABX and install IPE. Then read the documentation regarding SQTP, As I understand it you can configure to write sequential or random numbers to program memory, eeprom, or UserID locations.

    I have never used this and am not sure what programmers are supported with SQTP.

    https://microchipsupport.force.com/s/article/How-to-load-a-SQTP-file-in-MPLAB-IPE

     
  • Christos

    Christos - 2021-02-25

    mplab ide will better avoid it if possible, since i have to learn it :)
    intresting in gcbasic capabiliies

     
  • William Roth

    William Roth - 2021-02-25

    Update.

    I just used SQTP with MPLAB IPE 5.40 using a SNAP Programmer. It worked very well and added a serial number to the USERID area of a PIC18F27Q43.

    There is no reason that this could not work with a PICKIT3 or with most other PIC microcontrollers. Just follow the instructions in the provided link.

    This took me all of about 15 minutes to figure out.

     

    Last edit: William Roth 2021-02-25
  • William Roth

    William Roth - 2021-02-25

    GCB has no built in capability to do what you want. I suggesed MPLAP "IPE" Not MPLAB "IDE".

    IPE is relatively simple

     
    • Anobium

      Anobium - 2021-02-25

      Sorry. You can do within the compiler.

       
  • William Roth

    William Roth - 2021-02-25

    How? Please provide detailed steps plus a working example

     
    • Anobium

      Anobium - 2021-02-25

      See GitHub post above, and, in the Help.

       

      Last edit: Anobium 2021-02-25
  • William Roth

    William Roth - 2021-02-25

    This appears to be a "demo" with no instructions or help other than the posted code.

    Can it write to UserID or EEPROM locations where Serial numbers are typically stored?
    What is the format of the .cnt file ?
    Where is is the explanation ?
    How would this be implemented in a production environment for say 100 chips?

     

    Last edit: William Roth 2021-02-25
  • Anobium

    Anobium - 2021-02-25

    The code is documented. There is more in the Help.
    The file format is a text file. Contains the version number.

    Use exposed variables as you wish.

    or, do not use the method.

     

    Last edit: Anobium 2021-02-25
  • Anobium

    Anobium - 2021-02-25

    I just got home. I was previously responding on my cell phone.

    Loaded exampleprogram_to_autocreate_version_and_timestamp.gcb from the folder D:\GCB@Syn40\GreatCowBasic\Demos\converter_solutions I am running RC4), so change to your installation folder.

    I compiled the program . As part of the compilation process - the #include "gcbversionnumber.cnt" statement issued a version number.

    During this process the compiler
    - creates a new source called gcbversionnumber.gcb.
    - creates a file in the same folder as the user program called gcbversionnumber.cnt.

    gcbversionnumber.cnt is a text file and it can be opened in the IDE. gcbversionnumber.cnt contains the number 1.

    gcbversionnumber.gcb is the routine used to expose the variables. It is created/updated by the converter.

    This number value was exposed in the user program as versionString. Subsequent compilations increments this value.

    That is about all I can think of. It auto-creates and auto-increments a build number that is exposed as a string.

    Usage can be adapted as part of the build process to revert the gcbversionnumber.cnt if errors happen but that is down to the implementation details.


    As shown in the source program.

      #include "gcbversionnumber.cnt"
      'Include the GCBVersionNumber.cnt to increment versionString and create the build time string called GCBBuildTimeStr.
      ' versionString a string is created automatically.
      ' GCBBuildTimeStr is a string that is also created automatically.
      ' use "GCBVersionNumber.cnt" as this will create a local copy of the versionString tracker.
      ' if you use <GCBVersionNumber.cnt> this is a system wide versionString tracker.
    

    I have not looked at the Help, but, must be something similar in the Help in terms of the details.

     
  • Christos

    Christos - 2021-02-25

    i see thanx
    Not use ite yet, but example is self explanatory.

    However this means that i have to "compile+program" every time, which even not original asked, is not bad for now :)

     
    • Anobium

      Anobium - 2021-02-25

      Then, Hexmate is the answer.

      I just looked at my setip. I have 17 copies of Hexmate. Microchip use it the merge, manage and update hex. There is a huge resource of info on the web re Hexmate.

       
  • stan cartwright

    stan cartwright - 2021-02-25

    Anobium, A lot of your code has a date/time whatever.
    In the ili touch test it overwrites the clear label, even when commented out

            ' ------ Version Control - optional
    '        #include "GCBVersionNumber.cnt"
    '        'Include the GCBVersionNumber.cnt to increment versionString and create the build time string called GCBBuildTimeStr.
    '        ' versionString a string is created automatically.
    '        ' GCBBuildTimeStr is a string that is also created automatically.
    '        ' use "GCBVersionNumber.cnt" as this will create a local copy of the versionString tracker.
    '        ' if you use <GCBVersionNumber.cnt> this is a system wide versionString tracker.
    '
    '        dim versionString as string * 40
    '        versionString = "Build: "+GCBBuildStr
    '        versionString = versionString + "@"+GCBBuildTimeStr
    '        GLCDfntDefaultsize = 1
    '        GLCDPrint ( 2, Current_GLCD_HEIGHT-10, versionString)
    '        GLCDfntDefaultsize = 2
            ' ------ End of Version Control - optional
    
     
  • Anobium

    Anobium - 2021-02-25

    @Stan. You are correct - this code is in a lot demos - this would have been used for LCD, GLCD display etc. I also use when I am developing a library to ensure I am testing the latest version.

    :-)

     

    Last edit: Anobium 2021-02-25

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.