assurance-tunnel
assurance-tunnel
assurance-tunnel
assurance-tunnel

[SOLVED] Serial in Watcher


  • Tech Staff

    I am mostly getting things easily done with the send serial data actor, but I am lost with the "Serial in Watcher - Text and Binary". For example I want to get the lamp hours of the Barco projector, I send following command:

     "op lamp1.hours  ?" 0D

    I see this coming back from the projector in the monitor window

     "op lamp1.hours  = 143" 0D

    What serial in watcher do I have to use and what code is needed to just get the value 143?

    Thank you in advanced.



  • @michel said:

    op lamp1.hours  = 143

     I am assuming that this string  is exactly the same each time, and that there are two spaces after the word hours. If that's true, then you want to use this

    "op lamp1.hours  = "
    value : integer = digits

    The first line will match the text part

    The second line matches the number(s) that come after it.

    You'll want to use 13 as the EOM marker since you indicated it's sending hex 0D (decimal 13)

    I am attaching the test patch I created where I used the "Text Parser" to test this, because it is exactly the same parsing as the Serial In Watcher - Text.

    parsing-serial-data-example.izz

    Best Wishes,
    Mark


  • Tech Staff

    @mark 

    Thank you for your answer, unfortunately it is not working, I forgot to add the hrs to the number. This actually is coming back from the projector:

    0D 0A 4F 50 20 4C 41 4D 50 31 2E 48 4F 55 52 53 20 3D 20 31 34 33 20 48 52 53 0D 0A

    or 

    OP LAMP1.HOURS = 143 HRS

    Best Michel



  • @michel

    OK, here's another test patch which recreates the string above, including the 0D and 0A bytes. I created this string using the Text Formatter.

    I set the EOM character to 10 (hex 0A)

    It works for me, but I can't test it with serial because I don't have a device to test with. The string in the text parser is:

    "OP LAMP1.HOURS = "
    value : integer = digits

    The "HRS" after the number will be ignored.

    Best Wishes,
    Mark

    parsing-serial-data-example-2.izz


  • Tech Staff

    @mark 

    Dear Mark, thank you for your fast respond. That worked :-)

    Best Michel