Uneven RGB Rainbow

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

FriendlyPotato
Posts: 8
Joined: Mon Feb 26, 2018 11:45 am
Been thanked: 1 time
Contact:

Uneven RGB Rainbow

Postby FriendlyPotato » Mon Feb 26, 2018 12:01 pm

Hello.
I am trying to make a simple RGB rainbow in Flowcode V5, using the built-in LED RGB and a loop which slowly increases each color from 1 to 255 and make a TICK after each time.
The simulation works perfectly but when I try it out for real, it flickers and looks horrible, almost like it can't make the fine adjustments required for a smooth transition. I am using the PIC16F628A chip.

I have looked for solutions for several days now but I can't seem to get anything to work. the PIC is connected directly to the RGB LED with 330 Ohm resisters in between.

I have included the Flowcode file. It is also worth mentioning that I have access to the following PICs, if they would work better: 16F628, 16F676, 16F688, 16F84, 18F13K50, 16F88, 16F648A and 18F4550.

If anyone could tell me what I am doing wrong, I would be very grateful.
Attachments
RGB_chip.fcf
(18.68 KiB) Downloaded 25 times

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

Re: Uneven RGB Rainbow

Postby Benj » Mon Feb 26, 2018 3:10 pm

Hello,

Try this, I'm now calling the Tick macro as part of a regular timer interrupt, this allows the LED to take care of itself while you are free to set the colour variables. Refresh rate is now around 52Hz. To modify this edit the properties of the timer 2 interrupt. the refresh rate is the interrupt frequency divided by 256.

RGB_chip.fcf
(19.01 KiB) Downloaded 26 times
These users thanked the author Benj for the post:
jokkejok123 (Thu May 10, 2018 2:59 pm)
Rating: 5.88%
 

FriendlyPotato
Posts: 8
Joined: Mon Feb 26, 2018 11:45 am
Been thanked: 1 time
Contact:

Re: Uneven RGB Rainbow

Postby FriendlyPotato » Wed Feb 28, 2018 11:37 am

Thank you very much, it works like a charm! :D :D
These users thanked the author FriendlyPotato for the post:
Benj (Wed Feb 28, 2018 11:42 am)
Rating: 5.88%