Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 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.

Thanks

http://i.stack.imgur.com/WMtP3.png[^]
Posted
Updated 17-Jan-13 0:24am
v2
Comments
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.
Sergey Alexandrovich Kryukov 17-Jan-13 6:56am    
...and ask a question other than "is there any guy..."
saephoed 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
waitSomeTime();
}
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900