ivws 发表于 2008-10-12 15:07:00

软件摸拟EV1527编码IC 【恢复】

点击此处下载 ourdev_449590.pdf(文件大小:332K) (原文件名:EV1527.pdf) 



点击此处下载 ourdev_449591.pdf(文件大小:340K) (原文件名:F05P.pdf) 



点击此处下载 ourdev_449592.rar(文件大小:28K) (原文件名:16F84A F05P.rar) 





http://cache.amobbs.com/bbs_upload782111/files_11/ourdev_449593.jpg

(原文件名:00.jpg) 



http://cache.amobbs.com/bbs_upload782111/files_11/ourdev_449594.jpg

(原文件名:01.jpg) 



http://cache.amobbs.com/bbs_upload782111/files_11/ourdev_449595.jpg

(原文件名:02.jpg) 





EV1527的编码格式和PT2262的差不多...只要修改按键数据部份就可以控制PT2272...



//引入头文件*********************************************************

#include          "delay.h"

#include          "delay.c"

#include      <pic1684.h>



//时间常数***********************************************************

#define       RcOsc     910                                //脉冲总宽



//脚位定义***********************************************************

#define       Led       RA0                                //指示输出



//数据输出***********************************************************

#define       Out       RA1                                //数据输出 



//按键数据***********************************************************

     unsigned char value = 3;                              //按键的值  



//*******************************************************************

//函数名称:port_init();

//输入参数:无

//输出参数:无

//功能描述:端口设置

//建造日期:2008.10.11

//*****************************************************************

void PortInit(void)

 {

     OPTION = 0x00;                                        //允许上拉



     PORTA = 0xfc;                                         //  

     TRISA = 0xfc;                                         //A 口设置   

     

     PORTB = 0xff;                                         //

     TRISB = 0xff;                                         //B 口设置       

 }



//*******************************************************************

//函数名称:TxSycn();

//输入参数:无

//输出参数:无

//功能描述:发送同步头

//建造日期:2008.10.11

//*******************************************************************

void TxSycn(void)

 { 

       Out = 1;                                            //同步数据

       DelayUs(RcOsc / 16 * 4);

       Out = 0; 

       DelayMs(RcOsc / 16 * 124 / 1000);

 }



//*******************************************************************

//函数名称:TxByte(data);

//输入参数:待发数据

//输出参数:无

//功能描述:发送一字节数据

//建造日期:2008.10.11

//*******************************************************************

void TxByte(unsigned char data)

 {

     unsigned char i;

     

     for (i = 0; i < 8; i++)

      {

       if (data & 0x01)                                    //发送高位                          

        {

         Out = 1;                                          //高位数据

         DelayUs(RcOsc / 16 * 12);

         Out = 0; 

         DelayUs(RcOsc / 16 * 4);

        }



       else                                                //发送低位                                    

        {

         Out = 1;                                          //低位数据

         DelayUs(RcOsc / 16 * 4);

         Out = 0;

         DelayUs(RcOsc / 16 * 12);                                        

        }



       data>>= 1;                                         //右移一位

      }

 }



//*******************************************************************

//函数名称:TxData(data);

//输入参数:按键数据

//输出参数:无

//功能描述:发送数据

//建造日期:2008.10.11

//*******************************************************************

void TxData(unsigned char data)

 {   

     unsigned char buff = {0xaa, 0x3c, 0x03};

     unsigned char i, j;

     

     buff &= 0x0f;                                      //清除按键

     buff |= data;                                      //加载按键     



     for (j = 0; j < 4; j++)                               //每帆四次

      {

       TxSycn();                                           //送同步头



       for (i = 0; i < 3; i++)                   

        {

         TxByte(buff);                                  //发送数据    

        }

      }

 }



//*******************************************************************

//函数名称:KeyRead();

//输入参数:无

//输出参数:无

//功能描述:读取按键

//建造日期:2008.10.11

//*******************************************************************

void KeyRead(void)

 {

     static unsigned char temp = 0;                        //临时记录

     static unsigned char read = 0;                        //按键记录

     static unsigned char sign = 0;                        //状态标志

     static unsigned char time = 0;                        //防误记时



     temp = PORTB & 0x03;                                  //读取按键

     

     if (sign == 0)

      {

       if (read == temp)                                   //是否稳定

        {

         if (++time> 50)                                  //防误处理

          {

           time = 0;                                       //记时清零

           sign = 1;                                       //下个状态

           value = read;                                   //有效按键

          } 

        }

       

       else time = 0;                                      //从新记时  

      }



     else if (temp == 0x03) sign = 0;                      //等待弹起

               

     read = temp;                                          //更新记录

 }



//*******************************************************************

//函数名称:KeyInt();

//输入参数:无

//输出参数:无

//功能描述:按键处理

//建造日期:2008.10.11

//*******************************************************************

void KeyInt(void)

 {

     if (value != 3)                                       //是否有效

      {

       switch (value)

        {

         case 0B00000010:                                  //1 号按键

              {

           Led = 1;

           TxData(0x80); 

           Led = 0; 

                              

           break;

                  } 

                 

         case 0B00000001:                                  //2 号按键

              {

           Led = 1; 

           TxData(0x40);

           Led = 0; 



           break;

                  } 



         case 0B00000000:                                  //复合按键

          {

           Led = 1;

           TxData(0xc0);

           Led = 0; 

             

           break;

          }

                 

         default:                                          //无效离开

              { 

           break;

              }          

        }



       value = 3;                                          //执行一次

      }

 }



//*******************************************************************

//函数名称:main();

//输入参数:无

//输出参数:无

//功能描述:主要程序

//建造日期:2008.10.11

//*******************************************************************

void main(void)                                            //

 { 

     PortInit();                                           //脚位设置

    

     while (1)

      {

       DelayMs(1);                                         // 

       KeyRead();                                          //读取按键

       KeyInt();                                           //按键处理 

      }  

 }

ivws 发表于 2008-10-12 15:11:16

上面两个国产按键还没有使用到一天....就开始不怎么听话了.....国产呀..国产.想说爱你不容易...

ls81250 发表于 2011-1-31 22:11:51

mark

rlogin 发表于 2011-2-1 23:09:34

记号

millwood0 发表于 2011-2-5 03:53:52

"for (i = 0; i < 3; i++)                  
      {
         TxByte(buff);                                  //发送数据   
      } "

one issue with that type of coding is thatif the timing needs to be very precise, the loop overhead incurred between each byte transfer can be significant at high speed.

millwood0 发表于 2011-2-5 04:58:26

for example, one way is to load up the data to be transmitted into the lower 24 bits of a 32-bit data type:

========code==========
unsigned char ev1257_send(unsigned long frame_32) {
unsigned long mask=0x00800000;//send the highest bit first
do {
    if (frame_32 & mask) ev1257_send_one();//send 1
    else ev1257_send_zero();//send 0
    mask = mask >> 1;//prepare for the next bit
while (mask);
return 1;
}
=======end code=========

you can then write ev1257_send_one/zero() as two inline routines to speed up the execution.

wsm80828 发表于 2011-2-5 09:07:24

mark

sz898 发表于 2011-3-4 11:25:43

楼主能不能提供一个EV1527的软件PIC解码程序?我的邮箱laxi9674@163.com。先谢谢你!

ShuJi187 发表于 2011-7-11 17:53:25

重点学习了

servingapple 发表于 2011-12-21 09:48:21

mark!!!!

snwuzhisheng 发表于 2012-5-31 10:17:57

单片机 能模拟出1527的编码 频率????不是频率都很大吗 例如315M   而带51单片机最多用到24M

401281649 发表于 2013-5-13 23:35:36

{:handshake:}

wofei3344 发表于 2018-5-14 16:31:48

是我电脑的原因吗?楼主上传代码的时候没选择“code”吧,所以看起来像乱码一样,不过压缩包还是可以参考的,谢谢分享~

fenjinzhe 发表于 2018-5-14 18:07:44

谢谢分享,有空研究一下

windy_mia 发表于 2018-7-30 14:47:47

snwuzhisheng 发表于 2012-5-31 10:17
单片机 能模拟出1527的编码 频率????不是频率都很大吗 例如315M   而带51单片机最多用到24M ...

315M是载波,1527出个信号,调制载波发信息,模拟的是信号。

wowangru 发表于 2018-11-3 23:55:12

为什么有乱码!!!!!!!!!

qyvhome 发表于 2018-11-4 00:08:31

为什么看起来都是乱码,还是上传文件比较好。不然时间久了,乱码完全没法看
页: [1]
查看完整版本: 软件摸拟EV1527编码IC 【恢复】