RGB Led.

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

Post Reply
gdt
Posts: 71
Joined: Thu Aug 10, 2017 2:04 pm
Has thanked: 25 times
Been thanked: 36 times
Contact:

RGB Led.

Post by gdt »

Hello all,
I've imported one of my old project using an RGB Led which was running fine in simulation and on chip, but in FC7 it doesn't work anymore.
Then I rebuilt it from scratch and I got the same results. Finally I downloaded the example in RGB_LED.fcfx from wikyv7 page and I cannot get it working.
Is it a buggy component or I'm missing something?

Thanks
Giuseppe

Docara
Posts: 315
Joined: Sun Jun 23, 2013 1:29 pm
Has thanked: 28 times
Been thanked: 61 times
Contact:

Re: RGB Led.

Post by Docara »

Hi

Can you post your chart

Thanks

gdt
Posts: 71
Joined: Thu Aug 10, 2017 2:04 pm
Has thanked: 25 times
Been thanked: 36 times
Contact:

Re: RGB Led.

Post by gdt »

Hello,
thanks for your replay.
As told it's the example from the wiky. Anyway I changed the port and played with Timer timing but no change.
Here is the link
http://www.matrixtsl.com/wikiv7/index.p ... 10f03ce81d
and in attachment both versions (mine is v1).

Regards
Giuseppe
Attachments
RGB_LED_v1.fcfx
(12.94 KiB) Downloaded 273 times
RGB_LED.fcfx
(9.21 KiB) Downloaded 255 times

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

Re: RGB Led.

Post by Benj »

Hello,

In your chip configuration you have set the oscillator type to INTOSC, the default rate for this is 500KHz which is quite slow and could be the cause of the problems your having.

If you're using the INTOSC then I recommend you use the INTOSC helper component to help you to configure the speed of the oscillator.

For example running at 32MHz. Change the clock speed in the project options to 32000000 and then add the following code in a C code icon at the start of your project,

Code: Select all

OSCCON = 0xF0;
The 1 second LED flasher technique is great for solving problems like this.
https://www.matrixtsl.com/wikiv7/index. ... ED_flasher

Hope this helps.

gdt
Posts: 71
Joined: Thu Aug 10, 2017 2:04 pm
Has thanked: 25 times
Been thanked: 36 times
Contact:

Re: RGB Led.

Post by gdt »

Hello Ben,
thanks for your replay.
Just forget about my project. I'm asking about the example from wiky page RGB_LED.fcfx.
I haven't changed anything however it's not working for me. Can you check please if it works for you? Are you able to light the LED and get different colors just playing with the 3 pots?
If it works for you I have to troubleshoot my configuration or whatever but if doesn't...

Thanks
Giuseppe

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

Re: RGB Led.

Post by Benj »

Hello,

What is your hardware setup? Are you using an EB006 with 19.6608MHz crystal and 16F1937 chip?

Can you confirm the OSC/A6&7 jumper is in the OSC position and that the jumper links are horizontal as shown in the image here,
http://www.matrixtsl.com/webshop/e-bloc ... ion-9.html

gdt
Posts: 71
Joined: Thu Aug 10, 2017 2:04 pm
Has thanked: 25 times
Been thanked: 36 times
Contact:

Re: RGB Led.

Post by gdt »

I talk about simulation on laptop. It was working and I would see it working again on simulation before to try the hardware.
Is it working the example "as is" without modification?

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

Re: RGB Led.

Post by Benj »

Aha,

Ok now we are getting somewhere, Timer interrupts are currently known to have problems in simulation. It's something we tried to improve and ended up somehow making it a lot worse. If you call the timer interrupt macro as part of your main loop or run the code on a microcontroller then it should solve the problem for you.

gdt
Posts: 71
Joined: Thu Aug 10, 2017 2:04 pm
Has thanked: 25 times
Been thanked: 36 times
Contact:

Re: RGB Led.

Post by gdt »

Ok, this sounds better!
Thanks
Giuseppe

Docara
Posts: 315
Joined: Sun Jun 23, 2013 1:29 pm
Has thanked: 28 times
Been thanked: 61 times
Contact:

Re: RGB Led.

Post by Docara »

Benj wrote:Aha,

Timer interrupts are currently known to have problems in simulation.
Does this apply to FC generally or just the chip mentioned

Matt

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: RGB Led.

Post by medelec35 »

Hi Matt,
Docara wrote:Does this apply to FC generally or just the chip mentioned
FC generally.
I reported it here
It's also been mentioned here

Martin
Martin

User avatar
faveremario
Posts: 28
Joined: Sat Jun 02, 2012 6:08 pm
Has thanked: 8 times
Been thanked: 13 times
Contact:

Re: RGB Led.

Post by faveremario »

Hi
Is there a way to make the RGB function in simulation under FC7? On my PC the ISR is launched, but nothing changed to the RGB-color...

So I modified the demo from FC-wiki as follows :
* disable IRQ on T0
* copy the component Tick after the 100ms delay

no change in RGB-color on simulation....

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

Re: RGB Led.

Post by Benj »

Hello,

The RGB LED should simulate without having to mess about, try some saturated colours such as 255 for the colour channels. Low colour values tend to appear very dark on a PC monitor.

If you can't get it working then please post your program and we will take a look.

User avatar
faveremario
Posts: 28
Joined: Sat Jun 02, 2012 6:08 pm
Has thanked: 8 times
Been thanked: 13 times
Contact:

Re: RGB Led.

Post by faveremario »

Wow that's a quick reply :)

Included is a running screenshot of the simulation and also the program.
The color of the LED does not change (in neither of the programs).
First is from WIKI
V2 is modified : not using the IRQ from T0

Thanks.
Attachments
RGB_LED-V2.fcfx
(11.9 KiB) Downloaded 139 times
RGB_LED.fcfx
(13.11 KiB) Downloaded 130 times
Knipsel.PNG
(2.72 KiB) Downloaded 3659 times

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

Re: RGB Led.

Post by Benj »

Many thanks for letting us know.

I have now found and fixed the problem in the attached component file.

Simply copy to your "Flowcode 7/components" folder and restart Flowcode to load the changes.
led_rgb_pcb.fcpx
(14.38 KiB) Downloaded 204 times
Let us know how you get on.

jgu1
Posts: 1333
Joined: Tue Oct 06, 2009 9:39 am
Has thanked: 1135 times
Been thanked: 299 times
Contact:

Re: RGB Led.

Post by jgu1 »

Hi All!

The new component work for me in simulation now :wink:
And thank¨s for info to Ben and medelec concerning waitingtime in simulation-

Br Jorgen

gdt
Posts: 71
Joined: Thu Aug 10, 2017 2:04 pm
Has thanked: 25 times
Been thanked: 36 times
Contact:

Re: RGB Led.

Post by gdt »

Hello faveremario,
thanks to convince Benj to fix this component as I asked looooooooong time ago! :D :D :D
Now simulation is fine for me too.

Regards
Giuseppe

Post Reply