Hardware Reference
In-Depth Information
jsr delayby1ms
ldd #$B000
jsr sendMCP4922
ldy #1
jsr delayby1ms
lbra forever
; ********************************************************************************
; The following subroutine sends out the value to be converted by MCP4922.
; The value to be sent is passed in double accumulator D.
; ********************************************************************************
sendMCP4922
bclr
PTK,BIT7
jsr
putcSPI0
tfr
B,A
jsr
putcSPI0
bset
PTK,BIT7
rts
; ********************************************************************************
; The following subroutine enables SPI to shift data on the rising edge of SCK and
; force SCK to be idle low, and shift data at 6 MHz for the 24-MHz E-clock.
; ********************************************************************************
openSPI
movb
#$10,SPI0BR
; set SPI 0 baud rate to 6 MHz
movb
#$50,SPI0CR1
; disable interrupt, enable SPI, SCK idle low,
; data latched on the rising edge, msb first
movb
#$02,SPI0CR2
; disable bidirectional mode, stop SPI in wait mode
movb
#0,WOMS
; enable Port S pull-up (push-pull)
rts
#include “c:\miniide\delay.asm”
#include “c:\miniide\spi0util.asm”
end
This program can be modified to be interrupt-driven so that the MCU can still perform
other operations. The C language version of the program is straightforward and hence is left as
an exercise problem.
10.11 Matrix LED Displays
Many organizations have the need to display important information at the entrance or
some corners of their buildings. The information need not be displayed all at once but can be
rotated. Temperature, date, humidity, and other data in turn are displayed at many crossroads.
Schools display their upcoming games, the result of games yesterday, or other important events
using large display panels. Many of these display panels use the matrix LED displays because of
their brightness and versatility.
10.11.1 The Organization of Matrix LED Displays
Matrix LED displays are denoted by the number of their columns and rows. The most pop-
ular matrix LED display has five columns and seven rows (5
×
7). Other configurations, such
as 5
8, are also available. It is obvious that the more rows and columns of LEDs are
used, the better the resolution will be.
×
8 and 8
×
 
Search WWH ::




Custom Search