无线货架自动控制系统 第8页

无线货架自动控制系统 第8页
void manage_stop_left(uchar addr)
{  write_buffer(addr,0x04);
 write_buffer(addr,0x04);
 write_buffer(addr,0x04);
 write_buffer(addr,0x04);
 light_go=1;
 light_forbidleft=1;
}
void manage_stop_right(uchar addr)
{
 write_buffer(addr,0x05);
 write_buffer(addr,0x05);
 write_buffer(addr,0x05);
 write_buffer(addr,0x05);
 light_go=1;
 light_forbidright=1;
}
3.4 均分归位程序设计
下面的程序为无线移动货架自动控制系统软件实现部分的均分归位程序段
// 函数名称:  均匀散开处理函数
// 函数功能:  发送均匀散开命令
void manage_walkequality()
{  uchar equality_num;
 uchar k_walk;
// manage_gostatue();
 for(equality_num=Slaver_NUM;equality_num>=k_count;equality_num--)
 {
  //manage_walkright(equality_num);
  if(write_buffer(equality_num,0x03)!=0x03)
  {
  write_buffer(equality_num,0x03);
  }
  led_disp(equality_num);
  delay_ms(4000);
 }
  delay_ms(50000);
 for(equality_num=Slaver_NUM;equality_num>=k_count;equality_num--)
 {
  //manage_stop_right(equality_num);
  if(write_buffer(equality_num,0x05)!=0x05)
  {
    write_buffer(equality_num,0x05);
  }
    led_disp(equality_num);
  delay_ms(3000);
 }
 for(k_walk=0;k_walk<5;k_walk++)
 {
 led_disp(8);
 led_disp(10);
 }}
// 函数名称:  归位处理函数
// 函数功能:  发送归位命令
void manage_gotostatue()
{  uchar gotostatue_num;
 uchar k_walk;                        for(gotostatue_num=1;gotostatue_num<=Slaver_NUM;gotostatue_num++)
 {
  //manage_walkleft(gotostatue_num);
  if(write_buffer(gotostatue_num,0x02)!=0x02)
  {
   write_buffer(gotostatue_num,0x02);
  }
  led_disp(gotostatue_num);
  delay_ms(4000);
 }
delay_ms(50000);
  for(gotostatue_num=1;gotostatue_num<=Slaver_NUM;gotostatue_num++)
 {
  //manage_stop_left(gotostatue_num);
  if(write_buffer(gotostatue_num,0x04)!=0x04)
  {
    write_buffer(gotostatue_num,0x04);
  }
  led_disp(gotostatue_num);
  delay_ms(3000);
 }
 for(k_walk=0;k_walk<5;k_walk++)
 {
 led_disp(8);
 led_disp(10);
 }}
3.5 无线通信模块设计
无线模块分为无线发射模块和无线接收模块。具体实现程序如下:
ORG 0000H
 JMP MAIN
MAIN:
 MOV SP,#4FH
 MOV P0,#0FFH
   MOV P2,#0FH

START:
 
 MOV A,P0
    JB ACC.0,JJ0
 JB ACC.1,JJ1
 JB ACC.2,JJ2
 JB ACC.3,JJ3
 JB ACC.4,JJ4
 JB ACC.5,JJ5
 JB ACC.6,JJ6
 JB ACC.7,JJ7

 MOV A,P2
 ANL  A,#0FH             ;取出低四位
 JB ACC.0,JJ8
 JB ACC.1,JJ9
 JB ACC.2,JJ10

 MOV P2,#00H
 MOV P1,#00H

 JMP OUT

JJ0: MOV P1,#01H
  JMP OUT
JJ1: MOV P1,#02H
  JMP OUT
JJ2: MOV P1,#04H
     JMP OUT
JJ3: MOV P1,#08H
  JMP OUT
www.751com.cn
     JMP OUT
JJ7: MOV P1,#80H
     JMP OUT
JJ8: MOV P2,#10H
  JMP OUT
JJ9: MOV P2,#20H
  JMP OUT
JJ10:MOV P2,#40H
     JMP OUT
OUT: JMP START
DELAY:

END
整个模块软件流程图如下:

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有