View previous topic :: View next topic |
Author |
Message |
CBailey
Joined: 07 May 2015 Posts: 102
|
Posted: Wed May 17, 2023 1:22 am Post subject: 'Variable not dimensioned', even though it is |
|
|
When compiling my code, I get this error:
Error : 93 Line : 512 Variable not dimensioned [___DWTMPA] , in File : C:\Users\Charles\Desktop\Parkinsons\BASCOM Code\PDG-Timers-0.1.bas
Here's line 512:
PulseStartWJitter = RND(JitterSetting)
Both variables are already dimensioned as Word. If I try dimensioning them again, I get an error about already dimensioned. If I change it to this:
PulseStartWJitter = RND(15)
it still doesn't compile. If I change it to this:
PulseStartWJitter = JitterSetting
It DOES compile. If I change it to:
J = RND(JitterSetting) ' J is dimensioned as Word
It again does compile. Any ideas why?
(BASCOM-AVR version : 2.0.8.5 ) |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Wed May 17, 2023 3:46 am Post subject: |
|
|
Do you saw a "Code" button when you make a post?
It is always MANDATORY (when you quote a compiler answear) to make shortest as possible code you cant compile with atleast @regfile that designates uC... stacks are also important.
Believe me sometimes Attiny13 dont have USART and then print dont work, I know that this is maybe not this case but please be precise what a uC you are using. It is important _________________ Check B-Flash -my MCS bootloader app for Android |
|
Back to top |
|
|
CBailey
Joined: 07 May 2015 Posts: 102
|
Posted: Wed May 17, 2023 4:52 am Post subject: |
|
|
Thanks for the help EDC!
The program is getting a bit big and finding a smaller version that would still compile has not been successful yet.
Here are the vitals:
$regfile = "m328pdef.dat" 'Set the AVR to use - ATMega328.
$crystal = 16000000 'Set the AVR clock.
'
$hwstack = 64 'Set the capacity of the hardware stack.
$swstack = 64 'Set the capacity of the software stack.
$framesize = 64 'Set the capacity of the frame area.
Config RND = 32
CONFIG BASE = 0 '
The hwstack and swstack were smaller, so I raised them to 64. |
|
Back to top |
|
|
CBailey
Joined: 07 May 2015 Posts: 102
|
Posted: Wed May 17, 2023 5:46 am Post subject: |
|
|
I found the offending line. If I remark this out, it works:
'Config RND = 32
Any idea why? I'm still confused. |
|
Back to top |
|
|
MWS
Joined: 22 Aug 2009 Posts: 2262
|
Posted: Wed May 17, 2023 7:59 am Post subject: |
|
|
___DWTMPA stands for processor registers R16-R19.
These are internal dimensioned types for assembler use, obviously a temporary double word.
You can see them if you configure options -> compiler > output to 'Show internal variables'.
Then, after a successful compile hit Ctrl-W, opening the report, look for them about one page down:
Code: | ___DWTMPA 0010 16
___DWTMPB 0014 20
___DWTMPC 0018 24 |
In case these aren't shown, report to MCS.
However, if they are shown, there are two options:
1) Either you messed something up
2) or it's a compiler hickup, which occurs as soon as alternative rnd() code is compiled in, which again is triggered by Config RND = 32.
If you are not lazy, then boil down your code the way you can post it here, while it still shows the problem.
EDC already told you:
Quote: | It is always MANDATORY (when you quote a compiler answear) to make shortest as possible code you cant compile with atleast @regfile that designates uC |
If you want to go by ignore-mode, don't expect me or others to go for extra lengths, while you don't do your part.
In case your boiled down code shows it's a compiler bug, then report to MCS. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Wed May 17, 2023 9:18 am Post subject: |
|
|
if the code is big just attach it as a ZIP. _________________ Mark |
|
Back to top |
|
|
CBailey
Joined: 07 May 2015 Posts: 102
|
Posted: Wed May 17, 2023 1:22 pm Post subject: |
|
|
I made it a bit smaller.:
Code: |
'
$programmer = 22 'ARDUINO (using stk500v1 protocol)
$regfile = "m328pdef.dat" 'Set the AVR to use - ATMega328.
$crystal = 16000000 'Set the AVR clock.
'
$hwstack = 48 'Set the capacity of the hardware stack.
$swstack = 80 'Set the capacity of the software stack.
$framesize = 80 'Set the capacity of the frame area.
Config RND = 32
CONFIG BASE = 0 ' This makes arrays start at 0 instead of 1
Dim JitterSetting as Word ' This is the jitter value set.
Dim PulseStartWJitter as Word
'---------------------------------------------------
'***************************************************
MainLoop:
goto mainloop
'***************************************************
MakeJitter:
PulseStartWJitter = RND(JitterSetting)
Return
|
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Wed May 17, 2023 1:52 pm Post subject: |
|
|
it appears to be a bug. i will check it further.
if you dim Pulsestartwjitter as dword or long it will work. but integer/word seems to fail. _________________ Mark |
|
Back to top |
|
|
|