📄 keyled.c
字号:
#include <c8051f020.h >
#include "keyled.h"
#include "iic.h"
void Keyled_Config (void) {
WDTCN = 0x07; // Watchdog Timer Control Register
WDTCN = 0xDE; // Disable WDT
WDTCN = 0xAD;
XBR0 = 0xE7;
XBR1 = 0x05;
XBR2 = 0x44;
P0MDOUT = 0x1D; // Output configuration for P0
OSCXCN = 0x00; // EXTERNAL Oscillator Control Register
OSCICN = 0x06; // Internal Oscillator Control Register
SMB0CN = 0x40; // SMBus Control Register
SMB0ADR = 0xA0; // SMBus Address Register
SMB0CR = 0x60; // SMBus Clock Rate Register
IT0=1; // INT0 IS mode 1
}
void Delay_zlg7290(unsigned int time )
{
while(time--);
}
void Print_zlg7290( unsigned char bits, unsigned char content )
{
unsigned char temp[2];
temp[0]=(0x60+bits);
temp[1]=content;
SmbSend ( 0x70 ,0x07 ,2, temp );
Delay_zlg7290(2000);
}
unsigned char Wait_Key( )
{
unsigned char keyvalue[1];
IE0=0;
while ( IE0==0 );
SmbRec( 0x70,0x01,2,keyvalue);
return(keyvalue[0]);
}
void Clear_zlg7290( )
{
unsigned char i;
for(i=0;i<8;i++)
{
Print_zlg7290(i,0x1f);
}
}
void Disp_Shift( unsigned char direction, unsigned char shiftnum)
{
unsigned char command[1];
command[0]=direction+shiftnum-1;
SmbSend(0x70,0x07,1, command );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -