ZiggyStardust Posted July 28, 2012 Posted July 28, 2012 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!
Moderators Melba23 Posted July 28, 2012 Moderators Posted July 28, 2012 ZiggyStardust, Why do you keep opening multiple threads on the same subject? 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. So could you please explain why you feel this urge to post the each of your questions multiple times? M23 JohnOne 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
ZiggyStardust Posted July 28, 2012 Author Posted July 28, 2012 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?????
Moderators Melba23 Posted July 29, 2012 Moderators Posted July 29, 2012 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 thisAnd 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! 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
NiVZ Posted July 30, 2012 Posted July 30, 2012 I started off using this one as an alternative to the serial com UDFI 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now