📄 ltc1298.bas
字号:
'---------------------------------------------------------------------
' LTC1298.BAS
' (c) 2002 MCS Electronics
'This example shows how to make use of ASM libs
'---------------------------------------------------------------------
'First we tell the compiler about the lib
$lib "Ltc1298.lib"
'Second we tell which subroutine must be included from that lib
$external _ltc1298
'[ALIAS]
'It is a good idea to alias the used pins and to precede the clock and
'other pins with the chipname
Ltc1298_cs Alias P1.4
Ltc1298_clock Alias P1.3
Ltc1298_din Alias P1.2
'Now declare the subroutine
Declare Sub Ltc1298(w As Word)
'We pass a word to this routine
Dim W As Word
'call the sub routine with variable W
Ltc1298 W
Print W
End
'here we create the SUB
'this would normally not be needed but it is the only way to pass the address
'of the variable to the sub routine. This will be changed in the future and then
'you could ommit this code! So it is a good idea to store it into an include file
'when you have a buncg of them
Sub Ltc1298(w As Word)
$asm
' We put the address of the MSB into register r0
mov r0,#{w+1} ; address of MSB W into r0
'now call the actually routine in the lib
lcall _ltc1298
'the lib routine handles the rest
$end Asm
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -