Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
if [string equal -nocase $tcl_platform(platform) {windows}] {
set comport com1
} else {
set comport /dev/ttyS0
}
if { [catch {open $comport {r+}} fdin] } {
puts stderr "Error opening serial port $comport"
after 2000
exit
}
fconfigure $fdin -mode 38400,n,8,1 -blocking 0 -translation binary -buffering none
psubiaco said:Using RS232 serial port with TCL scripting language is very very easy.
Consider that the OS will buffer serial port too, so the device which transmit data to the PC serial port must supply a carriage return '\n' at the end of frame.
The routines below will work with both windows and linux OSes.
Regards. Paolo
Code:if [string equal -nocase $tcl_platform(platform) {windows}] { set comport com1 } else { set comport /dev/ttyS0 } if { [catch {open $comport {r+}} fdin] } { puts stderr "Error opening serial port $comport" after 2000 exit } fconfigure $fdin -mode 38400,n,8,1 -blocking 0 -translation binary -buffering none