8255a_3.cpp

来自「在纯DOS下运行的TurboC3_ucos2_ucgui bug改进版本」· C++ 代码 · 共 30 行

CPP
30
字号
/* 8255a_3.cpp
  HD 97413083 YGM
  set number to 8255a and then read it into computer
   and display every bit on screen
*/
#include "interfac.h"
#include "iostream.h"
#include "string.h"
P8255A  p8255a3;

void main()
 {

   cout<<"press any key to start ! "<<endl;
   getch();
   p8255a3.SetCtrl(0x80);          // 1000 000
   int portb=p8255a3.ReadPort(P8255A_B);
   for(int i=4;i<8;i++)
    { int abit=p8255a3.GetBit(portb,i);
      cout<<"PB"<<i<<"="<<abit<<"   ";
    }
    cout<<endl;
   int port_c=p8255a3.ReadPort(P8255A_C);
   for(i=0;i<8;i++)
    { int abit=p8255a3.GetBit(port_c,i);
      cout<<"PC"<<i<<"="<<abit<<"  ";
    }

 }

⌨️ 快捷键说明

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