Click here to Skip to main content
13,195,026 members (86,042 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am working on a RGB project using PWM. I need help in C- code. I want to display different colors from LED. But due to my small info of C- language it is difficult. Is there any guy can help me in writing code for it. Any sample code for it. That will be very helpful for me. By the way I am using PIC24FJ64GA002-I/SP. My specs are following Using RGB LED common anode. Pic is PIC24FJ64GA002-I/SP. Have external osc as well. Using enhancement mode Fet for switching RGB LED. Voltage supply is 3.3 from 5v regulator.

I want to display at least 256 colors from led. I need them to display at some interval which I can handle my self.

It will be very good if someone give me his sample code which I can play with. I using mplab IDE 8.86 and complier is mpalb c-30.

Posted 16-Jan-13 22:04pm
Updated 17-Jan-13 0:24am
Richard MacCutchan 17-Jan-13 6:26am
You need to study the documentation for the PIC device to see what commands and parameters it uses. Also the documentation for the mplab system.
...and ask a question other than "is there any guy..."
zaphoed 1-Feb-13 16:42pm
the following fragments may give you a hint:

int16_t iBrightness[NOF_LED] = {0, PWM_DURATION/10, PWM_DURATION/4};

int main(void) {
// init variables if any
init_IOs(); // by referring to the PIC docs
for (;;) {
modifyBrightnesses(); // calculate new values and set PWM
as richard said, the tricky part is to figure out how you can configure the hardware to do the needed initializations and change the PWM(s)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.171018.2 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100