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

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
Mon Aug 14 2017, 01:45 PM
angel patel
hey any one help to make the led scrolling display
desuza6
Sat Jul 29 2017, 07:09 AM
I see the code for step motor h l 298 to rotate 45 degree, but all delay time, if I want to input sensor to h the pulses to stepmotor
rammichael
Thu Jul 27 2017, 12:05 PM
okay fine
ExperimenterUK
Wed Jul 26 2017, 07:51 PM
Please post questions in the forum, the chat box is for chat
msd007
Wed Jul 26 2017, 11:27 AM
i need code if any one have aduc706 interfacing lcd 16*2
msd007
Wed Jul 26 2017, 11:26 AM
pl help me how to write code of interfacing ADuc7026 controlleo lcd pl any one help me hoe to initializend configure the direction
rammichael
Wed Jul 26 2017, 06:04 AM
can you explain what is timer and how to use their modes ...
rammichael
Wed Jul 26 2017, 06:03 AM
ExperimenterUk thank you for your quick reply okay

Downloads

Comments

kira113
Sat Aug 19 2017, 08:40 AM
Pirateak
Thu Aug 17 2017, 02:02 PM
sathishksk71
Wed Aug 16 2017, 04:47 AM
rawat742
Sun Aug 13 2017, 05:49 PM
alparslanbagriyanik
Fri Aug 11 2017, 08:10 AM
Thanhquan
Sat Aug 05 2017, 05:17 PM
NAMRATHA
Thu Aug 03 2017, 08:32 AM
Kgj
Tue Aug 01 2017, 12:41 PM

Online

Guests: 41, Members: 0 ...

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

Members: 37879
Newest member: kira113
Forum Activity
kira113 Avatar
Posted By kira113
Sat Aug 19 2017, 08:52 AM
hello everyone i write a simple program using c la...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Aug 19 2017, 02:47 AM
else x+=0x46; //print as ascill 0x41 to 0x46 A-F ...
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 02:58 PM
Dear Sir, I have a another program in which I am a...
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 11:45 AM
LCD SCROLLING MESSAGE PROGRAM CODE AND SIMULATION...
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 11:24 AM
Dear Sir , I am not able to increased value by pre...
rawat742 Avatar
Posted By rawat742
Fri Aug 18 2017, 11:19 AM
Dear Sir, as per your attachment I w...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Aug 17 2017, 10:54 PM
Try this. Attachment ...
rawat742 Avatar
Posted By rawat742
Thu Aug 17 2017, 08:24 PM
Dear Sir , Please help me for stor...
sathishksk71 Avatar
Posted By sathishksk71
Wed Aug 16 2017, 04:53 AM
Hi.. Iam refreshing c language using this useful r...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Aug 14 2017, 10:19 PM
The original 8051 is a primitive device.Over the ...