Home AMX User Forum AMX Technical Discussion

Yamaha RS232 => STRING Problem

Hi to All...

you are my last hope!

Program looks like that:

ACTIVE(FIND_STRING(DATA.TEXT,"'0026'",1)) :
{
SEND_STRING dvAMP,"$02,'22001',$03"
DB_LEVEL_TEMP1= RIGHT_STRING (AMP_BUFFER2, 9)
}

The problem is that anyway if I'm using left_string, right_string or what ever the compiler
ignores every string after the last "DC1" ($11) sign. But this is what I need...
Any suggestions?

look at the result:

Comments

  • viningvining Posts: 4,368
    Well the first thing I would change is you're looking for a value in DATA.TEXT but then removing a string from a created buffer or var, do one or the other not a mix of both. There may be a string size limit on the var you're using while data.text is good for 2048 bytes.

    Also any time I'm using data.text other than master or virtual comms I append it to a local or global var.
    cSomeVar = "cSomeVar,DATA.TEXT" ;
    
    just in case the device hiccups or stutters and the complete string doesn't arrive in a single data.event. It's just a safer and more reliable way to collect your data.

    Then I would use cSomeVar for my find_strings and remove, left, right_string... stuff working on a single buffer or var not 2 seperate ones.
  • I`ve already tried that. Same problem.
  • viningvining Posts: 4,368
    According to your watch bar you have 9 bytes in your var DB_LEVEL_TEMP1. Your buffer shows a length of 22 bytes, try changing "RIGHT_STRING (AMP_BUFFER2, 9)" to grab more bytes.
    Looks like you're not taking into account those oddball symbols in the count which represent non printing ascii characters. Switch the "Watch Bar" display from ascii to hex or decimal so you can see all the bytes.
Sign In or Register to comment.