Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 29, 2024, 01:38:50 01:38


Login with username, password and session length


Pages: [1]
Print
Author Topic: Need help for project RGB led controller.  (Read 5049 times)
0 Members and 1 Guest are viewing this topic.
xgnetto
Newbie
*
Offline Offline

Posts: 9

Thank You
-Given: 1
-Receive: 0


« on: October 21, 2007, 10:32:37 22:32 »

Dear all,
I start project with rgb led, what MCU i can use, AVR or PIC ?
I have need 3 PWM Hardware not less than 10 Bit resolution, and eeprom memory inside mcu.

Thank you for any comment or example similar project.
 

xgnetto
Logged
freddy
Newbie
*
Offline Offline

Posts: 15

Thank You
-Given: 0
-Receive: 7


« Reply #1 on: October 22, 2007, 01:21:45 01:21 »

Hi,

you can use AVR with 16MHz clock.

You have to do a 3 software PWM at 10bit using a timer with time base of 20us.

In C with 320 cycle of clock you have the time to do all.

With code writing in assembler, you can do 4 PWM.

Logged
mustuva
Junior Member
**
Offline Offline

Posts: 55

Thank You
-Given: 167
-Receive: 110


« Reply #2 on: October 22, 2007, 05:17:36 17:17 »

Hi,
This link uses PIC12F629 and 3 software PWM.

http://picprojects.org.uk/projects/rgb/index.asp

Source code http://petesworld.demon.co.uk/code/rgbsa-inet.zip
Schematic http://picprojects.org.uk/projects/simplergb/SimpleRGBdriver_sch.pdf
Logged
necati
Guest
« Reply #3 on: October 22, 2007, 06:44:54 18:44 »

#include <12F675.h>
#use delay (clock=4000000)//ccs
#fuses INTRC_IO,noWDT,PUT,NOBROWNOUT,noPROTECT,NOPUT,NOCPD,MCLR

#define    led1      PIN_A0//yes  led 220R +V
#define    led2      PIN_A1//mavi led 220R +V
#define    led3      PIN_A2//kirm led 220R +V

#ROM 0x3ff = {0x3480}

BYTE CONST TABLE [120]= {
                250,80,0,220,70,0,200,30,0,
                180,0,30,150,0,60,120,0,80,
                100,0,120,80,0,150,60,0,180,
                30,0,200,20,0,230,0,20,250,
                0,40,220,0,60,200,0,80,170,
                0,100,150,0,120,120,00,150,100,
                0,180,80,0,200,60,0,220,40,
                0,250,20,10,220,0,20,200,0,
                30,200,0,40,170,0,50,10,0,
                250,0,0,220,0,0,200,0,0,
                180,0,0,150,0,0,120,0,0,
                0,0,100,0,0,120,0,0,140,
                0,0,180,0,0,200,0,20,250,
                0,40,220,
            };
////////////////////////////////////////////////////////////////////////
void main() {

int16 titrval, dampval;
int led1val,led2val,led3val, deger,tablsay,lighthed1,lighthed2,lighthed3;
SET_TRIS_A   (0b00001000);
SETUP_TIMER_1(T1_DISABLED );
setup_comparator(NC_NC_NC_NC);
setup_ADC_ports(NO_ANALOGS);

   tablsay = 0;
/////////////////////////////////////////////////////////////////////////
while(1){

deger++;
titrval++;
dampval++;
//////////////////////////////////////
if (titrval == 2000){   //tablodan set say al
   titrval = 0;
   if (tablsay >= 98) tablsay = 0;
   lighthed1 = table [tablsay];
   lighthed2 = table [tablsay+1];
   lighthed3 = table [tablsay+2];
   tablsay+=3;}
///////////////////////////////////////
if (dampval ==600){//soft
   dampval = 0;
   if (led1val < lighthed1) led1val++;
   if (led1val > lighthed1) led1val--;
   if (led2val < lighthed2) led2val++;
   if (led2val > lighthed2) led2val--;
   if (led3val < lighthed3) led3val++;
   if (led3val > lighthed3) led3val--;}
////////////////////////////////////////
if( deger < led1val )
   {
   output_low(led1);
   }
else
   {
   output_high(led1);
   }

if( deger < led2val )
   {
   output_low(led2);
   }
else
   {
   output_high(led2);
   }

if( deger < led3val )
   {
   output_low(led3);
   }
else
   {
   output_high(led3);
   }
}

}
Logged
paxmowa
Newbie
*
Offline Offline

Posts: 14

Thank You
-Given: 7
-Receive: 18


« Reply #4 on: October 29, 2007, 01:27:58 13:27 »

The original poster wants 3 HARDWARE PWM channels,

There are AVR chips that can do that, but I don't know much about those.

As for PICs, i would look into the models:

16F737, 16F747, 16F767 and 16F777

They are similar devices, the only differences are in memory size and the number of A/D channels, they all have 3 Hardware PWM channels with 10-bit resolution.

Have used these in the past with great ease, just set up the channels and write values to the used registers, nothing more, nothing less.

Regards,
Pax
Logged
Mega32
Active Member
***
Offline Offline

Posts: 179

Thank You
-Given: 181
-Receive: 37


« Reply #5 on: October 30, 2007, 08:36:52 20:36 »

This is a pretty cool setup , using avr's

http://www.microsyl.com/moodlight/moodlight.html

/Mega32
Logged
localcrack
Active Member
***
 Muted
Offline Offline

Posts: 173

Thank You
-Given: 64
-Receive: 21



« Reply #6 on: November 18, 2007, 07:36:23 19:36 »

You can use PIC16F877A Microcontroller It has a two PWM Channel
you can generate third one by using timer1 or timer2 interrupt.
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC