xPC target ASCII conversion
1 回表示 (過去 30 日間)
古いコメントを表示
Hi!
I am trying to do some NMEA 0813 parsing in Simulink using a real time target xPC device. I am communicating with a Trimble GPS module using serial connection and receiving NMEA coded information. Now i need to decode the information using ASCII decode blocks from the xPC target library, but i cant get this to work.
The NMEA coded information comes as a ASCII coded uint8 array, lets say that i was to receive the $GPGGA information from the gps with the following content
172814.0,3723.46587704,N,12202.26957864,W,2,6,1.2,18.893,M,-25.669,M,2.0,0031*
in the ASCII decode block i specify the following format string
%f,%f,%C,%f,%C,%d,%d,%f,%f,%C,%f,%C,%f,%d*
the output is then ok until i reach the second letter "W", then everything starts to behave strange. The number 2 which is decoded with format %d is interpreted as "W" as well. And the bytes following are now completely misinterpreted. I have encountered similar behavior almost every time i use %c or %C format string. Does anybody have any suggestions of what to do?
0 件のコメント
回答 (3 件)
Gordon Weast
2012 年 10 月 31 日
There are two different ASCII decode blocks available for you.
The original one does it's own parsing of the format string. That one has some trouble with the %c format element.
The newer one, 'V2 Ascii Decode' uses TLC to construct a call to the built in sscanf function. That one handles %c much better. However, you can't use it in simulation on the host to test it out. You can use accelerator mode or GRT on the host to test before you go to the target since they both do code generation.
Gordon Weast xPC Target Development
0 件のコメント
Gianpiero Buzzo
2013 年 6 月 11 日
Hi everyone.
Gordon I'm using your .mdl file, NMEADecode, you sent it to me some days ago, for reading an NMEA string on serial port.
It works fine with an nmea coded information like that's one used by Carl-Johan Elm.
Now I'm trying to customize the code for decoding a different received string, using Hyperterminal as sender.
For example:
TEST,1,2,3.5,A,*45.
So I've changed only the header in the FIFO blocks, in this case it output just one port, and finally setted up the ASCII Decode V2, in this way:
'TEST,%d,%d,%f,%c,*%2d'
Unlikely, it doesn't work fine. It looks like nothing received on the serial port, because after running the simulation on the target and sending data by hyperterminal, no one data change on the target scope.
How can I do? Why is the count data, first data output from the ascii v2 block, always -1?
Thanks a lot.
0 件のコメント
rago
2014 年 7 月 12 日
hi everyone i am facing same problem can you help me in parsing this nmea message ..
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Target Computer Setup についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!