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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
' ----- Configuration#chip Mega8515#Option Explicit;-----Includelibrary#include <softserial.h>;-----ConfigSerialUART(weusetheonboardUSB-serialconverter):#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;ConfigI/Oportsfortransmitting:#define SER1_TXPORT PORTD ; I/O port (without .bit) must be defined#define SER1_TXPIN 1 ; portbit must be defined;ConfigI/Oportsforreceiving:#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 variablesDimCompteur,TempAsByteDimTest(16)AsByteTableEssai0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15EndTableDirPortBOutForCompteur=1To16ReadTableEssai,Compteur,Test(Compteur)Ser1PrintTest(Compteur)Ser1Send13Ser1Send10NextSer1Send13Ser1Send10ForCompteur=1To16PortB=Test(Compteur)XOR255Ser1PrintPortbSer1Send13Ser1Send10Next
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
This doesnt work (Errors on display for many values of Compteur)
Last edit: Bertrand BAROTH 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.
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
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.
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?
OK, Banzaï ! Where can I download it ?
Last edit: Bertrand BAROTH 2022-01-08
http://gcbasic.sourceforge.net/newfiles/gcbasic.exe
Builkd 1061. It is a 32bit build - let me know if it resolves.
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.
Please upload your ASM. I need to see it.
It work here.
Code is for an UNO but I have tested on my AVR sim for your chip - same results.
Here are the SIM results.
Code
Last edit: Anobium 2022-01-08
Here it is :
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.
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
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.
It has only 1 MB ! So I think it is a patch and I applied it ... without success !
Retry downloading the EXE. I downloaded .... attached.
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
Which browser?
Firefox 84.0.2 (64 bits)
file is 1,037,824 bytes. It is the 32bit version. It will work of, if same size.
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
Post the ASM
Here it is
Last edit: Bertrand BAROTH 2022-01-08