6 Replies - 1561 Views - Last Post: 24 June 2016 - 07:58 AM

#1 Damein  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 63
  • Joined: 29-March 14

Question regarding COM / Networking

Posted 16 June 2016 - 09:30 AM

Hello there, I'm sorry if this is in the wrong area but I wasn't sure where to put it.

I have a wireless transmitter / receiver that communicates with battery chargers that also have transmitters / receivers in them.

By default the modules come with some software to observe the chargers wirelessly but the data received and the data shown are incomplete. IE: It sends a lot more data that what it shows and I was able at one point to receive the data through some little programming but it suddenly stopped working.

Using a generic COM monitor like 232 Analyzer use to show me the data they were sending but now it does not. I think the reason being is the devices use a certain network to talk?

On the charger side (We'll refer to this as the server side) you can program a network ID. Through communication with the manufacturer I have found that they use a Gige???? network? But this network ID is simply "1234" and can be set to anything.

On the client side of the software you can then input a network ID to pull up the chargers to receive the information. I used 232 Analyzer for 2-3 days without any problems to write some software to display more data but as of yesterday it just stopped working. I'm thinking I got lucky initially and my PC / something had the right network or something and could communicate but now it can't.

Any help on this would be greatly appreciated, thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Question regarding COM / Networking

#2 macosxnerd101  Icon User is online

  • Games, Graphs, and Auctions
  • member icon




Reputation: 12174
  • View blog
  • Posts: 45,241
  • Joined: 27-December 08

Re: Question regarding COM / Networking

Posted 16 June 2016 - 09:38 AM

Moved to Networking and Wireless.
Was This Post Helpful? 0
  • +
  • -

#3 horace  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 768
  • View blog
  • Posts: 3,832
  • Joined: 25-October 06

Re: Question regarding COM / Networking

Posted 16 June 2016 - 12:15 PM

could the network be Zigbee? "1234" sounds like a Zigbee Pan ID wich is in the range 0000 to 0x3fff
if so there a Zigbee network analysers which could help


not sure where the 232 Analyzer comes in? is it a PC based tool ? a seperate peice of hardware

This post has been edited by horace: 16 June 2016 - 12:15 PM

Was This Post Helpful? 0
  • +
  • -

#4 Damein  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 63
  • Joined: 29-March 14

Re: Question regarding COM / Networking

Posted 17 June 2016 - 01:21 PM

Actually yes, after speaking to the technical support for the hardware I found that it is Zigbee.

232 Analyzer was in fact a PC based tool.

Now using this "Zigbee network analyse" would be okay but I want to write my own software to do what I want and I did but it stopped working randomly and thats what I'm really trying to find out.

What I did was hooked into a Comm.dll and just used a sort of "Sniffer" software that captured incoming messages and displayed it accordingly. But then one day it just randomly stopped working so I was trying to figure out why.

But if I need to I would be willing to use a 2nd program to capture the data and (if possible export it to a text) and then parse it with my software.

I use AutoIt primarily for any programming I do. Here is how I WAS capturing the data.


This opens the port of my choice and sets all the info.
Func _CommSetPort($iPort, ByRef $sErr, $iBaud = 9600, $iBits = 8, $iPar = 0, $iStop = 1, $iFlow = 0, $RTSMode = 0, $DTRMode = 0)
    Local $vDllAns
    $sErr = ''

    mgdebugCW("$fPortOpen = " & $fPortOpen & @CRLF)
    If Not $fPortOpen Then
        $hDll = DllOpen($DLLNAME)
        If $hDll = -1 Then
            SetError(2)
            $sErr = 'Failed to open commg.dll'
            Return 0;failed
        EndIf
        $fPortOpen = True
    EndIf
    mgdebugCW('port = ' & $iPort & ', baud = ' & $iBaud & ', bits = ' & $iBits & ', par = ' & $iPar & ', stop = ' & $iStop & ', flow = ' & $iFlow & @CRLF)

    $vDllAns = DllCall($hDll, 'int', 'SetPort', 'int', $iPort, 'int', $iBaud, 'int', $iBits, 'int', $iPar, 'int', $iStop, 'int', $iFlow, 'int', $RTSMode, 'int', $DTRMode)
    If @error <> 0 Then
        $sErr = 'dll SetPort call failed'
        SetError(1)
        Return 0
    EndIf

    If $vDllAns[0] < 0 Then
        SetError($vDllAns[0])
        Switch $vDllAns[0]
            Case -1
                $sErr = 'undefined baud rate'
            Case -2
                $sErr = 'undefined stop bit number'
            Case -4
                $sErr = 'undefined data size'
            Case -8
                $sErr = 'port 0 not allowed'
            Case -16
                $sErr = 'port does not exist'
            Case -32
                $sErr = 'access denied, maybe port already in use'
            Case -64
                $sErr = 'unknown error accessing port'
        EndSwitch
        Return 0
    Else
        Return 1
    EndIf

EndFunc   ;==>_CommSetPort




And this was what I used to capture the incoming data.
Func _CommGetLine($sEndChar = @CR, $maxlen = 0, $maxtime = 0)
    Local $vDllAns, $sLineRet, $sStr1, $waited, $sNextChar, $iSaveErr

    If Not $fPortOpen Then
        SetError(1)
        mgdebugCW("Port not open" & @CRLF)
        Return 0
    EndIf

    $sStr1 = ''
    $waited = TimerInit()

    While 1;stringinstr($sStr1,$EndChar) = 0
        If TimerDiff($waited) > $maxtime And $maxtime > 0 Then
            SetError(-2)
            mgdebugCW("Time Too long" & @CRLF)
            Return $sStr1
        EndIf


        If StringLen($sStr1) >= $maxlen And $maxlen > 0 Then
            SetError(-1)
            mgdebugCW("String to long" & @CRLF)
            Return $sStr1
        EndIf
        ;$ic =  _CommGetInputCount()


        $sNextChar = _CommReadChar()
        $iSaveErr = @error
        If $iSaveErr <> 0 Then
            mgdebugCW("$iSaveErr = " & $iSaveErr & @CRLF)
        EndIf

        If $iSaveErr = 0 And $sNextChar <> '' Then

            $sStr1 = $sStr1 & $sNextChar
            mgdebugCW($sStr1 & @CRLF)
            If $sNextChar = $sEndChar Then ExitLoop

        EndIf

        If $iSaveErr <> 0 And $iSaveErr <> 3 Then
            SetError(1)
            mgdebugCW("Errors" & @CRLF)
            Return $sStr1
        EndIf

      if $snextchar = '' then sleep(20)
    WEnd



    Return $sStr1
EndFunc   ;==>_CommGetLine



And that worked 100% until just a few days ago.
Was This Post Helpful? 0
  • +
  • -

#5 Damein  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 63
  • Joined: 29-March 14

Re: Question regarding COM / Networking

Posted 23 June 2016 - 03:09 PM

To add more mystery as of today its working again. I am the only one with access to both devices so nothing has changed. No modifications were made to anything. Anyone know why this is? Is there something on the computer side that I got lucky on... like a variably changing frequency / channel?
Was This Post Helpful? 0
  • +
  • -

#6 horace  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 768
  • View blog
  • Posts: 3,832
  • Joined: 25-October 06

Re: Question regarding COM / Networking

Posted 23 June 2016 - 09:32 PM

can you check the Zigbee signal levels? could there be some source of radio interference
Was This Post Helpful? 0
  • +
  • -

#7 Damein  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 63
  • Joined: 29-March 14

Re: Question regarding COM / Networking

Posted 24 June 2016 - 07:58 AM

Yeah, even when the software I was working on wasn't working the generic software that came with the devices still picked up the signals.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1