您现在的位置: 范文先生网 >> 理工论文 >> 电子通信论文 >> 正文

多网络智能远程遥控系统的设计与实现

时间:2007-1-20栏目:电子通信论文

4.1 下位机通讯软件设计

通过receive()函数可实现下位机与上位机的数据接收,而send()函数则用于实现下拉机与位机的数据发送,bote()函数的作用是实现串行通讯口初始化和9600波特率的产生。

4.2 双音频识别部分软件的设计

双音频信号由双音频译码单元电路检测,当有信号将译码输出到数据总线后,系统将产生中断请求,并送到T0计数器以产生中断,同时由CPU执行T0中断服务程序。T0中断服务程序由firstdetect()函数和seconddetect()函数组成。Firsdetect()函数用于完成对总线(P1.0~P1.3)数据的第一层菜单值进行读入识别;seconddetect()函数用于完成对总线数据第二层菜单值的读入识别。由于本系统目前只设有两层菜单,所以第二层也同时用作控制命令的触发。

4.3 语音控制部分的通信软件设计

以下的SPI通信程序是用C51语言的16位命令格式编写的。使用时,将其高8位地址和低8位地址正确给定,即可将控制信息(包含在高8位地址的高5位)通过ISD4003的SPI口进行传输。详细的SPI接口指令见ISD4003系列芯片手册。下面给出部分语音控制部分的通信程序。

Void SPI_COM(uchar address-high,uchar address-low

{

uchar i,Bit-temp;

SCLK=0;

SS=0; /*chip selected signal*/

for(i=0;i<8;i++) /*write low eight bits address */

{

SCLK=0;

Bit-temp=address-low & 0x01;

/*0x01 equals to 0000 0001B;get the first bit from the right in this way */

if(Bit-temp==0)

MOSI=0; /*if it doesn't work,some nops may be needed */

Else

MOSI=1; /*if it doesn't work,some nops be needed*/

SCLK=1;

Address-low=address-low>>1;

}

for(i=0;i<8;i++) /*write high eight bits address*/

{

SCLK=0;

Bit-temp=address-high&0x01; /*0x01 equals to 0000 0001B;get the first bit from the right in this way*/

if(Bit-temp= =0)

MOSI=0; /*if it doesn't work,some nops may be needed*/

Else

MOSI=1; /*if it doesn't work,some nops may be needed*/

上一页  [1] [2] [3] [4] [5] 下一页

下页更精彩:1 2 3 4 下一页