Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 16:37 26 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Help for multi line comment please

Author Message
Hans

Senior Member

Joined: 18/10/2022
Location: Canada
Posts: 116
Posted: 06:22pm 29 Jan 2024
Copy link to clipboard 
Print this post

hi all;

I'm using the newest release of picomite code and perhaps my error is not understanding the wording in the manual regarding multi line comments.

I am getting an error that I think is telling me the end of the comment is missing.

Here are the screen shots;







I just wanted to comment out a bunch of code, without the comments the code all works.

Thanks for your help guys.

Hans ...  
 
LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 479
Posted: 06:26pm 29 Jan 2024
Copy link to clipboard 
Print this post

I don't know if Basic has multiline comments, and it's strange to use C style comment blocks. I could be wrong, but is strange  
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6787
Posted: 06:38pm 29 Jan 2024
Copy link to clipboard 
Print this post

MMBasic does have multi-line comments now. :)

Does it work if you use individual comments on each line, Hans?

What happens if you run it as a DO/LOOP instead of calling it as a SUB?



EDIT:
I've just tried something similar and it looks to me as if */ isn't closing the comment.

On removing the multi-line comment marks the editor reverts to b/w too, although adding a new ' comment still colours that correctly. Other new commands aren't coloured.

.
Edited 2024-01-30 06:00 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Hans

Senior Member

Joined: 18/10/2022
Location: Canada
Posts: 116
Posted: 09:17pm 29 Jan 2024
Copy link to clipboard 
Print this post

Hi Mick;

Yes it will run without error if I individually comment each line.
I just thought it would be nicer to comment out a bunch of lines with this new functionality.

But now it's a case of understanding what the manual is saying in the event I have a larger project and want to mass comment.

The sub routine is actually an interrupt handler for the buttons pushed. I probably should have mentioned that.

Did not try the do loop and you can see why in the program I provided. I have an Arduino pinned hat with a joystick and 6 buttons. Too many wires in the way to test coding with just the joystick so I dug the joystick out of my Arduino kit and just wired it separately.

' Funduino Version 5
' 3V switched on

SetPin gp6,intl,button 'K
SetPin gp7,intl,button 'A
SetPin gp8,intl,button 'B
SetPin gp26,ain
SetPin gp27,ain

'Print "Funduino Joystick"
Print ""

Do

 Print Pin(gp26), Pin(gp27)
 Pause 300

Loop

Sub button

 If Pin(gp6)=0 Then
   Print "K = PRESSED"
   Pause 300
 EndIf
/*
 If Pin(gp7)=0 Then
   Print "A = PRESSED"
   Pause 300
 EndIf

 If Pin(gp8)=0 Then
   Print "B = PRESSED"
   Pause 300
  EndIf
*/
End Sub



BTW this is the original controller I was using. I got rid of the headers on top of the board.




Thanks guys,

Hans ...
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1241
Posted: 09:39pm 29 Jan 2024
Copy link to clipboard 
Print this post

Hi Hans,
I think you did everything right.
Looks like a MMBasic bug to me.

Best regards
Michael
causality ≠ correlation ≠ coincidence
 
Hans

Senior Member

Joined: 18/10/2022
Location: Canada
Posts: 116
Posted: 09:53pm 29 Jan 2024
Copy link to clipboard 
Print this post

Hi Michael;

Maybe but the manual wording is tricky.
I have tried different coding methods to no avail.



Maybe I'm reading too much into this.

Thanks guys

Hans ...  
Edited 2024-01-30 07:54 by Hans
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6787
Posted: 10:07pm 29 Jan 2024
Copy link to clipboard 
Print this post

No, I think what you've done is correct.

/*
this is
a multiline
comment
*/ and you can use this line as well

works correctly as a piece of stand-alone code.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9115
Posted: 10:48pm 29 Jan 2024
Copy link to clipboard 
Print this post

Multi-line comments can't be used inside subroutines and functions - this is a limitation of the way they work
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1241
Posted: 11:17pm 29 Jan 2024
Copy link to clipboard 
Print this post

  matherp said  Multi-line comments can't be used inside subroutines and functions - this is a limitation of the way they work

It's good that this could be clarified.

Regards
Michael
causality ≠ correlation ≠ coincidence
 
Hans

Senior Member

Joined: 18/10/2022
Location: Canada
Posts: 116
Posted: 12:10am 30 Jan 2024
Copy link to clipboard 
Print this post

Hi Peter;

Thank you for that bit of information.

Thank you to all who responded.

Hans ...  
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024