⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spihard.bas

📁 82 sample programs written in BASCOM-8051 for 8051 developement
💻 BAS
字号:
' -------------------------------------------------------------------
'                       SPIHARD.BAS
'        SPI demo for the hardware SPI found in the 89S8252
' -------------------------------------------------------------------
$regfile = "89s8252.dat"
Const Sim = 1

Dim Ar(10) As Byte
Dim I As Integer

'fill array
For I = 1 To 10
  Ar(i) = I
Next

Config Spi = Hard , Interrupt = Off , Data Order = Lsb , Master = Yes , Polarity = High , Phase = 1 , Clockrate = 4

#if Sim = 0
  Spiin Ar(1) , 10
#endif
'data is sent byte by byte,each byte returned is placed into the array
For I = 1 To 10
  Print Ar(i)
Next


'note that in the simulator the program will halt because the SPSR register will not have the proper value
'that is why we use conditional compilation to exclude the code
End

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -