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

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

Uneven RGB Rainbow

Post by FriendlyPotato »

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 214 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: Uneven RGB Rainbow

Post by Benj »

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 233 times

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

Re: Uneven RGB Rainbow

Post by FriendlyPotato »

Thank you very much, it works like a charm! :D :D

Post Reply