Page 1 of 1

From IDE, can one close the COM port?

Posted: 05 March 2006, 16:02 PM
by stevech
From IDE, can one close the COM port?

I'd like my ZBasic program to talk via the serial port to PC applications other than the IDE. I find no way to close the COM port from within the IDE other than exiting the IDE completely.

Ideally: I have a dumb terminal program that has an option to automatically close or open the com port as the program's window (focus) is active/inactive. That is, I can choose to have it close the com port automatically if I activate a different window. And vice-versa. If the ZBasic IDE could have an option to do the same, it would be great.

A minimum would be for the IDE to have a button to click on to open/close the COM port.

Posted: 05 March 2006, 19:21 PM
by mikep
In the current IDE, I do not believe there is a way to do that. For me I simply close the IDE and restart it when I need it. It's probably just as painless as closing and reopening the port and the IDE remembers the projects and files I had open.

Another option is to use your dumb terminal program and use ZBasic compiler and ZLoad downloader from the command line.

Posted: 06 March 2006, 7:42 AM
by dkinzer
I see your point. It would be convenient to have a way to close the active comm port while keeping the IDE open. A circuitous way to do this currently is to select a different port for the IDE after downloading and then select the port again later when you want to dowload again.

Posted: 30 March 2006, 14:16 PM
by dkinzer
The IDE has been updated to allow some choice in how the serial port is managed, i.e. when it is opened and closed. Also, the code that invokes ZBasic help has been modified to correct the difficulty that some users have reported. (If you added entries to your User Options file to work around this problem you'll want to comment them out in order to test the new code.)

A .zip file is provided that contains just the updated files. You should rename the corresponding existing files before extracting the updated files to replace them. The files should be extracted to the IDE subdirectory of the ZBasic installation directory.

Regarding the port management functionality, on the Device Options dialog you can select

Code: Select all

o Always open unless manually closed
o Open on activation, close on deactivation
o Open for download, close afterward
The first choice most closely represents the earlier functionality. Two additional items have been added to the Options menu to allow the port to be manually opened or closed at any time. The second choice will work best if you have another application that handles the port the same way. When the IDE is deactivated (by activating another application), the IDE will close the port. When the IDE is reactivated, it will reopen the port. The third choice keeps the port closed except when it is needed for downloading.

Posted: 30 March 2006, 19:33 PM
by stevech
Great!
"Upon Activation" to clarify, means, I think, that when the ZBasic IDE window gets focus, the COM port is opened, and vice-versa.

A window gets focus, usually, when the program is first launched.

A window loses focus, due to a user action, when the user clicks in some other window or on the desktop - causing the window border to dim.

So if you have a program other than the IDE that wants to open the COM port and talk to the ZBasic module, you merely activate that program and ZBasic will close the COM port automatically. You can leave the IDE running.

One terminal program that I have does this too.

Posted: 30 March 2006, 20:43 PM
by dkinzer
That is correct.

Posted: 30 March 2006, 21:02 PM
by mikep
dkinzer wrote:The IDE has been updated to allow some choice in how the serial port is managed, i.e. when it is opened and closed.

Regarding the port management functionality, on the Device Options dialog you can select

Code: Select all

o Always open unless manually closed
o Open on activation, close on deactivation
o Open for download, close afterward
Fantastic Don. You never cease to amaze me with your responsiveness and grasp of both technical problems and solutions. Exactly the type of person I would hire if I was building a new software team.