Hardware Reference
In-Depth Information
Solution: The procedure for generating the specified waveform is as follows:
Step 1
Configure SPI0 module properly.
Step 2
Output a high (5 V) from V OUTA and also output a high from V OUTB .
Step 3
Wait for 1 ms.
Step 4
Output a low from V OUTB .
Step 5
Wait for 1 ms.
Step 6
Output a low from V OUTA and output a high from V OUTB .
Step 7
Wait for 1 ms.
Step 8
Output a low from V OUTB .
Step 9
Wait for 1 ms.
Step 10
Go to step 2.
The value to be sent to MCP4922 to output a high from V OUTA is 0x3FFF whereas the value
to be sent to generate a low from the V OUTA pin is 0x3000.
The value to be sent to MCP4922 to output a high from V OUTB is 0xBFFF whereas the value
to be sent to generate a low from the V OUTB pin is 0xB000.
The assembly program for generating the specified waveform is as follows:
#include “c:\miniide\hcs12.inc”
org
$1500
lds
#$1500
; set up the stack pointer
jsr
openSPI
; configure the SPI0
bset
DDRK,BIT7
; configure PK7 pin for output
forever
ldd
#$3FFF
; output a high from V OUTA
jsr
sendMCP4922
;
ldd
#$BFFF
; output a high from V OUTB
jsr
sendMCP4922
;
ldy
#1
; wait for 1 ms
jsr
delayby1ms
;
ldd
#$B000
jsr
sendMCP4922
ldy
#1
jsr
delayby1ms
ldd
#$3000
jsr
sendMCP4922
ldd
#$BFFF
jsr
sendMCP4922
ldy
#1
Search WWH ::




Custom Search