Menu

FIXED: Unable to ReadTable directly into an array (Version of Dec 2021)

2022-01-08
2022-01-20
1 2 > >> (Page 1 of 2)
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-01-08

    This works (8 Leds connected to PortB) : Values from 0 to 15 are correctly displayed on the Leds

     

    Last edit: Bertrand BAROTH 2022-01-08
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-01-08

    This doesnt work (Errors on display for many values of Compteur)

     

    Last edit: Bertrand BAROTH 2022-01-08
  • Anobium

    Anobium - 2022-01-08

    Oh that is not correct.

    Any idea what is wrong in the ASM? Remember, I am not expert at AVR ASM - hence, I ask.

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-01-08

    Sorry, I am not an expert in ASM, neither do. And I tested with the newest version of Jan 2022 : same issue ... Call me Murphy !

     

    Last edit: Bertrand BAROTH 2022-01-08
    • Anobium

      Anobium - 2022-01-08

      We need an ASM expert. I can see what I can do but use the workaround you have. I think this is AVR specific as PIC seems to work.

       
  • Anobium

    Anobium - 2022-01-08

    The issue is.... the process sets the Z bytes to the memory address for the array element prior to reading the table value, however, the assignment (the next logical set of instructions) that reads the table overwrites the Z bytes..

    I can upload a fixed EXE for testing. Can you try?

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-01-08

    OK, Banzaï ! Where can I download it ?

     

    Last edit: Bertrand BAROTH 2022-01-08
  • Anobium

    Anobium - 2022-01-08

    http://gcbasic.sourceforge.net/newfiles/gcbasic.exe

    Builkd 1061. It is a 32bit build - let me know if it resolves.

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-01-08

    I downloaded the patch, executed it, compiled again and IT DOES NOT WORK. BTW my windows is W7 64 bit pro, maybe this is the reason ? I think I will simply use the intermediate variable ... until the bug has been perhaps resolved in a future version of GCBasic.

     
    • Anobium

      Anobium - 2022-01-08

      Please upload your ASM. I need to see it.

       
  • Anobium

    Anobium - 2022-01-08

    It work here.

    Values read from array after table read
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    
    PortB values after XOR
    255
    254
    253
    252
    251
    250
    249
    248
    247
    246
    245
    244
    243
    242
    241
    240
    

    Code is for an UNO but I have tested on my AVR sim for your chip - same results.

    ' ----- Configuration
     #chip Mega328p, 16
    
     #Option Explicit
    
      'USART settings for USART1
      #define USART_BAUD_RATE 9600
      #define USART_TX_BLOCKING
      #define USART_DELAY OFF
    
     ' Constantes et variables
    
     Dim Compteur, Temp As Byte
     Dim Test (16) As Byte
    
     Table Essai
      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
    
    
     End Table
    
     Dir PortB Out
    
    
     For Compteur = 1 To 16
      ReadTable Essai, Compteur, Test (Compteur)
      HSerPrintByteCRLF Test (Compteur)
     Next
    
      Wait 3 s
      HSerPrintCRLF 2
      For Compteur = 1 To 16
       PortB = Test (Compteur) XOR 255
       HSerPrintByteCRLF Portb
    
      Next
    
     
  • Anobium

    Anobium - 2022-01-08

    Here are the SIM results.

    Code

    ' ----- Configuration
     #chip Mega8515
    
     #Option Explicit
    
    ; ----- Include library
    #include <softserial.h>
    
    ; ----- Config Serial UART (we use the onboard USB-serial converter):
    #define SER1_BAUD 9600    ; baudrate must be defined
    #define SER1_DATABITS 8    ; databits optional (default = 8)
    #define SER1_STOPBITS 1    ; stopbits optional (default = 1)
    #define SER1_INVERT Off    ; USB-serial converter needs uninverted polarity
    ; Config I/O ports for transmitting:
    #define SER1_TXPORT PORTD  ; I/O port (without .bit) must be defined
    #define SER1_TXPIN 1       ; portbit  must be defined
    ; Config I/O ports for receiving:
    #define SER1_RXPORT PORTD  ; I/O port (without .bit) must be defined
    #define SER1_RXPIN 0       ; portbit  must be defined
    #define SER1_RXNOWAIT On   ; don't wait for stopbit optional (default = Off)
    
    ; ----- Constants
    #define RXTIMEOUT  100     ;Ser1GetString finishes after this timeout, 100 is ca. 1 second on a 16Mhz AVR
    #define RXMAXCHARS  20     ;Ser1GetString finishes when 20 bytes received
    #define RXENDCHAR   13     ;Ser1GetString finishes when Chr(13) = CR is received
    
    
     ' Constantes et variables
    
     Dim Compteur, Temp As Byte
     Dim Test (16) As Byte
    
     Table Essai
      0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
    
     End Table
    
     Dir PortB Out
    
    
     For Compteur = 1 To 16
      ReadTable Essai, Compteur, Test (Compteur)
      Ser1Print Test (Compteur)
      Ser1Send 13
      Ser1Send 10
     Next
    
      Ser1Send 13
      Ser1Send 10
      For Compteur = 1 To 16
       PortB = Test (Compteur) XOR 255
       Ser1Print Portb
       Ser1Send 13
       Ser1Send 10
      Next
    
     

    Last edit: Anobium 2022-01-08
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-01-08

    Here it is :

     
    • Anobium

      Anobium - 2022-01-08

      This is the old compiler.

      ;Program compiled by Great Cow BASIC (0.98.07 2021-07-24 (Windows 64 bit) : Build 1005) for Microchip MPASM

      Please update to the file at the URL.

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-01-08

    Where is the new one ? I used the compiler given by "Download latest version" in the "Files" tab ... and this is 0.98.07 !

     

    Last edit: Bertrand BAROTH 2022-01-08
  • Anobium

    Anobium - 2022-01-08

    In the URL above.

    pasted again. http://gcbasic.sourceforge.net/newfiles/gcbasic.exe

    Builkd 1061. It is a 32bit build - let me know if it resolves.

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-01-08

    It has only 1 MB ! So I think it is a patch and I applied it ... without success !

     
  • Anobium

    Anobium - 2022-01-08

    Retry downloading the EXE. I downloaded .... attached.

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-01-08

    1014 KB ! If I click on the link or the arrow under it, I got aways the same result ...

     

    Last edit: Bertrand BAROTH 2022-01-08
  • Anobium

    Anobium - 2022-01-08

    Which browser?

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-01-08

    Firefox 84.0.2 (64 bits)

     
  • Anobium

    Anobium - 2022-01-08

    file is 1,037,824 bytes. It is the 32bit version. It will work of, if same size.

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-01-08

    I applied it as a patch ...and got the same "wrong" result ! The size is exactly as indicated (right click on the file name, properties)

     

    Last edit: Bertrand BAROTH 2022-01-08
  • Anobium

    Anobium - 2022-01-08

    Post the ASM

     
  • Bertrand BAROTH

    Bertrand BAROTH - 2022-01-08

    Here it is

     

    Last edit: Bertrand BAROTH 2022-01-08
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.