Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20563

BASCOM-AVR : Cannot compile with sub : REPLY

$
0
0
Hello svein If you use the Call statment to call a sub you must include the enclosing parentheses but without the Call statement you leave them out but you can not mix them you first use Pos(1 , 2) then you use Pos 1 , 2 The code now works as I use Call Pos(1 , 2) both times Note if you use CONFIG SUBMODE = NEW then you need to move the sub to the front of the code. A good thing to start doing in Bascom is to put your sub's in a seperate file as then you can use the $Include statement to place them where you want, this works well with Bascom and its "Project" mode as you can have the sub's open in their own screens making it easy to move from the main code to them and back without scrolling up and down all the time it also makes the sub's modular if you use Local variables in them and only use global ones to pass info to them. Regards Paul [code:1:ecb4976268] $regfile "M328pdef.dat" $crystal = 16000000 $baud = 9600 'CONFIG SUBMODE = NEW Dim X As Byte Dim Y As Byte Declare Sub Pos(byval X As Byte , Byval Y As Byte) Open "comb.3:9600,8,n,1" For Output As #1 Waitms 500 Print #1 , "serial output" Wait 1 Print #1 , Chr(12); Waitms 2 Call Pos(1 , 2) Waitms 10 Print #1 , "3.25 3.26 3.27 3.18" Print #1 , "4.25 4.26 25.2"; Wait 5 Call Pos(3 , 6 ) Print #1 , "Jauda" Wait 5 End Sub Pos(x As Byte , Y As Byte) Print #1 , Chr(27) ; "O" ; Chr(x) ; Chr(y); End Sub [/code:1:ecb4976268]

Viewing all articles
Browse latest Browse all 20563

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>