赛事专区
登录
直播中
韬子莫
9年用户
5经验值
擅长:电源/新能源 模拟技术 嵌入式技术 RF/无线
私信
关注
[单片机设计大赛]
MAX7456——关于字符叠加芯片的应用问题
MAX7456
单片机
SPI
利用
单片机
控制MAX7456实现视频信号与字符叠加,求问大神有没有对MAX7456比较熟悉的,写的程序好像不能用~~
下面是我写的程序~哪里有问题~
#include "reg52.h"
#include
//MAX7456寄存器定义
#define MAX7456_VM0_write 0x00
#define MAX7456_VM0_read 0x80
#define MAX7456_VM1_write 0x01
#define MAX7456_VM1_read 0x81
#define MAX7456_HOS_write 0x02
#define MAX7456_HOS_read 0x82
#define MAX7456_VOS_write 0x03
#define MAX7456_VOS_read 0x83
#define MAX7456_DMM_write 0x04
#define MAX7456_DMM_read 0x84
#define MAX7456_DMAH_write 0x05
#define MAX7456_DMAH_read 0x85
#define MAX7456_DMAL_write 0x06
#define MAX7456_DMAL_read 0x86
#define MAX7456_DMDI_write 0x07
#define MAX7456_DMDI_read 0x87
#define MAX7456_CMM_write 0x08
#define MAX7456_CMM_read 0x88
#define MAX7456_CMAH_write 0x09
#define MAX7456_CMAH_read 0x89
#define MAX7456_CMAL_write 0x0A
#define MAX7456_CMAL_read 0x8A
#define MAX7456_CMDI_write 0x0B
#define MAX7456_CMDI_read 0x8B
#define MAX7456_OSDM_write 0x0C
#define MAX7456_OSDM_read 0x8C
#define MAX7456_RB0_write 0x10
#define MAX7456_RB0_read 0x90
#define MAX7456_RB1_write 0x11
#define MAX7456_RB1_read 0x91
#define MAX7456_RB2_write 0x12
#define MAX7456_RB2_read 0x92
#define MAX7456_RB3_write 0x13
#define MAX7456_RB3_read 0x93
#define MAX7456_RB4_write 0x14
#define MAX7456_RB4_read 0x94
#define MAX7456_RB5_write 0x15
#define MAX7456_RB5_read 0x95
#define MAX7456_RB6_write 0x16
#define MAX7456_RB6_read 0x96
#define MAX7456_RB7_write 0x17
#define MAX7456_RB7_read 0x97
#define MAX7456_RB8_write 0x18
#define MAX7456_RB8_read 0x98
#define MAX7456_RB9_write 0x19
#define MAX7456_RB9_read 0x99
#define MAX7456_RB10_write 0x1A
#define MAX7456_RB10_read 0x9A
#define MAX7456_RB11_write 0x1B
#define MAX7456_RB11_read 0x9B
#define MAX7456_RB12_write 0x1C
#define MAX7456_RB12_read 0x9C
#define MAX7456_RB13_write 0x1D
#define MAX7456_RB13_read 0x9D
#define MAX7456_RB14_write 0x1E
#define MAX7456_RB14_read 0x9E
#define MAX7456_RB15_write 0x1F
#define MAX7456_RB15_read 0x9F
#define MAX7456_OSDBL_write 0x6C
#define MAX7456_OSDBL_read 0xEC
#define MAX7456_STAT 0xA0
#define MAX7456_DMDO 0xB0
#define MAX7456_CMDO 0xC0
//单片机接口
***it CS=P1^0;
***it SDIN =P1^1;
***it SCLK =P1^2;
***it SDOUT =P1^3;
//***it button =P1^5;
//***it RESET =P1^7;
void MAX7456_RESET();
void MAX7456_write_addr_data(unsigned char,unsigned char);
unsigned char MAX7456_read_addr_data(unsigned char);
void MAX7456_turnoff_display();
void MAX7456_display(unsigned char,unsigned char,unsigned char);
void C52_delay_ms(unsigned char);
void C52_delay_us();
void main()
{
/*while(1)
{
if(1)
{
C52_delay_ms(20);
if(1)
{
MAX7456_display(0x01,0x01,0x0c); //
}
}
else
{
C52_delay_ms(20);
if(0)
{
MAX7456_turnoff_display();
}
}
}*/
while(1)
{
MAX7456_display(0x01,0x01,0x0c); //
C52_delay_ms(200);
C52_delay_ms(200);
C52_delay_ms(200);
C52_delay_ms(200);
C52_delay_ms(200);
}
}
void C52_delay_ms(unsigned char x)
{
unsigned char y,z;
for(y=0;y
{
for(z=0;z<111;z++);
}
}
void C52_delay_us()
{
;
}
/*void MAX7456_RESET()
{
RESET=0;
C52_delay_ms(1);
RESET=1;
C52_delay_ms(100);
}*/
unsigned char MAX7456_read_addr_data(unsigned char addr) 读数据操作
{
unsigned char byte=0;
unsigned char i,temp;
unsigned char j;
CS=1;
SCLK=0;
//C52_delay_ms(1);
;
CS=0;
//C52_delay_ms(1);
for(i=0;i<8;i++)
{
//SCLK=0;
temp=addr&0x80;
if(temp==0x80)
{
SDIN=1;
//C52_delay_us();
}
else
{
SDIN=0;
//C52_delay_us();
}
SCLK=1;
SCLK=0;
addr<<=1;
}
SCLK=0;
byte=0;
for(j=0;j<8;j++)
{
byte<<=1;
//byte=(byte<<1)|SDOUT;
//SCLK=0;
//C52_delay_us();
SCLK=1;
byte =(unsigned char)SDIN+byte;
SCLK=0;
}
CS=1;
return byte;
}
void MAX7456_write_addr_data(unsigned char addr,unsigned char dt) //写
{
unsigned char i,temp;
CS=1;
SCLK=0;
//C52_delay_ms(1);
//temp=addr;
CS=0;
//C52_delay_ms(1);
for(i=0;i<8;i++)
{
//SCLK=0;
temp=addr&0x80;
if(temp==0x80)
{
SDIN=1;
//C52_delay_us();
}
else
{
SDIN=0;
//C52_delay_us();
}
SCLK=1;
SCLK=0;
addr<<=1;
}
//SCLK=0;
//C52_delay_ms(1);
//CS=0;
//C52_delay_ms(1);
for(i=0;i<8;i++)
{
//SCLK=0;
temp=dt&0x80;
if(temp==0x80)
{
SDIN=1;
//C52_delay_us();
}
else
{
SDIN=0;
//C52_delay_us();
}
SCLK=1;
SCLK=0;
dt<<=1;
}
CS=1;
SDIN=0;
}
void MAX7456_turnoff_display()//¹Ø±ÕÏÔʾ
{
unsigned char i;
unsigned char j;
i=MAX7456_read_addr_data(MAX7456_VM0_read);
MAX7456_write_addr_data(MAX7456_VM0_write,i&~(1<<3));
for(j=0;j<20;j++)
{
C52_delay_us();
}
}
void MAX7456_display(unsigned char row,unsigned char col,unsigned char c) //c为地址
{
unsigned int num;
unsigned char temp;
num=row*30+col;
MAX7456_write_addr_data(MAX7456_DMM_write,MAX7456_read_addr_data(MAX7456_DMM_read)|1<<2); //
while(MAX7456_read_addr_data(MAX7456_DMM_read)>>2%2){};
temp=MAX7456_read_addr_data(MAX7456_DMM_read);
MAX7456_write_addr_data(MAX7456_DMM_write,temp|0x40);
MAX7456_write_addr_data(MAX7456_DMAH_write,MAX7456_read_addr_data(MAX7456_DMAH_read)&(~(1<<1)));//
MAX7456_write_addr_data(MAX7456_DMAH_write,(num/256)&(0xFD));//
MAX7456_write_addr_data(MAX7456_DMAL_write,num%256);
while(MAX7456_read_addr_data(MAX7456_DMM_read)>>2%2){};
MAX7456_write_addr_data(MAX7456_DMDI_write,c);//
while(MAX7456_read_addr_data(MAX7456_STAT)>>5%2|MAX7456_read_addr_data(MAX7456_DMM_read)>>2%2){};
//MAX7456_write_addr_data(MAX7456_VM0_write,MAX7456_read_addr_data(MAX7456_VM0_read)|(0x01<<3));
// while(MAX7456_read_addr_data(MAX7456_STAT)>>5%2|MAX7456_read_addr_data(MAX7456_DMM_read)>>2%2){}
MAX7456_write_addr_data(MAX7456_VM0_write,0x08);
MAX7456_write_addr_data(MAX7456_OSDBL_write,MAX7456_read_addr_data(MAX7456_OSDBL_read)&(~(0x01<<4)));
}
回帖
(1)
丶周一
2017-2-27 22:47:32
请问楼主搞定这个问题没??求一份能用MAX实现字符叠加的例程,本人也在学习过程,但是一脸懵逼。如果有电路图结构的连接方法就更好了。
请问楼主搞定这个问题没??求一份能用MAX实现字符叠加的例程,本人也在学习过程,但是一脸懵逼。如果有电路图结构的连接方法就更好了。
举报
更多回帖
rotate(-90deg);
回复
相关帖子
MAX7456
单片机
SPI
基于
MAX7456
的视频
字符
叠加
系统设计
3262
MAX7456
字符
叠加
2157
关于
MAX7456
2019
DP
7456
完全替代
MAX7456
的
字符
叠加
芯片
3137
DP
7456
完全替代
MAX7456
的
字符
叠加
芯片
2070
DP
7456
完全替代
MAX7456
的
字符
叠加
芯片
1785
DP
7456
完全替代
MAX7456
的
字符
叠加
芯片
2250
DP
7456
字符
叠加
芯片
替代
MAX7456
2672
DP
7456
完全替代
MAX7456
的
字符
叠加
芯片
2081
MAX7456
原厂中文资料
50
发帖
登录/注册
20万+
工程师都在用,
免费
PCB检查工具
无需安装、支持浏览器和手机在线查看、实时共享
查看
点击登录
登录更多精彩功能!
首页
论坛版块
小组
免费开发板试用
ebook
直播
搜索
登录
×
20
完善资料,
赚取积分