📄 ucio.c
字号:
#include <reg52.h>
#include <absacc.h> // 包含绝对地址访问宏
#include <ucio.h>
#include <v51rx2.h>
#ifndef disable
#define disable() EA = 0
#define enable() EA = 1
#endif
/********************************
* write io port at address *
********************************/
void WriteRawIO(unsigned char Address, unsigned char value)
{
#ifdef V51RX2
disable();
AUXR |= 0x02;
#endif
PBYTE[Address]=value;
#ifdef V51RX2
AUXR &= 0xfd;
enable();
#endif
}
/********************************
* write io port from address *
* return the value read *
********************************/
unsigned char ReadRawIO(unsigned char Address)
{
unsigned char c;
#ifdef V51RX2
disable();
AUXR |= 0x02;
#endif
c = PBYTE[Address];
#ifdef V51RX2
AUXR &= 0xfd;
enable();
#endif
return c;
}
void WriteIO(unsigned char address, unsigned char value)
{
WriteRawIO(0x00,GetRegPage(address)); // select appropriate page
WriteRawIO(address, value);
}
unsigned char ReadIO(unsigned char address)
{
WriteRawIO(0x00,GetRegPage(address)); // select appropriate page
return ReadRawIO(address);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -