Discussion in "8051 Discussion Forum" started by    Miguelito    Apr 26, 2012.
Thu Apr 26 2012, 02:49 AM
#1
Hi,
Can anybody give some hints on how I can achieve this?
I have a tri-color LED controlled by a shift register.
Without pwm I can make it lit, each color(R-G-B).
But no idea how should I do it using pwm in Keil C51 as I'll be controlling its duty cycle so I can create different color and dimming.

I'm confused here:
If I use 8-bit pwm mode. Where should I put my shift register CLOCK and shift register LATCH value?

Here is my code WITHOUT PWM.
void Illum(enum color col)
{
	U8 i, temp;
	if(col & MASKED_RED)
		temp = col & MASKED_RED;
	if(col & MASKED_GREEN)
		temp = col & MASKED_GREEN;
	if(col & MASKED_BLUE)
		temp = col & MASKED_BLUE;
       for(i=0;i<8;i++)
	{
		SER_IN = (temp & 0x80);
		SRCK_P = 1;
		SRCK_P = 0;
		temp = temp << 1;
	}

	temp = 0;	
	LATCH = 1;
}


I used Silabs 8051F387 mcu.


thanks in advance
miguelito
Fri Apr 27 2012, 09:20 PM
#2
I can only guess but I am not sure how you've connected your LEDs but i want to see your schematic only then i can give you any suggestions.
Wed May 02 2012, 05:08 AM
#3


I can only guess but I am not sure how you've connected your LEDs but i want to see your schematic only then i can give you any suggestions.

Ajay Bhargav



Thanks Ajay.
Attached is my schematic.

Wed May 02 2012, 06:52 PM
#4
as expected Its not possible this way to have three different PWMs for each LED.
Mon May 07 2012, 06:34 AM
#5
Thanks. Do you have any recommendation on this?
I have hard time figuring out on how I can modulate(lengthen/shorten) the pulse of the OUTPUT of the shift register so I can have a dimming effect.
Should I use Timer interrupt, software pwm?

thanks
Miguelito
Mon May 07 2012, 08:43 PM
#6
you will have no control when LEDs are connected to shift register.. all you can do is.. control them all together nothing else.
Mon May 07 2012, 09:31 PM
#7
You have control lines for clock, data, reset and latch.
Why not drive the LEDs from these instead of using a shift register ?
Mon May 07 2012, 09:34 PM
#8
thats a nice question Phil he is already using 3 pins by the way.. why not connect LEDs directly?
Tue May 08 2012, 01:08 AM
#9
Thanks for your reply guys.
There are 3 tri-color LEDs actually ( I only show you one to simplify the situation) and needs 9 pins for them, and my mcu couldn't cater them all. And sooner, it will be 5 tri-color LEDS.

I think, i should use SPI protocol for this. What do you think?

thanks
Miguelito
Tue May 08 2012, 07:00 AM
#10
Please tell me if I can modulate the output of the shift register by using the G*/OE*(output enable) of the shift register?
I read some article, I forgot the address, that if handled correctly the OUTPUT ENABLE can be used to pwm the shift register output.

Let me know your thoughts about this.

thanks in advance
miguelito

Get Social

Information

Powered by e107 Forum System

Conversation

Wed Nov 08 2017, 01:35 PM
Anirudh jain
I want to burn code in atmel 89s51 24pc 0329 but cannot get the connection with the burner. Can somebody provide me with the circuit diagram for connecting controller to burner. I'm using usb burner
Thu Nov 02 2017, 11:44 AM
karpal
write a program to exchange the content of b register with external RAM address 02CFH help me
Wed Nov 01 2017, 05:47 PM
sanae
i am using the DHT11 but i'm getting some errors in the simulate the programe in proteus 8 professional,: 1)cannot find model file 'DHTXX.MDF'.2)simulation failed due to netlist linker error(s).
Fri Sep 29 2017, 02:45 AM
Maaz
i am doing the same project on verilog please contact me [email protected]
Wed Sep 20 2017, 12:36 AM
Ted
In a missing pulse detector using a 555 timer connected as a monostable vibrator with a PNP transistor,how does the positve input pulse turn on the PNP transistor?
Sun Sep 03 2017, 02:29 PM
martymarty
How do I connect an <NOKIA 1100 LCD > to an atmega328P ?
poojab51296
Sun Aug 20 2017, 10:23 AM
i am intending to interface sd card with STM32F4 and want to write a file in sd card using SPI protocol but using HAL only. Can anyone help me PLEASE!!!!
poojab51296
Sun Aug 20 2017, 10:22 AM
hello
rawat742
Fri Aug 18 2017, 11:37 AM
hi @ angel patel i will attach a file i hope it will be helpfull for you
ExperimenterUK
Mon Aug 14 2017, 09:57 PM
@ angel patel... just log in and post your problem

Downloads

Comments

PANDIKOTESWARARAO
Mon Nov 20 2017, 07:40 PM
Hemantika
Sun Nov 19 2017, 07:34 PM
Wed Nov 15 2017, 10:46 AM
Ansh12
Sat Nov 11 2017, 03:43 AM
AngelGT93
Fri Nov 10 2017, 06:53 AM
JardCrocker
Wed Nov 08 2017, 05:27 PM
vivitern
Tue Nov 07 2017, 09:08 AM
catrons
Sat Nov 04 2017, 10:46 PM

Online

Guests: 53, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37918
Newest member: PANDIKOTESWARARAO
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Nov 20 2017, 10:18 PM
Here is a version of the tutorial that reads a key...
Ansh12 Avatar
Posted By Ansh12
Mon Nov 20 2017, 02:15 AM
As a starting point, can you tell us how much of t...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Nov 19 2017, 08:35 PM
As a starting point, can you tell us how much of t...
Ansh12 Avatar
Posted By Ansh12
Fri Nov 17 2017, 04:07 AM
I am looking keypad interfacing program. I was rea...
JardCrocker Avatar
Posted By JardCrocker
Wed Nov 08 2017, 05:29 PM
Hi...i am a new user here. I was also facing the s...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Nov 07 2017, 07:13 PM
> It employs a fairly advanced technique to detect...
vivitern Avatar
Posted By vivitern
Tue Nov 07 2017, 09:33 AM
I own a used Clavia ddrum4 SE drum module. It empl...
bvdb Avatar
Posted By bvdb
Wed Oct 18 2017, 01:50 AM
I purchased the RKitL51 8051 C compiler from Raiso...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Oct 16 2017, 11:44 PM
That looks complicated.Is 8051_BLK a standard 80...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sun Oct 15 2017, 07:29 PM
According to this, gmail should support POP3.https...