Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 23:25 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 : MMBasic for Windows - betas

     Page 28 of 30    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9116
Posted: 09:34am 21 Dec 2023
Copy link to clipboard 
Print this post

This has changed the version to b22 so you can be sure


MMBasic.zip
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4234
Posted: 09:54am 21 Dec 2023
Copy link to clipboard 
Print this post

Minor: adapt copyright date to 2023 -or- 2024

Volhout
PicomiteVGA PETSCII ROBOTS
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 10:03am 21 Dec 2023
Copy link to clipboard 
Print this post

Sorry Peter, This what I see. I am running it from MMEdit but I don't see how that could affect anything.



Same program with MMBasic DOS



This program still crashes MMB4W.
OPEN "com3: 38400" AS #2
input #2, test$
print test$
CLOSE #2



Bill
Keep safe. Live long and prosper.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9116
Posted: 10:51am 21 Dec 2023
Copy link to clipboard 
Print this post

What is the zero when you start up? Have you got something running - try deleting .options
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 11:43am 21 Dec 2023
Copy link to clipboard 
Print this post

The zero comes from running the program at startup, MMEdit runs the program when it starts MMB4W. It's the same zero that you see after I type RUN. I have no strange OPTIONS set I believe.

One thing though, the program being run is not in my default directory it is in a subdirectory of /micros > /micros/MMB4W but I can't see how that can have any bearing. But...



Sorry off to bed now.

Bill
Keep safe. Live long and prosper.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 12:02pm 21 Dec 2023
Copy link to clipboard 
Print this post

Not seeing a problem. Sending "hello" at 10mS intervals from a PicoVGA MMB4W receives ok.
Pico
do :? "hello" :pause 10 :loop

MMB4W
> ? mm.ver
5.07032
> open "com7: 115200" as #9
> for n=0 to 9 :input #9, test$ :? test$ :pause 9 :next

hello
hello
...
>


Edit
Down loaded the latest 5.070322 .exe and same result.
Output from another program.

Edited 2023-12-21 22:29 by phil99
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9116
Posted: 12:35pm 21 Dec 2023
Copy link to clipboard 
Print this post

  Quote  Not seeing a problem.


 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6098
Posted: 08:04pm 21 Dec 2023
Copy link to clipboard 
Print this post

Sorry, but I still can't get it to work.
Works OK from the command line as per Phil but not in a program.



Running in a program does send to the cmm2 and the receive buffer gets the data returned but unable to retrieve from the rx buffer.

OPEN "com4:460800" AS #8
PRINT #8, "fred"
PAUSE(1000)
PRINT LOC(#8)
test$ = INPUT$(100,#8)
PRINT test$
CLOSE #8


Jim

Edit:
If you use
INPUT #8, test$
it works OK so the problem is with the INPUT$(nn,#x) command.
Edited 2023-12-22 06:40 by TassyJim
VK7JH
MMedit   MMBasic Help
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3802
Posted: 09:00pm 21 Dec 2023
Copy link to clipboard 
Print this post

I wonder if the print test$ could be fooling you...

What is len(test$)?

How about getting each char out of test$ and printing its asc() value in case there's ... I don't know, something in there?

INPUT and INPUT$() are somewhat different. E.g. they stop reading for different reasons and so don't return the same chars.

John
Edited 2023-12-22 07:01 by JohnS
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 10:22pm 21 Dec 2023
Copy link to clipboard 
Print this post

INPUT$() seems to work ok at the command line.
> for n=0 to 9 :a$ = input$(255,#9) :pause 9 :? a$ :next
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 10:44pm 21 Dec 2023
Copy link to clipboard 
Print this post

I don't want to use this in a command line I need to use it in a program. The very same program works in MMBasic DOS. Same port, same program and the same input source.

For my tests the MM2 is sending "Hello from the MM2" continuously with a 10mS gap. This not a real test of what I want to do, I only want to send a few characters at a time spasmodically, say from a joystick.

Perhaps, because the MM2 is sending this repeatedly at a rapid rate, is it filling up the coms buffer before I run the MMB4W program and this is causing MMB4W problems. So perhaps a more "real world" type test would be more appropriate. But it works with MMBasic DOS.

I'm not sure how much more I can go with this until after Christmas. My MM2 device has no I/O so maybe I can try a CMM2 with a joystick sending a message only when the joystick is operated.

Bill

PS I know that calling "MMBasic DOS" just that is not really correct because it is really running in Windows but I'll continue calling it that to differentiate between it and MMB4W.
Keep safe. Live long and prosper.
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1101
Posted: 11:19pm 21 Dec 2023
Copy link to clipboard 
Print this post

The following works fine for me - note I am running MMB4W under wine on Mint Cinnamon. For this, com ports come up as COM33, COM34 etc (equates to ttyACM0 and ttyACM1 respectively under linux). I have the two ports connected back to back in 2 microbridges (COM33/ttyACM0 Tx to COM34/ttyACM1 Rx).


> print mm.ver
5.070322
> option list
OPTION Default mode 9 1024x768
OPTION Default Font 2,1
OPTION Default path C:\MMB4W\work\
OPTION Keyboard US,1000,50
Current display 38,85
> list
open "COM33: 115200" as #1 'mint ttyACM0
open "COM34: 115200" as #2 'mint ttyACM1
do
 print "Start loop"
 print #1,"test1 using INPUT"
 pause 1000
 input #2, a$
 pause 1000
 print "from #2 - "+a$
 pause 1000
 print #1,"test2 using INPUT$"
 pause 1000
 b$ = input$(20,#2)
 pause 1000
 print "from #2 - "+b$
 pause 1000
 print "looping"

loop

> run
Start loop
test1 using INPUT
test2 using INPUT$

looping
Start loop
test 1 using INPUT
.
.
.

... so, nothing wrong that I can see?
Doug.
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3802
Posted: 11:33pm 21 Dec 2023
Copy link to clipboard 
Print this post

  Turbo46 said  For my tests the MM2 is sending "Hello from the MM2" continuously with a 10mS gap.

Is it sending CR and/or LF as well?

You PRINT in the MMB4W listing without ";" (semi-colon) - is that confusing maybe?

John
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 12:16am 22 Dec 2023
Copy link to clipboard 
Print this post

Thanks Fellas.

John, I don't know whether MMBasic terminates a PRINT with <CR> or <LF> or <CR><LF>. I think from memory it is just <CR>. I did use a hex editor on a file written to by MMBasic but I don't remember what I found now. I would expect that one version of MMBasic would be compatible with another. I don't think the semi-colon is an issue.

Doug, Thanks for your test but if it does do anything for me it strengthens my suspicion that, for my test, the com buffer is being filled before MMB4W even gets to it and that is causing MMB4W problems. I need to try a more real world test when time permits.

But it works with MMBasic DOS.

Bill
Keep safe. Live long and prosper.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6098
Posted: 12:29am 22 Dec 2023
Copy link to clipboard 
Print this post

I think I have gone as far as I can with this.
OPEN "com4:460800" AS #8
PRINT #8, "fred"
PAUSE 1000
atest$ = INPUT$(100,#8)
PRINT atest$
CLOSE #8

works

OPEN "com4:460800" AS #8
PRINT #8, "fred"
PAUSE 1000
test$ = INPUT$(100,#8)
PRINT test$
CLOSE #8


fails

The only difference is the second code uses test$ as the variable name.

Baa Humbug...
Jim
VK7JH
MMedit   MMBasic Help
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 02:25am 22 Dec 2023
Copy link to clipboard 
Print this post

This works quite well. Sending Bin$ to make it easier to see what is happening. Change to Hex$ for practical use, adjusting receive end to match.
'test.bas
open "com7: 115200, , buffer, 16" as #3
do
 if flag then
  flag = 0
  ? a$
 endif
loop

sub buffer
 a$ = input$(16,#3)
 flag = 1
end sub

close #3
end

' Program running on PicoMiteVGA
'
dim integer m, n
m = 2^16
do
 inc n
 n = n mod m
 pause 999
 ? bin$(n,16)
loop
end

Edit.

Edited 2023-12-22 13:00 by phil99
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 02:55am 22 Dec 2023
Copy link to clipboard 
Print this post

Hmmm. The plot thickens. Maybe the variable name TEST is part of some internal debugging code:


The first zero is because the program is run immediately it is loaded.

It does work on MMBasic DOS.

Bill
Keep safe. Live long and prosper.
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1611
Posted: 03:16am 22 Dec 2023
Copy link to clipboard 
Print this post

So I changed the name from test$ to a$ and ran it again.



As you can see it doesn't print zero now but prints nothing. Again it does work on MMBasic DOS.

I wonder if MMBasic DOS empties the com buffer as it opens the port while MMB4W doesn't?

From that and TassyJim's test it does seem the TEST is some kind of internal variable that overrides it's use in a program.

Bill
Keep safe. Live long and prosper.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6098
Posted: 03:26am 22 Dec 2023
Copy link to clipboard 
Print this post

"test" is used as a variable name in the source code in commands.ccp and one of the json files.
Perhaps it has escaped it's local status and become global.
VK7JH
MMedit   MMBasic Help
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2135
Posted: 04:29am 22 Dec 2023
Copy link to clipboard 
Print this post

  Quote  I wonder if MMBasic DOS empties the com buffer as it opens the port while MMB4W doesn't?

I wondered about that. If I stop and restart my MMB4W program (a few posts above) sometimes the lower characters remain static while the higher characters count up at the rate that the lower characters should, suggesting there are already a few in the receive buffer.
It's also possible the program started mid-transmission, it has no means of getting back in step. Discarding the first input$ might be a solution.

Adding CLEAR to the start of the program seems to fix it, though might be just luck.

Edit
So far this seems ok,
'test 2.bas
clear
open "com7: 115200" as #3
pause 10
a$ = input$(255,#3)
a$ = ""
close #3
pause 10
open "com7:115200,, buffer, 4" as #3
pause 10

do
 If flag then
  ? a$
  flag = 0
 endif
loop

sub buffer
 a$ = input$(4,#3)
  inc flag
end sub

Edited 2023-12-22 15:01 by phil99
 
     Page 28 of 30    
Print this page
© JAQ Software 2024