Menu

Remove tag and redirect

Help
nadabro
2011-11-13
2013-05-20
  • nadabro

    nadabro - 2011-11-13

    Hi..

    I´ve a microcontroller reading a ADC (Analog-to-Digital) which have 3 channels, but the software i use to plot the data doesnt work with multiple channels, so i can only read one channel from the ADC.

    The software only can read numbers from the ADC, so my idea is to:

    -The microcontroller sends:
    CH1 9831
    CH2 5329
    CH3 1293

    comOcom picks the CH1 data, remove the "CH1" tag and sends it to a specific virtual serial port. So:

    CH1 goes to Virtual Port X
    CH2 goes to Virtual Port Y
    CH3 goes to Virtual Port Z

    CH1 9831 --> 9831 ---> Virtual Port X
    CH2 5329 --> 5329 ---> Virtual Port Y
    CH3 1293 --> 1293 ---> Virtual Port Z

    com0com is able to do this? If so, a simple script will work? Do you have any example?

    I appreciate any help.

    Best Regards.

     
  • Vyacheslav Frolov

    The hub4com includes the similar functionality (1 byte tag then 1 byte data).
    See hub4com's ReadMe.txt - Multiplexing (it's use the tag filter, see "hub4com -help=tag").

     
  • nadabro

    nadabro - 2011-11-16

    Thanks for the answer vfrolov.

    Indeed multiplexing is what i need, looking at the readme i only need to run the multiplexer.bat on client side.

    But i´m a bit confused how to use the tag filter, will it run using multiplexer.bat or in hub4com? Do you have a example how to create a tag filter?

    Thanks.

     
  • Vyacheslav Frolov

    See hub4com's ReadMe.txt - FAQs & HOWTOs, 1st question.

     
  • nadabro

    nadabro - 2011-11-27

    Hi.

    I dont know how to make this working, if anyone have a working example i appreciate a lot..

    The only thing i know is to split the serial ports correctly, removing the tag and redirects to specific virtual serial port i completely lost.

    Thanks.

     
  • nadabro

    nadabro - 2011-11-29

    If i use the Multiplexer example only from the client side:

    multiplexer -baud 115200 COM4 -mode server CNCA0 -mode client CNCA1 -mode client

    The multiplexer.bat will wait for the Server to send the tag, to understand which port to send data. Since i´m not correctly sending the "tag", i´m not receiving anything from the COM5  (CNCA0) and COM6 (CNCA1)

    For testing i´m using this on the microcontroller:

      Serial.println("tag0 123");
      delay(250);
      Serial.println("tag1 666");
      delay(250);
    

    But i cant get anything from COM5 and COM6, i´m trying to find what is the default tag that multiplexer.bat creates, is:
    "tag1" or "1" or "tag.IN", etc?

    Knowing what the multiplexer.bat creates for default tags i should get this working.

    Thanks.

     
  • Vyacheslav Frolov

    multiplexer.bat uses tags '0', '1', '2' …
    If you'd like to send "123" to 1'st port and "666" to 2'nd port then send "010203161616" or "011602160316".

     
  • nadabro

    nadabro - 2011-11-30

    Thanks for explaining how multiplexer adds tags.

    So my microcontroller is sending:
    010203161616

    In my pc:
    multiplexer -baud 115200 COM4 CNCA0 CNCA1

    I cant get nothing from COM5 and COM6, looking to the "schematics" that multiplexer creates after sends the command, everything should work:
    http://imageshack.us/photo/my-images/38/multiy.png/

     
  • Vyacheslav Frolov

    multiplexer.bat uses binary tags (not ascii) 0x00, 0x01 …
    It also uses RFC2217 telnet.

    So try this bat file:

    hub4com --baud=115200 --load=\"%~f0\",_BEGIN_MX,_END_MX:COM4
    GOTO END_MX
    _BEGIN_MX
      --octs=off
      --write-limit=512
      \\.\%%1%%
      --use-driver=connector
      CNCA0-muxA
      --create-filter=tag,tag0:--tag=48
      --add-filters=1:tag0
      --bi-route=0:1
      --no-default-fc-route=1:0
      CNCA0-muxB
      --bi-connect=CNCA0-muxA:CNCA0-muxB
      --use-driver=serial
      --octs=off
      --write-limit=256
      \\.\CNCA0
      --bi-route=2:3
      --use-driver=connector
      CNCA1-muxA
      --create-filter=tag,tag1:--tag=49
      --add-filters=4:tag1
      --bi-route=0:4
      --no-default-fc-route=4:0
      CNCA1-muxB
      --bi-connect=CNCA1-muxA:CNCA1-muxB
      --use-driver=serial
      --octs=off
      --write-limit=256
      \\.\CNCA1
      --bi-route=5:6
    _END_MX
    :END_MX
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    
     
  • nadabro

    nadabro - 2011-12-02

    The *.bat Its working! Thanks!

    Sending "010203" and "151617", works perfect.

    Just a last question, how can i make to send data to a new line?

    Sending Serial.println("010203") (ln stands for new line), it does not work. Also adding a 0 or 1 to the final of each message it also doesnt work.

    I appreciate the help.

     
  • Vyacheslav Frolov

    Most languages have print method.
    So try Serial.print("0102030\n") or Serial.print("0102030\r0\n")

     
  • nadabro

    nadabro - 2011-12-04

    Hi vfrolov.

    This line worked for me: Serial.print("0\r0\n");

    So, now i´m running at 100%! I think at 300SPS i have some packets lost, but since i only need up to 100SPS it works perfectly, no packets lost running for more than 24h.

    I appreciate a lot your code and support. It was a tremendous help.

    Best regards,
    nadabro.

     

Log in to post a comment.