9391 views|9 replies

187

Posts

9

Resources
The OP

Infrared encoding and decoding——GREE remote control transmission [Copy link]

In the last issue, we described infrared decoding and the errors caused by infrared transmission. Last Issue Review [Infrared]02. Infrared Coding and Decoding - GREE Remote Controlhttps://bbs.eeworld.com.cn/thread-462015-1-1.html Principles of infrared coding for GREE remote control file:///C:/Documents%20and%20Settings/Administrator/Local%20Settings/Application%20Data/YNote/data/1696933323@qq.com/43ff4fe8f4dd442c9376e4071652cbe1/clipboard.png The encoding is as follows The code is as follows: [/table ]IRsend_enableIROut The main function is to configure the carrier frequency of the PWM wave, which is generally 38KHZ 1/ 3~1/4Duty (Of course there are some special ones) From [Infrared] 01, Infrared remote control introduction and reception [ /size]https://bbs.eeworld.com.cn/thread-461935-1-1.html[/ u]It can be known [attach]198926[ /attach] To emit infrared waves, use PWM to drive the infrared LED to transmit infrared waves file:///C:/Documents%20and%20Settings/Administrator/Local%20Settings/Application%20Data/ YNote/data/1696933323@qq.com/475d1bd30dec47ea8a82677c7f6337b7/clipboard.png [font =宋体]The code is as follows: [table=98%,inherit] [ tr=inherit][td]
void Sct_Pwm_Init(uint32_t PWM_RATE)
{
/* Initialize the SCT as PWM and set frequency */
Chip_SCTPWM_Init(LPC_SCT);
Chip_SCTPWM_SetRate(LPC_SCT,PWM_RATE);
/* Setup Board specific output pin */[/ backcolor]
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 9, IOCON_FUNC2 | IOCON_MODE_INACT | IOCON_DIGITAL_EN | IOCON_INPFILT_OFF);
/* Use SCT0_OUT1 pin */
Chip_SCTPWM_SetOutPin(LPC_SCT, SCT_PWM_OUT, SCT_PWM_PIN_OUT);
/* Start with 0% duty cycle */[ /backcolor]
Chip_SCTPWM_SetDutyCycle(LPC_SCT, SCT_PWM_OUT, Chip_SCTPWM_GetTicksPerCycle(LPC_SCT) / 4);
//Chip_SCTPWM_Start(LPC_SCT);
[backcolor=inherit ]}
void IRsend_sendGREE(long datavalue ,unsigned int greeCRC)
{
long data = 0;
long temp = 0;
IRsend_enableIROut(38);
IRsend_mark(GREE_HDR_MARK);
IRsend_space(GREE_HDR_SPACE) ;
data = (datavalue&0xffffff80)|0x0A;
for (int i = 0; i < 32; i++){
if (data & TOPBIT) {
IRsend_mark(GREE_BIT_MARK);
IRsend_space(GREE_ONE_SPACE);
}
else {[/ align]
IRsend_mark(GREE_BIT_MARK);
IRsend_space(GREE_ZERO_SPACE);
}
data <<= 1;
}[/ align]
data = 0x02;
for (int i = 0; i < 3; i++){
if (data & TOPBIT) {
IRsend_mark( GREE_BIT_MARK);
IRsend_space(GREE_ONE_SPACE);
}
else {
IRsend_mark(GREE_BIT_MARK);[/align ]
IRsend_space(GREE_ZERO_SPACE);
}
data <<= 1;[/ backcolor]
}
IRsend_mark(GREE_COM_MARK);
IRsend_space(GREE_COM_SPACE);
temp = datavalue&0x00000040;//7[/ backcolor]
data = (temp>>6);
data = data<<4;
temp = datavalue&0x00000020;//6
data = data|(temp>>5);
data =data<<5;
temp = datavalue&0x00000018;//5 4
data = data|(temp>>3);
data = ((data<<16)|0x1000)<<1;//3
temp = datavalue&0x00000004;
[align= left] data = data|(temp>>2);
data = (data<<5)|(greeCRC&0x000f);
for (int i = 0; i < 32; i++){
if (data & TOPBIT) {
[backcolor= inherit] IRsend_mark(GREE_BIT_MARK);
IRsend_space(GREE_ONE_SPACE);
}
else {[/ align]
IRsend_mark(GREE_BIT_MARK);
IRsend_space(GREE_ZERO_SPACE);
}
data <<= 1;
}[/ IRsend_mark(GREE_BIT_MARK);
[backcolor =inherit] IRsend_space(0);
}
void IRsend_mark(int time) {
// Sends an IR IRsend_mark for the specified number of microseconds.
// The IRsend_mark output is modulated at the PWM frequency.
TIMER_ENABLE_PWM(); // Enable pin 3 PWM output
[align=left ] if (time > 0) delayMicros(time);
}
[backcolor=inherit ]/* Leave pin off for time (given in microseconds) */
void IRsend_space(int time) {
// Sends an IR IRsend_space for the specified number of microseconds.
// A IRsend_space is no output, so the PWM output is disabled.
TIMER_DISABLE_PWM(); // Disable pin 3 PWM output
[ align=left] if (time > 0) delayMicros(time);
}
From [Infrared]02. Infrared encoding and decoding - GREE remote control https ://bbs.eeworld.com.cn/thread-462015-1-1.html The decoded code Use the on/off key as the principle Close IRsend_sendGREE (0x900400,0xa); Open IRsend_sendGREE(0X10900400,0xb); Analyze and compare with data acquisition instrument LPC54102 sent out[/color ] file:///C:/Documents%20and%20Settings/Administrator/Local%20Settings/Application%20Data/YNote/data/1696933323@qq.com/25105f09d6fb4f1eb6d1452cd3f70040/clipboard.png file:///C:/Documents%20and%20Settings/Administrator/Local%20Settings/Application%20Data/YNote/data/1696933323@qq.com/13cbcd67b3f84aca9be613ffeadc10ae/clipboard.png Remote Control file:///C:/Documents%20and%20Settings/Administrator/Local%20Settings/Application%20Data/YNote/data/1696933323@qq.com/1f6cd68b1f004a78bc7af0f0451c55a5/clipboard.png Compare carefully and proofread to get the above picture. Finally, the power-on test succeeded and the switch air conditioner was turned on. In summary, the resources of LPC54102 are PWM output and timer (delay). In fact, software delay is also possible. The following figure is a non-accurate delay diagram, which can realize power on and off. If resources are not very tight or it is a beginner, it is recommended to use timer delay. The resources used are mainly LPC_SCT and LPC_TIMER2

2.png (5.12 KB, downloads: 1)

2.png
This post is from NXP MCU

Latest reply

MARK~  Details Published on 2018-3-5 17:27

4170

Posts

8

Resources
2
Is the frequency of Gree's infrared also 38Khz? What software did you use to decode the graphics? Can you tell me? Thank you.
This post is from NXP MCU

Comments

It is 38KHZ. I can control it with 38KHZ without any problem. I use a logic analyzer. You can find it online. The usage is similar.  Details Published on 2015-5-24 15:27

187

Posts

9

Resources
3
huaiqiao posted on 2015-5-23 19:38 May I ask if the frequency of Gree's infrared is also 38Khz? What software did you use to decode the graphics? Can you tell me? Thank you.
It is 38KHZ. I can control it with 38KHZ without any problem. I use a logic analyzer. You can find it online. The usage is similar.
This post is from NXP MCU

Comments

Oh, okay. Got it, thanks.  Details Published on 2015-5-24 17:24

4170

Posts

8

Resources
4
dvd1478 posted on 2015-5-24 15:27 It is 38KHZ. I can control it with 38KHZ without any problem. I use a logic analyzer. You can find it online. The usage is similar.
Oh, OK. Got it. Thank you.
This post is from NXP MCU

1

Posts

0

Resources
5
Buddy, can you add me on QQ? I want to ask you about the infrared control of Gree air conditioner. QQ: 15154033
This post is from NXP MCU

Comments

Ask directly upstairs, I also want to hear  Details Published on 2015-6-5 20:53
Ask directly upstairs, I also want to hear  Details Published on 2015-6-4 07:58

110

Posts

0

Resources
6
QQ15154033 posted on 2015-6-3 22:22 Buddy, can you add me on QQ? I would like to ask you about the infrared control of Gree air conditioner. QQ: 15154033
Ask directly from the above, I also want to listen{:1_137:}
This post is from NXP MCU

187

Posts

9

Resources
7
QQ15154033 posted on 2015-6-3 22:22 Buddy, can you add me on QQ? I would like to ask you about the infrared control of Gree air conditioner. QQ: 15154033
What's the problem?
This post is from NXP MCU

3

Posts

0

Resources
8
Hello, may I ask which models of Gree air conditioners this coding rule applies to? I am doing some related work and found that this coding rule can only control cabinet air conditioners, but not wall-mounted ones. I don't know the specific reason. It may be that the coding rules are different.
This post is from NXP MCU

8

Posts

0

Resources
9
have a look
This post is from NXP MCU

88

Posts

0

Resources
10
MARK~
This post is from NXP MCU

Guess Your Favourite
Find a datasheet?

EEWorld Datasheet Technical Support

Related articles more>>

    EEWorld
    subscription
    account

    EEWorld
    service
    account

    Automotive
    development
    circle

    Robot
    development
    community

    Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
    快速回复 返回顶部 Return list