![]() |
Forum Index : Microcontroller and PC projects : MMBasic for DOS Beta 6
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
flip Senior Member ![]() Joined: 18/07/2016 Location: AustraliaPosts: 114 |
Please don't worry on my account...after tinkering I'm now sorry I mentioned it and thinking about it it's not really needed anyway.. MMBasic for DOS would generally be so much faster ![]() Regards, Phil |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1868 |
Sorry for this longish rambling post: I had already done that and about everything I could think of. Now before I posted, I made sure to run simple code of sending only one byte from MMBasic and receiving that one Byte on a separate Windows terminal application. 1: TX 1 Byte from MMBasic over COM8. 2: RX 1 Byte from COM10 using a Win terminal application. Always the wrong value received. 1: TX 1 Byte from a another Win app over COM8. 2: RX 1 Byte from COM10 using same Win app as with MMbasic test. Correct data received. I even rebooted the PC three times over the day trying to fault find. This morning I RESUME the PC (from last night session). Press run - the CORRECT char is returned!!! seriously ??? Load the full E-100 code and transmit 32 bytes out one port and receive it over the 2nd port in the same code - no delays and 100% every time. WTH? This is not user error as everything was as I left it last night - nothing touched, no cables moved - press on button - press run and it worked. I'm taking up basket weaving. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
Your experience shows why this joke could actually be true... Geoff Geoff Graham - http://geoffg.net |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1868 |
So true, but the good thing is that DOS MMBasic is now working perfectly on the COM ports, I've done everything to try and replicate the fault but to no avail, which irks me on some level. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
MicroBlocks![]() Guru ![]() Joined: 12/05/2012 Location: ThailandPosts: 2209 |
If the connection uses USB (USB-Serial) then first thing to do is go into devicemanager and uninstall all the USB drivers. Then do a check for new hardware. It happens especially when you use USB hub and lots of connections/disconnections. Somehow the USB drivers get confused and resetting that helps. I even had situations where my keyboard and/or mouse stop working when i repeatedly connected and disconnected USB devices. It happens faster when you not use the exact same port to plug in the same device. It can take between one hour and a few months, so this is not something that can be easily debugged. De mentioned solution worked at least for me every time. The USB drivers are assigned to a specific USB HUB/port and those stay valid even when restarting or coming out of hibernation. The do 'fix' themselves sometimes but i am still unaware of what trigger that. My thinking about it now to explain it is: Maybe there is a certain amount of retries before it enumerates the USB devices again instead of using the last known 'preferred' values. It is all done to make starting up the computer faster, by saving the last situation it does not need to scan and enumerate every single time. Microblocks. Build with logic. |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1868 |
Hi, I'm right up with the problems of USB on the Windows platform. Write a lot of SW and assembler code for industrial micros. Most need a Windows communications application to control them, even update firmware over flaky radio links etc. As a test, I went back to USB -> serial -> loop-back and MMBasic worked every time. Was only when the radio link was introduced that the problem showed up. Yet the radio links were perfect, even have a box full of new units to swap out. I could connect other programs to same ports and xfer data across the same RF link - only MMBasic would not play with the link - just sent incorrect data - even one byte was sent incorrectly - turn it on this morning - it worked and has not stopped since, been working all day as I code the rest of the program. I'm just going to pretend that it never happened. Sigh! NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2430 |
geoff: the following little demo may be of interest, showing how a console application can make use of open/save dialog windows. this may be a worthwhile alternative to LOAD <filename> and SAVE <filename>. one option would be that if either command is typed at the prompt without a filename the appropriate dialog pops up. note that the dialogs remember the last directory location they used, but do not alter the setting of the current directory (flag:OFN_NOCHANGEDIR). this means that if an mmbasic program changes the current directory the operation of the dialogs is not affected. as always, this is just offered as an idea. the following zip file contains both an executable and the pascal/delphi source. this should be easy enough to translate into C, just #include CommDlg. 2017-07-30_150109_project4.zip cheers, rob :-) |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2430 |
just spotted that while COLOR is accepted, the correct spelling, COLOUR, is not! cheers, rob :-) |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
That is a good find. I know that you are keen on this IDE concept but nearly everyone will use an external editor and launch the exe + program from there and in that case a fancy dialog box is not worth the effort for load/save. But many programs written for DOS MMBasic do things with files so it would be handy to have a command in MMBasic that launches the file select dialog and returns the selected file name to the program. Very handy indeed. Geoff Geoff Graham - http://geoffg.net |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2430 |
funny thing is... i was initially thinking about the usefulness of exposing some of the win32 dialogs directly to mmbasic programs, but set it aside as a step too far! as well as GetOpenFileName and GetSaveFileName, another useful one is MessageBox. i guess one down side of providing access to these in the mmbasic language is that an mmbasic program rapidly becomes quite platform-specific, requiring either win32, wine, or reactos to function; if any of the dialogs are used the program will no longer operate without a desktop/GUI environment. i think that the win32 version of mmbasic is already a good diatance into the IDE stage - using either edit or wedit (it doesn't matter which), development can be completed without closing the mmbasic shell. btw, i can't comment for others, but i almost exclusively launch programs by dropping icons onto applications. if they were already available to mmbasic programs, why not make them available to LOAD and SAVE too? it would just take a half dozen more lines of code, and a second OPENFILENAME structure to keep accessing .BAS and accessing data files separated. as always, just ideas to kick around. i'm happy to tinker with ideas and bits of code and offer them up to see how useful (or not) they are, with no expectations of any outcome. cheers, rob :-) |
||||
flip Senior Member ![]() Joined: 18/07/2016 Location: AustraliaPosts: 114 |
Hi Geoff, Can MM.HRES and MM.VRES be swapped around? EDIT: Experiencing some problems when scanning the ports...attached test code thinks it opens COM1 successfully...some other errors...could be specific to my Win 10 environment of course 2017-07-31_222011_FinduM.zip Regards, Phil |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1868 |
Hi Phil, Code ran fine on my Win10-64. Only found valid ports. Mike. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
flip Senior Member ![]() Joined: 18/07/2016 Location: AustraliaPosts: 114 |
Thanks KeepIS, That's interesting...so maybe it could be a 32-bit only problem... (I should have included more details of course) I am running Win10-32 (same result with Win7-32) DOS MMBasic Ver 5.04.05 Beta 6 Copyright 2011-2017 Geoff Graham Micromite Controller Port 1 opened successfully Testing COM 1...Micromite not found Open COM 2: failed..'Cannot open port: $' (MM.ERRNO= 16) Open COM 3: failed..'Cannot open port: $' (MM.ERRNO= 16) Open COM 4: failed..'Cannot open port: $' (MM.ERRNO= 16) Open COM 5: failed..'Cannot open port: $' (MM.ERRNO= 16) Open COM 6: failed..'Cannot open port: $' (MM.ERRNO= 16) ... Regards, Phil |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1868 |
I know that a lot of motherboards came with COM1 on board, but I'm assuming that Device manager does not have COM1 listed? NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6269 |
What ports do you have listed in Device Manager? What chipset does your 'mine USB-TTL adapter use? Try without the 'mite plugged in and again with it plugged in. 64/32 shouldn't make any difference here. Your code finds my ports OK on W10-64bit CH340 chipset on com5 and microbridge on com12 Jim VK7JH MMedit |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2430 |
the following mmbasic line should find all ports enumerated in the registry. i've found variations on this approach to be quite reliable: System "reg query HKLM\hardware\devicemap\serialcomm" you can redirect the output to a file, then read the file, parsing for lines containing the substring "REG_SZ" and if found picking out "COM" and the following port number. cheers, rob :-) |
||||
flip Senior Member ![]() Joined: 18/07/2016 Location: AustraliaPosts: 114 |
Thanks Rob! That proves there is indeed a (non-uMite) comms port available. HKEY_LOCAL_MACHINE\hardware\devicemap\serialcomm \Device\Serial0 REG_SZ COM1 Also thanks KeepIS and thanks Jim for that test...Jim's result mimics what I'm getting with a uMite connected. Jim is correct - it has nothing to do with environment...(just my [lack of] understanding of it!) Thanks again Phil |
||||
KeepIS![]() Guru ![]() Joined: 13/10/2014 Location: AustraliaPosts: 1868 |
Quite often still on the Motherboard, even if not fully populated - no physical connection, but still there in the bios and Windows, usually on slightly older MB. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2430 |
geoff: i've been tinkering with a couple of 'helper' applications for mmbasic. the first draws graphics quite successfully on the standard console window (cmd.exe), but if the window is resized or another window passes in front the graphics get erased :-( the fix is to hook the WM_PAINT messages to the console, but this is both difficult and potentially blocked on some windows setups. it was a nice idea, though. the second is a shell replacement, using a similar mechanism to 'p32p gui' - redirecting stdin and stdout through pipes back to the launching application. the replacement shell will support a subset of VT100 escape sequences, underlining and itallic text, and a graphics language of some sort. this is all working exceptionally well with programs like cmd.exe and pic32prog.exe, but unfortunately i've not been able to capture stdout from mmbasic.exe. even cmd.exe can not redirect it, ie MMbasic myprog.bas > abc.txt does not redirect the console output. how does mmbasic handle i/o to the console? is there any chance of a commandline switch to modify this behaviour? to progress much further i really need to use mmbasic to generate escape sequences, etc, for testing. cheers, rob :-) |
||||
MicroBlocks![]() Guru ![]() Joined: 12/05/2012 Location: ThailandPosts: 2209 |
Maybe use XWindows. Then it will even be possible to simulate a LCD. Microblocks. Build with logic. |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |