![]() |
![]() |
![]() |
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Experienced Member
Join Date: Jan 2007
Location: South Mald Isld
Posts: 533
![]() |
Hi I searched in piclist & in google but I couldn’t find any rc5 routine.
Sony of course ok it has same pulse gap after each bit (600mS). But when it comes to RC5 (bi phase) it’s hard for me to write a code because it doesn’t have the same pulse gap. The below RC5 code written same as Sony (SIRC) thinking it has same pulse gap. But it doesn’t work for Philips remotes. Does anybody have RC5 code to share for PIC 16F series using assembly? Many thanks Code:
;====================================== ; 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 NOP BCF INTCON,T0IF ; CLR timer 0 flag NOP ; 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,F ; 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 |
|
|
|
|
|
#2 (permalink) |
|
Experienced Member
|
http://home.tu-clausthal.de/~dpor/rc5dekoder_eng.html
http://home1.stofanet.dk/hvaba/fprc5rx/index.html http://www.sixca.com/eng/articles/remote/index.html One suggestion is to use the CCP Capture mode. Should simplify the software. Last edited by blueroomelectronics; 9th May 2008 at 03:48 AM. |
|
|
|
|
|
#4 (permalink) |
|
Experienced Member
|
I just added sixca
http://www.sixca.com/eng/articles/remote/index.html |
|
|
|
|
|
#6 (permalink) |
|
Experienced Member
|
No code but very good information on IR protocols.
http://www.sbprojects.com/knowledge/ir/ir.htm |
|
|
|
|
|
#11 (permalink) |
|
New Member
Join Date: Jan 2008
Location: Toronto Canada
Posts: 29
![]() |
Take a look here:
http://www.ustr.net/infrared/infrared1.shtml This may help you also: http://focus.ti.com/lit/an/slaa134/slaa134.pdf
__________________
We learn by example and by direct experience because there are real limits to the adequacy of verbal instruction. Malcolm Gladwell www.olson-engineering.com Last edited by ex-navy; 11th May 2008 at 10:40 PM. |
|
|
|
|
|
#12 (permalink) |
|
Experienced Member
Join Date: Jan 2007
Location: South Mald Isld
Posts: 533
![]() |
Hi everybody thanks for the support.I read all of the links & manage to write a code.Now I need to check with a TV remote.
The problem is in many websites they tells "RC5 is more popular among hobbyists".Does it means they all playing with Phillips remotes? But in the market there aren't very much available Phillips remotes but sony has a lot. In the market I cannot identify is it a Phillips or some other is there any RC5 supporting remote list? |
|
|
|
|
|
#13 (permalink) |
|
Experienced Member
|
Universial remotes are very cheap. All appear to support SIRC & RC5 as they are common.
More RC5 stuff http://www.picbasic.nl/frameload_uk....sceiver_uk.htm |
|
|
|
|
|
#14 (permalink) | |
|
Super Moderator
Join Date: Nov 2003
Location: Derbyshire, UK
Posts: 22,786
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Quote:
The advantage of RC5 is that it's used in more remotes than any other type of coding, as Philips supply components to many other manufacturers. |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| MP Lab Program Help | bamafan54 | Micro Controllers | 3 | 19th October 2007 02:53 AM |
| Accessing EEPROM | Clayton | Micro Controllers | 15 | 23rd March 2007 03:00 AM |
| Need some help with a code provided by ATMEL | ikalogic | Micro Controllers | 1 | 23rd January 2007 02:46 PM |
| Tough assembly program for the PIC16F84 | asmpic | Micro Controllers | 34 | 3rd December 2004 06:50 PM |
| An error in pic16f84a, why? | Zener_Diode | Micro Controllers | 6 | 11th April 2004 02:55 AM |