Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

New ver. does not show error

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
jure_m

Bascom Member



Joined: 14 Jan 2005
Posts: 68
Location: Ljubljana

slovenia.gif
PostPosted: Thu Feb 03, 2022 11:24 am    Post subject: New ver. does not show error Reply with quote

Hi,

I have this code. If compiled with Bascom2085 it does not compile and does not say if there are any warnings and the program does not work:


Code:
$regfile = "M8def.dat "
$hwstack = 25
$swstack = 25
$framesize = 25
$crystal = 8000000
$baud = 38400

Config Submode = New

Declare Sub Teststr(b As Byte , Dl() As String)

Dim B As Byte
Dim I As Byte
Dim Bb As Byte
Dim Ar(20) As Byte

Dim Sar As String * 20                                      'strng array
Dim Dl As String * 20                                       'strng array

Sar = "TEST LIA"

'----------------------------------------------------------------------------------------------
Do
     Bb = 1
     Call Teststr(bb , Sar(1))
Loop
'----------------------------------------------------------------------------------------------
End
'----------------------------------------------------------------------------------------------

Sub Teststr(b As Byte , Dl() As String)
    Dl(b) = Dl(b) + "add"
End Sub


If I compile it with Bascom 2082, it shows errors :
Error : 238 Line : 25 Variable is not dimensioned as an array [SAR(1)]
Error : 263 Line : 25 Array index out of range [1] , in File : I:\Arhiv_Jure\BascomAVR\Jure\Doma\Jure\TMP_Rudi.bas
Error : 124 Line : 25 LOOP expected , in File : I:\Arhiv_Jure\BascomAVR\Jure\Doma\Jure\TMP_Rudi.bas

Is there something wrong with the file or new version of Bascom?

Best regards
Jure

(BASCOM-AVR version : 2.0.8.5 )
Back to top
View user's profile Visit poster's website
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5922
Location: Holland

blank.gif
PostPosted: Thu Feb 03, 2022 11:51 am    Post subject: Reply with quote

you declare this : Declare Sub Teststr(b As Byte , Dl() As String)
which means you will pass an array of strings.

but then you use this : Call Teststr(bb , Sar(1))

which ok, is a string but: you dimmed it like : Dim Sar As String * 20
which is a normal string.
so no that will not work. that an older version allowed that does not mean it is ok.

and the error actual point this out.

_________________
Mark
Back to top
View user's profile Visit poster's website
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Thu Feb 03, 2022 1:46 pm    Post subject: Re: New ver. does not show error Reply with quote

jure_m wrote:
Is there something wrong with the file or new version of Bascom?

I use 2085 and get 4 errors. Likely your error window is hidden, try to reset the IDE.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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