51 MCU HXD019 driver
发布时间:2017-03-09 浏览次数:1598次

51 microcontroller and hxd019 communication

0, set up three GPIO and initialization, hyxx.c file:

All IO MCU internal pull-down and remote IC_HXD019 connected to Set_SDA_IO (GetBUSYStatus) to close, (all) the main control chip and hxd019 connected to the pin pin set function set, respectively is the hardware on the SDA, SCL, BUSy power or standby are high, then add the compiler;

1, send learning data or library data:

1.1. data obtained from the library (Size variable length, up to 120 bytes, learning data is 232 bytes) example:

unsigned char  data[]={0x30,0x00,0x01,0x1c,0xE3,0x00,0xFF,0x20,0x88,0xD7}

  1.2.Then write function: writeI2C(data, 10): 

  2,Learning and learning data,hyxx.cfile

2.1 Access to learning: master if the data obtained from the upper layer: the first two bytes

0x30,0x20,The given function  Learn_start2();

At this time the external operation: with the remote control to the infrared diode code, not more than 20 seconds to learn, HXD019 timeout);

2.2 And so on: when IO:busy From low to highCall function call function readI2C2(),Master write their own example:

   LLearn_start2();

Delay10ms(10);

while(BUSY==0)

Delay10ms(1);

if(BUSY==1)

{

readI2C2(ReceiveBuf1);  //进After learning,busyRead data from low to high

Delay10ms(10 );    ......

Data obtained readtempbuf[]={},230 Byte;Process back to the upper or the master (the latter case): the first byte will be read 00 Get rid of,Front plus 30 03 Add check,30Start with all data and low 8 bits put 232 byte,30 03 +(00  229 individual byte)+check(All previous data and low 8 bits),When used to send back 019 chips,Function name writeI2C(),This example is learning data for 232 bytes,If the database data SizeThere may be changes according to the actual code value;

3,Hardware dependent:

 The hardware is connected, in the debugging period, it is recommended that the three communications IO port, the string of a 100R resistor (production does not need), to prevent abnormal IO conflict.

4,Timing adjustment hyxx.c file,

Refer to the timing reference map.JPG> document: according to the different clock adjustment MCU, measuring the communication clock SCL line parameters:

     #define  DELAY_TIME  15// When the SCL clock cycle is called writeI2C ():H=30uS,

     #define  DELAY_ST  20//hxd;SCL the first falling edge to the second falling edge of time:20mS,

Note: if the program calls writeI2C () and Learn_start2 (busy) when the interval between the 800mS, (Learn_start2) (after) to check whether or not to become high: to be more than 50mS intervals

 

Professional remote control chip: mobile phone universal remote control, infrared remote control IC, HXD019, infrared code library, infrared remote control data, universal code library, cloud code library, wifi turn infrared
您是第31143位访客   粤ICP备13027018号