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

📄 yuyin.c

📁 关键字:LCD液晶显示屏 串行 并行 ST7920 RT12864
💻 C
字号:
#include "reg52.h"
#include "string.h"
#include <stdio.h>
#define uchar unsigned char
#define uint unsigned int
#include "lcd.h"
sbit    PLAY  =P3^2;
//sbit    RECORD =P1^6;

sbit    A0 = P1^0;
sbit    A1=  P1^1;
sbit    A2 = P1^2;
sbit    A3 = P1^3;
sbit    A4 = P1^4;
sbit    A5 = P1^5;
sbit    A6 = P1^6;
sbit    A7 = P1^7;


unsigned char  address;

#define LOW 0
#define HIGH 1
#define TRUE 1
#define FALSE 0

//#define SET_PLAY 0x00
//#define SET_RECORD 0x00


 //;您的体温是
#define TEXT2    0x68  //;体温正常
#define TEXT3    0x78  //;危险
//#define TEXT4    0xb0
#define ERROR    0X98 

#define ZERO    0x00
#define ONE     0x08
#define TWO     0x10
#define THREE   0x18
#define FOUR    0x20
#define FIVE    0x28
#define SIX     0x30
#define SEVEN   0x38
#define EIGHT   0x40
#define NINE    0x48
#define TEN     0x50
#define DU      0x58 
#define POINT   0x60



//*******************延时子程序***********************
void delays10ms(void)
{  
   unsigned char i;
   for(i=0;i<250;i++);
   
   //for(j=0;j<10;j++);
}

void delay500ms(void)
{  
   unsigned char i,j;
   /*for(i=0;i<250;i++);
   
   for(j=0;j<50;j++);*/
   for(i=0;i<250;i++)
   for(j=0;j<250;j++);
   
}
void delay1s(int n)
{
  unsigned char i,j;
  for(;n>0;n--)
     for(i=0;i<250;i++)
        for(j=0;j<250;j++);
}
char AudioAddr[]={
0x00,//0
0x08,//1
0x10,//2
0x18,//3
0x20,//4
0x28,//5
0x30,//6
0x38,//7
0x40,//8
0x48,//9
0x50,//10
0x58, //du
0x60,//dot
};

xdata char play_char[11];
xdata char play_step=0;

void start_alm(void)
{
	char i=0;
    play_step=0;
    timer0_count2 = timer0_count2_CNST = 150;
    timer0_tick2 = 0;
	play_char[0]=0x68;   
    play_char[1]=0x68;
	play_char[2]=0x68; 
    play_char[3]=0;
    play_char[4]=0;
}
void startplay(void)///long int tt)
{
	char i=0;
    play_step=0;
    timer0_count2 = timer0_count2_CNST = 100;
    timer0_tick2 = 0;
	Get_t_Str(); 
	strcpy(play_char,s);
    i=strlen(s);
    play_char[i++]=DU;
    if(tt>Alm_t)
    {
      LCD_WStr(0x80,"--超温!--        "); 
	  play_char[i++]=0x68;   
      play_char[i++]=0x68;
	  play_char[i++]=0x68;
     }
    else LCD_WStr(0x80, "                 "); 
    play_char[i++]=0;
	play_char[i++]=0;

      
}

void radio_play(void)
{	
	 char addr,c; 
     if(!timer0_tick2)  return;
     if(play_step>10)   return;
	 c=play_char[play_step];
     if(c==0)   return;  //end
     if(c=='.') addr=POINT;
	 else if(c>='0' && c<='9')
	    {
	      c =c- 0x30;
	      addr=AudioAddr[c];
	     }
	 else if(c==DU) addr=c;
	 else if(c==0x68) addr=0x68;
     else 
	 {
	   play_step++; 
       timer0_count2=100;
       timer0_tick2=0;
	   return;
	 }
	 P1=addr;	
	 delays10ms();
     PLAY=HIGH;
	 delays10ms();
	 PLAY=LOW;
	 delays10ms();

     play_step++;
     timer0_count2=100;
     timer0_tick2=0;
  }


  

	 

⌨️ 快捷键说明

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