Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Embedded C
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 16-Jan-13 23:04pm
Edited 17-Jan-13 1:24am
(no name)406.4K
v2
Comments
Richard MacCutchan at 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 at 17-Jan-13 6:56am
   
...and ask a question other than "is there any guy..."
zaphoed at 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)

  Print Answers RSS
0 Kornfeld Eliyahu Peter 275
1 Maciej Los 204
2 Sergey Alexandrovich Kryukov 200
3 King Fisher 185
4 OriginalGriff 183
0 OriginalGriff 6,223
1 DamithSL 4,724
2 Maciej Los 4,196
3 Kornfeld Eliyahu Peter 3,894
4 Sergey Alexandrovich Kryukov 3,496


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 17 Jan 2013
Copyright © CodeProject, 1999-2014
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