free 8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems

 
8051 microcontroller 8051 microcontroller
Forums

Rickey's World :: Discussion Forums :: Discuss and Learn :: PIC Microcontroller Discussion
 
<< Previous thread | Next thread >>
required help and info on microchip picdem 2 plus demo board 2006 edition
Go to page   <<      
Moderators: Ajay Bhargav, Arun Kumar V, pdi33, Shailesh NAYAK, ۞ TPS ۞, shyam, sashijoseph, ExperimenterUK, DavesGarage
Author Post
xundeadx
Wed Jul 29 2009, 08:32PM
 User Offline
Registered Member #19422
Joined: Wed Jun 17 2009, 12:37AM

Posts: 11
Thanked 0 times in 0 posts
hi sorry to trouble u again... but my teacher is asking me to do RGB LED on the pwm.. may i know if this code works with the RGB and if it don't where should i make improvment on..

and for the prescale and postscale on the timer.. i don really get it.. cuz i change the value of the scales and test on the board.. i don find any different.. plz enlighten me ..

Back to top

Ajay Bhargav
Fri Jul 31 2009, 12:29PM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 7567
Thanked 1331 times in 1255 posts
its not the kind of PWM code you're looking for maybe.
for RGB, you need 3 PWMs that will control brightness of individual Red, green and blue color.

which controller you're board is using?

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top

xundeadx
Tue Aug 04 2009, 07:51PM
 User Offline
Registered Member #19422
Joined: Wed Jun 17 2009, 12:37AM

Posts: 11
Thanked 0 times in 0 posts
i am using the same board and pic... the board is picdem2 plus demo board 2006 version
and pic is p18f4520... i read the data sheet and only see 2 pwm output for this chip so the RGB cannot be done?
Back to top

Ajay Bhargav
Wed Aug 05 2009, 01:50PM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 7567
Thanked 1331 times in 1255 posts
you can use 1 PWM and switch between RGB colors to have different PWMs for every LED.

I believe your first step should be generating PWM and changing dimmness of LED through PWM. then you can move further to control individual colors.

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top

xundeadx
Wed Aug 05 2009, 06:15PM
 User Offline
Registered Member #19422
Joined: Wed Jun 17 2009, 12:37AM

Posts: 11
Thanked 0 times in 0 posts
i did the dimming already... but how do i get different pwm for every led? by using 1 pwm signal? fyi i dont know how to use interrupt command so.. if there is a need plz give me a sample and a brief explanation if possible
Back to top

Ajay Bhargav
Fri Aug 07 2009, 06:09AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 7567
Thanked 1331 times in 1255 posts
there are no interrupt commands, they are called interrupt service routines and they are like small functions which are called automatically when your controller is interrupted by an event. and they have fixed addresses so processor know where to jump when any specific event comes.

all you have to do is..
switch to PWM to different pins.. where you LEDs are connected. Its the same way like you do with 7-segment display. select RED LED generate PWM for it then switch to Green then blue.

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top

xundeadx
Mon Aug 10 2009, 06:20PM
 User Offline
Registered Member #19422
Joined: Wed Jun 17 2009, 12:37AM

Posts: 11
Thanked 0 times in 0 posts
ok i roughly got the idea of what you are telling me. thx and 1 last question

#pragma what does it mean? i read the wiki about it but i still don get it... mind explaining the meaning @ layman term
Back to top

Ajay Bhargav
Tue Aug 11 2009, 12:55PM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 7567
Thanked 1331 times in 1255 posts
#pragma is a compiler directive and run during preprocess of your code compilation.. it used to define options for a specific function or variable or whole program.

lets say in PIC you can define variable in its own udata space. This is needed if your variable is big and not fitting in predefined data space.

CODE:
#pragma udata _myvariable
unsigned char abc[250]; //a big variable
#pragma udata
 


so this way while compilation pragma tells compiler that specific option is provided for this variable.

there are many options you can specify with #pragma, just look into "Help" of C18 compiler or whatever compiler you are using.

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top

xundeadx
Tue Aug 11 2009, 06:05PM
 User Offline
Registered Member #19422
Joined: Wed Jun 17 2009, 12:37AM

Posts: 11
Thanked 0 times in 0 posts
ok thx~
Back to top

Go to page   <<       

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System

8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems