View previous topic :: View next topic |
Author |
Message |
Sarek
Joined: 15 Oct 2009 Posts: 72
|
Posted: Thu Oct 08, 2015 10:42 am Post subject: Error : 342 Line : 59 OFFSET not allowed, too many lo |
|
|
Hi,
I try to program a template as a SUB for a user defined vertical bargraph (FT800).
I pass many parameters as BYVAL, so I can pass constants e.g. for colors ...
I get this errors if I define too many parameters and locals:
Code: |
Error : 342 Line : 59 OFFSET not allowed, too many locals used [Y_VALUE] , in File : FT80x_User_Functions.inc
Error : 203 Line : 77 Error in LD or LDD statement [Y+64] , in File : FT80x_User_Functions.inc
Error : 203 Line : 77 Error in LD or LDD statement [Y+65] , in File : FT80x_User_Functions.inc
Error : 203 Line : 77 Error in LD or LDD statement [Y+64] , in File : FT80x_User_Functions.inc
Error : 203 Line : 77 Error in LD or LDD statement [Y+65] , in File : FT80x_User_Functions.inc
Error : 203 Line : 91 Error in LD or LDD statement [Y+64] , in File : FT80x_User_Functions.inc
Error : 203 Line : 91 Error in LD or LDD statement [Y+65] , in File : FT80x_User_Functions.inc
Error : 203 Line : 98 Error in LD or LDD statement [Y+64] , in File : FT80x_User_Functions.inc
Error : 203 Line : 98 Error in LD or LDD statement [Y+65] , in File : FT80x_User_Functions.inc
Error : 203 Line : 98 Error in LD or LDD statement [Y+64] , in File : FT80x_User_Functions.inc
Error : 203 Line : 98 Error in LD or LDD statement [Y+65] , in File : FT80x_User_Functions.inc
Error : 203 Line : 99 Error in LD or LDD statement [Y+64] , in File : FT80x_User_Functions.inc
Error : 203 Line : 99 Error in LD or LDD statement [Y+65] , in File : FT80x_User_Functions.inc
Error : 203 Line : 101 Error in LD or LDD statement [Y+64] , in File : FT80x_User_Functions.inc
Error : 203 Line : 101 Error in LD or LDD statement [Y+65] , in File : FT80x_User_Functions.inc
Error : 203 Line : 102 Error in LD or LDD statement [Y+64] , in File : FT80x_User_Functions.inc
Error : 203 Line : 102 Error in LD or LDD statement [Y+65] , in File : FT80x_User_Functions.inc
Error : 203 Line : 102 Error in LD or LDD statement [Y+64] , in File : FT80x_User_Functions.inc
Error : 203 Line : 102 Error in LD or LDD statement [Y+65] , in File : FT80x_User_Functions.inc
|
Where is the maximum for passed parameters and locals?
Here the Declare Sub:
Code: |
Declare Sub Cmd_ud_v_bargraph(byval X0 As Word , Byval Y0 As Word , Byval Width As Integer , Byval Height As Integer , Byval Frame As Byte , _
Byval Value_act As Integer , Byval Value_min As Integer , Byval Value_max As Integer , _
Byval Value_warn As Integer , Byval Value_error As Integer , _
Byval Cl_frame As Dword , Byval Cl_bgr As Dword , _
Byval Cl_bargraph_act As Dword , Byval Cl_bargraph_warn As Dword , Byval Cl_bargraph_error As Dword , _
Byval Font_label_min_max As Byte , Byval Cl_label_min_max As Dword , _
Byval Font_label_act As Byte , Byval Cl_label_act As Dword , _
Byval Font_label_headline As Byte , Byval Cl_label_headline As Dword )
'(
X0 : Position X in pixels
Y0 : Position Y in pixels
Width : Width in pixels
Height : Height in pixels
Frame : Frame in pixels
Value_act : Value actual
Value_min : Value minimum (for scaling and label min)
Value_max : Value maximum (for scaling and label max)
Value_warn : Value warning (for color change bargraph e.g.=>yellow)
Value_error : Value error (for color change bargraph e.g.=>red )
Cl_frame : Color Bargraph Frame
Cl_bgr : Color Bargraph Background
Cl_bargraph_act : Color Bargraph (act.value < warning and < error value)
Cl_bargraph_warn : Color Bargraph (act.value > warning and < error value)
Cl_bargraph_error : Color Bargraph (act.value > warning and > error value)
Font_label_min_max : Font Label minimum and maximum inside bargraph
Cl_label_min_max : Color Label minimum and maximum inside bargraph
Font_label_act : Font Label actual value inside bargraph
Cl_label_act : Color Label actual value inside bargraph
Font_label_headline : Font Label Headline above bargraph
Cl_label_headline : Color Label Headline above bargraph
')
Locals:
|
Local X1 As Word : Local X2 As Word : Local X3 As Word
Local Y1 As Word : Local Y2 As Word : Local Y3 As Word
Local Y_range As Word
Local Value_range As Integer
Local L_long As Long
Local Y_value As Word
Code: |
If i use a few more bytes as parameter or local the Error will appear.
|
(BASCOM-AVR version : 2.0.7.9 , Latest : 2.0.7.8 ) |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Thu Oct 08, 2015 11:30 am Post subject: Stack and framesize? |
|
|
What about stack and framesize?
Have fun
Ben Zijlstra |
|
Back to top |
|
|
Sarek
Joined: 15 Oct 2009 Posts: 72
|
Posted: Thu Oct 08, 2015 12:05 pm Post subject: Re: Stack and framesize? |
|
|
bzijlstra wrote: | What about stack and framesize?
Have fun
Ben Zijlstra |
has no influence!
I already tested with
$hwstack = 1024
$swstack = 1024
$framesize = 1024 |
|
Back to top |
|
|
Plons
Joined: 24 May 2005 Posts: 435 Location: Hilversum - The Netherlands
|
Posted: Thu Oct 08, 2015 12:23 pm Post subject: |
|
|
If passing so many parameters causes problems, is keeping them global not a better option ? _________________ Bascom AVR ver 2.0.8.6
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel" |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Oct 08, 2015 12:53 pm Post subject: |
|
|
the AVR has a limit to the offset that can be addressed. normally one can address using y+offset and the maximum is 63. of course there could be additional code to increase the pointer, and to decrease it after the access but i wondered if anyone would pass so many parameters. if you write to support i will see what can be done. _________________ Mark |
|
Back to top |
|
|
Sarek
Joined: 15 Oct 2009 Posts: 72
|
Posted: Thu Oct 08, 2015 1:31 pm Post subject: |
|
|
albertsm wrote: | the AVR has a limit to the offset that can be addressed. normally one can address using y+offset and the maximum is 63. of course there could be additional code to increase the pointer, and to decrease it after the access but i wondered if anyone would pass so many parameters. if you write to support i will see what can be done. |
thank you for your quick answer!
I already have seen the error message with [Y+64] and I thought 64Bytes must be a limit.
But I wonder because I have in above example 54 Bytes Parameters and 22 Bytes Locals and it works!
If I add one more local byte the compiler error appears.
So where I can see the limit of 64Bytes?
I think I will split the Sub.
The reason for this template is a universal bargraph for the FT800.
Calling like this:
Code: |
Cmd_ud_v_bargraph 400 , 20 , 60 , 200 , 1 , _
Pwm_bright , -50 , 128 , 70 , 90 , _
Black , Silver , Lime , Yellow , Red , _
16 , Blue , 18 , Blue , 18 , Black , "T_mot"
|
result in attachment |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Oct 08, 2015 3:12 pm Post subject: |
|
|
you get this when the total parameters and local exceed 32. (each address requires 2 bytes). _________________ Mark |
|
Back to top |
|
|
Plons
Joined: 24 May 2005 Posts: 435 Location: Hilversum - The Netherlands
|
Posted: Thu Oct 08, 2015 3:43 pm Post subject: |
|
|
FWIW: a hardwarestack of 1024 is overdone, don't you think ?
Passing a pointer to an array of values you want, to the sub, would be my choice. _________________ Bascom AVR ver 2.0.8.6
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel" |
|
Back to top |
|
|
Sarek
Joined: 15 Oct 2009 Posts: 72
|
Posted: Thu Oct 08, 2015 6:00 pm Post subject: |
|
|
Plons wrote: | FWIW: a hardwarestack of 1024 is overdone, don't you think ?
Passing a pointer to an array of values you want, to the sub, would be my choice. |
Hwstack 1024
was only for quick and dirty testing purposes.
I use Xmega256A3, there is enough RAM. |
|
Back to top |
|
|
Sarek
Joined: 15 Oct 2009 Posts: 72
|
Posted: Fri Oct 09, 2015 8:17 am Post subject: |
|
|
Plons wrote: | Passing a pointer to an array of values you want, to the sub, would be my choice. |
How can i adress a variable which is bigger than 1 Byte via pointer? |
|
Back to top |
|
|
Plons
Joined: 24 May 2005 Posts: 435 Location: Hilversum - The Netherlands
|
Posted: Fri Oct 09, 2015 9:42 am Post subject: |
|
|
Have a look at "Array". That's the kind of pointer I am pointing at
But back to the OP (Original Problem):
It is good practice to pass variables to a Sub or Function. But if that causes a problem because you need to pass too many variables (more than 32 ), your next option is to do it a little less slick and use global variables, the old-school Gosub.
How is your son doing ?
Nard _________________ Bascom AVR ver 2.0.8.6
Dragon-lair: http://www.aplomb.nl/TechStuff/Dragon/Dragon.html
"leef met vlag en wimpel, maar hou het simpel" |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|