Hi Rob, This was a testing way. I know abou the third bit . I am now working on a better way : I am now so far that all commands are working beside the play function. (0x35) . On the normal button operation this button is also used as pauze command. With the RC5 (0x35) command works only when i have the pauze situation activated with the button. Then it restarts, but not as a normal start. In the program attached you can see the command list i have from this device. If you have time pleas have a look at this revised, untested program change. :
alias RC5 is pin_D2 pin_D2_direction = output RC5 = low var byte ADRES var byte COMMAND include delay -- fetch delay library -- procedure HOOG is RC5 = low _usec_delay(889) RC5 = high _usec_delay(889) end procedure procedure LAAG is RC5 = high _usec_delay(889) RC5 = low _usec_delay(889) end procedure procedure RC (byte in adres,byte in command) is var byte xx = adres <<3 var byte yy = command <<2 var bit x at xx : 7 var bit y at yy : 7 --start hoog hoog laag --now adres 5 bits for 5 loop if x == high then hoog else laag end if XX=XX << 1 end loop -- now command 6 bits for 6 loop if y == high then hoog else laag end if yy = yy << 1 end loop end procedure forever loop RC( 0x05, 0x35) -- play RC( 0x05, 0x36) -- stop RC( 0x05, 0x37) -- rec RC( 0x05, 0x32) --left RC( 0x05, 0x34) --right RC( 0x05, 0x20) --next RC( 0x05, 0x21) -- last RC( 0x05, 0x31) -- delete RC( 0x05, 0x3c) --lyrics RC( 0x05, 0x3a) -- transp up RC( 0x05, 0x3b) -- transp down RC( 0x05, 0x1d) -- menu RC( 0x05, 0x29) -- play next RC( 0x05, 0x22) -- play last RC( 0x05, 0x3e) -- monitor end loop regards Hans Op donderdag 17 juni 2021 om 19:47:23 UTC+2 schreef [email protected]: > Hi Hans, > > I had a look at your program. The procedure called 'Basis' raises some > questions. > > It starts with two start bits (both 'hoog') but the third bit is a toggle > bit. If you press a key on the remote control and you keep it pressed. The > same command is repeated with the same toggle bit. The receiver then knows > that it is still the same command. As soon as you release a key and press > it again, the toggle bit changes. In your 'basis' the toggle bit is always > the same so your device thinks you are repeated the same command. > > Next to that do you know the RC5 device address? In your 'basis' you use > low-low-high-low-high to the device has address 0x05 which is a VCR so I > assume you are controlling a VCR. If not you should change 'basis'. > > You can find the RC5 addresses on wikipedia. > > For the rest it seems to be OK. One thing that can be a problem is the > opto coupler. It will invert your bits and I do not know if the infrared > received in your device does the same. If not then you should invert all > bits in 'hoog' and 'laag'. > > Kind regards, > > Rob > > ------------------------------ > *Van:* [email protected] <[email protected]> namens hans < > [email protected]> > *Verzonden:* woensdag 16 juni 2021 20:39 > *Aan:* jallib <[email protected]> > *Onderwerp:* Re: [jallib] RC5 lib > > > Hi Rob, > > I've tried a few things but it's not as easy as I thought. Simply removing > the IR receiver and replacing it with an optocoupler will not work. There's > something behind it with no license plates. So I put the case back together > and checked with a standard remote. He's working again. End of story : I do > need a lib for the normal IR operation. If it can send and receive. I hope > you have the time for it. > > Here is what i have done. > > I have a very old RC5 reader and on that one the data reeceived is > correct, adres and commands. But not on the one i like to use. (as i said > above) > > -- Title: RC5 test > > -- > > > > -- ------------------------------------------------------ > > -- > > -- > > include 16f877a -- target PICmicro > > -- > > > > pragma target clock 20_000_000 -- oscillator frequency > > -- > > pragma target OSC HS -- crystal or resonator > > pragma target WDT DISABLED -- watchdog > > pragma target DEBUG DISABLED -- no debugging > > pragma target BROWNOUT DISABLED -- no brownout reset > > pragma target LVP DISABLED---ENABLED -- low voltage > programming > > -- > > > > enable_digital_io() -- make all pins digital I/O > > > > -- library with delay procedures > > include delay > > > > alias RC5 is pin_D2 > > pin_D2_direction = output > > RC5 = low > > > > > > include delay -- fetch delay library > > -- > > procedure HOOG is > > RC5 = low > > _usec_delay(889) > > RC5 = high > > _usec_delay(889) > > end procedure > > > > procedure LAAG is > > RC5 = high > > _usec_delay(889) > > RC5 = low > > _usec_delay(889) > > end procedure > > > > procedure BASIS is > > hoog > > hoog > > laag > > laag > > laag > > hoog > > laag > > hoog > > end procedure > > > > procedure START_PAUZE is > > for 10 loop > > basis > > hoog > > hoog > > laag > > hoog > > laag > > hoog > > delay_1mS(114) > > end loop > > end procedure > > > > procedure STOP is > > for 10 loop > > basis > > hoog > > hoog > > laag > > hoog > > hoog > > laag > > delay_1mS(114) > > end loop > > end procedure > > > > procedure VOLGENDE is > > for 10 loop > > basis > > hoog > > laag > > laag > > laag > > laag > > laag > > delay_1mS(114) > > end loop > > end procedure > > > > > > delay_1S(5) > > forever loop > > > > start_pauze > > delay_1S(2) > > start_pauze > > delay_1S(2) > > start_pauze > > delay_1S(2) > > stop > > delay_1S(2) > > volgende > > delay_1S(2) > > start_pauze > > delay_1S(2) > > stop > > delay_1S(5) > > > > end loop > > > > > > > > > > Thanks again. > > regards > > Hans > > Op woensdag 16 juni 2021 om 08:04:59 UTC+2 schreef [email protected]: > > Hi Hans, > > I understand what you are doing so you do not need the 36 kHz carrier. > That makes it even simpler. In that case you only need a timer to generate > the RC5 bi-phase signal. Will you be able to do that or do you need some > help with that? > > Met vriendelijke groet, > Rob Jansen > ------------------------------ > *From:* [email protected] <[email protected]> on behalf of > hans <[email protected]> > *Sent:* Tuesday, June 15, 2021 9:54:26 PM > *To:* jallib <[email protected]> > *Subject:* Re: [jallib] RC5 lib > > > Hi Rob, > > Thanks for responding, even though you're on vacation. First some more > information. I have a device that I normally operate with push buttons, but > that can also work with RC5 if i connect a Tsop1836 on it, for example. I > also have the codes used for address and commands. So I want to use a Pic > as a transmitter. > > Actually I don't need the whole IR part because I can also connect an > output of the PIC directly to the RC5 input of the device.. I have already > found the information about what the pulse train should look like. > > At least it keeps the gray matter flexible. > > Greetings and have a nice holiday > > Hans > Op dinsdag 15 juni 2021 om 18:31:02 UTC+2 schreef [email protected]: > > Hi Hans, > > Some years ago (in 2014 to be exact) I wrote a decoder routine that is > capable of decoding RC5 and RC6 messages. It works on an interrupt basis. I > wrote two variants, one using Timer 0 and one using Timer 1. I attached the > sources files in the attached zip file. > > I could make a JAL library out of it - since these source files are not > yet Jallib compilant - and make it part of Jallib. I could then incorporate > the timer part in the decoder part so that you only have one library to > include. > > Currently I am enjoying my vacation so I am not able to test them but I > think they work. The main program uses a USART to write the received RC5 or > RC6 message. The UART part is also included in the zip file. > > I could make an RC5 and RC6 encoder program since I have done that in the > past because I have worked at Philips many years ago and was one of the > contributors of the Philips RC6 standard 🙂. As you may know, for the > encoder you need a 36 kHz modulated signal to drive the Infra Red LED so > you need a PWM signal for that. > > Kind regards, > > Rob > > > > > > ------------------------------ > *Van:* [email protected] <[email protected]> namens hans < > [email protected]> > *Verzonden:* dinsdag 15 juni 2021 10:49 > *Aan:* jallib <[email protected]> > *Onderwerp:* [jallib] RC5 lib > > Is there beside the SIRC lib also one for sending/receiving RC5 ? > > -- > You received this message because you are subscribed to the Google Groups > "jallib" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jallib/0e2b7ff9-dfde-4d3b-8db2-72e3c50ee21fn%40googlegroups.com > > <https://groups.google.com/d/msgid/jallib/0e2b7ff9-dfde-4d3b-8db2-72e3c50ee21fn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > -- > You received this message because you are subscribed to the Google Groups > "jallib" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jallib/7bc0ee26-67d2-46ac-bd58-a6d339042326n%40googlegroups.com > > <https://groups.google.com/d/msgid/jallib/7bc0ee26-67d2-46ac-bd58-a6d339042326n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > -- > You received this message because you are subscribed to the Google Groups > "jallib" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jallib/850931fd-ea4f-45e8-9cd2-80389810ead6n%40googlegroups.com > > <https://groups.google.com/d/msgid/jallib/850931fd-ea4f-45e8-9cd2-80389810ead6n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/06d8f065-5f5c-4d65-96db-21be1be2f62fn%40googlegroups.com.
