Author Topic: Digimesh - 2 questions  (Read 14782 times)

secs

  • Newbie
  • Posts: 25
  • I'm a llama!
    • View Profile
Digimesh - 2 questions
« on: March 18, 2013, 02:03:13 AM »
Hi guys.

I am looking at using some xbee pro type units. the ones that do the DIGIMESH stuff.

I want to to use one module via the rs232 port on the 2424 and then simply the others without pc's connected. I need to be able to read and write to the remote I/O's etc to turn on and off remote appliances.

I have reviewed the documentation for both the 2424 and the mesh units and can't see that there will be a problem. IS there any samples out there?


support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Digimesh - 2 questions
« Reply #1 on: March 19, 2013, 11:21:07 AM »
There are sample programs for using a XBEE module available for download in sections 19.3 and 19.4 of the F2424 user manual.

Note that the code would have to be modified to use COM1 instead of COM2 if you are using the RS232 port to connect to an external module.

The digimesh protocol has not been tested with our products, but it should be possible to implement if it is only a matter of sending and receiving binary/ASCII data, which can be handled by the PLC program.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

secs

  • Newbie
  • Posts: 25
  • I'm a llama!
    • View Profile
Re:Digimesh - 2 questions
« Reply #2 on: March 19, 2013, 02:10:15 PM »
Thanks guys. Yeah I have been reading up the digi mesh stuff and its just a protocol sent in hex. Its packet based so shouldn't be hard. I have to operate them in API mode

You simply send a start byte, address of where etc. And even better, you can send a packet ID (number) so when a reply comes back, you can tell from which request it is in response to

I have also thinking on how to do it. So I am going to use a NANO10 I have laying around and talk to the digi unit via RS485. I have a 485 to digi adapter. So my intention is to poll the various remote units with the nano and write the values to memory etc. The main PLC can poll the nano via MODBUS TCP and so can my software. That way if responses are a bit slow, the main PLC isn't sitting waiting.

I will I reckon need a bit of help with the packet stuff but I need to set up a test bench first. Lets see what happens. Can you see any floors so far?

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Digimesh - 2 questions
« Reply #3 on: March 19, 2013, 02:27:25 PM »
No problem. Your intended setup should work well.

The Nano-10 can send out the data, then look for a response, check the data once received, and put it DM[] registers for your master PLC/software to access via Modbus TCP.

You can also preformat the data before making it available to the Modbus registers (DM[]  memory) if need be.
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

secs

  • Newbie
  • Posts: 25
  • I'm a llama!
    • View Profile
Re:Digimesh - 2 questions
« Reply #4 on: March 19, 2013, 06:57:43 PM »
I have to admit I have to drive 400kms this weekend to pick up my gear to start playing but yes it does all look ok.  ;D

Even my manuals etc are at my base camp.


To get the DIGIMESH stuff to work it has to be done in API mode to speed things up

Reading more in the  manual the only 2 things I can see is

there are a couple of charecters that have to be excaped and as such (from the manual)

"Escape characters. When sending or receiving a UART data frame, specific data values must be
escaped (flagged) so they do not interfere with the data frame sequencing. To escape an
interfering data byte, insert 0x7D and follow it with the byte to be escaped XOR?d with 0x20."

so can we do Xor'ing easily


and

all stuff has to be sent (and receieved) as hex. So there examples show each charecter having an 0x in front of it to apparently tell the radio its coming in hex. So I have to work out if I have to send that each charecter of simply once but can we do HEX easily?


Thanks guys

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Digimesh - 2 questions
« Reply #5 on: March 19, 2013, 09:04:38 PM »
Yes, you can assign a hex number to the DM easily e.g.

DM[1] = &H7D   ' hexadecimal number 7D


You can built up the command in DM, then use a FOR .. NEXT loop to send out the entire command using OUTCOMM command:

FOR I = 1 to 10
   OUTCOMM 1, DM[I+100]  ' send out DM[101] to DM[110]
NEXT

You may need to wait for a while for all response data to come in, then use INCOMM(1) to read all data from COMM port #1.

FOR I = 1 to 255
    DM[I+200] = INCOMM(1) 'read incoming data into DM[201], DM[202]....
   IF DM[I+200] < 0   ' no more data
         EXIT
   ENDIF
NEXT
« Last Edit: March 19, 2013, 09:05:48 PM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS