At 05:28 PM 10/24/99 +1000, you wrote: >Hallo all, >Of course this has been asked before. I cannot find the codes that are >transmitted by my TV/VCR remote control. I see signals on the scope and want >to do something with it but... >So: >where can I find the standard codes? (read something about ISI ASCII) but >ISI site is too full of info and no search engine >Is the decoding software in the public domain (for 16F84 for instance)? >Henk - VK2GWK It is now if it wasn't before. My code (a beginner's hack from start to finish for the JVC RM-RXC30) is below. I used this on a 16F84 with four common anode 7-segment displays on portb and digit driver PNP transistors on porta.0-3. The input from the ir demodulator is on porta.4. Drive with a 4MHz crystal. With my remote, the code is always F9xx, so I test for the F9 before setting the digits. Yours may be differerent, so try disabling that check. As to standard codes, I don't think there are any in practice - I looked at 6 remotes on my scope - not one looked anything like the other. They all had different transmission rates and pulse widths, some PWM, some fixed pulse width. Enjoy. ;Firewall Fred's public domain code for the JVC RM-RXC30 IR remote. Use and abuse freely. processor 16f84 include __config _XT_OSC & _WDT_OFF & _PWRTE_ON J equ H'1F' ; J = address hex 1F K equ H'1E' ; K = address hex 1E L equ H'1C' ; L.0-L.3=digit0 L.4-L.7=digit1 M equ H'1B' ; M.0-M.3=digit2 M.4-M.7=digit3 DigEn equ H'1A' ;turn on bits 0-3 to enable digit 0-3 w_temp equ H'19' ; rxlow equ H'17' ;ir code, lsb rxhigh equ H'16' ;ir code, msb rxbits equ H'15' ;ir code length rxlow1 equ H'14' ;ir code, lsb for confirmation rxhigh1 equ H'13' ;ir code, msb for confirmation goodthresh equ H'12' ;ir code, msb for confirmation ;======================================= ; Initialization ;======================================= org 0 ; start at address 0 goto config nop nop nop goto INTERRUPT config: movlw B'00010000' ; Set port a.4=in A.3-A.0=out tris PORTA movlw B'00000000' ; Set port B.7-B.0 as output tris PORTB movlw B'00000001' movwf DigEn ;begin refresh on digit0 movlw H'00' movwf L movwf M movlw H'03' movwf goodthresh movlw H'03' option ;prescale to 1:16 movlw H'A0' ;GIE & T0IE set, T0IF cleared movwf INTCON ;t0 interrupts now enabled main_loop: call high_3mS ;wait for 3mS of high (startbit) wtfrlow: btfsc PORTA,4 ;wait for logical low (first bit) goto wtfrlow movlw D'16' ;16 bits of data movwf rxbits clrf rxlow ;reset received code clrf rxhigh ;reset received code waitforhigh: ;get next bit btfss PORTA,4 goto waitforhigh call wait_100uS ;state determined after 700uS call wait_100uS call wait_100uS call wait_100uS call wait_100uS call wait_100uS call wait_100uS btfss PORTA,4 goto rxlowbit rxhighbit: bsf STATUS,C ;bit goes into carry for rotate goto recordbit rxlowbit: bcf STATUS,C ;bit goes into carry for rotate goto recordbit recordbit: rlf rxlow,f ;shift bit in rxlow.0, rxlow.7 >> C rlf rxhigh,f ;shift C >> rxhigh.0 waitforlow: btfsc PORTA,4 goto waitforlow checkiffinished: decfsz rxbits,f goto waitforhigh movfw rxlow subwf rxlow1,0 bz checkhighbyte ;good so far, check high byte goto bad_comp ;bad compare, get another one checkhighbyte: movfw rxhigh subwf rxhigh1,0 bz checkf9 ;good so far, check rxhigh for f9 goto bad_comp ;bad compare, get another one checkf9: movfw rxhigh sublw H'F9' bz good_comp ;good compare test for threshold goto bad_comp ;bad compare, get another one good_comp: decfsz goodthresh,f ;must be good n times goto main_loop movfw rxlow movwf L movfw rxhigh movwf M goto main_loop bad_comp: movlw D'3' ;reset test threshold movwf goodthresh movfw rxlow movwf rxlow1 movfw rxhigh movwf rxhigh1 goto main_loop ;======================================= ;high3mS: looks for 3mS of high on PORTA,4 ; instr = 3n + 5n^2 ;======================================= high_3mS: ;3000 instr at 4MHz movlw D'24' ;=2952 instr movwf J j3mS: movwf K ;K=J btfss PORTA,4 goto high_3mS ;start over if it goes low during wait k3mS: decfsz K,f ;K=K-1 goto k3mS ;5 instr per k loop decfsz J,f ;J=J-1 goto j3mS ;3 instr per j loop return ;======================================= ;Wait_100uS: Delays return for 100uS ;======================================= wait_100uS: ;100 instructions at 4MHz movlw D'31' movwf J ; J = 10 jloop: decfsz J,f ; J = J-1, skip next if zero goto jloop return INTERRUPT: movwf w_temp ;save W test1: btfsc DigEn,0 ;if on dig0, set dig0 goto setdig0 btfsc DigEn,1 ;if on dig1, set dig1 goto setdig1 btfsc DigEn,3 ;if on dig2, set dig2 goto setdig3 goto setdig2 ;if on dig3, set dig3 setdig0: movf PORTA,W ;clear dig enable ; andlw H'F0' ;(com cathode) iorlw H'0F' ;(com anode) movwf PORTA ; movf L,W ; andlw H'0F' ;keep lower nibble call seg_pat ;get seg pattern in w xorlw H'FF' ;(com anode) movwf PORTB ;and put in on the port ; bsf PORTA,0 ;then enable dig0 (com cathode) bcf PORTA,0 ;then enable dig0 (com anode) rlf DigEn,f ;adjust digit pointer goto restore_fi setdig1: movf PORTA,W ;clear dig enable ; andlw H'F0' ;(com cathode) iorlw H'0F' ;(com anode) movwf PORTA ; swapf L,0 ;reverse nibbles in L, result in W andlw H'0F' ;keep lower nibble call seg_pat ;get seg pattern in w xorlw H'FF' ;(com anode) movwf PORTB ;and put in on the port ; bsf PORTA,1 ;then enable dig1 (com cathode) bcf PORTA,1 ;then enable dig0 (com anode) rlf DigEn,f ;adjust digit pointer goto restore_fi setdig2: movf PORTA,W ;clear dig enable ; andlw H'F0' ;(com cathode) iorlw H'0F' ;(com anode) movwf PORTA ; movf M,W ; andlw H'0F' ;keep lower nibble call seg_pat ;get seg pattern in w xorlw H'FF' ;(com anode) movwf PORTB ;and put in on the port ; bsf PORTA,2 ;then enable dig1 (com cathode) bcf PORTA,2 ;then enable dig0 (com anode) rlf DigEn,f ;adjust digit pointer goto restore_fi setdig3: movf PORTA,W ;clear dig enable ; andlw H'F0' ;(com cathode) iorlw H'0F' ;(com anode) movwf PORTA ; swapf M,0 ;reverse nibbles in M, result in W andlw H'0F' ;keep lower nibble call seg_pat ;get seg pattern in w xorlw H'FF' ;(com anode) movwf PORTB ;and put in on the port ; bsf PORTA,3 ;then enable dig1 (com cathode) bcf PORTA,3 ;then enable dig0 (com anode) bcf DigEn,3 ;adjust digit pointer bsf DigEn,0 goto restore_fi restore_fi: movf w_temp,W ;restore W bcf INTCON,T0IF retfie seg_pat: addwf PCL,f ;bit.0=seg.a retlw B'00111111' ;0 retlw B'00000110' ;1 retlw B'01011011' ;2 retlw B'01001111' ;3 retlw B'01100110' ;4 retlw B'01101101' ;5 retlw B'01111101' ;6 retlw B'00000111' ;7 retlw B'01111111' ;8 retlw B'01100111' ;9 retlw B'01110111' ;a retlw B'01111100' ;b retlw B'00111001' ;c retlw B'01011110' ;d retlw B'01111001' ;e retlw B'01110001' ;f end Get HushMail. The world's first free, fully encrypted, web-based email system. Speak freely with HushMail.... http://www.hushmail.com