ANSI Escape Sequences

Hi,

I have a device that (as far as I understand) transmit data using the ECMA-48 protocol or ANSI Escape sequences.
That data usually get printed to a 2rows-16chars LCD device.
I want to be able to read that data using an Arduino, and send it to another software parsed as:

<1>FirstRowData</1><2>SecondRowData</2>

I found some projects online that do the opposite..let you send ANSI escape sequences parsed data to a device. I need the other way around..

Any ideas?

I have a device that (as far as I understand) transmit data using the ECMA-48 protocol or ANSI Escape sequences.

How are you connecting it the Arduino? How are you reading the data?

RS-422 device connected to a SN75179BP connected to the serial pins of an Arduino Mega.

In the serial I get text mixed with ANSI escape codes.

In the serial I get text mixed with ANSI escape codes.

That sounds like a good thing. What is the problem?

I want to get a clean text divided to 2 rows.
For example, instead of:

000089568.[K.[H.[H07 BAG DDAST  .[K

I would like to get:

<1>07 BAG DDAST  </1><2>000089568</2>

It appears that .[x is an ANSI escape sequence. Removing them should be pretty simple. Of course, you'll need to understand what each of them does, in order to figure out how the text is currently displayed, so that you can rearrange the text in the same way.

you're right..the problem is that there are alot of escape codes...
and I hoped that someone once built an Arduino library/code for that matter..

The only ones that I see used in your example are the home and erase line codes. I don't see how those move 000089568 to the second line, and 07 BAG DDAST to the first line.

1.It was just an example [there are different escape codes used with this device].
2. I don't know for sure how, but if I'll connect the real display connected to the device - this is the rows order.
first it outputs the second row, then, the first one.

OK, so that data was just a snapshot of a portion of the data stream. From that, it appears that there are two different packets involved. The value is from one, and the header if from the next packet.

Finding what represents the start of a packet might be important.