Differences

This shows you the differences between two versions of the page.

wiki:projects:python:ezusb:4chardsp [2006/06/16 11:50] (current)
Line 1: Line 1:
 +====== 4chardsp ======
 +Interface one of those 4-digit-LED-displays produced by philips.
 +===== firmware =====
 +  * {{:wiki:projects:python:ezusb:iomap.hex.zip|iomap.hex.zip}}
 +
 +===== source =====
 +<code python>
 +#!/usr/bin/python
 +
 +from ezusb import EZUSB
 +
 +ezusb=EZUSB(0x0547,0x2131)
 +ezusb.downloadFW('iomap.hex')
 +
 +import time as time
 +
 +DSP_WR=1<<0  # 1
 +DSP_A0=1<<1  # 2
 +DSP_A1=1<<2  # 4
 +DSP_BL=1<<3  # 8
 +DSP_CLR=1<<4  # 16
 +
 +time.sleep(0.1)
 +
 +def writeDSP(chars):
 +  ezusb.writeRAM(0x1b40,[DSP_WR | DSP_BL | DSP_CLR, ord(chars[3]) ])
 +  ezusb.writeRAM(0x1b40,[        DSP_BL | DSP_CLR, ord(chars[3]) ])
 +  ezusb.writeRAM(0x1b40,[DSP_WR | DSP_BL | DSP_CLR, ord(chars[3]) ])
 +
 +  ezusb.writeRAM(0x1b40,[DSP_WR | DSP_BL | DSP_CLR|DSP_A0, ord(chars[2]) ])
 +  ezusb.writeRAM(0x1b40,[        DSP_BL | DSP_CLR|DSP_A0, ord(chars[2]) ])
 +  ezusb.writeRAM(0x1b40,[DSP_WR | DSP_BL | DSP_CLR|DSP_A0, ord(chars[2]) ])
 +
 +  ezusb.writeRAM(0x1b40,[DSP_WR | DSP_BL | DSP_CLR|DSP_A1, ord(chars[1]) ])
 +  ezusb.writeRAM(0x1b40,[        DSP_BL | DSP_CLR|DSP_A1, ord(chars[1]) ])
 +  ezusb.writeRAM(0x1b40,[DSP_WR | DSP_BL | DSP_CLR|DSP_A1, ord(chars[1]) ])
 +
 +  ezusb.writeRAM(0x1b40,[DSP_WR | DSP_BL | DSP_CLR|DSP_A0|DSP_A1, ord(chars[0]) ])
 +  ezusb.writeRAM(0x1b40,[        DSP_BL | DSP_CLR|DSP_A0|DSP_A1, ord(chars[0]) ])
 +  ezusb.writeRAM(0x1b40,[DSP_WR | DSP_BL | DSP_CLR|DSP_A0|DSP_A1, ord(chars[0]) ])
 +
 +while 1:
 +  writeDSP( time.strftime('%M%S') )
 +  print "%s" % (time.strftime('%M%S'))
 +  time.sleep(0.5)
 +
 +</code>
 
wiki/projects/python/ezusb/4chardsp.txt · Last modified: 2006/06/16 11:50 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki