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

📄 test4.c

📁 试验仪自检程序
💻 C
字号:
//======================================================
//  The information contained herein is the exclusive property of
//  Sunnnorth Technology Co. And shall not be distributed, reproduced,
//  or disclosed in whole in part without prior written permission.
//               (C) COPYRIGHT 2003  SUNNORTH TECHNOLOGY CO.
//                             ALL RIGHTS RESERVED
//  The entire notice above must be reproduced on all authorized copies.
//========================================================

//============================================================
//  工程名称: test4.spj
//  功能描述:  用C语言实现B口作为输入口、A口作为输出口。
//  硬件连接:1)键盘接B口高八位
//	          2)LED接A口低八位
//	    
//  文件来源:《实验仪实验指导书》 "实验六	使用C语言实现B口作为
//             输入口、A口作为输出口实验"    第14页
//  IDE环境:   SUNPLUS u'nSPTM  IDE 1.8.4
//
//  涉及的库:
//  组成文件:
//    	test4.c
//===============================================

//============================================================
// 文件名称:main.c// 
// 实现功能: 取B口状态在A口显示
//============================================================

#include "spce061v004.h"
//============================================================= 
// 函数名称:   main()
// 功能描述:  取B口状态在A口显示
// 语法格式:  main()
//入口参数:     无
// 出口参数:    无
// 注意事项:    仅为用户模型
//=============================================================
int main()
{
	unsigned int Key;	
    *P_IOA_Dir=0x00ff;					//设置A0-A7口为同相输出口
	*P_IOA_Attrib=0x00ff;
	*P_IOA_Data=0x00ff;
	*P_IOB_Dir=0x0040;					//设置B8-B15为上拉输入口,B6为同相高电平输出口
	*P_IOB_Attrib=0x0040;
	*P_IOB_Data=0xffff;
	while(1) 	{
		Key=*P_IOB_Data;
		Key=Key>>8;						  //高8位数据移至低8位
		*P_IOA_Data=Key;
		*P_Watchdog_Clear= 0x1;
	}
}	

⌨️ 快捷键说明

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