Hi
I've been working on this project for a while. I started by importing a 4-digit TM1637 example (Flowcode8) because I couldn't get it to work in Flowcode 10 and 11. In fact, I received your help at that time. I haven't tested it since to see if it was a bug or, more likely, my own mistake. From there, I've added functions like sleep, WDT, RTC, Valve, Display, Relay, and Batteries. I'm using all the pins of a PIC16F1847. Now I was adding low-power communication and initially thought of using the RC5 (KY-022), eliminating an IR photodiode and replacing it with the KY-022. However, when I compile, I've received different messages. Since I'm waiting to get the component, I took the opportunity to start the flowchart while I wait for it to arrive. Yesterday, I was doing some testing and managed to get it to compile, but it sends several messages that I'm not sure will affect its operation. I simplified the program, keeping only the last message it sends. I appreciate you looking at the messages and the flowchart, so I can get your opinion.
I even made adjustments in the RC5 properties, setting the frequency to 38 kHz and the pulse time to 945, according to the KC-022 specifications.
Enrique
Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
-
ELECTRONICA67
- Posts: 181
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 02, 2020 3:59 pm
- Has thanked: 31 times
- Been thanked: 9 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
- Attachments
-
- Med_RC5test.fcfx
- (102.84 KiB) Downloaded 8 times
-
- Screenshot 2026-07-11 123610.png (138.92 KiB) Viewed 78 times
-
mnfisher
- Valued Contributor
- Posts: 2074
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 162 times
- Been thanked: 958 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
The messages are warnings (not errors) - but are indication of something wrong in the code.
The problem seems to be in DIGIT_RC5 where you have (for one instance) 'if command < 9999' - however command is a byte (0..255) - so the comparison may give incorrect results (similarly with if command < 999(
Martin
The problem seems to be in DIGIT_RC5 where you have (for one instance) 'if command < 9999' - however command is a byte (0..255) - so the comparison may give incorrect results (similarly with if command < 999(
Martin
-
mnfisher
- Valued Contributor
- Posts: 2074
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 162 times
- Been thanked: 958 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
In STATE:
You have
FLASH = 0
LOOP count 7 TIMES using FLASH
...
FLASH = FLASH + 1
If you count using a variable - you don't need to set it to 0 (it does (for(flash = 0; flash < 7; flash++) { ... )
The increment means that the flash won't occur 7 times - so would be best removed (and the loop count set accordingly)
... or ....
flash = 0
whle (flash < 7)
...
flash = flash + 1
Which does the same thing..
You have
FLASH = 0
LOOP count 7 TIMES using FLASH
...
FLASH = FLASH + 1
If you count using a variable - you don't need to set it to 0 (it does (for(flash = 0; flash < 7; flash++) { ... )
The increment means that the flash won't occur 7 times - so would be best removed (and the loop count set accordingly)
... or ....
flash = 0
whle (flash < 7)
...
flash = flash + 1
Which does the same thing..
-
ELECTRONICA67
- Posts: 181
- Joined: Wed Dec 02, 2020 3:59 pm
- Has thanked: 31 times
- Been thanked: 9 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
Thanks Martin, se eliminaron las advertencias, estas que quedan no afecta ? voy v ver si consigo 1 kc-022 para probar si flowcode lo acepta cambiando solamente las propiedades
C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC\PIC_CAL_IO.c: 216: non-reentrant function "_FC_CAL_Port_In_DDR__x" appears in multiple call graphs and has been duplicated by the compiler
Med_RC5test.c: 607: non-reentrant function "_FCD_01bf1_RC5__Initialise_States" appears in multiple call graphs and has been duplicated by the compiler
Enrique
C:\ProgramData\MatrixTSL\FlowcodeV10\CAL\PIC\PIC_CAL_IO.c: 216: non-reentrant function "_FC_CAL_Port_In_DDR__x" appears in multiple call graphs and has been duplicated by the compiler
Med_RC5test.c: 607: non-reentrant function "_FCD_01bf1_RC5__Initialise_States" appears in multiple call graphs and has been duplicated by the compiler
Enrique
-
mnfisher
- Valued Contributor
- Posts: 2074
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 162 times
- Been thanked: 958 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
The 'duplicated' by the compiler warning means that there are multiple instances of the code (the function Initialise_states) generated - which will give larger code. It 'shouldn't' (famous last words) cause an issue - but looks to be an issue with the component. The source isn't currently available on the Wiki - so can't check this.
Note - it would be an error to have a function that is called by a function it calls (or from an ISR) if it has some state variables (the non-reentrant warning). Usually you would attempt to remove this error (by re-structuring or re-factoring the code) - but the compiler also attempts to do this by creating 2 (or more) instances of the function.
Martin
Note - it would be an error to have a function that is called by a function it calls (or from an ISR) if it has some state variables (the non-reentrant warning). Usually you would attempt to remove this error (by re-structuring or re-factoring the code) - but the compiler also attempts to do this by creating 2 (or more) instances of the function.
Martin
-
ELECTRONICA67
- Posts: 181
- Joined: Wed Dec 02, 2020 3:59 pm
- Has thanked: 31 times
- Been thanked: 9 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
Okay, I understand. I think it would be better to get the RC5 working first before including it in the project and further complicating the module's proper functioning.
Enrique
Enrique
-
ELECTRONICA67
- Posts: 181
- Joined: Wed Dec 02, 2020 3:59 pm
- Has thanked: 31 times
- Been thanked: 9 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
I obtained two modules, one 36 kHz (TSOP31236) and one 38 kHz (KC-022). I also ordered 10 units of this model. This includes a small IR controller. I modified the flowchart properties of the component and the timers for testing. I added a 16x2 LCD display to see the program's status and what it's not doing: 0 - starts, 111 - no data detected, 222 - data detected and displayed. To avoid mixing programming sequences, I used a PIC16F1939 and a PIC16F887. I couldn't receive data from either of them. I also tried the example program published for Arduino (RC_Tests).
- Attachments
-
- RC5_Tests (1).fcfx
- Arduino
- (14.62 KiB) Downloaded 9 times
-
- RC5_Tests1939.fcfx
- PIC16F1939
- (14.89 KiB) Downloaded 9 times
-
- modulos IR.jpeg (127.56 KiB) Viewed 36 times
-
ELECTRONICA67
- Posts: 181
- Joined: Wed Dec 02, 2020 3:59 pm
- Has thanked: 31 times
- Been thanked: 9 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
I used it to test the small IR remote control that included the 38 kHz sensor and I made a TX control with flowcode
- Attachments
-
- Prueba con el de 38KHZ
- Probando con el Control IR .jpeg (37.76 KiB) Viewed 35 times
-
- Sin deteccion
- No detecto datos entrantes.jpeg (56.15 KiB) Viewed 35 times
-
- RC5TxV10.fcfx
- TX_36KHZ
- (13.4 KiB) Downloaded 9 times
-
ELECTRONICA67
- Posts: 181
- Joined: Wed Dec 02, 2020 3:59 pm
- Has thanked: 31 times
- Been thanked: 9 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
I would appreciate any help or guidance you can give me. I'm not sure if these are my mistakes or if it could be a bug. I believe the previous messages were warnings and didn't compromise proper functioning. If you require me to perform any tests, I have what's needed to do so.
Thanks
Enrique
Thanks
Enrique
- Attachments
-
- Ejemplo de Arduino.jpeg (52.6 KiB) Viewed 35 times
-
mnfisher
- Valued Contributor
- Posts: 2074
- Joined: Wed Dec 09, 2020 9:37 pm
- Has thanked: 162 times
- Been thanked: 958 times
Re: Modulo Ky-022 Sensor Receptor Infrarrojo Ir Pic
I found one of the sensors in the toybox and a small (hopefully RC5) transmitter.
First attempt - failed (error in Timer function).
Compiled the example which seems very similar (except it has a TimerCallback - that does nothing) - and it doesn't work (nothing output
)
Added a TimerCallback (which doesn't seem documented) - to my code - still won't compile...
Unfortunately the source foe the component isn't currently available on the wiki - reported this - but I'll play some more later. The LED flashes on the IR board - a good start? Now the LED is on constantly?
So at the moment - I'm stumped for using the component. Will play a little more later...
Martin
First attempt - failed (error in Timer function).
Compiled the example which seems very similar (except it has a TimerCallback - that does nothing) - and it doesn't work (nothing output
Added a TimerCallback (which doesn't seem documented) - to my code - still won't compile...
Unfortunately the source foe the component isn't currently available on the wiki - reported this - but I'll play some more later. The LED flashes on the IR board - a good start? Now the LED is on constantly?
So at the moment - I'm stumped for using the component. Will play a little more later...
Martin