serial communication to VFD displays

조회 수: 7 (최근 30일)
DINESH MOKA
DINESH MOKA 2020년 1월 3일
답변: Amish 2025년 2월 13일
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일
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 CenterFile Exchange에서 MATLAB Compiler SDK에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by