Home  |  Contents 
Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: MMBasic for DOS Beta 6 Post ReplyPost New Topic
<< Prev Page of 8 Next >>
Author
Message << Prev Topic | Next Topic >>
MicroBlocks
Guru
Guru
Avatar

Joined: 12 May 2012
Location: Thailand
Online Status: Offline
Posts: 1993
Posted: 30 July 2017 at 6:07am | IP Logged Quote MicroBlocks

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.


Back to Top View MicroBlocks's Profile Search for other posts by MicroBlocks
 
KeepIS
Regular Member
Regular Member
Avatar

Joined: 13 October 2014
Location: Australia
Online Status: Offline
Posts: 81
Posted: 30 July 2017 at 6:49am | IP Logged Quote KeepIS

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!

__________________
It's all too hard.
Back to Top View KeepIS's Profile Search for other posts by KeepIS
 
robert.rozee
Guru
Guru


Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 1141
Posted: 30 July 2017 at 3:02pm | IP Logged Quote robert.rozee

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 :-)
Back to Top View robert.rozee's Profile Search for other posts by robert.rozee
 
robert.rozee
Guru
Guru


Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 1141
Posted: 31 July 2017 at 4:53am | IP Logged Quote robert.rozee

just spotted that while COLOR is accepted, the correct spelling, COLOUR, is not!


cheers,
rob :-)
Back to Top View robert.rozee's Profile Search for other posts by robert.rozee
 
Geoffg
Guru
Guru
Avatar

Joined: 06 June 2011
Location: Australia
Online Status: Offline
Posts: 2117
Posted: 31 July 2017 at 4:55am | IP Logged Quote Geoffg

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
Back to Top View Geoffg's Profile Search for other posts by Geoffg Visit Geoffg's Homepage
 
robert.rozee
Guru
Guru


Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 1141
Posted: 31 July 2017 at 11:18am | IP Logged Quote robert.rozee

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.


Quote:
a fancy dialog box is not worth the effort

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 :-)

Edited by robert.rozee on 31 July 2017 at 11:20am
Back to Top View robert.rozee's Profile Search for other posts by robert.rozee
 
flip
Regular Member
Regular Member


Joined: 18 July 2016
Location: Australia
Online Status: Offline
Posts: 56
Posted: 31 July 2017 at 12:42pm | IP Logged Quote flip

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


Edited by flip on 31 July 2017 at 10:21pm
Back to Top View flip's Profile Search for other posts by flip
 
KeepIS
Regular Member
Regular Member
Avatar

Joined: 13 October 2014
Location: Australia
Online Status: Offline
Posts: 81
Posted: 01 August 2017 at 12:37am | IP Logged Quote KeepIS

Hi Phil, Code ran fine on my Win10-64. Only found valid ports.

Mike.


__________________
It's all too hard.
Back to Top View KeepIS's Profile Search for other posts by KeepIS
 
flip
Regular Member
Regular Member


Joined: 18 July 2016
Location: Australia
Online Status: Offline
Posts: 56
Posted: 01 August 2017 at 2:01am | IP Logged Quote flip

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

Edited by flip on 01 August 2017 at 2:03am
Back to Top View flip's Profile Search for other posts by flip
 
KeepIS
Regular Member
Regular Member
Avatar

Joined: 13 October 2014
Location: Australia
Online Status: Offline
Posts: 81
Posted: 01 August 2017 at 2:08am | IP Logged Quote KeepIS

I know that a lot of motherboards came with COM1 on board, but I'm assuming that Device manager does not have COM1 listed?


__________________
It's all too hard.
Back to Top View KeepIS's Profile Search for other posts by KeepIS
 
TassyJim
Guru
Guru


Joined: 07 August 2011
Location: Australia
Online Status: Offline
Posts: 2221
Posted: 01 August 2017 at 2:40am | IP Logged Quote TassyJim

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


Quote:
DOS MMBasic Ver 5.04.05 Beta 6
Copyright 2011-2017 Geoff Graham

Micromite Controller
Open COM 1: failed..'Cannot open port: $' (MM.ERRNO= 16)
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)
Port 5 opened successfully
>
> ? 2
2
>
>
Testing COM 5...Comms Port found at 5..use this one(Y)? or keep searching(N)n
Open COM 6: failed..'Cannot open port: $' (MM.ERRNO= 16)
Open COM 7: failed..'Cannot open port: $' (MM.ERRNO= 16)
Open COM 8: failed..'Cannot open port: $' (MM.ERRNO= 16)
Open COM 9: failed..'Cannot open port: $' (MM.ERRNO= 16)
Open COM 10: failed..'Cannot open port: $' (MM.ERRNO= 16)
Open COM 11: failed..'Cannot open port: $' (MM.ERRNO= 16)
Port 12 opened successfully
>
> ? 2
2
>
>
Testing COM 12...Comms Port found at 12..use this one(Y)? or keep searching(N)
Open COM 13: failed..'Cannot open port: $' (MM.ERRNO= 16)
Open COM 14: failed..'Cannot open port: $' (MM.ERRNO= 16)
Open COM 15: failed..'Cannot open port: $' (MM.ERRNO= 16)
Open COM 16: failed..'Cannot open port: $' (MM.ERRNO= 16)
Open COM 17: failed..'Cannot open port: $' (MM.ERRNO= 16)
Open COM 18: failed..'Cannot open port: $' (MM.ERRNO= 16)
Open COM 19: failed..'Cannot open port: $' (MM.ERRNO= 16)
Open COM 20: failed..'Cannot open port: $' (MM.ERRNO= 16)
Searched comms to Port # 20...uMite Port not found
>


Jim

__________________
It all started with the ZX81....
VK7JH
http://www.c-com.com.au/MMedit.htm
Back to Top View TassyJim's Profile Search for other posts by TassyJim Visit TassyJim's Homepage
 
robert.rozee
Guru
Guru


Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 1141
Posted: 01 August 2017 at 3:34am | IP Logged Quote robert.rozee

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 :-)
Back to Top View robert.rozee's Profile Search for other posts by robert.rozee
 


<< Prev Page of 8 Next >>
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.0791 seconds.
Privacy Policy     Process times : 0, 0.02, 0, 0.06