I am working on a conversion from one of my existing project written in MikroBasic for PIC16F1825.
After the syntax corrections needed to convert the code, I got 2 final error messages that I not really understand.
First message seems to be related to Interrupt handling. The error message is as following:
Error: First page of program memory is full, please reduce size of Main and Interrupt routines
To note that the interrupt routine is the same as for MikroBasic. I have only a Sub Interrupt at the end of the source code with handling of 2 sources, interrupt on Timer4Overflow and interrupt on Timer2Overflow.
These both sources cannot be used with On Interrupt Source Call...
If I place all the Sub Interrupt routine in comments, this compilation error dissapear!
The second error is in a Sub procedure including a Select Case routine. On the last Case the compiler always gives following error message:
Error: Invalid variable name: 000
Error: Variable 000 was not explicitly declared
The variable is declared and initialised on the start of the program.
I am actually turning in cercle and not really figure out what could be the problem. These both errors make compilation unsuccessfull. The converted project is successfull compiled on MikroBasic with 58% ROM and 12% RAM.
Any good advice would be appreciated. Thank a lot.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
About the source, in opposition with other projects I shared with Community here, this one contains some sensitive information and cannot be shared globally. Sorry for that.
@Evan, I posted you a chat message over the messaging platform.
Thank for comprehension.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Usinf the LST file the progran uses 0x07F6 out of 0x800 on the first page. Very tight. If a program fills any page then simply cut the program to create a few subs.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
Anobium gave me some support, thank a lot for that.
Following changes were made, can be usefull for everyone moving from MikroBasic to GCBASIC (see below copy from source code history section):
Following syntax must be modified from MikroBasic to GCBASIC (related to instructions used in this code):
* INC() to replace with += 1
* while - wend to replace with Do While - Loop
* %00000000 to replace with 0b00000000
* $00 to replace with 0x00
* EEProm_Write to EPWrite
* EEProm_Read to EPRead
* ADC_read(3) to replace with ReadAD10(AN3), including personnal ADC routine to win program memory steps
With the help of Anobium about GCBASIC particularity, update to V1.22 to adapt structural changes required by GCBASIC
* For Next loop to replace with For Next Step loop (or use #DEFINE USELEGACYFORNEXT but not recommended by documentation)
* In the main loop, move several routines in Sub procedures and call when needed, solve Error: First page of program memory is full, please reduce size of Main and Interrupt routines
* Select Case does not accept 0 as 000 (used 000 to have same visual structure for all cases: 000, 100, 200, etc...), solve Error: Invalid variable name: 000, Error: Variable 000 was not explicitly declared
With these changes, compilation is successful. Run of code cannot be tested yet, need to rework push button management routines.
Thank a lot for great and quick support
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have had a quick look at the for-next handler within the compiler. I think I can optimise further to use either of the two methods implemented.
The old/legacy method can be used when the step is ABS(1). So, if step is not explicit and therefore assumed to be 1, a constant of 1 or a constant of -1 then it would be safe to use the old/legacy method.
At the moment if either of the low or high values are variables then it will use newer method, which uses more memory etc.
I will have a look deeper in the next few weeks.
❤️
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To give you more feedback about conversion code issues between MikroBasic and GCBASIC, please note that GCBASIC handle the variables as global. No local variables to sub routines exist.
Dear GCBASIC Community,
I am working on a conversion from one of my existing project written in MikroBasic for PIC16F1825.
After the syntax corrections needed to convert the code, I got 2 final error messages that I not really understand.
First message seems to be related to Interrupt handling. The error message is as following:
Error: First page of program memory is full, please reduce size of Main and Interrupt routines
To note that the interrupt routine is the same as for MikroBasic. I have only a Sub Interrupt at the end of the source code with handling of 2 sources, interrupt on Timer4Overflow and interrupt on Timer2Overflow.
These both sources cannot be used with On Interrupt Source Call...
If I place all the Sub Interrupt routine in comments, this compilation error dissapear!
The second error is in a Sub procedure including a Select Case routine. On the last Case the compiler always gives following error message:
Error: Invalid variable name: 000
Error: Variable 000 was not explicitly declared
The variable is declared and initialised on the start of the program.
I am actually turning in cercle and not really figure out what could be the problem. These both errors make compilation unsuccessfull. The converted project is successfull compiled on MikroBasic with 58% ROM and 12% RAM.
Any good advice would be appreciated. Thank a lot.
The GCBASIC optimisation does all the heavy work placing code in memory.
Without the source I would be guessing to what is happening and how to resolve.
Last edit: Anobium 2024-03-31
About the source, in opposition with other projects I shared with Community here, this one contains some sensitive information and cannot be shared globally. Sorry for that.
@Evan, I posted you a chat message over the messaging platform.
Thank for comprehension.
I have reviewed the program.
-------------------------------------------------------------
Use
#DEFINE USELEGACYFORNEXT
to use the old legacy for-next loop. If you are using the For Next Step 1 or Step -1 then you will be ok.-------------------------------------------------------------
Usinf the LST file the progran uses 0x07F6 out of 0x800 on the first page. Very tight. If a program fills any page then simply cut the program to create a few subs.
Hello,
Anobium gave me some support, thank a lot for that.
Following changes were made, can be usefull for everyone moving from MikroBasic to GCBASIC (see below copy from source code history section):
Following syntax must be modified from MikroBasic to GCBASIC (related to instructions used in this code):
* INC() to replace with += 1
* while - wend to replace with Do While - Loop
* %00000000 to replace with 0b00000000
* $00 to replace with 0x00
* EEProm_Write to EPWrite
* EEProm_Read to EPRead
* ADC_read(3) to replace with ReadAD10(AN3), including personnal ADC routine to win program memory steps
With the help of Anobium about GCBASIC particularity, update to V1.22 to adapt structural changes required by GCBASIC
* For Next loop to replace with For Next Step loop (or use #DEFINE USELEGACYFORNEXT but not recommended by documentation)
* In the main loop, move several routines in Sub procedures and call when needed, solve Error: First page of program memory is full, please reduce size of Main and Interrupt routines
* Select Case does not accept 0 as 000 (used 000 to have same visual structure for all cases: 000, 100, 200, etc...), solve Error: Invalid variable name: 000, Error: Variable 000 was not explicitly declared
With these changes, compilation is successful. Run of code cannot be tested yet, need to rework push button management routines.
Thank a lot for great and quick support
I have had a quick look at the for-next handler within the compiler. I think I can optimise further to use either of the two methods implemented.
The old/legacy method can be used when the step is ABS(1). So, if step is not explicit and therefore assumed to be 1, a constant of 1 or a constant of -1 then it would be safe to use the old/legacy method.
At the moment if either of the low or high values are variables then it will use newer method, which uses more memory etc.
I will have a look deeper in the next few weeks.
To give you more feedback about conversion code issues between MikroBasic and GCBASIC, please note that GCBASIC handle the variables as global. No local variables to sub routines exist.
You can read more here:
https://sourceforge.net/p/gcbasic/discussion/579126/thread/f95b902d/?limit=25
Last edit: Fabrice Engel 2024-04-09