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

📄 3-serial.c

📁 全数字高清电视数字调谐器
💻 C
字号:
#include <w77e58.h>
#include <stdio.h>
#include<intrins.h>

#define display_con8  0x00f8 
#define display_con7  0x00f7 
#define display_con0  0x00f0 
#define DEBUG 1
sbit cs=P2^5;
sbit sckl=P2^4;
sbit sin=P2^3;

sbit ac0=ACC^0;          /*定义ACC的位,利用ACC操作速度最快*/
sbit ac1=ACC^1;
sbit ac2=ACC^2;
sbit ac3=ACC^3;
sbit ac4=ACC^4;
sbit ac5=ACC^5;
sbit ac6=ACC^6;
sbit ac7=ACC^7;

extern void delay1(unsigned int i);

void char_write(unsigned int t);
void delaya();



void char_w_a(unsigned int char_p[]);//多字节工作模式设置
void char_w_b(unsigned int address,unsigned int char_p);//单字节工作模式设置
void char_w_c(unsigned int row,unsigned int color,
                          unsigned int char_p[]);//每行字符设置

void char_w_d(unsigned int row,unsigned int color,
                          unsigned int char_p[]);//每行不定字符设置  用于放大字符


void char_w_e(unsigned int address,unsigned int color,
                          unsigned int char_p[]);//不定字符 不定地址 不定个数显示
                          
void char_w_f(unsigned int row,unsigned int content,
                         unsigned int color,unsigned int char_p);//单字符设置

                         

void char_write(unsigned int t)
{
 unsigned int m;
 m=t>>8;
ACC=t;  
sckl=0;_nop_();sin=ac0;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
sckl=0;_nop_();sin=ac1;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
sckl=0;_nop_();sin=ac2;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
sckl=0;_nop_();sin=ac3;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
sckl=0;_nop_();sin=ac4;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
sckl=0;_nop_();sin=ac5;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
sckl=0;_nop_();sin=ac6;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
sckl=0;_nop_();sin=ac7;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();

ACC=m;
sckl=0;_nop_();sin=ac0;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
sckl=0;_nop_();sin=ac1;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
sckl=0;_nop_();sin=ac2;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
sckl=0;_nop_();sin=ac3;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
sckl=0;_nop_();sin=ac4;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
sckl=0;_nop_();sin=ac5;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
sckl=0;_nop_();sin=ac6;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
sckl=0;_nop_();sin=ac7;_nop_();_nop_();_nop_();sckl=1;_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();

}


void delaya()
{
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
}

void char_w_a(unsigned int char_p[])//多字节工作模式设置 用于初始化
{
unsigned int  i;
cs=0;
_nop_();
_nop_();
_nop_();
_nop_();
char_write(display_con0);
for(i=0;i<9;i++)  
{
    char_write(char_p[i]);
    delaya();
    }    
    cs=1;
    delaya();
}

void char_w_b(unsigned int address,unsigned int char_p)//单字节工作模式设置
{
cs=0;
_nop_();
_nop_();
_nop_();
_nop_();
char_write(address); 
char_write(char_p); 
delaya();
cs=1;
delaya();   
}

void char_w_c(unsigned int row,unsigned int color,
                          unsigned int char_p[])//每行字符设置
{
unsigned int  i;
cs=0;
_nop_();
_nop_();
_nop_();
_nop_();
char_write(row*24);
for(i=0;i<24;i++)  
    {
    char_write(char_p[i]|((color<<8)&0xff00));
    delaya();
    }    
    cs=1;
    delaya();
}
void char_w_d(unsigned int row,unsigned int color,
                          unsigned int char_p[])//每行不定字符设置  用于放大字符
{
unsigned int  i;
unsigned int sun;
sun=char_p[0];
cs=0;
_nop_();
_nop_();
_nop_();
_nop_();
char_write(row*24);
for(i=1;i<sun;i++)  
    {
    char_write(char_p[i]|((color<<8)&0xff00));
    delaya();
    }    
    cs=1;
    delaya();
}

void char_w_e(unsigned int address,unsigned int color,
                          unsigned int char_p[])//不定字符 不定地址 不定个数显示
{
unsigned int  i;
unsigned int sun;
sun=char_p[0];
cs=0;
_nop_();
_nop_();
_nop_();
_nop_();
char_write(address);
for(i=1;i<sun;i++)
{
char_write(char_p[i]|((color<<8)&0xff00));
delaya();
}
cs=1;
delaya();
}
void char_w_f(unsigned int row,unsigned int content,
                         unsigned int color,unsigned int char_p)//单字符设置
{
cs=0;
_nop_();
_nop_();
_nop_();
_nop_();
char_write(row*24+content);
char_write(char_p|((color<<8)&0xff00));
delaya();
cs=1;
delaya();
}

/*

void char_w_g()
{
unsigned int i;   
 char_w_a(display_con0,osd_serial);
 cs=0;
_nop_();
_nop_();
_nop_();
_nop_();
 char_write(display_con8);
 #if (DEBUG)
 printf("address=0xf8");
 #endif
 char_write(0x0000);
 delay1(8000);
 #if (DEBUG)
 printf("   display off\n");
 printf("\n");
 #endif
 for(i=0;i<249;i++)  
    {
    char_write(osd_serial[i]);
    #if (DEBUG)
    printf("   ram  %u=0x%4x    ",i,osd_serial[i]);
    #endif      
    }    
    cs=1;   
    #if (DEBUG)
    printf("\n");
    printf("end\n");
    #endif
}
*/

⌨️ 快捷键说明

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