Menu

A suggested improvement for future versions of GCBasic ?

2020-06-21
2024-12-23
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-06-21

    As far as I understood, serial communications (and even in both directions) are sometimes followed by a LF ( = chr(10) ) and not by a CR ( = chr(13) ) ; example : Elechouse VR3. Maybe it would be "elegant" to have this as an option (for each port individually, perhaps via a #Define Endchar ... ), so the characters could be sent and above all received as a string, instead of programming a loop to receive them a character at once ... Unfortunately this would not solve the issue caused by a chr(10) IN the string received (this can happen with VR3, thanks Murphy) !

     

    Last edit: Bertrand BAROTH 2020-06-21
    • Anobium

      Anobium - 2020-06-22

      For sending there is a little feature that may help.

      In all the Serial libraries you can use the constants SERPRINTCR and SERPRINTLF. If you define the constants then the libraries will add a CR and/or LF to each serialPRINT command.

      SERPRINTCR and SERPRINTLF is shown in the hardware serial commands but this applies to the software serial commands.


      For receiving.

      The user needs to develop the receive handler. At the moment the libraries receive and we enable the user to handle the incoming data.

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-06-22

    Thanks, it was only an idea and far from perfection ! As I wrote, in some situations, VR3 includes a LF into the data stream ...

     
  • Anobium

    Anobium - 2020-06-22

    Serial can be so flexible.. therefore it can be so frustrating. 😀

     
  • jackjames

    jackjames - 2020-06-23

    A next implementation could be the use of structures (Type MyStruct) and the use of pointers.
    In some of my projects in GcBasic I used an array instead of the structure so that you can save, for example, the device configuration with a simple for next.
    This is an example of how I replaced the structure with an array.
    The situation becomes more complicated when other types (eg word) or strings are used instead of the Byte variables.
    The following code shows how I solved it in part:

            #Define DATI_UNIT     Record (0)
            #Define DATI_IND1     Record (1)
            #Define DATI_IND2     Record (2)
            #Define DATI_COMANDO  Record (3)
            #Define DATI_PARAM1   Record (4)
            #Define DATI_PARAM2   Record (5)
            #Define DATI_PARAM3   Record (6)
            #Define DATI_PARAM4   Record (7)
            #Define DATI_PARAM5   Record (8)
            #Define DATI_PARAM6   Record (9)
            #Define DATI_SEQUENZA Record (10)
            #Define DATI_CRC      Record (11)
    

    The name "DATI" is the name of the structure, the following word is the name of the corresponding variable.

    Using pointers would also make the compiler much more complete.

     
    • Anobium

      Anobium - 2020-06-24

      Thank you. Both Structures and Pointers are on the list. One day....

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-06-24

    Another friend of Pascal's records ...
    :)

     

    Last edit: Bertrand BAROTH 2020-07-07
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-07-07

    And maybe You could include the support for the STK200 in USB version : in sequence Erase - Program flash - Verify flash ...

     
    • Anobium

      Anobium - 2020-07-07

      @Bertrand. Yes this can be done. I need the exact parameters for USE.INI

      Assume the following:
      1. There is an option in the installer to install ATMEL ATprogram.exe
      2. There will be a folder called ATMEL, under the GCB@SYN directory
      3. The following will be installed in the ATMEL, under the GCB@SYN\ATMEL directory from this ZIP - https://github.com/Anobium/Tiny104_USART/blob/master/ATPrpogrammer/ATPrpogrammer.zip
      4. There is a parameter in Tools Variables called atmelatprogramdir and is set to C:\GCB@SynRC18\ATMEL\atbackend

      I recently added the ATMEL mEDBG using TPI using the following parameters.

      [tool = atprogram]
      desc = ATMEL mEDBG using TPI
      type = programmer
      useif = 
      progconfig = 
      command = %atmelATPROGRAMdir%\ATprogram.exe
      params = -t mEDBG -i TPI -d AT%ChipModel%  chiperase program  -f "%FileName%"
      workingdir = %atmelATPROGRAMdir%\
      

      I have attached USE.INI for you - you can get the ZIP from GitHub so you can test.

      If you test on your setup, I just need the tool description for the STK2000 similar to what is shown above.

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-07-07

    Sorry, I don't really understand ... I will wait for the next version of GCBasic, if STK200 is supported. Concerning the parameters ... I don't know them ! In fact I installed simply the software downloaded from Kanda's page (I only know that they use a FTDI chip)

     
    • Anobium

      Anobium - 2020-07-07

      As I do not know the STk200. What is kanda page? Does the page have the programming parameters? and, surely AVDUDE works with the STk200?

      And, I just checked - ATPROGRAM does not support the STk200. Just these tools: avrdragon, avrispmk2, avrone, jtagice3, jtagicemkii, qt600, stk500, stk600, samice, edbg, medbg, nedbg, atmelice, pickit4, snap,

       
      • jackjames

        jackjames - 2024-12-23

        I would do it this way:
        A structure of this type:
        Struct MyStruct
        Name as string °16
        Surname as tring * 16
        GraduationYear as word
        Other as byte
        End Struct
        Dim Myvar as MyStruct

        First I would allocate an array of bytes of the total size of the entered variables.
        So 17 + 17 of the strings,
        2 bytes for the word variable
        and another 2 bytes for the other two byte-type variables.

        Therefore the memory to be allocated is 38 bytes.
        Then I would create a pointer that points to the location of each of the variables, so 4 pointers.
        Therefore it is necessary to create a descriptor managed by the compiler where the name of the pointer, the type of variable pointed to and its length is found.
        Then the compiler based on the variable name.field name, for example MyVar.Name
        When the program refers to one of these variables the compiler must read and write in those allocations in the way it reads and writes that type of variable.

        I don't know if I explained myself well, English is not my language and I cannot express many words and concepts that exist in Italian in English.

         

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.