Menu

String definition

Help
2008-01-16
2013-05-30
  • Nobody/Anonymous

    When I use the example code to define a string in my program,
    I get the errormessages :
    ASM: compiled.asm:248:Error [113] Symbol not previously defined (PCLATH).
    ASM: compiled.asm:300:Error [113] Symbol not previously defined (IRP).
    ASM: compiled.asm:302:Error [113] Symbol not previously defined (IRP).
    ASM: compiled.asm:311:Error [113] Symbol not previously defined (IRP).
    ASM: compiled.asm:313:Error [113] Symbol not previously defined (IRP).

    PIC is the 16C57, compiler lastest update

    What is the correct way to define several strings, or one string
    with about 40 characters ?

    regards,
          Reelf

     
    • Hugh Considine

      Hugh Considine - 2008-02-10

      The lower end PICs like the 16C57 don't work properly with the string routines in GCBASIC. I did fix the problem which was causing those messages, but GCBASIC will not be able to handle string constants on the 16C57 as the SysReadString subroutine isn't able to call the table used to hold the string in the program memory.

      The correct way to define a string is:

      Dim SomeString As String

      This will create a string of 20 characters on chips with less than 368 bytes of RAM, and 40 characters on chips with more. To override the default size, you can set the StringSize constant like this:

      #define StringSize 40

      Or add the length to the Dim command like this:

      Dim SomeString As String * 40

      Either of these methods will create a string of 40 characters.

       

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.