匿名
未登录
登录
丢石头百科
搜索
查看“使用74LS165将C8051F的串口输入扩为并口输入”的源代码
来自丢石头百科
名字空间
页面
讨论
更多
更多
页面选项
查看
查看源代码
历史
←
使用74LS165将C8051F的串口输入扩为并口输入
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
<table border="0" cellpadding="0" cellspacing="0" style="color: rgb(72, 61, 139); font-family: Arial, 新宋体, 微软雅黑; font-size: 12px;" width="780"><tbody><tr><th class="type_483D8B" scope="col" style="line-height: 20px; font-weight: normal; border-top-style: none;" valign="top"> <table border="0" cellpadding="0" cellspacing="0" width="120"><tbody><tr><th align="center" bgcolor="#698192" class="white_12px_b" height="20" scope="col" style="font-size: 12px; color: rgb(255, 255, 255); line-height: 20px; font-family: Arial, Helvetica, sans-serif;">系统功能</th></tr></tbody></table> 使用74LS165将C8051F的串口输入扩为并口输入。 </th></tr><tr><th align="center" class="type_483D8B" scope="col" style="line-height: 20px; font-weight: normal; border-top-style: none;" valign="top"> <table border="0" cellpadding="0" cellspacing="0" width="120"><tbody><tr><th align="center" bgcolor="#698192" class="white_12px_b" height="20" scope="col" style="font-size: 12px; color: rgb(255, 255, 255); line-height: 20px; font-family: Arial, Helvetica, sans-serif;">硬件设计</th></tr></tbody></table> [[File:C8051F_3_3.jpg]] 串行输入扩展为并行输入芯片74LS165控制电路原理图 </th></tr><tr><th class="type_483D8B" scope="col" style="line-height: 20px; font-weight: normal; border-top-style: none;" valign="top"> <table border="0" cellpadding="0" cellspacing="0" width="120"><tbody><tr><th align="center" bgcolor="#698192" class="white_12px_b" height="20" scope="col" style="font-size: 12px; color: rgb(255, 255, 255); line-height: 20px;">软件设计</th></tr></tbody></table> 下面部分从TXT拷出,拷到网页,代码部分缺省了很多空格,比较凌乱,请谅解! //目标系统: 基于C8051F单片机 //应用软件: Silicon IDE / Keil /*01010101010101010101010101010101010101010101010101010101010101010101 ---------------------------------------------------------------------- 实验内容: 使用P2口作为信号源输入到74LS165,74LS165将会将该信号转为串行信号, MCU再自己接收串行信号,使用P2口的LED指示灯查看数据是否正确。 ---------------------------------------------------------------------- 硬件连接: 将PB口的LED指示灯开关切换到"ON"状态。 DVK501(165PrlPort) F320 EX D0 --------- P2.0 D1 --------- P2.1 D2 --------- P2.2 D3 --------- P2.3 D4 --------- P2.4 D5 --------- P2.5 D6 --------- P2.6 D7 --------- P2.7 VCC --------- VCC GND --------- GND PL --------- P1.0 QH --------- P0.5 CLK --------- P0.4 ---------------------------------------------------------------------- 注意事项: (1)若有加载库程序,请将光盘根目录下的“library”下的“C8051F”文件夹拷到D盘 (2)请详细阅读:光盘根目录下的“说明书首页.htm”里的相应产品说明 ---------------------------------------------------------------------- 10101010101010101010101010101010101010101010101010101010101010101010*/ #define _DVK501_F320_EX_ #include <c8051f320.h> #include <../../../../library/C8051F/ws_clock.h> #include <../../../../library/C8051F/ws_74hc165_port.h> void main(void) { uchar a = 0; PCA0MD &= ~0x40; XBR1 = 0x40; clock_external(); P2MDOUT = 0xFF; hc165Init(); while(1) { P2 = 0x55; a = hc165GetDat(); P2 = a; } } sbit HC165_RXD = P0^5; sbit HC165_TXD = P0^4; sbit HC165_PL = P1^0; uchar hc165GetDat(void) { uchar i,dat=0; HC165_PL = 0; HC165_PL = 1; for(i=0;i<8;i++) { HC165_TXD = 0; dat = dat<<1; if(HC165_RXD) dat |= 0x01; HC165_TXD = 1; } return dat; } void hc165Init(void) { P0MDOUT |= 0x08; P1MDOUT |= 0x01; }</th></tr><tr><th class="type_483D8B" scope="col" style="line-height: 20px; font-weight: normal; border-top-style: none;" valign="top"> <table border="0" cellpadding="0" cellspacing="0" width="120"><tbody><tr><th align="center" bgcolor="#698192" class="white_12px_b" height="20" scope="col" style="font-size: 12px; color: rgb(255, 255, 255); line-height: 20px; font-family: Arial, Helvetica, sans-serif;">系统调试</th></tr></tbody></table> 将74LS165的输入端口D0--D7接入单片机的P2口,那么P2口输出的数据经过74LS165的转换变为串行数据,将串行数据接入串口,那样若正常工作接收到的数据将与从P2口发出的数据一致,用LED指示串口接收到的数据,进行观察。</th></tr></tbody></table>
返回至
使用74LS165将C8051F的串口输入扩为并口输入
。
导航
导航
首页
最近更改
随机页面
MediaWiki帮助
首页
首页
树莓派
主机
配件包
外壳
键鼠
电源
扩展板
显示屏
墨水屏
摄像模块
通信模块
继电器
电机驱动板
游戏机
产品分类
树莓派
Arduino
micro:bit
STM32
Espressif
WiFi模块
蓝牙模块
无线模块
LoRa模块
4G模块
GSM
GPRS
以太网
导航模块
北斗卫星
GPS
LCD
墨水屏
OLED
摄像头
USB模块
串口模块
RS232
RS485
CAN
传感器
温度模块
湿度模块
气压模块
继电器
电机模块
指纹模块
电平转换
音频模块
编程器
Wiki工具
Wiki工具
特殊页面
页面工具
页面工具
用户页面工具
更多
链入页面
相关更改
页面信息
页面日志