Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Philips RC-5 Protocol convert in to NEC Protocol 32

Status
Not open for further replies.

sahu

Advanced Member level 2
Joined
Oct 9, 2009
Messages
516
Helped
67
Reputation
128
Reaction score
61
Trophy points
1,308
Location
Uttar pradesh (INDIA)
Activity points
3,887
i want change Philips RC-5 Protocol to NEC Protocol 32
*can any body help me ..

Code ASM - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
;======================================
; READ RC5 Format
; OUTPUT : TOGGLE.7 = TOGGLE BIT
;              ADDR = ADDRESS 5 BIT 
;               CDM = COMMAND 6 BIT
;                 C = 0 READ OK
;                   = 1 READ ERROR
;======================================
GET_RC5:
        BTFSC   IR
        GOTO    GET_RC5         ; WAIT IR LOW
        CLRF    TMR0            ; clear timer 0
    
        BCF             INTCON,T0IF     ; CLR timer 0 flag
 
        ;
        BTFSC   INTCON,T0IF     
        GOTO    ERR1            
        ;
        BTFSS   IR
        GOTO    $-3
        ;       
        MOVF    TMR0,W          
        ;MOVLW  0xC8            ; FOR TEST
        MOVWF   TEMP
        MOVLW   0XFF            ; 1020 mS = 255*4
        SUBWF   TEMP,W
        BTFSC   STATUS,C
        GOTO    ERR1            ; ERROR IF Time > 1020 uS
        MOVLW   0XC8            ; 800 mS
        SUBWF   TEMP,W
        BTFSS   STATUS,C
        GOTO    ERR1            ; ERROR IF Time < 800 uS  (C8h * TM0 Prescaler = 800 uS )
        ;
        BTFSC   IR              ; Time validate 800uS-1020uS
        GOTO    $-1             ; WAIT TO LOW (Syn BIT)
        CALL    DELAY1252       ; DELAY 3/4 BIT LENGHT=1252 uS
        ;
        BTFSS   IR
        BCF             TOGGLE,7        
        BTFSC   IR
        BSF             TOGGLE,7        
        ;               
        BTFSS   IR
        GOTO    $+4
        BTFSC   IR
        GOTO    $-1
        GOTO    READ    
        ;
        BTFSS   IR
        GOTO    $-1
 
;====== READ ADDRESS 5 BIT ===========
; READ MSB FIRST
;       
READ:   
        MOVLW   5
        MOVWF   TEMP    ; LOOP COUNTER
        CLRF    ADDR
        ;       
READ1:  
        CALL    DELAY1252
        BTFSS   IR
        BCF             STATUS,C
        BTFSC   IR
        BSF             STATUS,C
        RLF             ADDR,; SHIFT LEFT ADDRESS
        ;
        BTFSS   IR
        GOTO    $+4
        BTFSC   IR      ; WAIT LOW
        GOTO    $-1
        GOTO    $+3
        ;
        BTFSS   IR
        GOTO    $-1
        ;
        DECFSZ  TEMP,F
        GOTO    READ1
        ;
;====== READ COMMAND 6 BIT ===========  
; READ MSB FIRST
;
        MOVLW   6
        MOVWF   TEMP    ; LOOP COUNTER
        CLRF    CMD
        ;       
CMD1:   
        CALL    DELAY1252
        BTFSS   IR
        BCF             STATUS,C
        BTFSC   IR
        BSF             STATUS,C
        RLF             CMD,F   ; SHIFT LEFT COMMAND
        ;
        BTFSS   IR
        GOTO    $+4
        BTFSC   IR
        GOTO    $-1
        GOTO    $+3
        ;
        BTFSS   IR
        GOTO    $-1
        ;
        DECFSZ  TEMP,F
        GOTO    CMD1
        ;       
        MOVLW   0X3F    ; 0011 1111
        ANDWF   CMD,F
        MOVLW   0X1F    ; 0001 1111
        ANDWF   ADDR,F
        BCF             STATUS,C        ; C=0 NO ERROR
        RETURN
        ;
ERR1:   
        BSF     STATUS,C        ; C=1 HAVE ERROR        
        RETURN

 

asimkumar

Member level 4
Joined
Jan 1, 2011
Messages
78
Helped
8
Reputation
16
Reaction score
7
Trophy points
1,288
Location
Chandigarh, India
Activity points
1,755
what do you want just to write a NEC receiver or
make an device which receives RC5 and retransmits some NEC equivalent command.
 

sahu

Advanced Member level 2
Joined
Oct 9, 2009
Messages
516
Helped
67
Reputation
128
Reaction score
61
Trophy points
1,308
Location
Uttar pradesh (INDIA)
Activity points
3,887
what do you want just to write a NEC receiver or
make an device which receives RC5 and retransmits some NEC equivalent command.
it is a part IR remote controlled sw board. it work with RC5 very fine . but right now i want to change it code for NEC Protocol
for chaneise remote .
 

asimkumar

Member level 4
Joined
Jan 1, 2011
Messages
78
Helped
8
Reputation
16
Reaction score
7
Trophy points
1,288
Location
Chandigarh, India
Activity points
1,755
but what is NEC 32 i have used NEC only
i have written the code for atmega16 the algorithm will be same for any other microcontroller
you have to record the time between the pulses.
first check whether any pulse with length 9ms if yes start decoding the next incoming codes
IR Remote receiver 16 Device
written with codevision avr
this is link to a code in my blog, sorry i had not formatted it.
 

sahu

Advanced Member level 2
Joined
Oct 9, 2009
Messages
516
Helped
67
Reputation
128
Reaction score
61
Trophy points
1,308
Location
Uttar pradesh (INDIA)
Activity points
3,887
but what is NEC 32 i have used NEC only
i have written the code for atmega16 the algorithm will be same for any other microcontroller
you have to record the time between the pulses.
first check whether any pulse with length 9ms if yes start decoding the next incoming codes
IR Remote receiver 16 Device
written with codevision avr
this is link to a code in my blog, sorry i had not formatted it.
i cant understand Ur code can create in pic 16f676 in asm format ?
 

asimkumar

Member level 4
Joined
Jan 1, 2011
Messages
78
Helped
8
Reputation
16
Reaction score
7
Trophy points
1,288
Location
Chandigarh, India
Activity points
1,755
Sorry i don't know PIC programming,
now i have formatted the code in my blog,
you may see the "AN #157 - Implementation of IR NEC protocol " from bascom , this page is also for NEC but a bit different from my remote(cheap chinease)
u can check the protocol with a logic analyser
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top