Sign in to follow this  
Followers 0
ZiggyStardust

Need Different Serial Communications UDF

5 posts in this topic

I started out using the CommMG UDF but have found it to be maybe not so good. I am doing serial I/O via a USB to Serial Converter (virtual ComPort) and it does the I/O really well but I find it to be fatally flawed when it comes to error handling. I hope I am wrong but here goes. I have written a very simple script:

#include <CommMG.au3>

Global $Port=35, $Baud=115200, $Databits=8, $Parity="none", $Stopbits=1, $Flow=2, $RTS=3, $DTR=2

Global $Received, $Result, $PortList[100]

Global $oMyError = ObjEvent("AutoIt.Error", "MyErrorFunc")

$PortList = _CommListPorts(0)

$Result = _CommSetport($Port, $Received, $Baud, $Databits, $Parity, $Stopbits, $Flow, $RTS, $DTR)

$Result = _CommSetTimeouts(5,5,5,5,5)

_CommSendString("010D" & @CR, 0)

$Received = _CommGetLine(">", 100, 2000); Should get back speed

Exit

Func MyErrorFunc()

Beep()

Beep()

Exit

EndFunc

The problem happens when the user pulls the USB cable out of the computer (or if you run this the port does not exist). 1) It seems to resist the COM Error Handler (I guess no biggie) but 2) it appears as though the commmg.dll has its own error handling and pops up with a error message and asks the user to click on OK.

That is a show stopper of me. What is the point in checking @error and return codes when the UDF does its own thing anyway? I don't want the UDF to display an error and ask the user for input. I want to handle the error.

Anyway.... if someone sees a way around it and I could still use CommMG I really like it but I have a feeling I need another serial comminication UDF. Can anyone recommend one that does not have the above flaws?

Thanks!

Share this post


Link to post
Share on other sites



ZiggyStardust,

Why do you keep opening multiple threads on the same subject? :huh:

I asked you here why you had started a second thread about this very question and was seemingly ignored - and now I find you starting a third. As you are well aware, you have previous form on this to boot and yet here you are doing it all over again. :naughty:

So could you please explain why you feel this urge to post the each of your questions multiple times? :huh:

M23

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

They are two distinctly seperate questions. The one you referred to above was how do you recover from a CommMG error.

This one is "I need another serial UDF"

I keep getting chastised for this. You really consider these two to be the same question?????

Share this post


Link to post
Share on other sites

ZiggyStardust,

Each of the three threads is based on this event:

The problem happens when the user pulls the USB cable out of the computer (or if you run this the port does not exist)

So yes I do consider them all very closely related. However, as you point out, in this particular thread you do actually ask a supplementary question about seeking a new UDF right at the end of the post - which is why I did not lock this one. :)

I keep getting chastised for this

And who is to blame? You are the one who keeps posting threads concerning the same problem. If you do not get an answer to the earlier threads, what makes you think that you will get one in the subsequent versions? The same people are reading them all! :D

But you have used up any flexibility that I am prepared to show. Do NOT post any more multiple threads - if you do not get the response you expected, it is because no-one knows the answer and merely posting the question again will not remedy that. Understood? ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I started off using this one as an alternative to the serial com UDF

I also just posted code here, which I used for checking which COM port was being used (not sure what you can do if the device is unplugged though)

NiVZ

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0