标题: 三个通道载波转发板的驱动程序 [打印本页]

作者: xuwei    时间: 2015-6-13 15:55
标题: 三个通道载波转发板的驱动程序

#include <PL3201_Addr_Map.h>
#include "pl3201.h"
#include "usart.h"
#include "Protocol_layer.h"
#include"app.h"


   sbit USART_SEND=P2^2;
extern struct Device_PL3201 xdata *P_Drvier;//PL3201设备指针
       


extern        bit    bdata   PLC_Rxd_OK;                 // 载波接收完成标志
extern  bit    bdata   PLC_sending;
extern  bit    data    PLC_TX_EN;       
                         
void main ( void )
{       


init_PLC3201();       
init_pl3201_device();
initsys ();                                    
       
for(;;)                                                
   {
        //        printf_usart("你好啊!\n");
           Check_sys_plc();
       
          if ( PLC_Rxd_OK )                                          
           {


         P_Drvier->plc_rx();
         PLC_Rxd_OK=0;          


           }                         


       


       if ( PLC_TX_EN )       
       {   
                                        
                 PLC_TX_EN=0;
                printf_usart("Iam from channel C please check me!\r\n");
                         USART_SEND=~USART_SEND;


//Post_Messages_to_Distance(1,2,3,"HD0123456789",9) ;


      
       }


                         


    }





#include <PL3201_Addr_Map.h>
#include "pl3201.h"
#include "usart.h"
#include "Protocol_layer.h"
#include"app.h"




  sbit USART_RX=P3^3;
  sbit USART_TX=P2^2;
extern struct Device_PL3201 xdata *P_Drvier;//PL3201设备指针
       


extern        bit    bdata   PLC_Rxd_OK;                 // 载波接收完成标志
extern  bit    bdata   PLC_sending;
extern  bit    data    PLC_TX_EN;       
extern check_usart();                 
void main ( void )
{       




init_PLC3201();       
init_pl3201_device();
initsys ();                                  


for(;;)                                                
   {
        //         check_usart();
           Check_sys_plc();
       
          if ( PLC_Rxd_OK )                                          
           {
                         
                 P_Drvier->plc_rx();
                 PLC_Rxd_OK=0;          


           }                         


  if(RI)
          {
          RI=0;
         USART_RX=~USART_RX;
         SendOneByte(SBUF);
          
          }         
                         
       if ( PLC_TX_EN )       
       {                           
             PLC_TX_EN=0;
                   USART_TX=~USART_TX;
                printf_usart("I am from channel B,plese check me!\r\n");
//Post_Messages_to_Distance(1,2,3,"HD0123456789",9) ;


       }


                         


    }






}

#include <PL3201_Addr_Map.h>
#include "pl3201.h"
#include "usart.h"
#include "Protocol_layer.h"
#include"app.h"




extern struct Device_PL3201 xdata *P_Drvier;//PL3201设备指针
       


extern        bit    bdata   PLC_Rxd_OK;                 // 载波接收完成标志
extern  bit    bdata   PLC_sending;
extern  bit    data    PLC_TX_EN;       
extern check_usart(void);
extern void SendOneByte1(unsigned char c);                         
void main ( void )
{       
         char a;
init_PLC3201();       
init_pl3201_device();
initsys ();                                  
Show_version();




for(;;)                                                
   {
           check_usart();
           Check_sys_plc();
       
          if ( PLC_Rxd_OK )                                          
           {
                       
         
                 P_Drvier->plc_rx();
                 PLC_Rxd_OK=0;          


           }                         


                /* if(RI)
                 {
                         a=SBUF;
                         RI=0;
                  SendOneByte1(a) ;
                 
                 } */


       if ( PLC_TX_EN )       
       {   
         //          printf_usart("74hc595\n");                          
                 PLC_TX_EN=0;
Post_Messages_to_Distance(1,2,3,"HD0123456789",9) ;


      
       }


                         


    }






}











欢迎光临 (http://www.51hei.com/bbs/) Powered by Discuz! X3.1