RC5 component for PIC16 or PIC18 (help!)

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

RC5 component for PIC16 or PIC18 (help!)

Postby RobH » Wed Feb 18, 2015 1:48 am

I'm having issues with the RC5 component in FC6.1. I can't compile the sample program (RC5 Receive Example: http://www.matrixtsl.com/wiki/index.php ... ireless%29) when I change the chip to known working chips (at least on my system) PIC16F688 or PIC18F25K50. Here are my errors, although, I think the real error here is me and my lack of programming knowledge:

PIC16F688 (RC5 on Port A2):
RC5_Test_Rx.fcfx
(5.79 KiB) Downloaded 209 times

C:\Program Files (x86)\Flowcode 6\CAL\PIC\PIC_CAL_PWM.c(168): Hardware PWM not supported by Target microcontroller.

Hmm, no PWM available on this chip. Is there a workaround?

Onto the other chip...

PIC18F25K50 (RC5 on Port B2):
RC5_Test_Rx2.fcfx
(6.11 KiB) Downloaded 181 times

RC5_Test_Rx.c(712:25): error: unknown identifier 'INT0E'
RC5_Test_Rx.c(712:25): error: failed to generate expression
RC5_Test_Rx.c(712:25): error: invalid operand 'INT0E'
RC5_Test_Rx.c(712:20): error: failed to generate expression
RC5_Test_Rx.c(712:16): error: invalid operand '~(1 << ( INT0E))'
RC5_Test_Rx.c(712:13): error: failed to generate expression
RC5_Test_Rx.c(1168:25): error: unknown identifier 'INT0F'
RC5_Test_Rx.c(1168:25): error: failed to generate expression
RC5_Test_Rx.c(1168:25): error: invalid operand 'INT0F'
RC5_Test_Rx.c(1168:20): error: failed to generate expression
RC5_Test_Rx.c(1168:16): error: invalid operand '~(1 << ( INT0F))'
RC5_Test_Rx.c(1168:13): error: failed to generate expression
RC5_Test_Rx.c(1175:24): error: unknown identifier 'INT0E'
RC5_Test_Rx.c(1175:24): error: failed to generate expression
RC5_Test_Rx.c(1175:24): error: invalid operand 'INT0E'
RC5_Test_Rx.c(1175:19): error: failed to generate expression
RC5_Test_Rx.c(1175:17): error: invalid operand '1 << ( INT0E)'
RC5_Test_Rx.c(1175:13): error: failed to generate expression
RC5_Test_Rx.c(1276:27): error: unknown identifier 'INT0E'
RC5_Test_Rx.c(1276:27): error: failed to generate expression
RC5_Test_Rx.c(1276:27): error: invalid operand 'INT0E'
RC5_Test_Rx.c(1276:22): error: failed to generate expression
RC5_Test_Rx.c(1276:20): error: invalid operand '1 << ( INT0E)'
RC5_Test_Rx.c(1276:17): error: failed to generate expression
RC5_Test_Rx.c(1276:61): error: unknown identifier 'INT0F'
RC5_Test_Rx.c(1276:61): error: failed to generate expression
RC5_Test_Rx.c(1276:61): error: invalid operand 'INT0F'
RC5_Test_Rx.c(1276:56): error: failed to generate expression
RC5_Test_Rx.c(1276:54): error: invalid operand '1 << ( INT0F)'
RC5_Test_Rx.c(1276:51): error: failed to generate expression
RC5_Test_Rx.c(1276:7): error: invalid operand '((intcon) & (1 << ( INT0E)))'
RC5_Test_Rx.c(1276:41): error: invalid operand '((intcon) & (1 << ( INT0F)))'
RC5_Test_Rx.c(1276:37): error: failed to generate expression
RC5_Test_Rx.c success
failure
.
Completed BoostC compilation, return = 1

C:\Program Files (x86)\Flowcode 6\compilers\pic\boostc\boostc_18F.exe reported error code 1

Wow. Just not my evening!

Is it me, or is it a needed FCPx tweak? Thanks in advanced for explaining this to me!

On a separate note, I never got the Sparkfun Arduino ProMicro (ATMega32u4) working with FC6.
viewtopic.php?f=54&t=13084
Last edited by RobH on Mon Feb 23, 2015 7:31 pm, edited 2 times in total.

User avatar
Benj
Matrix Staff
Posts: 14674
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4659 times
Been thanked: 4283 times
Contact:

Re: RC5 component for PIC16 or PIC18

Postby Benj » Wed Feb 18, 2015 11:51 am

Hello,

I've managed to fix the compile problem on the 18F device but the 16F without PWM is a bit more troublesome.

Let me know how you get on.
Attachments
RC5.fcpx
(15.84 KiB) Downloaded 185 times

User avatar
Benj
Matrix Staff
Posts: 14674
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4659 times
Been thanked: 4283 times
Contact:

Re: RC5 component for PIC16 or PIC18

Postby Benj » Wed Feb 18, 2015 12:16 pm

Hello,

Managed to find a fix for the 16F688 device too.

First the component lives here "C:\Program Files (x86)\Flowcode 6\components"

RC5.fcpx
(15.87 KiB) Downloaded 217 times


Then the CAL file needs changing slightly here "C:\Program Files (x86)\Flowcode 6\CAL\PIC"

PIC_CAL_PWM.c
(10.92 KiB) Downloaded 196 times


Let me know how you get on.
These users thanked the author Benj for the post:
RobH (Wed Feb 18, 2015 3:01 pm)
Rating: 5%
 

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18

Postby RobH » Wed Feb 18, 2015 3:21 pm

Thanks, Ben. I'll try these today and get back with you on my results.

*update 1*

Both files compile now. That's about as far as I've chipped into this brick wall. I also think there is possibly an issue with the IRda component too.

*update 2*

Could someone show me the error of my ways and provide a simple program to receive any IR byte on an INT pin and turn a port on for 1 second?

*update 3*

I got *something* to work with the IrDA component on a 16F688, so that's progress! The end goal is to read an IR code from a remote and do something with the code, like turn on a port. Not having much luck. I assume I need tro use the RC5 component, not the IrDA component. So far we've gotten both the IrDA and RC5 component to sense an IR signal, but we haven't quite worked out how to move forward. Following in others' footsteps, I've found that even their older FC4 and FC5 codes, when converted to FC6 do not function properly.
Last edited by RobH on Mon Feb 23, 2015 6:57 pm, edited 1 time in total.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18

Postby RobH » Fri Feb 20, 2015 12:47 am

Latest build compile for 18F25K50 went OK, but had a couple of serious warnings I wanted to share:

Serious Warning: Possible sw stack corruption, function 'FC_CAL_Port_In_DDR__x' called by more than one asynchronous thread (main/Task, interrupt, interrupt low)
Serious Warning: Possible sw stack corruption, function 'FCD_01bf1_RC5__Initialise_States' called by more than one asynchronous thread (main/Task, interrupt, interrupt low)

*update 1*
Same errors for 16F688
Serious Warning: Possible sw stack corruption, function 'FC_CAL_Port_In_DDR__x' called by more than one asynchronous thread (main/Task, interrupt, interrupt low)
Serious Warning: Possible sw stack corruption, function 'FCD_01bf1_RC5__Initialise_States' called by more than one asynchronous thread (main/Task, interrupt, interrupt low)

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18

Postby RobH » Fri Feb 20, 2015 3:33 am

Right now, I seem to be at a stand still. I've made what I think is the simplest of simple tests Just to check RC5 for new data with retval. It should either give me a 0 or a 1 (0 for now new data, 1 for new data). It never gives a 1. Not sure if that has to do with the serious warnings I'm getting, or the fact that I'm not using RC5 correctly (interrupt or timer based). Also I'm trying to use 38khz, instead of 36khz.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18

Postby RobH » Fri Feb 20, 2015 11:49 pm

I decided to run multiple tests with multiple chips with different parameters, all with the same results. I'm still getting the serious warnings for all compiles, which I suspect is the problem:

Building CASM file
Serious Warning: Possible sw stack corruption, function 'FC_CAL_Port_In_DDR__x' called by more than one asynchronous thread (main/Task, interrupt, interrupt low)
Serious Warning: Possible sw stack corruption, function 'FCD_01bf1_RC5__Initialise_States' called by more than one asynchronous thread (main/Task, interrupt, interrupt low)

I decided to upload some of my codes, you'll notice that all of them are configured differently and coded differently.
16f688:
16f688 low pin count RC5 test1.fcfx
(12.44 KiB) Downloaded 203 times


16f690:
16f690 rc5 test low pin count.fcfx
(11.41 KiB) Downloaded 199 times


18f25k50:
RC5 test2.fcfx
(9.65 KiB) Downloaded 187 times



I still need help, am not sure if the error is my own lack of RC5 knowledge, or a bug in the RC5 component. I am not able to get IR working on any chip with FC6 using the RC5 component.

User avatar
Benj
Matrix Staff
Posts: 14674
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4659 times
Been thanked: 4283 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby Benj » Wed Feb 25, 2015 3:26 pm

Hi Rob,

The warnings can be ignored. I have checked the code and the same macros are called in both the main and the interrupt but never at the same time. Basically we initialise settings in the initialise component macro before switching on the interrupt.

Would it be possible to see a schematic of your circuit to try and see what's going on. On our E-block we use a module that filters out the high frequency IR carrier and provides nice clean signal edges (TSOP1236).

The E-block schematic is available at the end of this doc: http://www.matrixtsl.com/resources/getr ... php?id=116

Do you have access to a scope so you can see the data from the IR sensor to see if it is getting to the uC and how clean the signal is.

If your signal is letting through the high frequency carrier then you will have to create a basic RC low pass filter to try and get rid of it.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby RobH » Wed Feb 25, 2015 3:37 pm

We do have a scope. I'll check out the signals, but we have also run a similar (available online for download) sketch on an arduino that works with our current schematic perfectly, although, not with Flowcode. We never got our selected Arduino to download anything from FC6. This is one of the reasons we prefer Microchip, because at least they will work with FC consistently. All we are doing is connecting a "from ebay" IR receiver module/remote pair.
http://blog.whatgeek.com.pt/arduino/key ... te-sensor/ to an INT pin (have also tried other pins and configs). Have tried with or without an INT macro, etc.

I would love for this to be a hardware issue. Those are easily fixed!

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby RobH » Tue Mar 17, 2015 11:18 pm

And after 3 weeks of failed attempts, I give up. I would love some assistance from anyone.

Schematic of one attempt:

Image

User avatar
Benj
Matrix Staff
Posts: 14674
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4659 times
Been thanked: 4283 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby Benj » Wed Mar 18, 2015 11:41 am

Hi Rob,

The CheckRx macro didn't seem to be linked to the component correctly. when I double clicked it didn't auto select the right function so I wonder if this is a v5 import issue.

I have hopefully fixed this issue so please can you try this program and let me know if you have any joy.

16f690 rc5 test low pin count.fcfx
(11.39 KiB) Downloaded 193 times


I might have a 16F690 device here so I will rig it up and see if I can make it work. Unfortunately my RC5 receiver is 36KHz so I cannot replicate your setup 100%.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby RobH » Wed Mar 18, 2015 1:35 pm

I appreciate your help. If it would be easier for you to use an 18F25K50, let me know.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby RobH » Wed Mar 18, 2015 11:49 pm

Ben,

Same results. Compiles fine with the two serious warnings but doesn't function as intended. Scoping pin RA2 shows a signal is received when I use an IR remote, so it must be software.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby RobH » Mon Mar 23, 2015 2:48 pm

Ben,

I would be happy to send you any components you may need to recreate this issue.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby RobH » Fri Mar 27, 2015 1:42 am

I'm also having compile issues for RC5 with attiny and atmega. For instance:

In file included from C:\Program Files (x86)\Flowcode 6\CAL\includes.c:229,
from G:\LIFELI~1\Projects\PROGRA~1\Flowcode\ATMEGA32\RC5 test.c:381:
C:\Program Files (x86)\Flowcode 6\CAL\/AVR\AVR_CAL_PWM.c:105:5: warning: #warning "PWM Channel Uses Resource Timer 0"
G:\LIFELI~1\Projects\PROGRA~1\Flowcode\ATMEGA32\RC5 test.c: In function 'FCD_01bf1_RC5__Timer_Event':
G:\LIFELI~1\Projects\PROGRA~1\Flowcode\ATMEGA32\RC5 test.c:716: error: 'FCP_TRIS_A' undeclared (first use in this function)
G:\LIFELI~1\Projects\PROGRA~1\Flowcode\ATMEGA32\RC5 test.c:716: error: (Each undeclared identifier is reported only once
G:\LIFELI~1\Projects\PROGRA~1\Flowcode\ATMEGA32\RC5 test.c:716: error: for each function it appears in.)
G:\LIFELI~1\Projects\PROGRA~1\Flowcode\ATMEGA32\RC5 test.c:716: error: 'FCP_PORT_A' undeclared (first use in this function)

Error returned from [avr-gcc.exe]
Completed compilation, return = 1


I don't have a port A. Why does it need to be declared?

User avatar
Benj
Matrix Staff
Posts: 14674
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4659 times
Been thanked: 4283 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby Benj » Mon Mar 30, 2015 4:06 pm

I don't have a port A. Why does it need to be declared?


Some of the hidden properties, i.e. the transmitter pin might be referencing PortA.

Working fine for me using the 36KHz IR, would you be able to send us some hardware to replicate your setup and see if we can sort out the problem.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby RobH » Mon Mar 30, 2015 6:27 pm

Absolutely will send you hardware. Send me your address via PM.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby RobH » Tue Apr 14, 2015 11:21 pm

Sent a couple weeks ago. Just checking to see if it has been received.

User avatar
Benj
Matrix Staff
Posts: 14674
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4659 times
Been thanked: 4283 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby Benj » Mon Apr 20, 2015 12:37 pm

Hello Rob,

Yes we have received the bits, they are currently sat on my desk.

I will try and find some time for you this week to try and determine what the problem is.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby RobH » Thu May 07, 2015 4:17 pm

Thanks for the update. I can't wait to see what you find.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby RobH » Thu May 21, 2015 5:47 pm

Ben,

Is there any update on this?

User avatar
Benj
Matrix Staff
Posts: 14674
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4659 times
Been thanked: 4283 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby Benj » Wed May 27, 2015 12:36 pm

Hi Rob,

Been looking into this this morning for you and it appears that the IR transmitter is not sending out anything like RC5 encoded data.

This is the signal I'm getting from your transmitter, to me it looks very similar to a LIN bus packet. i.e. a break, followed by a auto baud sync, followed by the data, followed by the checksum?? Might be nothing like this I'm just guessing.

IR1.jpg
IR1.jpg (122.32 KiB) Viewed 11934 times


Here is a RC5 signal for comparison which is working as expected with the Flowcode program below. This is just from a generic off the shelf TV remote with RC5 functionality.

IR2.jpg
IR2.jpg (122.72 KiB) Viewed 11934 times


RC5.fcfx
(7.02 KiB) Downloaded 189 times


The IrDA component might work with your transmitter if you can get the baud rate right. Looks like a baud of 800bps but I could be wrong.
These users thanked the author Benj for the post:
RobH (Wed May 27, 2015 1:34 pm)
Rating: 5%
 

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby RobH » Wed May 27, 2015 1:37 pm

That explains why IRDA was (kind of) working for me at some point on this. Were you able to use your RC5 remote with the IR receiver I sent?

User avatar
Benj
Matrix Staff
Posts: 14674
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4659 times
Been thanked: 4283 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby Benj » Wed May 27, 2015 2:17 pm

Were you able to use your RC5 remote with the IR receiver I sent?


Yes this worked great.

My transmitter look a bit like the one on the left here : http://www.ebay.co.uk/itm/like/27116057 ... 0&ff14=108

But I got mine for £1 at a pound shop. I've seen small thin one's like the one your using on eBay before for very low cost.

Do you want to PM me your address and I will return the items to you.

User avatar
RobH
Posts: 95
Joined: Wed Sep 11, 2013 7:51 pm
Has thanked: 29 times
Been thanked: 17 times
Contact:

Re: RC5 component for PIC16 or PIC18 (help!)

Postby RobH » Wed May 27, 2015 2:20 pm

Returning those items is not necessary. Thank you for taking a look at them.
These users thanked the author RobH for the post:
Benj (Wed May 27, 2015 2:24 pm)
Rating: 5%