Saturday, July 25, 2015

Use mode in batch file to fix serial paramters


Here's my batch file:
----------------------------------------------
rem set serial port to 9600,8,n,1
mode com16 baud=9600 parity=n data=8
-------------------------------------------------


hh

Ascii table

Got it from here.



c

Friday, July 24, 2015

This site is good for redirecting to COM ports

This helped me a lot.


In above, I wrote a little exe file in FreeBasic to output a character every 5 seconds. The Arduino was on COM16 via USB-Serial. Somehow the baudrate etc was all ok.
Here's the FreeBasic program: (note most of it is commented out)
---------------------------------------------------------------------------------------
' this time redirect output via dos command
'this part just print chars to standard output
dim adresult as single
' open com "com16:9600,n,8,1,cs0,cd0,ds0,rs" as #1
if err <> 0 then
    print "Error opening COM16:"
    sleep
    end
end if
do
print 59;
print #1,59;
' rem input #1, adresult 'get result
' print adresult 'display result
' sleep 3
sleep 5000,0 'reading evering 2 seconds
loop until inkey$ = chr$(27)
sleep
----------------------------------------------------------------------------------
c