Serial port Communication
Baud rate: Some products (use USB/serial converter chips): 9600bps, 1b stop bit, no parity checkOther products (use USB-CDC protocol): no limitation (always transfer at max USB speed) Command EOL (End Of Line) char: CR+LF, in hex format 0x0D+0x0A, in C language \r\nSpecial char for console: Ctrl-C Reset: single binary char 0x03, in C language \x03in most cases, send this char will stop current running command or reset the console and new prompt '=>' will be printed Debug tool (Linux): miniterm.py is included in pyserial library, install with pipno extra setting for TX/RX EOL char ![]() a tiny interactive serial debugger is provided in mcush_util shell mode ![]() Debug tool (Windows): Tera Term https://ttssh2.osdn.jp/notice to set receive/transmit new line EOL char: ![]() Port number and priority under Ubuntu system: Ports are often enumerated as /dev/ttyUSBxxx or /dev/ttyACMxxx with increasing ID.To avoid the hopping id, you can retrieve the device by device VID/PID: /dev/serial/by-id/usb-??????????? Or by bus path: /dev/serial/by-path/pci-??????????? Normal user needs to add to dialout group for device priority (modify /etc/group). Send serial port command in Windows/Cmd.exe: eg: echo a -c 0xff00ff > \\.\comXX (XX is the enumerated serial port number, check it in Device Manager)The command above will send the raw command "a -c 0xff00ff" to a specific port. You can put the command into .bat script for automation. As no feedback is checked, this is only suitable for simple commands. Send serial command with console tool mcush_util: sending serial commands directly in console may fail because of:you can use console program mcush_util to handle these conditions (support Win/Linux). eg:
this command opens specific port, send Ctrl-C to reset console and get prompt, check *idn?, and run following multiple commands (with arguments) download: Win(32bit) mcush_util.exe, Linux(64bit) mcush_util compile for other platform from source codes (provide CodeBlocks project, or Makefile/GCC that supports cross-compile) Send command with DLL in LabVIEW: call DLLmcush_util.dll mcush_command function to send command to deivce,only port and command (with arguments) are required ![]() ![]() |
C Programming
C Programming API example
mcush_api.c
mcush_api.h
Call example
C++ Programming API example mcush_drv.cpp mcush_drv.h mcush_api.c mcush_api.h
Call example
Call example
|
C++ Programming API example mcush_drv.cpp mcush_drv.h mcush_api.c mcush_api.h
Call example
|