How to send commands to gps via usb and defined as a serial port?

1 次查看(过去 30 天)
Hello,
I am reading data from the BU-353S4 gps unit and have defined the connection as a serial/com. It receives commands in the NMEA system in order to define what outputs to give. This commands have the following format:
Enable WAAS/EGNOS - $PSRF151,01*0F
Disable WAAS/EGNOS - $PSRF151,00*0E
Enable GGA Output 1sec - $PSRF103,0,0,1,1*25
Disable GGA Output - $PSRF103,0,0,0,1*24
Enable GLL Output 1sec - $PSRF103,1,0,1,1*24
Disable GLL Output - $PSRF103,1,0,0,1*25
Enable GSA Output 5sec - $PSRF103,2,0,5,1*23
Disable GSA Output - $PSRF103,2,0,0,1*26
Enable GSV Output 10sec - $PSRF103,3,0,10,1*16
Disable GSV Output - $PSRF103,3,0,0,1*27
Enable RMC Output 1sec - $PSRF103,4,0,1,1*21
Disable RMC Output - $PSRF103,4,0,0,1*20
Enable VTG Output 1sec - $PSRF103,5,0,1,1*20
Disable VTG Output - $PSRF103,5,0,0,1*21
Enable ZDA Output 1sec - $PSRF103,8,0,1,1*2D
Disable ZDA Output - $PSRF103,8,0,0,1*2C
The commands start with the $ sign. How can I send any of these to the gps through MATLAB?

回答(1 个)

Walter Roberson
Walter Roberson 2018-12-14
serial(). set properties. fopen(). fprintf() to send data. fclose when done.
  2 个评论
Philip Nahmias
Philip Nahmias 2018-12-14
Hey Walter,
first of all thank you for your response. I have tried both fprintf() and fwritef() and neither have worked. One possible reason I think may be because I cant enter a return (enter) character in the sent string and as a result the gps just ignores the sent command. Any suggestions on how I can correct that?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Automated Driving Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by