Version 4 of Xilinx Spartan 3 Demo rs232 clock set

Updated 2005-08-02 16:50:34

TV

http://82.168.209.239/Wiki/xilledson.jpg

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

To put all the leds on or off from tcl connected over the serial port:

 proc s a {global fh; puts $fh $a ; flush $fh}
 for {set i 0} {$i <=7} {incr i} {s "led$i on" ; after 1; update}
 for {set i 0} {$i <=7} {incr i} {s "led$i off"; after 1; update}

http://82.168.209.239/Wiki/xilledsoff.jpg


Category Example