Ired remote control pb code


Closed Thread
Results 1 to 4 of 4
  1. #1

    Default Ired remote control pb code

    This is an adaptation of some code for NEC remotes that is on this forum. Up till now I've just been using it for decoding the leader pulse to enable a simple on/off switch and it works great, but now I want to use it for a specific keypress on my remote. The key will output 0xFF629D. (11111111 0110 0010 1001 1101).

    I'm a bit confused on where and what is going to show up on each of the bytes when it sees the 0xFF629D --
    ADDR '00000110 ?
    ADDRINV '00000010 ?
    COMM '00001001 ?
    COMMINV '00001101 ?

    probably have that all wrong thanks for any help on this. trying to save time -- didn't want to breadboard something.
    was going to an IF byte = then high an led. but thought i'd just ask instead.

    Code:
    '12F508  nec REMOTE CONTROL RECEIVER (RENTRON)
    
    #CONFIG
      __config _OSC_IntRC & _WDT_OFF & _MCLRE_OFF & _CP_OFF 
    #ENDCONFIG
    
    TRISIO = %000001  'GPIO.0 IS REMOTE RCVR INPUT, GPIO2 IS OUTPUT
    DEFINE OSC 4
    LEADERr VAR WORD    ' will be up to 900 for a 9mS leader pulse
    BTNVAL VAR BYTE[32] ' holds 32 pulse results
    ADDR VAR BYTE       ' address byte
    ADDRINV VAR BYTE    ' inverse of address byte
    COMM VAR BYTE       ' command byte
    COMMINV VAR BYTE    ' inverse of command byte
    X VAR BYTE          ' loop count
    
    MAIN:                       
    PULSIN GPIO.0,0,Leader          ' leader pulse is ~9mS low-going
    IF Leader < 850 THEN mAIN
    FOR X = 0 TO 31                     ' grab 32 incoming pulses
    PULSIN GPIO.0,1,BtnVal(X)      ' measuring high-going pulse widths
    NEXT X
    
    'we'll decode 4 bytes from 32 pulses....
    
    FOR X = 0 TO 7                       'FIRST 8 PULSES  ADDRESS BYTE
    IF BtnVal[X] > 150 THEN  ' > 150 x 10uS = > 1.5mS pulse period
    addr.0[X] = 1             
    ELSE
    addr.0[X] = 0
    ENDIF
    NEXT X
    
    FOR X = 8 TO 15                     'SECOND 8 PULSES  ADDRESS BYTE (INVERSE)
    IF BtnVal[X] > 150 THEN
    addrinv.0[X-8] = 1
    ELSE
    addrinv.0[X-8] = 0
    ENDIF
    NEXT X
    
    FOR X = 16 TO 23                   'THIRD 8 PULSES  COMMAND BYTE
    IF BtnVal[X] > 150 THEN
    comm.0[X-16] = 1
    ELSE                                      
    comm.0[X-16] = 0                 
    ENDIF                                  
    NEXT X                 
    
    FOR X = 24 TO 31                   'FOURTH 8 PULSES  COMMAND BYTE (INVERSE)
    IF BtnVal[X] > 150 THEN
    comminv.0[X-24] = 1
    ELSE                     
    comminv.0[X-24] = 0
    ENDIF
    NEXT X
    
    PAUSE 1000
    GOTO Main

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Ired remote control pb code

    couldn't see a way to edit post so ----

    I wasn't thinking. 0xFF629D =

    11111111 0110 0010 1001 1101

    Leader is 11111111

    Address is 0110 0010 ?

    Command is 1001 1101 ?

    is that right ?

    and addrinv and comminv just invert those in the code?

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Ired remote control pb code

    And although just grabbing the leader pulse with a 12F508 worked fine, just discovered the
    BTNVAL VAR BYTE[32]
    is a problem (unable to fit error) so need to try and get around that. never had occasion to use that syntax, not sure what's going on there anyway BYTE[32] ?

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: Ired remote control pb code

    Disregard this post.
    Sorry -- problem sol ved

Similar Threads

  1. Simple RF remote control code
    By Bruce in forum Code Examples
    Replies: 13
    Last Post: - 22nd January 2014, 11:45
  2. help to record any ir code from any remote control pleeese ?
    By FADI984 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th July 2013, 01:26
  3. My code for TV remote and MIBAM for RGB control
    By idtat in forum Code Examples
    Replies: 4
    Last Post: - 12th January 2013, 21:52
  4. Help with remote control
    By Clodoaldo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th July 2009, 00:24
  5. RF Remote control
    By eralp in forum General
    Replies: 3
    Last Post: - 11th January 2007, 00:15

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts