Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 04:10 21 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : IRSEND - Unknown command etc...

Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9757
Posted: 08:54am 30 May 2022
Copy link to clipboard 
Print this post

Manual says IRSEND, but I get an invalid command error to that.
IR SEND seems more happy, but I still get a "Variable name" error.  







What am I doing wrong?

EDIT: Do "dev" and "key" as per the manual page 26, have to be variables?
I would have thought you could just insert actual integer values here, but perhaps I am wrong....
Edited 2022-05-30 18:57 by Grogster
Smoke makes things work. When the smoke gets out, it stops!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10627
Posted: 08:59am 30 May 2022
Copy link to clipboard 
Print this post

Don't know which version you are using but 25046 is invalid. Should be between 0 and 31
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9757
Posted: 09:12am 30 May 2022
Copy link to clipboard 
Print this post

25046 is what was reported by the examine code in the manual:




Oh, BTW, Micromite2 firmware 5.0408

Perhaps I need to update if there is a newer version?
Edited 2022-05-30 19:14 by Grogster
Smoke makes things work. When the smoke gets out, it stops!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10627
Posted: 10:17am 30 May 2022
Copy link to clipboard 
Print this post

IR SEND uses the sony 12-bit code. 5-bits for the dev (0-31) and 7 for the key (0-127). Receive can also receive NEC codes
Edited 2022-05-30 20:17 by matherp
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2832
Posted: 01:07pm 30 May 2022
Copy link to clipboard 
Print this post

For codes other than Sony you will need to find the specifications and use Bitbang Bitstream.
See this page and scroll down to the end.

https://www.thebackshed.com/forum/ViewTopic.php?TID=14835&PID=186389#186389#186444
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10627
Posted: 02:00pm 30 May 2022
Copy link to clipboard 
Print this post

See https://www.thebackshed.com/forum/ViewTopic.php?TID=8367 for a NEC send CFunction for the MM2
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9757
Posted: 01:08am 31 May 2022
Copy link to clipboard 
Print this post

Thanks chums, I will do more research.
Smoke makes things work. When the smoke gets out, it stops!
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9757
Posted: 09:04am 01 Jun 2022
Copy link to clipboard 
Print this post

UPDATE:

The NEC code Csub works a charm to control my LED projector.
The old remote-control is wearing out, and I often have to press the buttons VERY hard to get things to work, but cos it was a projector out of eBay several years ago, I cannot find replacement remote controls for it.

Using a MicroMite solves this problem completely, and now I can built a wee box of tricks that with one button press, will turn the projector on and set it to the input I want etc, and then another button can turn it off.  

Thanks to matherp, for writing the NECSend Csub, without which, I would not be able to do this.


'NECsend pin,device,code
CSub NECsend
0000000E
'high
00001021 40824800 0045102B 10400008 00804021 40024800 0048182B 1460FFFD
0045102B ACC70000 1440FFFA 01044021 03E00008 00000000
'main
27BDFFB0 AFBF004C AFBE0048 AFB70044 AFB5003C AFB30034 AFB20030 AFB1002C
AFB00028 AFB60040 3C109D00 AFB40038 8E02009C 00808821 3C044795 24844E00
00C09821 0040F809 00A09021 AFA2001C 8E02009C 3C0444DE 0040F809 248438E4
0040B821 8E02009C 3C0442DE 0040F809 248438E4 AFA20020 8E240000 8E020024
24050007 0040F809 24150001 AFA20018 8E240000 8E020024 0040F809 24050005
0040F021 8E020028 0040F809 8E240000 8E430000 8E440004 0055A804 306500FF
14800006 8E670000 54800005 38A300FF 2C620100 54400002 38A300FF 7C633A00
3C169D00 AFD50000 8E240000 8EC20010 00079400 38E700FF 00073E00 02459025
02479025 00003021 00031A00 24050008 0040F809 02439025 8EC20004 240407D0
0040F809 AFB50010 8EC30000 8EC20080 8ED30064 8C640000 8FA30018 00002821
00008821 0040F809 AFA30014 00408021 8EC2009C 0040F809 3C044000 00402821
0260F809 02002021 0040A021 8EC20064 8ED0007C 02E02821 0040F809 02802021
0200F809 00402021 00409821 8FA50020 8EC20064 8ED0007C 0040F809 02802021
0200F809 00402021 0040B821 8FA5001C 8EC20064 8ED0007C 0040F809 02802021
0200F809 00402021 8FA60018 00402021 3C030008 0040A021 3C02BF88 AC431064
02E02821 3C02BF88 02A03821 AC401068 0411FF75 00000000 AFD50000 8EC20004
24041194 0040F809 3C109D00 24160020 8FA60014 02602821 02A03821 02802021
0411FF69 00000000 8FA20010 24040232 26310001 AFC20000 8E020004 0040F809
0260B821 32420001 10400004 00000000 8E020004 0040F809 24040465 1636FFEC
00129042 8FA60018 02802021 02E02821 02A03821 0411FF54 00000000 AFD50000
8FBF004C 3C020008 3C03BF88 AC621064 3C03BF88 8FBE0048 8FB70044 8FB60040
8FB5003C 8FB40038 8FB30034 8FB20030 8FB1002C 8FB00028 AC621068 03E00008
27BD0050
End CSub


'NEC key and device code reader
Option explicit
Option default none
Dim integer dev,key
IR dev,key,irint
Do
Pause 1000
Loop
irint:
If (dev And &HFF) = ((dev>>8) Xor &HFF) Then ' normal address
Print brv((dev>>8),8) ,brv(key,8)
Else ' extended address
Print brv(dev,16),brv(key,8)
EndIf
IReturn

Function brv(x As integer, k As integer) As integer
Local integer n
brv=0
For n=1 To k
If x And (1<<(n-1)) Then
brv=brv Or (1<<(k-n))
EndIf
Next n
End Function



Sub PWR 'POWER button
 Local X As integer
 For X=1 To 3
   NECsend 15,27526,10
   Pause 26
 Next X
End Sub


Sub VOLD 'Volume Down button
 Local X As integer
 For X=1 To 3
   NECsend 15,27526,72
   Pause 26
 Next X
End Sub

Smoke makes things work. When the smoke gets out, it stops!
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025