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

📄 123.bas

📁 我用BASIC开发环境下的LED屏单显示实验程序
💻 BAS
字号:
Define CONF_WORD = 0x3f72
Define CLOCK_FREQUENCY = 12
AllDigital

Define SPI_CS_REG = PORTC
Define SPI_CS_BIT = 4
Define SPI_SCK_REG = PORTC
Define SPI_SCK_BIT = 3
Define SPI_SDI_REG = PORTC
Define SPI_SDI_BIT = 0
Define SPI_SDO_REG = PORTC
Define SPI_SDO_BIT = 5
SPIPrepare

TRISB = 000
Dim digit As Byte
Dim tah As Byte
Dim tal As Byte
Dim sah As Byte
Dim sal As Byte
Dim zhh As Byte
Dim zhl As Byte
Dim dah As Byte
Dim dal As Byte
Dim work0 As Byte
Dim work2 As Byte
Dim work3 As Byte
Dim work1 As Byte
Dim work4 As Byte
Dim work5 As Byte
Dim work6 As Byte
Dim work7 As Byte



loop:
For digit = 0 To 15

tah = LookUp(0x01, 0x00, 0x3f, 0x30, 0x3f, 0x30, 0x3f, 0x30, 0x3f, 0x30, 0x3f, 0x3c, 0x6c, 0x6f, 0xcc, 0x00), digit
tal = LookUp(0x80, 0xc0, 0xfe, 0xc0, 0xf8, 0xd8, 0xfe, 0xd8, 0xf8, 0xc0, 0xf0, 0x18, 0x18, 0xf8, 0x18, 0x00), digit
sah = LookUp(0x01, 0x01, 0x01, 0x01, 0x01, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x7f, 0x30, 0x00), digit
sal = LookUp(0x80, 0x80, 0x86, 0x86, 0x80, 0x86, 0x86, 0xfe, 0x06, 0x86, 0x86, 0x80, 0x80, 0x86, 0x86, 0x00), digit
zhh = LookUp(0x30, 0xff, 0x7f, 0x0c, 0x3f, 0x0e, 0x0c, 0x0c, 0x6c, 0x0f, 0x0c, 0x0f, 0x0c, 0x19, 0x0f, 0x0c), digit
zhl = LookUp(0x00, 0xe6, 0xf8, 0x18, 0x18, 0x18, 0x66, 0x80, 0x7e, 0x7e, 0x18, 0xf8, 0x66, 0x80, 0xf8, 0x18), digit
dah = LookUp(0x00, 0x40, 0x30, 0x10, 0x0f, 0x00, 0x00, 0x80, 0x80, 0x21, 0x22, 0x24, 0x28, 0x50, 0x8f, 0x00), digit
dal = LookUp(0x00, 0x80, 0x80, 0x80, 0xfc, 0x80, 0x80, 0x80, 0x40, 0x20, 0x18, 0x0c, 0x08, 0x02, 0xfc, 0x00), digit

work0 = ShiftLeft(tah, 0)
If tal.7 = 1 Then tah.0 = 1
If tal.7 = 0 Then tah.0 = 0

work1 = ShiftLeft(tal, 0)
If sah.7 = 1 Then tal.0 = 1
If sah.7 = 0 Then tal.0 = 0

work2 = ShiftLeft(sah, 0)
If sal.7 = 1 Then sah.0 = 1
If sal.7 = 0 Then sah.0 = 0

work3 = ShiftLeft(sal, 0)
If zhh.7 = 1 Then sal.0 = 1
If zhh.7 = 0 Then sal.0 = 0

work4 = ShiftLeft(zhh, 0)
If zhl.7 = 1 Then zhh.0 = 1
If zhl.7 = 0 Then zhh.0 = 0

work5 = ShiftLeft(zhl, 0)
If dah.7 = 1 Then zhl.0 = 1
If dah.7 = 0 Then zhl.0 = 0

work6 = ShiftLeft(dah, 0)
If dal.7 = 1 Then dah.0 = 1
If dal.7 = 0 Then dah.0 = 0

work7 = ShiftLeft(dal, 0)

SPICSOn
SPISend work0
SPISend work1
SPISend work2
SPISend work3
SPISend work4
SPISend work5
SPISend work6
SPISend work7

SPICSOff
PORTB = digit
Next digit

Goto loop
End

⌨️ 快捷键说明

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