TCL routines for RS232 communication

Status
Not open for further replies.

kukurigu

Junior Member level 3
Joined
Dec 14, 2002
Messages
25
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
272
Hello all!

I'm looking for TCL routines for RS232 communication - receive, transmit, baud rate selection ...

Can you help me?
Best Regards!
 

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
 



i see what you have done ..but can u show me how to do this in window..cause i think its abit diffrernt isn't it.
 

Hello all.
If I'm not wrong the RS232 full control is already avilable in the latestest releases if TCL, for example 8.4.
Just try google "tcl/tk" serial port.....
You will find a lot.
S.
 


i get an this error when i try to open com 1 or com 2

all i wrote is this -> set serial [open com1 r+]
and i get this error -> permission denied

iv got windows xp

i dont get it :x
 

Oh so trying to access hardware via WinXP...no !! thats not a very convenient thing to do..as the OS does not allow such things ...you will have to incorporate some additional code...
 

dont worry bro, iv fixed it, i dont think you have to add extra code, r u sure you know what your talking about, cause iv fixed the problem and its really simple as.
and actully its no extra code that was required. just used my head a little, but thanks for trying to help.
 

im having the same problem about accessing the com port using tcl, i beg u to tell me how u did it, please, im dying here
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…