本帖最后由 lilith 于 2014-5-18 18:35 编辑
一下子忘了 38 的 ID 不同 
效果只能说,哎 
源代码,用 AVR 单片机操作一个双 DAC(LTC1446)实现:
Declare Function DrawChr(bLine As Byte) As Byte
DDRD = &b00000111
PORTD = &b00000100
InitLcd()
WaitMs 255
Cls
Lcd " LTC1446 Test 3"
Wait 1
'WriteDAC(192, 128)
Do
Charat = "Lilith"
DrawChr(0)
Loop
Function DrawChr(bLine As Byte) As Byte
Local is As Byte
Local iLs As Byte
Local iFn As Byte
Local iChn As Byte
Local bChr As Byte
Local xAdd As Byte
Local xBdd As Byte
Local idw As Byte
xAdd = 0
xBdd = 0
iLs = Len(Charat)
Locate 2, 1 : Lcd iLs
For is = 1 To iLs
bChr = Asc(Mid(Charat,is,1)) - 32
For iFn = 0 To 4
iChn = Ft1(bChr * 5 + iFn)
ic = iChn
For idw = 0 To 7
id = ic And &b10000000
If id = 128 Then
WriteDAC(iFn * 8 + xAdd * 32 + xBdd * 12, idw * 16 + 16)
End If
WaitUs 2
ic = Shift(Left, 1, ic)
Next idw
'xAdd = xAdd + 1
Next iFn
xAdd = xAdd + 1
xBdd = xBdd + 1
Next is
Return 0
End Function
Function WriteDAC(X As Byte, Y As Byte) As Byte
Local wB1 As Byte
Local wB2 As Byte
Local wB3 As Byte
wB1 = X
wB2 = Swap(Y)
wB2 = wB2 And &b00001111
wB3 = Swap(Y)
wB3 = wB3 And &b11110000
ChipSet = 0
ShiftOut wB1; wB2; wB3
ChipSet = 1
Return 0
End Function
|