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

📄 ex24 - 74hc165.bs2

📁 这是proteus得一些经典例子 供大家学习参考
💻 BS2
字号:
' {$STAMP BS2}
' ==============================================================================
'
' File...... Ex24 - 74HC165.BS2
' Purpose... Input expansion with 74HC165
' Author.... Parallax
' E-mail.... stamptech@parallaxinc.com
' Started...
' Updated... 01 MAY 2002
'
'
' ==============================================================================
' ------------------------------------------------------------------------------
' Program Description
' ------------------------------------------------------------------------------
' This program shows how to read eight inputs with just three Stamp pins using
' a 74HC165 shift register.
' ------------------------------------------------------------------------------
' I/O Definitions
' ------------------------------------------------------------------------------
Clock CON 0 ' shift clock (74x165.2)
DataIn CON 3 ' shift data (74x165.7)
Load CON 4 ' input load (74x165.1)
' ------------------------------------------------------------------------------
' Variables
' ------------------------------------------------------------------------------
switches VAR Byte ' inputs switches
' ------------------------------------------------------------------------------
' Initialization
' ------------------------------------------------------------------------------
Initialize:
HIGH Load ' make output; initialize to 1
' ------------------------------------------------------------------------------
' Program Code
' ------------------------------------------------------------------------------
Main:
GOSUB Read_165 ' read 8-pos dip switch
DEBUG Home, "Switches = ", BIN8 switches, CR ' display binary mode
PAUSE 100
GOTO Main ' do it again
' ------------------------------------------------------------------------------
' Subroutines
' ------------------------------------------------------------------------------
Read_165:
PULSOUT Load, 5 ' grab the switch inputs
SHIFTIN DataIn, Clock, MSBPre, [switches] ' shift them in
RETURN

⌨️ 快捷键说明

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