serial communication to VFD displays

2 ビュー (過去 30 日間)
DINESH MOKA
DINESH MOKA 2020 年 1 月 3 日
回答済み: Amish 2025 年 2 月 13 日 4:29
hi sir am trying to send serial data to the VFD Display (CU20045SCPB-T31A) through USB to RS-485 converter using following code
s=serial('COM3','Baudrate',19200)
set(s,'stopbits,1')
set(s,'databits',8)
fopen(s)
fwrite(s,'HELLO')
my objective is to receive HELLO in the display but am receving different sysmbols in the display....can u please help me

回答 (1 件)

Amish
Amish 2025 年 2 月 13 日 4:29
Hi Dinesh,
When sending serial data to a device like a VFD display through a USB to RS-485 converter, it's important to ensure that the serial communication settings match the requirements of both the converter and the display. If you're seeing different symbols instead of the expected text, it could be due to several reasons. Some of them are:
  • Ensure that the baud rate, stop bits, and data bits match the specifications required by your VFD display.
  • Some devices require a specific terminator (e.g., carriage return \r, newline \n, or both) to recognize the end of a command. Check if your VFD display requires this.
  • Verify that the USB to RS-485 converter is installed correctly and that its settings are compatible with the VFD display.
Based on some of my obersvation, I have slighlty modified your code. You may try running te same:
% Create a serial object and open it
s = serial('COM3', 'BaudRate', 19200, 'StopBits', 1, 'DataBits', 8);
fopen(s);
% Write data to the serial port
% If a terminator is needed, append it to the string
fwrite(s, 'HELLO'); % Try 'HELLO\n' or 'HELLO\r\n' if a terminator is required
fclose(s);
delete(s);
clear s;
Additonally, you can consider using a terminal program like PuTTY to manually send data to the VFD display. This can help determine if the issue is with the MATLAB code or elsewhere in the setup.
Hope this helps!

カテゴリ

Help Center および File ExchangeProgramming Utilities についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by