Forum Replies Created
-
AuthorPosts
-
Varun SrivastavaParticipant
Hii,
Ajish
sry fr d delay…!!!
Iwould lyk to let u knw dat the problem is resolved on hardware by considering switch debounce into account.
I would also lyk to give you more overview of wat i m doing.
I am using this GENERATED PWM for driving the GATE of a MOSFET which infact is controlling the current in my LOAD and wid all our previous efforts we are able to vary the DUTY CYCLE of the PWM.
Now the next problem which is faced is that the LOAD is taking HICCUPS due to discontinuity of the GATE driving voltage wen i change the PWM DUTY CYCLE as there is no voltage present at that duration of time when the switch is pressed and the DUTY CYCLE changes.
As per my knowledge, I think that this is happening bcoz dere is no HOLDING CURRENT to sufficiently keep the MOSFET on during that period of SWITCH press.
I would lyk to know about ur suggestion over this thing and whether you have any other possible explanation that why this is happening, also if u cn provide any information how to maintain this HOLDING CURRENT in MOSFET.
Expecting to hear frm u soon.
Thnx
Varun SrivastavaParticipantHi Ajish,
Here is the bad news…i tried on implementing TIMERS btu didnt succeeded…nd then came back again to FOR LOOPs…did a very little change to the logic provided by….
The Program is lyk dis…
#include <reg51.h>
sbit INCREASE = P2^6;
sbit DECREASE = P2^7;
sbit MTR = P1^0;
void MSDelay(int value);
void main()
{
unsigned int on,off;
on=20; //initial value of ON time delay
off=0; //initial value of OFF time delay
while (1)
{
while(ONE==1 && TWO==1) //when both keys are open
{//—-generating PWM
//
MTR=1;
MSDelay(on); //applying ON time delay
MTR=0;
MSDelay(off); //applying OFF time delay
//
//
}//—when any of the key is down, exit from while loop and check which key is down–//
if(INCREASE==0 && on<20) //if key increase is down check whether it has max value or not
{on++;
off–; //—-increment ON time delay if it is not maximum–////
//
}
else if (TWO==0 && on>0) // if key decrease is down check whether it ON time delay >0//
{on–;
off++; //—-decrement ON time delay if it is not zero—-////
//
}
}}
void MSDelay(int value) // Delay function //
{
int x;
for(x=0;x<=value;x++);
}Now the above thing works very fine in Multisim but when i tried with my hardware….i m getting only two states either my load goes fully on or fully off….no in between states…
Now i dnt knw where the problem is…is it possible that the case may be of switch debounce…!!!
expecting your reply soon…thnx
Varun SrivastavaParticipantHi Ajish,
First of all thnx for ur quick assistance. I implemented the logic provided by you, I am very close to final result just now i have brought up few changes in the program and simulated it via MULTISIM.
Although the simulation seems to be what i want but i still want to check it through hardware. Also i m trying to implement TIMER in MODE 0 instead of FOR LOOP as somebody told me it will be more accurate.
I will put up the changes here soon….also if u can provide any assistance in how to implement TIMER in MODE 0…pls guide me..I m reffering to Mazidi for the programming part.
Thnx.
Varun SrivastavaParticipantHii Ajish,
The Programing part i have done yet is using 4 push buttons to change d value of PWM output. Now this is the next step in my project design dat i want to do it using only two push buttons to either increase or decrease the duty cycle of the PWM.
My present program is….
#include <reg51.h>
sbit ONE=P2^7;
sbit TWO=P2^6;
sbit THREE=P2^5;
sbit FOUR=P2^4;
sbit FIVE=P2^3;
sbit SIX=P2^2;
sbit SEVEN=P2^1;
sbit EIGHT=P2^0;
sbit MTR=P1^0;
void MSDelay(int value);
void main()
{
unsigned int on,off;
ONE=1;
TWO=1;
THREE=1;
FOUR=1;
FIVE=1;
SIX=1;
SEVEN=1;
EIGHT=1;
while(1)
{
if (ONE==0)
{
FIVE=0;
SIX=1;
SEVEN=1;
EIGHT=1;
while(FIVE==0 && TWO==1 && THREE==1 && FOUR==1)
{
on=2;
off=8;
MTR=1;
MSDelay(on);
MTR=0;
MSDelay(off);
}
}
else if (TWO==0)
{
FIVE=1;
SIX=0;
SEVEN=1;
EIGHT=1;
while(SIX==0 && ONE==1 && THREE==1 && FOUR==1)
{
on=3;
off=7;
MTR=1;
MSDelay(on);
MTR=0;
MSDelay(off);
}
}
else if (THREE==0)
{
FIVE=1;
SIX=1;
SEVEN=0;
EIGHT=1;
while(SEVEN==0 && ONE==1 && TWO==1 && FOUR==1)
{
on=5;
off=5;
MTR=1;
MSDelay(on);
MTR=0;
MSDelay(off);
}
}
else if (FOUR==0)
{
FIVE=1;
SIX=1;
SEVEN=1;
EIGHT=0;
while(EIGHT==0 && ONE==1 && TWO==1 && THREE==1)
{
MTR=1;
}
else
{
MTR=1;
}
}
}
void MSDelay(int value)
{
int x;
for(x=0;x<=value;x++);
}
If u cn help me where to change d logic in dis present program…looking forward for it…!!
Varun SrivastavaParticipant88 views but only 6 replies…does no one has any idea abt it…
I thought every1 out here is gonna help me out…!!Varun SrivastavaParticipantHi Amrith,
The problem i m facing is not with the timers but i want to vary the duty cycle with push of the buttons this is where i m stuck.
If u can provide any help in logical building of the program that how to vary the duty cycle with single push of the button.It will be appreciated very much.
thnx.
Varun SrivastavaParticipantpresently i am using for loop for generating delay but i have no problem in using timers if the condition demands it.
-
AuthorPosts