Version 2 of Xilinx Spartan 3 Demo rs232 clock set

Updated 2005-05-11 12:56:35 by escargo

TV

I've been working with a Xilinx Spartan-3 demo board[L1 ], for which there is a clock example that can be burned in the config FLASH with little effort, and that clock can be set (and some other things) over an RS-232 link.

This tcl script programs the computer clock automatically into the board with a readable command:

 #open serial port
 set fh [open COM1: RDWR]
 fconfigure $fh -blocking 0 -mode 9600,n,8,1 -translation binary -translation cr -buffering none

 # make a text window for incoming communication
 text .t -width 40 -height 10
 pack .t -expand y -fill both
 fileevent $fh readable {.t insert end [read $fh] ;.t see end}

 # print time, and set the xilinx time
 puts [clock format [clock seconds] -format "%H:%M:%S"]
 puts $fh "time" ; flush $fh
 puts $fh "time [clock format [clock seconds] -format \"%H:%M:%S\"]" ; flush $fh

Category Example