Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28

Thread: Plugin noob looking to start

  1. #21
    Raw Wave
    Auto Apps:loading...
    justchat_1's Avatar
    Join Date
    Jul 2008
    Location
    Boston, Ma or NY,NY
    Posts
    2,359
    Quote Originally Posted by jmullan99 View Post
    Okay. I would like to request a favor.

    I need some snippets to show me how to get/send data to a selected com port. I can easily do it with an MSCOMCTL object on form based project (basically drag-n-drop the control), but not sure what I should do with just a class library.

    Is there related routines in the framework?

    John
    Take a look here:
    http://msdn.microsoft.com/en-us/libr...erialport.aspx

    Basically you create a serial port object passing the port name (don't stip anything off, on windows it might be COM1 on linux it might be /dev/ttys0/). Then you Open the port and Read and Write to it.

  2. #22
    Maximum Bitrate jmullan99's Avatar
    Join Date
    Feb 2009
    Location
    Niagara Falls, Ontario
    Posts
    671
    That was quick, thanks for that. I now offer up com port selection, and as a test send stuff to the Arduino. The "stuff" is wrong at this point, but hey, it's communicating! Now to get the protocol right.

    I have to revisit the com port names though. I try using "COM6" (in the returned list of port names) but when selecting it seems it prefers just 6 (as integer).

    John
    ZOTAC G43ITX-A-E 2.5ghz Core i3 2GB 160GB SSD
    Win7 Ultimate - OpenMobile - Directed HD - Wifi
    OMMaps + MS GPS Puck - WiFi via LTE Android phone
    2 Zones - Matrix Orbital LCD - Arduino - Build Pics

  3. #23
    Maximum Bitrate jmullan99's Avatar
    Join Date
    Feb 2009
    Location
    Niagara Falls, Ontario
    Posts
    671

    Help!

    I have spent a few hours trying to figure this out. My code seems to be coming along. However, I am tossed over this com port thing.

    Okay, so this is the scenario. I have 2 valid com ports. COM5 and COM6

    COM5 = LCD. COM6 = Arduino.

    When I open OM (0.9), my plugin will (by design) start with either no valid com port selected in settings, or last valid com port (should be COM6).

    Case #1: Start with no com port selected
    ----------------------------------
    My code will determine that there is currently no valid com port selected. User selects from list (first item is COM5). Plugin determines that it is not valid (because in use by LCD). This is good. Select next port COM6, it too is not valid because of exception "Access to the port 'COM6' is denied.". From here, if I go back to COM5 (still invalid) and then back to COM6 again, COM6 is now valid. WTF (sorry for that).

    Case #2: Basically continued from Case #1, except that COM6 is now remembered by settings because it was valid. Exit and start OM again and my loadsettings() will reset the previously remembered choice (by design) because it appears no longer valid because of "Access to the port 'COM6' is denied.". Again if I cycle to COM5 and back to COM6, it is okay again.
    ----------------------------------

    I am stymied because if it is valid when I switch between ports, why is it not valid when I first instantiate a serial port?

    I've come a long way in a week learning VS, .NET and OM plugins, but this little bug is giving me a headache.

    My VB project is available for download for anyone interested and checking it out. I update it approx once per day if there is any real progress. PM me if you want the URL.

    John
    ZOTAC G43ITX-A-E 2.5ghz Core i3 2GB 160GB SSD
    Win7 Ultimate - OpenMobile - Directed HD - Wifi
    OMMaps + MS GPS Puck - WiFi via LTE Android phone
    2 Zones - Matrix Orbital LCD - Arduino - Build Pics

  4. #24
    Maximum Bitrate jmullan99's Avatar
    Join Date
    Feb 2009
    Location
    Niagara Falls, Ontario
    Posts
    671
    Update: All I did was unplug my Arduino, re-insert, now it's COM6 doesn't exist.

    Problem is, it does. It gets found, it's added to the list, it exists in Registry, but when I connect, the exception is thrown that it doesn't exist.

    This is really confusing.
    ZOTAC G43ITX-A-E 2.5ghz Core i3 2GB 160GB SSD
    Win7 Ultimate - OpenMobile - Directed HD - Wifi
    OMMaps + MS GPS Puck - WiFi via LTE Android phone
    2 Zones - Matrix Orbital LCD - Arduino - Build Pics

  5. #25
    Maximum Bitrate jmullan99's Avatar
    Join Date
    Feb 2009
    Location
    Niagara Falls, Ontario
    Posts
    671
    Well, after a LOT of searching, it's at least not my fault!

    Apparently, some virtual ports (I guess like the Arduino creates) do NOT like being unplugged while in use, under .NET < 4.0 even if it is listed as an available port, the exception of "does not exist" is still thrown.

    It is apparently fixed in 4.0 but if anyone knows of a relatively simple code fix for this relative newby to implement, by all means my ears are open.

    The solution is a reboot. Then it is again addressable.

    I don't know how this will affect users in the long run. And I have not yet tested it in hibernation. But I can proceed for now.

    John
    ZOTAC G43ITX-A-E 2.5ghz Core i3 2GB 160GB SSD
    Win7 Ultimate - OpenMobile - Directed HD - Wifi
    OMMaps + MS GPS Puck - WiFi via LTE Android phone
    2 Zones - Matrix Orbital LCD - Arduino - Build Pics

  6. #26
    Maximum Bitrate Borte's Avatar
    Join Date
    Jan 2006
    Location
    Norway
    Posts
    527
    Have you tried to disable/enable the usb controller instead of a reboot to remedy the problem?

    I don't know if this will help, just a suggestion since this is something that might be controllable from software.
    Failure is not an option...
    __________________________________________________ ______________________________
    The only full multizone / multiscreen cross platform open source Front End -> OpenMobile

  7. #27
    Maximum Bitrate jmullan99's Avatar
    Join Date
    Feb 2009
    Location
    Niagara Falls, Ontario
    Posts
    671
    Thanks yet again. Heezer7 is helping me outside of the forum. I'll post results when we get that far.

    Cheers!
    ZOTAC G43ITX-A-E 2.5ghz Core i3 2GB 160GB SSD
    Win7 Ultimate - OpenMobile - Directed HD - Wifi
    OMMaps + MS GPS Puck - WiFi via LTE Android phone
    2 Zones - Matrix Orbital LCD - Arduino - Build Pics

  8. #28
    Maximum Bitrate Mickz's Avatar
    Join Date
    Sep 2009
    Location
    Australia
    Posts
    811

    Usb

    Hi, just a bit of feedback on com ports. Although I have seen the finger of blame pointed at .Net, I am not so sure. Unplugging a USB device from an open active port has always locked the port in VB and this behaviour has not changed with any version of .NET.

    From what I am seeing it appears to be, in some cases, that the virtual com driver locks. I have never had to reboot the PC to solve this issue. However I have to close the application that was using the port to enable access to the port. Trying to reinitialise the port in any way in software obviously fails if the driver has hung. You would need to find a way in software to access the associated virtual driver at OS level and unload/reload it.

    Sometimes have to unplug and reconnect the USB device after the program has been closed to allow the OS to unload and reload the driver – also seems to depend on the USB device and associated driver.

    I have 6 or 7 USB devices in the CAR PC and this behaviour has never caused a problem. I don’t disconnect a USB device that is open and accessed by an app. Every commercial app that I have tried so far behaves in the same way if the accessed USB device is unplugged.

    Hibernation/sleep/suspend cause’s no problems in any device I have, however I have set USB properties to NOT allow the OS/drivers to power down the ports.
    GA-Z77N-WIFI, i5-2400S, 8GB, Intel 520 128GB SSD, M4-ATX Modified, 2 Rev Cams, 2 Web Cams
    8" 16:9 TRANSFLECTIVE, Win8-64, Dual GPS RX and Garmin PC + Odyssey Nav, FM-DAB+, BB-Rec
    T-Screen HVAC control, custom microcontrollers, code and FE. CarPC Project

Page 3 of 3 FirstFirst 123

Similar Threads

  1. Need Alpine wired remote control pinout.
    By FordNoMore in forum Input Devices
    Replies: 31
    Last Post: 11-17-2012, 06:24 AM
  2. eyeR Interceptor: Automated Engine Start How-to
    By Civic Modz in forum Fusion Brain Innovations
    Replies: 2
    Last Post: 03-04-2010, 04:27 AM
  3. nGhost 2.0.0 Final is out!
    By tripzero in forum LinuxICE
    Replies: 53
    Last Post: 07-16-2009, 09:16 PM
  4. noob car pc start up question
    By IZNICE in forum Power Supplies
    Replies: 0
    Last Post: 11-04-2008, 06:22 AM
  5. IRMAN plugin
    By knyarko in forum StreetDeck
    Replies: 3
    Last Post: 01-05-2007, 08:26 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •