Page 1 of 1
rc5 no pin control/possible incorrect operation
Posted: Fri Dec 28, 2012 5:59 am
by brandonb
below i have dropbox links because i wanted to show it in full resolution, please look at each one and tell me what you think?
first of all im not sure if rc5 macro is producing the correct signals, reveiw waveforms
then when i tell it to output on a certain pin it doesnot do it on the correct pin
here are all the rc5 combinations except the eblock running on a 16f1938
https://dl.dropbox.com/u/10367218/SOFTW ... FTWARE.jpg
https://dl.dropbox.com/u/10367218/SOFTW ... %20PWM.jpg
https://dl.dropbox.com/u/10367218/TIMER%20%20PWM.jpg
there are a few things that have been messing with me
TX QUESTIONS
- am i suppose to have the full blown modulated signal on one pin or two pins in all modes
or is it intentionally done the way the waveforms show?
- is the timer output on ccp1 suppose to actually output a constant 36khz 50% duty waveform?
- why do i get the full signal on A0 when in software/software mode and not in the other modes?
- obviously there is something wrong with the pin choosing macro
RX QUESTIONS
- why is there an interrupt and a timer option, this makes no sense, how could it use a int on pin as a timer, how could it not use a timer to check the incoming bits?
- how does "check_rx" and "collect data" work as a sudo code example
THIS IS HOW I USE IT CURRENTLY
-to get ir led to pulse correctly in software software mode i hook led from A0 to ground
-to get it to work in other modes i hook anode to A4 and cathode to CCP1
sorry i have so many questions but i was hoping to know how this all works and whats broken, thanks for taking the time and checking this out for me
https://dl.dropbox.com/u/10367218/QUESTIONS.jpg
Re: rc5 no pin control/possible incorrect operation
Posted: Sun Dec 30, 2012 3:26 am
by brandonb
here is a simple working project of both send and receive that i did as a test of current operation, it works the way it is programmed with the execptions of problems and questions stated above
sending 5% resolution pwm commands with on off commands
address 1 = command 0 pwm off command 1 pwm on
address 5 = pwm 0-20 (pwm*5) 5%
switches
up=increment pwm%
down= decrement pwm%
flow= (with up or down) fast scroll
stop = pwm on
enter = pwm off
the switches are weird as i have hardware that matches from previous projects that i adapt
Re: rc5 no pin control/possible incorrect operation
Posted: Mon Dec 31, 2012 1:29 am
by DannyBerry
Thanks Brandon,
Nice work

Re: rc5 no pin control/possible incorrect operation
Posted: Wed Jan 02, 2013 10:43 am
by Benj
Hello,
It looks like there is a bug in the RC5 component connections which means the PWM pin is set to RA0 and the TX pin is set to RA4.
I will ensure that this problem gets fixed for the next release.
For now you should be able to fix this by using the custom code feature to edit the RC5 defines function.
The section of code you need to change is this.
Code: Select all
#define %a_RX_PORT port%g
#define %a_RX_TRIS tris%g
#define %a_RX_PIN %h
#define %a_TX_PORT port%i
#define %a_TX_TRIS tris%i
#define %a_TX_PIN %j
#define %a_PWM_PORT port%k
#define %a_PWM_TRIS tris%k
#define %a_PWM_PIN %l
Here is an example
Code: Select all
#define %a_RX_PORT porta
#define %a_RX_TRIS trisa
#define %a_RX_PIN 0
#define %a_TX_PORT porta
#define %a_TX_TRIS trisa
#define %a_TX_PIN 2
#define %a_PWM_PORT porta
#define %a_PWM_TRIS trisa
#define %a_PWM_PIN 4
Re: rc5 no pin control/possible incorrect operation
Posted: Wed Jan 02, 2013 6:41 pm
by brandonb
thanks for fixing that for me, it works now

Re: rc5 no pin control/possible incorrect operation
Posted: Thu Jan 03, 2013 5:24 am
by brandonb
ben, in the TX set up below in red, the TIMER option runs the tx to fast, so instead of taking 24.8 milliseconds it takes around 12-14 milliseconds,
could you help me out with understanding the questions below, and see if you could fix or show me where to fix the timer part to use timer instead of software delays, 25 milliseconds is a long time in a program
Re: rc5 no pin control/possible incorrect operation
Posted: Thu Jan 03, 2013 11:12 am
by Benj
Hello,
Which device are you using, the tx timer should not be running at the incorrect rate but I will try and test here for you.
1) On an 8-bit PIC the timer used is Timer 0 for the RX and Timer 2 for the TX.
2-3) I am guessing you are talking about the RX functionality here. The interrupt option will trigger the INT interrupt as the data is coming in and use the timer as a passive counter to check the time passed since the last interrupt. When no data is coming in the RC5 macros do not take up any system run time. The timer option uses a high speed timer interrupt to repeatedly check the incoming signal which is far less efficient but leaves the interrupt pin unused and allows you to use a generic I/O pin.
Re: rc5 no pin control/possible incorrect operation
Posted: Thu Jan 03, 2013 1:39 pm
by brandonb
Which device are you using, the tx timer should not be running at the incorrect rate but I will try and test here for you.
im using two to test at the momement 16f1938 and 12f1840, thanks for setting me straight on the operation, its nice to know the overveiw of operation
Re: rc5 no pin control/possible incorrect operation
Posted: Thu Jan 03, 2013 1:58 pm
by Benj
Hi Brandon,
Right the devices your using are both fairly modern so I wonder if the timer peripherals have changed a bit for these. I will investigate and see if I can find the cause on a 16F1939. It should be possible to use the customization functionality to modify the value passed by Flowcode to fix the issue but I will check.
Re: rc5 no pin control/possible incorrect operation
Posted: Fri Jan 04, 2013 2:47 am
by medelec35
Hi Ben,
While you looking into RC5 component would if be possible to fix RC5 so it work's with 16F690 as well please?
I just created a test flowchart to transmit a modulated signal.
When compiled to chip I get the folloing errors:
Code: Select all
RC5 TX 16F690 v0.c(525:23): error: unknown identifier 'TMR0IE'
RC5 TX 16F690 v0.c(525:23): error: invalid operand 'TMR0IE'
RC5 TX 16F690 v0.c(525:18): error: failed to generate expression
RC5 TX 16F690 v0.c(525:18): error: invalid operand '<<'
RC5 TX 16F690 v0.c(525:12): error: failed to generate expression
RC5 TX 16F690 v0.c(545:36): error: unknown identifier 'TMR0IF'
RC5 TX 16F690 v0.c(545:36): error: invalid operand 'TMR0IF'
RC5 TX 16F690 v0.c(545:31): error: failed to generate expression
RC5 TX 16F690 v0.c(545:31): error: invalid operand '<<'
RC5 TX 16F690 v0.c(545:26): error: failed to generate expression
RC5 TX 16F690 v0.c(545:26): error: invalid operand '& '
RC5 TX 16F690 v0.c(545:14): error: failed to generate expression
RC5 TX 16F690 v0.c(550:24): error: unknown identifier 'TMR0IF'
RC5 TX 16F690 v0.c(550:24): error: invalid operand 'TMR0IF'
RC5 TX 16F690 v0.c(550:19): error: failed to generate expression
RC5 TX 16F690 v0.c(550:15): error: invalid operand '~(1 << ( TMR0IF))'
RC5 TX 16F690 v0.c(550:12): error: failed to generate expression
RC5 TX 16F690 v0.c(1078:24): error: unknown identifier 'TMR0IE'
RC5 TX 16F690 v0.c(1078:24): error: invalid operand 'TMR0IE'
RC5 TX 16F690 v0.c(1078:19): error: failed to generate expression
RC5 TX 16F690 v0.c(1078:19): error: invalid operand '<<'
RC5 TX 16F690 v0.c(1078:13): error: failed to generate expression
RC5 TX 16F690 v0.c(1292:27): error: unknown identifier 'TMR0IE'
RC5 TX 16F690 v0.c(1292:27): error: invalid operand 'TMR0IE'
RC5 TX 16F690 v0.c(1292:22): error: failed to generate expression
RC5 TX 16F690 v0.c(1292:22): error: invalid operand '<<'
RC5 TX 16F690 v0.c(1292:17): error: failed to generate expression
RC5 TX 16F690 v0.c(1292:62): error: unknown identifier 'TMR0IF'
RC5 TX 16F690 v0.c(1292:62): error: invalid operand 'TMR0IF'
RC5 TX 16F690 v0.c(1292:57): error: failed to generate expression
RC5 TX 16F690 v0.c(1292:57): error: invalid operand '<<'
RC5 TX 16F690 v0.c(1292:52): error: failed to generate expression
RC5 TX 16F690 v0.c(1292:17): error: invalid operand '& '
RC5 TX 16F690 v0.c(1292:52): error: invalid operand '& '
RC5 TX 16F690 v0.c(1292:38): error: failed to generate expression
RC5 TX 16F690 v0.c success
failure
To sort that out,
Code: Select all
#define TMR0IE T0IE
#define TMR0IF T0IF
is added to supplementary code window.
Now Flowchart compiles ok, there is no output from Pin C5 which is CCP1 (or any other pin assigned to PWM component .
This is the first time of using tx of rc5 so it could be something I'm doing wrong?
Attached is the flowchart without supplementary code box ticked (defines are added) for investigation.
Martin
Re: rc5 no pin control/possible incorrect operation
Posted: Fri Jan 11, 2013 3:41 am
by brandonb
martin, i think ben forgot about this one

Re: rc5 no pin control/possible incorrect operation
Posted: Fri Jan 11, 2013 1:54 pm
by medelec35
As A pure guess, I wonder if 16F1939 is causing more of a headache than anticipated?
Perhaps after that's sorted then working on 16F690?
Or as you say, just forgot: P
Re: rc5 no pin control/possible incorrect operation
Posted: Fri Jan 11, 2013 2:44 pm
by Benj
Hi Guys,
Looking into this one now

Re: rc5 no pin control/possible incorrect operation
Posted: Fri Jan 11, 2013 3:25 pm
by Benj
Right, here is the result of tx testing so far using a 16F1939 device.
The hardware PWM options seems to be working well - frequency generated approx 35.87KHz.
The software PWM option is not working at all - output stays low.
The transmit pin is toggling correctly but is on the wrong pin.
I have had a look at the code and it seems that the connection substitutions are not being passed over correctly from the component. We can fix this but it will take a bit of time, hopefully we can get the fix into the up coming January release.
To fix the issues you need to use the code customisation feature on the defines section of code.
Find this section of code.
Code: Select all
#define %a_RX_PORT port%g
#define %a_RX_TRIS tris%g
#define %a_RX_PIN %h
#define %a_TX_PORT port%i
#define %a_TX_TRIS tris%i
#define %a_TX_PIN %j
#define %a_PWM_PORT port%k
#define %a_PWM_TRIS tris%k
#define %a_PWM_PIN %l
and replace with your required connections. for example,
Code: Select all
#define %a_RX_PORT portc
#define %a_RX_TRIS trisc
#define %a_RX_PIN 0
#define %a_TX_PORT portc
#define %a_TX_TRIS trisc
#define %a_TX_PIN 1
#define %a_PWM_PORT portc
#define %a_PWM_TRIS trisc
#define %a_PWM_PIN 2
With this mod in place here are the results from testing.
Software tx & Software PWM - OK
Software tx & Hardware PWM - OK
Timer tx & Hardware PWM - TX has significant timing issues. I will investigate.
Re: rc5 no pin control/possible incorrect operation
Posted: Fri Jan 11, 2013 4:16 pm
by medelec35
Thanks Ben,
I had a play with RC5 Eblock, and could not believe how easy it was to use with LED and LCD Eblocks to control LEDS on/off.
Pressing buttons on remote;
1= LED1 on
2= LED2 on
3= LED3 on
4= LED4 on
5= LED5 on
6= LED6 on
0 =All LEDs off.
Worked first time, and proved 100% reliable.
It will be easy to alter Flowchart to toggle relays on Relay Eblock with corresponding keys of remote.
If the interest is there, then I will post something.
Ben is there going to be development of the newer RC6 protocol?
Re: rc5 no pin control/possible incorrect operation
Posted: Fri Jan 11, 2013 5:03 pm
by Benj
Hello,
RC5 is very good and reliable. I have hardware which I can control in other rooms by bouncing the signal off a load of walls. One big downside is that it is quite slow and so you can only really use it for control.
Yes I don't see why we can't support RC6 too, the main issue is getting all the timings correct for all the different devices. This will likely be a v6 development as we are pretty flat out at the moment until v6 is released.