Table of Contents

4chardsp

Interface one of those 4-digit-LED-displays produced by philips.

firmware

source

#!/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)
 
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