导航: 老古网老古论坛XMOS公共讨论区XMOS开源项目区单片机程序设计嵌入式系统广告区域
→[求助]哪位大虾用过UPD6453,请帮小弟看一下程序!

* 35215: [求助]哪位大虾用过UPD6453,请帮小弟看一下程序!

   guest 
guest发表的帖子 

 [求助]哪位大虾用过UPD6453,请帮小弟看一下程序!
哪位大虾用过UPD6453,请帮小弟看一下程序!
小弟按如下程序运行时,在UPD6453的输出端得不到任何的信号。
/*
 AddLetters.c
 Author:RanGuanghong
 Date:2003.6.2
 Vervion:1.0
 Function:
 Ocsillor:12.00Mhz.
 CPU:w78e51
 OSD device:uPD6453CY-001
 OSD ocsillor:7.2Mhz,33pf.
*/


#include   <reg51.h>  


#ifndef uchar
#define uchar unsigned char
#endif
#ifndef uint
#define uint unsigned int
#endif


#define ReloadTh1 0xf4
#define ReloadTl1 0xf4


/*
 I/O port.
*/
sbit Load=P1^0;
sbit Sclk=P1^1;
sbit BackGround=P1^2;

sbit Busy=P1^3;
sbit Clk=P1^4;
sbit Cs=P1^5;
sbit DataLine=P1^6;

sbit Led=P1^7;


/*
 Parramenters.
*/
uchar bdata Flags=0;
sbit AddLetterFlag=Flags^0;


uchar data ReloadTh0=0xff;
uchar data ReloadTl0=0xbf;
uchar data ColumCounter=0;
uint data LedDelayTimer=65000;
uchar data ByteCounter=0;


uchar data DisplayControl=0;
uchar data BackgroundControl=0;
uchar data ProgressiveScanControl=0;
uint data DisplayPositionControl=0;
uint data CharacterWriteAddessControl=0;


/*
 void Int1(void)
*/
void Int0(void) interrupt 0
{
 EX0=0;
 ET0=1;
 while(1);
}


/*
 void T0(void)
*/
void Timer0(void) interrupt 1
{
 TR0=0;
 ET0=0;
 while(1);
}


/*
 void Int0(void)
*/
void Int1(void) interrupt 2
{
 EX1=0;
 while(1);
}


/*
 void Timer1(void)
*/
void Timer1(void) interrupt 3
{
 TH1=ReloadTh1;
 TL1=ReloadTl1;
 while(1);
}


/*
 void SerialPort(void)
*/
void SerialPort(void) interrupt 4
{
 if(RI)
 {
  RI=0;
 }
 
 if(TI)
 {
  TI=0;
 }
 while(1);
}


/*
 void WriteByte(uchar x)
*/
void WriteByte(uchar x)
{
 uchar i,j;
 
 
 j=x; 
 while(Busy);
 for(i=0;i  <8;i++)
 {
  Clk=0;
  j  <  <=1;
  DataLine=CY;
  Clk=1;
 } 
}


/*
 void WriteOneByte(uchar x)
*/
void WriteOneByte(uchar x)
{
 uchar i;
 
 
 i=x;
 Cs=0;
 WriteByte(i);
 while(Busy);
 Cs=1;
}


/*
 void WriteTwoByte(uint x)
*/
void WriteTwoByte(uint x)
{
 uchar i;
 
 
 i=x/256;
 Cs=0;
 WriteByte(i); 
 i=x%256;
 WriteByte(i); 
 while(Busy);
 Cs=1;
}


/*
 void WriteSecondByte(uint x)
*/
void WriteSecondByte(uint x)
{
 uchar i;
 
 
 i=x/256;
 Cs=0;
 WriteByte(i); 
 i=x%256;
 WriteByte(i); 
 WriteByte(i);
 while(Busy);
 Cs=1;
}


/*
 void WriteCharacterAddess(uchar x,uchar y,uchar Character)
 x=1~12;
 y=1~24;
 Character=0~255;
*/
void WriteCharacter(uchar x,uchar y,uchar Character)
{
 uint i=0;
 
 
 i=i|0x8400;
 if(x>  =0x10)
 {
  i=i|0x0100;
 }
 i=i|(x  <  <5);
 i=i|y;
 WriteTwoByte(i);
 
 i=0xca00;
 i=i|Character;
 WriteSecondByte(i);
}


void main(void)
{
 uchar Temp=0;
 
 
 P0=0x00;
 P1=0xff;
 P2=0x00;
 P3=0xff;
 Load=1;
 Load=0;  
 
 IP=0x00;
 IE=0x00;
 TMOD=0x25;
 TCON=0x05;
 PCON=0x00;
 SCON=0x00;
 
 TH0=ReloadTh0;
 TL0=ReloadTl0;
 TH1=ReloadTh1;
 TL1=ReloadTl1;
 
 ES=1;
 EX0=0; 
 EA=1;
 
 while(1)
 {
  WriteOneByte(0x04); /*Display off,Osc on,Flink off.*/
  WriteOneByte(0x40); /*No background.*/
  WriteOneByte(0x1e); /*Background color:white.*/
  WriteOneByte(0x30); /*Nomal TV scan.*/
  WriteOneByte(0x34); /*Video RAM all reset.*/
  
  WriteTwoByte(0x8088); /*Display position.*/  
  
  WriteCharacter(1,1,0x00);  
  WriteCharacter(1,2,0x01);
  WriteCharacter(1,3,0x02);
  WriteCharacter(1,4,0x03);
  WriteCharacter(1,5,0x04);
  WriteCharacter(1,6,0x05);
  WriteCharacter(1,7,0x06);
  WriteCharacter(1,8,0x07);
  WriteCharacter(1,9,0x08);
  
  WriteCharacter(4,1,0x00);
  WriteCharacter(4,2,0x01);
  WriteCharacter(4,3,0x02);
  WriteCharacter(4,4,0x03);
  WriteCharacter(4,5,0x04);
  WriteCharacter(4,6,0x05);
  WriteCharacter(4,7,0x06);
  WriteCharacter(4,8,0x07);
  WriteCharacter(4,9,0x08);
  
  WriteCharacter(8,1,0x00);
  WriteCharacter(8,2,0x01);
  WriteCharacter(8,3,0x02);
  WriteCharacter(8,4,0x03);
  WriteCharacter(8,5,0x04);
  WriteCharacter(8,6,0x05);
  WriteCharacter(8,7,0x06);
  WriteCharacter(8,8,0x07);
  WriteCharacter(8,9,0x08);
  
  
  //WriteTwoByte(0x8800); /*Size,Smooth,Mask pule control.*/
  
  WriteOneByte(0x0c); /*Display on,Osc on,Flink off.*/  
  
  
  Cs=0;  
  
  while(1)
  {
   if(LedDelayTimer==0)
   {
    Led=~Led;
    LedDelayTimer=65000;
   }
   else
   {
    LedDelayTimer--;
   }
  }  
 }
}

发表时间:2003年6月20日15:56:59

  
回复该帖

本主题共有 6 帖,分页:>>>>>该主题的所有内容[6]条

 *树形目录 只列出部分跟帖的标题以及简单的摘要信息 该主题的部分跟帖如下:

  35267.[详细]版主有没有点招儿啊!我知道很少人用这种芯片。
摘要:......(无内容)
- [guest][1414次] 2003年6月21日

  35283.[详细]看热闹的人倒是挺多的,哎!
摘要:......(无内容)
- [guest][1017次] 2003年6月21日

  35292.[详细]不要叹气吗,推荐给你!
摘要:如果你有兴趣,去到这里问问 sky_abc  http://www.rdeast.com/rdbbs/index.asp......(75字)
- [guest][823次] 2003年6月21日

[上一篇帖子]:照抄?撒点银子 我帮你搞定算了 怎样?
[下一篇帖子]:用过16c554的达人能发个例程给我吗?小弟在做关于16c554的毕业设计,可对于编程一窍不通,不知