Announcement

Collapse
No announcement yet.

P1-540 Embedding control characters in strings

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • P1-540 Embedding control characters in strings

    Say I need to send out "ABCDE" and a carriage return 0x0D over RS232. How do I embed a a control code into a string? I can receive a string in and see that it has an STX code (02) if I display in hex but cannot seem to create a string like that.
    Last edited by Adisharr; 03-08-2020, 01:01 AM.

  • #2

    Can/have you tried to use something like 0x02 8-bit datatype?
    Maybe try CPO (if you are currently using AOUT)
    I do not have that software (or any automation software) installed here- or I would try it.

    Comment


    • #3
      see view marq manual starting at 7-31. it uses a cpd instruction to copy 0x0D to a Unsigned Int 8 bit

      Adding Termination Codes
      You will need to add a termination character (“$0d”) to the end of the message string. In Productivity3000, non-printable characters cannot be directly inserted into a string tag. Here are the steps to insert the characters at the end of the string:
      1) Create an Unsigned Int 8 array and use a CPD instruction copy 0x0D to this array.
      2) Use the CPC (Copy Character) instruction to create a string of 1 character to move 1 byte into.
      3) Combine the two strings together into a string ready to send out the port using the PKS (Pack String) instruction.

      Comment


      • #4
        Ok that's great thanks guys

        I guess my next question for the developers would be why on Earth is there no obvious way to embed non-printable characters?!?!?!

        A DL05 could do that lol

        Comment

        Working...
        X