View previous topic :: View next topic |
Author |
Message |
autoguider
Joined: 24 Sep 2007 Posts: 82 Location: Aachen

|
Posted: Mon Nov 21, 2022 9:52 pm Post subject: Function declaration not accepted / var. not dimensioned/ Lo |
|
|
Dear All,
I declared a funtion that has no parameters and returns a byte
Code: | Declare Function Is_new_process As Byte |
Here the code of the function
Code: |
Function Is_new_process As Byte
Local Mybyte As Byte
If Exposure_paused_pin = 0 Then
B_exposure_paused = True
Else
B_exposure_paused = False
End If
If B_exposure_paused_old = False And B_exposure_paused = True Then
B_temp_byte = True
B_exposure_paused_old = True
End If
If B_exposure_paused_remote = True Then
B_exposure_paused_remote = False
B_exposure_paused_old = True
Mybyte = True
End If
Is_new_process = Mybyte Or B_temp_byte
End Function
|
Now calling the function
Code: | Dim Xbyte As Byte
Call StringEval
Xbyte = Is_new_process
If B_temp_byte = True Then
Call Start_ir
End If
|
I get 2 error messages and even after studying the docs I do not know what I did wrong.
Error : 93 Line : 662 Variable not dimensioned [IS_NEW_PROCESS] , in File : D:\Schubi_Stick\motcntrl20221118.bas
As far as I know locals are allowed in functions and subs
Error : 114 Line : 1411 LOCAL only allowed in SUB or FUNCTION [MYBYTE AS BYTE] , in File : D:\Schubi_Stick\motcntrl20221118.bas
when I write Function Is_new_process without the As byte in the head of the function the error message does not pop up
I kindly ask for advice.
kind regards
Christian
(BASCOM-AVR version : 2.0.8.3 , Latest : 2.0.8.5 ) |
|
Back to top |
|
 |
EDC
Joined: 26 Mar 2014 Posts: 1133

|
|
Back to top |
|
 |
MWS
Joined: 22 Aug 2009 Posts: 2335

|
Posted: Mon Nov 21, 2022 11:49 pm Post subject: |
|
|
I would complete the function with empty braces. |
|
Back to top |
|
 |
EDC
Joined: 26 Mar 2014 Posts: 1133

|
Posted: Tue Nov 22, 2022 12:05 am Post subject: |
|
|
That code had one more flaw.
This probably was from some copying.
If Bascom shows strange errors then you should check copied code in some Notepad++ for incorrect encoding or invisible characters.
So...here you have CRLF but after some weird space. Comment line before the last "END" and code probably compile
BTW. Bascom also have option for that ->Option->Environment->Show Special Characters but maybe this will not be so visible for the first look.
 |
|
Back to top |
|
 |
autoguider
Joined: 24 Sep 2007 Posts: 82 Location: Aachen

|
Posted: Tue Nov 22, 2022 2:41 pm Post subject: |
|
|
Many thanks for your advice.
In Options>Environment-> Font I found the checkbox to show the special characters.
With your advised corrections I was able to get a compilation.
So far so good but now I am facing another problem which seems to be caused by Copying and /pasting data from the Windows editor
I made the strange experience that BASCOM starts up the opening process of the file that I edited yesterday.
I see a BASCOM fileeditor window opened and a green progress bar in the IDE bottom section.
Then the IDE disappears without any message/ comment.
So I have no other choice but to open the file in the editor, copy the code and paste it into a new BASCOM file.
Then it compiles fine.
I save it.
When reopening I face the problem as described above. Opening starts, progress bar long and green and the the application is closed without any warning/ message.
I can create a new file in BASCOM, save it, close it and reopen it.
When pasting some code from another file that was opened in the BASCOM environment save and close it reopening runs well.
When pasting some code from another file file that I opened in the Windows editor I can save it but reopening it fails.
Further investigation:
When creating the new file in the IDE and having the option for the special characters activated the new file contains a lot of EOF characters only.
After pasting, even of a few lines only, I do not see any EOF.
The long progress bar when loading is suspicious. maybe BASCOM does not find an EOF.
Is there an intereference to VisualBasic (VisualStudio 2019) that I have also on my computer?
I keep on trying to copy from the editor function by function.
Do you have some idea what to do?
Thx again
Christian |
|
Back to top |
|
 |
EDC
Joined: 26 Mar 2014 Posts: 1133

|
Posted: Tue Nov 22, 2022 8:50 pm Post subject: |
|
|
Maybe you should start with update your Bascom.
Download 2085 installer and install it in new folder.
I always do that and have previous for "some reasons"
Here I have "only" from 2082 because i change my computer.
Bascom from some version create separate XML file that can sometimes fix your Bascom installation.
In Bascom IDE you find ->Help ->About ->App data dir.
If you click that link then folder should open and then you must close entire Bascom because those files are keept in the memory and resaved on Bascom close.
So if Bascom is closed then rename your XML into something else like "___bascom-avr2083.xml"
Then if you reopen Bascom then it should be like new.
If that not help then you probably must search problem in your PC. |
|
Back to top |
|
 |
|