cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with sending commands/time-stamp via terminal/LabVIEW in USB_VCP mode

rumlyen
Associate II
Posted on June 15, 2016 at 15:50

Hello all,

I'm facing an issue with sending commands (and time-stamp) from PC to MCU (Stm32L151) via USB_VCP. Following the idea from

http://www.instructables.com/id/Synchronise-DS3221-RTC-with-PC-via-Arduino/?ALLSTEPS

, I was able to send PC time via USART using a Batch script. But, the same script isn't working for USB_VCP. I tried to send single character via script/LabVIEW but MCU can't recognize it. MCU can only recognize character/string sending from uTerm software.

Am I missing something ? Is it mandatory to use Hyper-terminal software to communicate with MCU via USB_VCP ? I'm attaching the Batch Script file for reference: (Output ''S33,D22,H11,T04,M05,J16,'' for 11:22:33 05/04/2016)

Batch Script:

--------------

mode COM11 BAUD=115200 PARITY=n DATA=8

@echo off

for /F ''usebackq tokens=1,2 delims=='' %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j

set hours=%ldt:~8,2%

set minutes=%ldt:~10,2%

set /A seconds=%ldt:~12,2%+2

set miliSeconds=%ldt:~15,3%

:loop

if %TIME% LSS %hours%:%minutes%:%seconds%.00 goto loop

for /F ''usebackq tokens=1,2 delims=='' %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j

echo S%ldt:~12,2%,D%ldt:~10,2%,H%ldt:~8,2%,T%ldt:~6,2%,M%ldt:~4,2%,J%ldt:~2,2%, >COM11

set /A seconds=%ldt:~12,2%+4

:loop2

if %TIME% LSS %hours%:%minutes%:%seconds%.00 goto loop2
0 REPLIES 0