二、语音电路图:
一、主机电路图:
附录(一)
31
三、从机电路图:
32
附录(二)
一、主机程序: #include < reg52.h > #include < intrins.h >
#define uchar unsigned char #define uint unsigned int void Ok_Menu (); void data_chuli();
void fangyin(uchar addr); void ISD4004_Stop();
void ISD4004_Powerdown(); //bit result ; uchar data chs;
sbit LCD_RS = P2^5 ; sbit LCD_RW = P2^6 ; sbit LCD_EN = P2^7 ; sbit Led=P3^0; sbit sendd=P2^4;
sbit add=P3^7; //上翻 sbit sub=P3^6; //下翻 sbit affirm=P3^5; //应答
uchar code cdis1[ ] = {\ \
unsigned char data shuju_sbit[6] ={0x00,0x00,0x00,0x00,0x00,0x00} ;
uchar data shuju[][4]={ {0x00,0x00,0x00,0x00},//组号,房号(地址),次数,是否应答 {0x01,0x00,0x00,0x00}, {0x02,0x00,0x00,0x00}, {0x03,0x00,0x00,0x00}, {0x04,0x00,0x00,0x00}, {0x05,0x00,0x00,0x00}, {0x06,0x00,0x00,0x00}, {0x07,0x00,0x00,0x00} };
/**********************************************
flag为组号标志 flag1 为收到信号置位 flag5用来判断数据是否有效
flag3为 应答标志 flag2 用来判断是否为同一个病房呼叫 flag4 用来标志收到信号
********************************************/
33
uchar flag2=0,flag=1,flag1,flag4,flag5,Flag_ReqSend,jieshou=0; uint flag3; uint a=0; uchar temp;
//语音所用的口
sbit K_luying=P3^4;
sbit K_fangyin=P3^3; sbit K_Tingzhi=P3^1;
sbit ISD4004_SS=P1^4; //语音 sbit ISD4004_MOSI=P1^5; sbit ISD4004_SCLK=P1^6;
//sbit ISD4004_INT=P1^7;// 要换回来
code unsigned char table1[]={0,1,2,3,4,5,6,7,8,9,10,11} ;
code unsigned char table[]={0x00,0x00,0x00,0x65, 0x00,0xc9,0x01,0x2d, 0x01,0x91,0x01,0xf5, 0x02,0x59,0x02,0xbd, 0x03,0x21,0x03,0x85, 0x03,0xb7,0x03,0xe8, 0x04,0x1a,0x04,0x4c, 0x04,0x7e,0x04,0xb0, 0x04,0xe2,0x05,0x14, 0x05,0x46,0x05,0x78, 0x05,0xaa,0x05,0xdc, 0x06,0x0e,0x06,0x40, 0x06,0x72,0x06,0xa4, 0x06,0xd6,0x07,0x08, 0x07,0x3a,0x07,0x6c };
#define delayNOP() ; {_nop_() ;_nop_() ;_nop_() ;_nop_() ;} ;
void delay10ms(uchar hehe) {
uint i; for(hehe;hehe>0;hehe--) for(i=1240;i>0;i--); }
34
//语音地址表
/*******************************************************************/ void delay1(int ms) {
unsigned char y ; while(ms--) {
for(y = 0 ; y<25; y++) {
_nop_() ; _nop_() ; _nop_() ; _nop_() ; } } }
/******************************************************************/ /*检查LCD忙状态 */ /*lcd_busy为1时,忙,等待。lcd-busy为0时,闲,可写指令与数据。 */ /******************************************************************/ bit lcd_busy()
{ bit result ;
LCD_RS = 0 ; LCD_RW = 1 ; LCD_EN = 1 ; delayNOP() ;
result = (bit)(P0&0x80) ; LCD_EN = 0 ; return(result) ; }
/*写指令数据到LCD */ /*RS=L,RW=L,E=高脉冲,D0-D7=指令码。 */
/*******************************************************************/ void lcd_wcmd(uchar cmd)
{ while(lcd_busy()) ; LCD_RS = 0 ; LCD_RW = 0 ;
35