Click here to Skip to main content
Rate this: bad
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.
Posted 16-Jan-13 23:04pm
Edited 17-Jan-13 1:24am
(no name)431.3K
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
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 OriginalGriff 455
1 Sergey Alexandrovich Kryukov 312
2 DamithSL 179
3 King Fisher 179
4 Peter Leow 154
0 OriginalGriff 240
1 Maciej Los 95
2 Sascha Lefévre 85
3 King Fisher 70
4 F-ES Sitecore 55

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