Ascii Decode Block simulink

5 views (last 30 days)
Christian Torres
Christian Torres on 7 Jul 2013
I must say i can't speak english properly, so, sorry for my bad english hahaha. Well, i got a trouble with ascii decode block in simulink, i'm working with a serial receive, an analog value between 0 to 255, i conect the serial receive block to ascii decode and i see the value with a display. The issue is display show a number between 0 to 9, for example, if i got a 255 in the serial port, display just show me the last number (5). i think the problem is the format string of ascii decode, however, if i try to write "%d,%d" , i get a "simulation diagnostics, RS232/Rec: receive data error".
I tested the serial comunication with hyperterminal, virtual terminal (proteus), and all it's okey... I got a headache with ascii decode block haha, please i need help about this.
  2 Comments
Muhammad Fairuz Luthfa
Muhammad Fairuz Luthfa on 18 Oct 2013
set the datasize to [1 3] means that 3 character before terminator will be saved. If you set the datasize [1 1] means that only one character will be saved. Thats why when you received string "255" only "5" will be displayed. I already figured it out.
Muhammad Fairuz Luthfa
Muhammad Fairuz Luthfa on 18 Oct 2013
I use this protokol to send the data ("%3d %3d\r") and setting the receive serial block like this: terminator --> CR/LF data size -->[1 7]
setting for ascii decode: format string --> %3d %3d\r (dont forget with spacetab) number of variables 2
and I use this protokol to send my data --> %3d %3d\r (dont forget space tab)
hope this will help you

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!