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

📄 8255_exp.c

📁 _计算实用教程Visual C++6.0实用教程
💻 C
字号:
/*Program to generate walking pulses on all the port C bits*/
/*8255_exp.c*/
#include<dos.h>
#include<stdio.h>
#include<conio.h>


#define BASE_ADDRESS 0x300

main()
{
unsigned char control_byte[16], temp;
/*This buffer stores the control byte set a bit and then to reset it*/
/*For 8 bits there are 16 bytes*/

control_byte[0]=0x01; /*set bit 0*/
control_byte[1]=0x00; /*reset bit 0*/
control_byte[0]=0x03; /*set bit 1*/
control_byte[1]=0x02; /*reset bit 1*/
control_byte[0]=0x05; /*set bit 2*/
control_byte[1]=0x04; /*reset bit 2*/
control_byte[0]=0x07; /*set bit 3*/
control_byte[1]=0x06; /*reset bit 3*/
control_byte[0]=0x09; /*set bit 4*/
control_byte[1]=0x08; /*reset bit 4*/
control_byte[0]=0x0b; /*set bit 5*/
control_byte[1]=0x0a; /*reset bit 5*/
control_byte[0]=0x0d; /*set bit 6*/
control_byte[1]=0x0c; /*reset bit 6*/
control_byte[0]=0x0f; /*set bit 7*/
control_byte[1]=0x0e; /*reset bit 7*/

while(!kbhit()) /*continue till the keyboard is pressed*/
{

for(temp=0; temp<16; temp++)
outportb(BASE_ADDRESS+3, control_byte[temp]);
/*it must be noted that to set or reset the port C bits, using the
bit set/reset mode,  the information must be written into the
control register and NOT the port C*/

}
return 1;

}

⌨️ 快捷键说明

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