Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Can't declare new Function?

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

Bascom Member



Joined: 16 Jul 2004
Posts: 523

blank.gif
PostPosted: Sun Aug 04, 2019 7:43 pm    Post subject: Can't declare new Function? Reply with quote

Code:

$regfile = "m2561def.dat"
$crystal = 16000000
$hwstack = 400
$swstack = 550
$framesize = 345
$Baud = 57600


Declare Function ConvertToLog(Test) As Single


Function ConvertToLog(Test) As Single


End Function


Compiling result:

Error : 26 Line : 12 AS expected [AS expected] , in File : C:\MCS Electronics\BASCOM-AVR\test_function.bas

(Notice I did install the new 2.0.8.2 into the existing directory where previous versions have resided for years. Might this cause problems?)
Quote:


(BASCOM-AVR version : 2.0.8.2 )
Back to top
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 971

poland.gif
PostPosted: Sun Aug 04, 2019 7:58 pm    Post subject: Reply with quote

You should declare what type of variable "Test" will be...
Code:
Declare Function Converttolog(byval Test As Byte) As Single


Function Converttolog(byval Test As Byte) As Single


End Function
Back to top
View user's profile Visit poster's website
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Sun Aug 04, 2019 8:04 pm    Post subject: Re: Can't declare new Function? Reply with quote

KenHorse wrote:
Code:
Declare Function ConvertToLog(Test) As Single

Problem is: you forget faster than you learn.
The compiler simply tells you that Test needs dimensioning.
Back to top
View user's profile
KenHorse

Bascom Member



Joined: 16 Jul 2004
Posts: 523

blank.gif
PostPosted: Thu Aug 08, 2019 12:42 am    Post subject: Re: Can't declare new Function? Reply with quote

MWS wrote:
KenHorse wrote:
Code:
Declare Function ConvertToLog(Test) As Single

Problem is: you forget faster than you learn.
The compiler simply tells you that Test needs dimensioning.


Stupid oversight on my part.......

Thanks
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