5x7 LED Display Driver

91.548 Robotics I
Assignment 5
David J. Meppelink
February 27, 2003

Description

The LogoChip can be used to display characters on a 5x7 LED dot matrix display (part number LTP-747HR).

The display has 7 row pins and 5 column pins. Each one of its 35 LEDs is connected across an intersection of a row pin and a column pin. So, a single LED can be lit by applying a positive voltage to its column and grounding its row. Multiple LEDs can be lit by applying voltage to multiple columns and grounding multiple rows simultaneously. However, this can only create a limited number of patterns. To display character glyphs, the display must use row or column scanning and depend on persistence of vision. The basic scheme is to flash the proper LEDs of each row (or column) in succession. Repeating this quickly enough gives the illusion of a steady display.

The LogoChip is wired to the display so that PORTB1 through PORTB7 are connected to the display rows and PORTA0 through PORTA4 are connected to the display columns through driver transistors, as shown in the the schematic diagram. The driver transistors deliver more current to the display than the LogoChip outputs can on their own, so they produce a brighter display. Without them, the display can barely be seen in normal room lighting. The LogoChip can sink more current than it can source, so the display is connected directly to PORTB without driver transistors. (Adding driver transistors to the rows would be even better.)

The schematic diagram also shows the basic LogoChip wiring (crystal, boot flash LEDs, etc). The UML 305 Development Board provides control switches and serial line voltage level conversion. SW4 is the LogoChip start/stop button. The other pushbuttons (SW1, SW2, SW3) are wired to extra PORTC inputs for experimental purposes; they are not used here.

Given this hardware configuration, column scanning produces a brighter display (because the transistor can drive up to 7 LEDs rather than only 1 LED if row scanning were used). The LogoChip program reads an ASCII character from the Cricket Bus and displays it on the 5x7 LED display. It reads character glyphs stored in the LogoChip starting at address $1000. Each glyph is five bytes long, one byte for each column of the display. The main loop reads each byte in turn, writes it to PORTB and toggles the appropriate bit of PORTA. The "when" routine reads a character off the bus and stores it. After each refresh, the main loop resets its starting address using the character to calculate the offset.

A Handy Cricket can send a character to the display using the Cricket Bus. For example, the Handy Cricket could simply read an ASCII character from its IR port and forward it to the LogoChip display, as shown below. The protocol is to simply send device ID $80 and then the ASCII character value as a single byte. PORTB0 is used for Handy Cricket bus because it is the only input that can generate a hardware interrupt.

A PC terminal emulator can send characters to the Handy Cricket using the Cricket Serial-IR interface. Or a second cricket can send a sequence of characters.

Schematic Diagram

Character Glyphs

Execute these commands in the MicroWorlds Command Center window (not the LC LOGO -cc- window) to download the character glyphs to the LogoChip. See IkonBoard for details.
monoff
cricket-check
wl $1000 [ $f8 $fc $fc $fc $f8 ]
wl $1005 [ $fe $fe $04 $fe $fe ]
wl $1041 [ $fe $ee $ee $ee $fe ]
wl $1050 [ $82 $7c $6c $7c $82 ]
wl $1055 [ $fe $bc $00 $fc $fe ]
wl $105a [ $b0 $6c $6c $6c $9c ]
wl $105f [ $ba $7c $6c $6c $92 ]
wl $1064 [ $0e $ee $ee $00 $ee ]
wl $1069 [ $0a $6c $6c $6c $72 ]
wl $106e [ $82 $6c $6c $6c $b2 ]
wl $1073 [ $78 $76 $6e $5e $3e ]
wl $1078 [ $92 $6c $6c $6c $92 ]
wl $107d [ $9a $6c $6c $6c $82 ]
wl $10a5 [ $80 $6e $6e $6e $80 ]
wl $10aa [ $00 $6c $6c $6c $92 ]
wl $10af [ $82 $7c $7c $7c $ba ]
wl $10b4 [ $00 $7c $7c $7c $82 ]
wl $10b9 [ $00 $6c $6c $7c $7c ]
wl $10be [ $00 $6e $6e $7e $7e ]
wl $10c3 [ $82 $7c $6c $6c $a2 ]
wl $10c8 [ $00 $ee $ee $ee $00 ]
wl $10cd [ $fe $7c $00 $7c $fe ]
wl $10d2 [ $fa $fc $7c $02 $7e ]
wl $10d7 [ $00 $ee $ee $d6 $38 ]
wl $10dc [ $00 $fc $fc $fc $fc ]
wl $10e1 [ $00 $be $de $be $00 ]
wl $10e6 [ $00 $de $ee $f6 $00 ]
wl $10eb [ $82 $7c $7c $7c $82 ]
wl $10f0 [ $00 $6e $6e $6e $9e ]
wl $10f5 [ $82 $7c $74 $78 $80 ]
wl $10fa [ $00 $6e $66 $6a $9c ]
wl $10ff [ $9a $6c $6c $6c $b2 ]
wl $1104 [ $7e $7e $00 $7e $7e ]
wl $1109 [ $02 $fc $fc $fc $02 ]
wl $110e [ $06 $fa $fc $fa $06 ]
wl $1113 [ $02 $fc $f2 $fc $02 ]
wl $1118 [ $38 $d6 $ee $d6 $38 ]
wl $111d [ $3e $de $e0 $de $3e ]
wl $1122 [ $78 $74 $6c $5c $3c ]
send $fb

LogoChip Display Program

This LogoChip program reads an ASCII character from the Cricket Bus and displays it on the 5x7 LED display.
constants [[porta 5][porta-ddr $85]
           [portb 6][portb-ddr $86]
           [portc 7][portc-ddr $87]
           [adcon1 $9f]]

global [addr ch]

to main
  write adcon1 6
  write porta-ddr 0
  write portb-ddr 1
  setch $21

  when [newbus?] [if brcv = $180 [waituntil [newbus?] setch brcv]]

  loop [
    setaddr $1000 + ((ch - $20) * 5)
    write portb read-rom (addr)     clearbit 0 porta setbit 0 porta
    write portb read-rom (addr + 1) clearbit 1 porta setbit 1 porta
    write portb read-rom (addr + 2) clearbit 2 porta setbit 2 porta
    write portb read-rom (addr + 3) clearbit 3 porta setbit 3 porta
    write portb read-rom (addr + 4) clearbit 4 porta setbit 4 porta
  ]
end

Handy Cricket Program

This Handy Cricket program reads an ASCII character from its IR port and forwards it to the LogoChip display at bus address $80.
to main
  waituntil [newir?]
  bsend $180 bsend low-byte ir
  main
end

Handy Cricket Character Sender Program

This Handy Cricket program sends the ASCII characters A to Z over its IR port.
global [ch]
to main
  setch $41
  repeat 26 [send ch setch ch + 1 wait 10]
end