ASCII Decode V2

ASCII Decode V2


Simulink® Real-Time™ Library for RS-232


The ASCII Decode block parses an input vector according to a format specifier similar to scanf, and makes converted values available to a Simulink program. The input vector to the ASCII Decode block can be either 8-bit or 16-bit and signed or unsigned. If the data format is 16-bit, the ASCII Decode block ignores the upper eight bits of each entry.

Block Parameters


Enter a scanf like format string. Each format specifier such as %d must match a corresponding part of the input vector. Literal strings in the format must match the first character plus the number of characters. Acceptable format specifiers are the following, enclosed in single quotes. Failure to include these quotes causes simulation failures: %c, %d, %i, %o, %u, %x, %e, %f, and %g. These follow the normal description for scanf. The number of format specifiers actually satisfied by the input string is known as the count output.

An example format string is:

'foo %d bar %f\n'

In this example, assume that the data from the FIFO read is 'foo 5'. In this case, the count output is 1 and the second output will be unchanged from the last time both were found in a string. If the block expects two values, and the returned count output value is less than two, there is an error in the data.

Was this topic helpful?