?? 8255_exp.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 + -