RC5 on a 16F88

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

RC5 on a 16F88

Postby Crenwick » Tue Aug 30, 2011 11:41 am

Hello all,

I am new to Flowcode and also to your forum. After a little USB serial project that works flawles (thanks !) I am now playing with an RC5 receiver (I made a little PCB for this). I thougt it was possible to use a 16F88. I made a test program but it doesn't seem to work :-( . I use a 19.6608Mhz quartz) can you please check my program to see I forgot something ? Or does the 16F88 not be a good idee ?

Thanks,

Bernard


PS : Sorry for my english...

Test RC5.fcf
(5 KiB) Downloaded 150 times
Bernard

Flowcode 6 / EB006-V9

User avatar
fotios
Posts: 424
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 92 times
Been thanked: 101 times
Contact:

Re: RC5 on a 16F88

Postby fotios » Tue Aug 30, 2011 6:07 pm

Hello Bernard
Unfortunatelly RC5 receiver component can't be simulated, it can be tested only on actual hardware. Since i haven't the EB060 RC5 E-Block i can't test your *fcf. I think that you have the EB006 multiprogramming board. If you have and the EB005 LCD board and a RC5 compatible remote control handset i can post you a new *fcf file to try the RC5 functionality. For the IR receiver, you can use your custom PCB board.
P16F88 can be used for tests, you can also use its internal oscillator instead the external XTAL.
Please inform me for your hardware stuff.
Fotis
Best Regards FOTIS ANAGNOSTOU

User avatar
fotios
Posts: 424
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 92 times
Been thanked: 101 times
Contact:

Re: RC5 on a 16F88

Postby fotios » Wed Aug 31, 2011 9:50 am

Hi Bernard
Attached is the fcf file that i promised you. You can play with it to explore the RC5 protocol functionality.
Regards
Fotis
Attachments
RC5_test.fcf
(19.02 KiB) Downloaded 168 times
Best Regards FOTIS ANAGNOSTOU

User avatar
fotios
Posts: 424
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 92 times
Been thanked: 101 times
Contact:

Re: RC5 on a 16F88

Postby fotios » Wed Aug 31, 2011 10:44 am

Hi again, i forgot some instructions :mrgreen:
First of all, the fcf file that i posted does not run on FlowCode simulator it runs only on actual hardware. The mcu is the P16F88 but is configured to work with its internal oscillator. The Fosc is selected at the beginning of Main Macro thru a C code command: "osccon = 0x60;", for details about this, you should look at P16F88 datasheet. I suppose that you have the EB006 multiprogrammer. You must do two modifications to work with the current fcf: 1) Remove the on board XTAL (is very easy, is not soldered) 2) Change the place of the double jumper J18-J19 (beside to green Led) from its default place "OSC" to "A6&7" place. Now your P16F88 uses its internal oscilator while at the same time you have 2 more pins (A6 - A7) available as general I/O ports.
I think that you know how you should connect the IR receiver IC to supply lines and to Port B pin 0 (RB.0) of P16F88. This Port is the external interrupt input of PIC and is used for the connection of the output of IR receiver. IR receiver output is in HI state during iddle mode; when receives signal from the remote control handset drops to LOW state and causes interrupt on program.
I hope that you have the EB005 LCD board. If yes, you should connect it at PortA connector. You have to do some modifications on it, because RA.5 pin of P16F88 is the MCLR input: 1) Make 6 jumpers from spare lead wires of used components, like resistors. On LCD board, there are two pinstrips named P1 - P2 "PATCH SYSTEM". Connect "BIT0" of P1 to "0" of P2, BIT1 to 1, BIT2 to 2, BIT3 to 3, RS to 4 and EN to 6. In this way you will leave free "P2 - 5" that corresponds to RA.5 of P16F88. 2) Remove the large jumper from the "DEFAULT" place to "PATCH" place. Now you are ready to compile the program on P16F88.
If you have did everything correct, after compiling LCD display should shows "ADDRESS" in the upper line and "COMMAND" in the lower line. Press a key on your remote control handset, and LCD display should show the address and the command numbers.
I wish you success
Fotis
Best Regards FOTIS ANAGNOSTOU

Sean
Valued Contributor
Valued Contributor
Posts: 548
Joined: Tue Jun 26, 2007 11:23 am
Has thanked: 6 times
Been thanked: 44 times
Contact:

Re: RC5 on a 16F88

Postby Sean » Wed Aug 31, 2011 10:55 am

Your program, using the RC5 component, should work. Generating a 1ms pulse every time a valid signal is received.

If you are using the EB060 RC5 E-Block, or similar hardware, the received signal will be inverted. The 'Invert signal' check box in the component property panel needs to be checked to convert the signal back to positive logic.

This application was originally developed for a 4MHz PIC16F84 and was a good match for its timer and interrupt features. Any faster or larger processor should have no problems.
These users thanked the author Sean for the post:
Crenwick (Wed Aug 31, 2011 4:22 pm)
Rating: 5.26%
 

User avatar
fotios
Posts: 424
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 92 times
Been thanked: 101 times
Contact:

Re: RC5 on a 16F88

Postby fotios » Wed Aug 31, 2011 12:32 pm

Hello Sean & Bernard
Just now i came accross the FlowCode new RC5 component, help file. After reading (most carefully this time) the component macros, i made a new program using these macros. I used exactly the same hardware configuration that described in my previous post. The program runs without errors on actual hardware, in the upper line of LCD is printed the Address received while in the lower line is printed the Command received. I use two RC5 remote control handsets one for TV (Addr = 0) and one for preamplifiers (Addr = 16); both are decoded nicely from receiver.
Attached is the modified fcf
Fotis
Attachments
Test RC5_mod.fcf
(8.5 KiB) Downloaded 175 times
These users thanked the author fotios for the post (total 3):
Sean (Wed Aug 31, 2011 12:35 pm) • Crenwick (Wed Aug 31, 2011 4:22 pm) • medelec35 (Wed Aug 31, 2011 4:50 pm)
Rating: 15.79%
 
Best Regards FOTIS ANAGNOSTOU

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: RC5 on a 16F88

Postby Crenwick » Wed Aug 31, 2011 4:21 pm

Hello all,

Problem solved :-) It was the "invert signal" checkbox that was not marked. My projectboard is like the EB060 inverted.

I also noted that the newest TV remote I have from Philips doesn't work, maybe they changed to another coding ?? The others works really good.

Thanks ;-)
Bernard

Flowcode 6 / EB006-V9

User avatar
fotios
Posts: 424
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 92 times
Been thanked: 101 times
Contact:

Re: RC5 on a 16F88

Postby fotios » Wed Aug 31, 2011 6:54 pm

Thanks for your attention, you are very kind. :)
I did some corrections on fcf code:
1) I removed the Enable interrupt "INT" icon because is redundant; this interrupt is automatically enabled from the RC5 component macro RC5_RX_Enable.
2) I added two strings on LCD display: ADDRESS in line 0 and COMMAND in line 1. I think is more elegant to be visible what number (code) corresponds to each string.
I gave a wrong instruction regarding EB006 hardware setuup: To enable the internal oscillator of P16F88, there is no need of remove the on board XTAL; simply, change the place of J18-J19 jumper to A6&A7.
I attach 2 pictures: In the first is shown the setup of EB005 LCD board so that RA.5 (MCLR input) input of P16F88 remain free. In the second is shown the IR receiver IC and its associated parts connected "on the air" thru a D-sub connector to Port B input of EB006.
Regards
Fotis
Attachments
LCD_JUMPER.jpg
LCD_JUMPER.jpg (80.55 KiB) Viewed 4180 times
IR_LCD.jpg
IR_LCD.jpg (104.01 KiB) Viewed 4180 times
Best Regards FOTIS ANAGNOSTOU

User avatar
fotios
Posts: 424
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 92 times
Been thanked: 101 times
Contact:

Re: RC5 on a 16F88

Postby fotios » Wed Aug 31, 2011 6:56 pm

And here is the corrected fcf
Thanks again for your attention
Fotis
Attachments
Test RC5_mod.fcf
(8.5 KiB) Downloaded 201 times
Best Regards FOTIS ANAGNOSTOU

User avatar
fotios
Posts: 424
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 92 times
Been thanked: 101 times
Contact:

Re: RC5 on a 16F88

Postby fotios » Wed Aug 31, 2011 8:33 pm

Here is a picture that shows the connection of IR receiver IC and its associated parts to a D-Sub connector. When the connector inserted to EB006 PORT B socket, Pin 1 of connector is tied to RB.0 (external interrupt port) of P16F88 and Pin 9 is tied to Gnd rail. You have to connect the +5V using a cable to +V screw terminal of EB006 board.
Thanks again for your time
Fotis
Attachments
IR_CONECT_S.jpg
IR_CONECT_S.jpg (46.91 KiB) Viewed 4176 times
Best Regards FOTIS ANAGNOSTOU

User avatar
fotios
Posts: 424
Joined: Mon Feb 08, 2010 10:17 am
Location: Greece
Has thanked: 92 times
Been thanked: 101 times
Contact:

Re: RC5 on a 16F88

Postby fotios » Wed Aug 31, 2011 10:00 pm

Crenwick wrote:Hello all,

Problem solved :-) It was the "invert signal" checkbox that was not marked. My projectboard is like the EB060 inverted.

I also noted that the newest TV remote I have from Philips doesn't work, maybe they changed to another coding ?? The others works really good.

Thanks ;-)

Hi Bernard
The RC5 protocol has been developed by Philips during 1985 (?) for first time. In the first version 6 command bits are used (from 0d - 63d). Later on, Philips did an upgrade on RC5 protocol since 64 commands were inadequate for the demands of new devices. In the early RC5 protocol, the two first bits are the Start bits (allways LO to HI transition) which used from the receiver IR for AGC. In the second version of RC5, Philips decided to use only the first bit for the AGC of receiver while the second bit for doubling the command number from 64 to 128, shared in two fields (upper field = commands 64 to 127, lower field = commands 0 to 63) so as demands of new multimedia devices can be fulfiled. So, while in the first version bit 2 was allways HI, now it can be either HI or LOW and is called "Field bit". When is LO (logic "0") the upper field of commands (64 to 127 decimal) is selected and when is HI (logic "1") the lower field of commands (0 to 63 decimal) is selected.
The RC5 component of FlowCode is probably in accordance with the early RC5 protocol (2 start bits, that should go from LO to HI state simultaneously, to be recognized by the receiver as a valid code). Your new Philips remote control probably transmits the new RC5 protocol and can't be recognized by the receiver because of the different state of second (field) bit. I don't know if my thought is correct, i was faced in the past with similar problem like you. From then, i allways preffer the Universal remote control handsets; since the RC5 protocol is very old, is included by 99% in any universal (programable) remote control handset.
Regards
Fotis
Best Regards FOTIS ANAGNOSTOU

User avatar
Crenwick
Posts: 127
Joined: Sun Aug 07, 2011 1:40 pm
Location: Belgium
Has thanked: 7 times
Been thanked: 21 times
Contact:

Re: RC5 on a 16F88

Postby Crenwick » Thu Sep 01, 2011 8:32 am

Thanks again Fotis for all this information ;-)

Best regards,

Bernard
Bernard

Flowcode 6 / EB006-V9