⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 canltwo.tcl

📁 can4linux-3.5.3.gz can4 linux
💻 TCL
字号:
#!/usr/bin/tclsh# Tcl CAN Layer 2 example#load ./canLtwo.soputs "....... swig wrapper loaded"# open the can interface /dev/can0# but before, set the baud rate if other than defaultexec /bin/echo 125 > /proc/sys/Can/Baudputs "....... bit rate changed"set device 1set can_fd [can_open $device]puts "....... /dev/can$device opened"# send 8 byte, message id 100can_send $can_fd 8 100:1,2,3,4,5,6,7,8puts "... sent message"# don't specify message lengthcan_send $can_fd 0 100:8,7,6,5,4,3,2,1puts "... sent message"# send RTR messagescan_send $can_fd 0 r200puts "... sent message"can_send $can_fd 4 r101puts "... sent message"set timeout 10# try to receive something from can_fd, timeout in 祍# wait forever if timeout == 0puts "Wait $timeout sec for an message....."puts [can_read2 $can_fd [expr $timeout * 1000000]]puts "Wait $timeout sec for an message....."puts [can_read1 $can_fd [expr $timeout * 1000000]]puts "Wait default timeout for an message....."puts [can_read1 $can_fd]can_close $can_fdputs "....... /dev/can$device closed"exit

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -