Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[help] PIC16F877A using for while problems

Status
Not open for further replies.

sfchew7

Junior Member level 2
Joined
Sep 29, 2011
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,423
The design is I have 2 PARKING LOTS
if both of the inputs x and y = high
then z will show the number of parking lots now is : 0
Can someone teach me how to do this ?
I only know how to use the begineer method but don't know how to use
"For (z=0 ; z<3,z++ )" to complete the code
thanks
 

The design is I have 2 PARKING LOTS
if both of the inputs x and y = high
then z will show the number of parking lots now is : 0
Can someone teach me how to do this ?
I only know how to use the begineer method but don't know how to use
"For (z=0 ; z<3,z++ )" to complete the code
thanks


May be it will be helpful

z = 2;
while(1)
{
if(x & y)
{
z = 0; //parking lot full
}
else if( x & !y)
{
z = 1;
}
else if(!x & y)
{
z=1;
}
else
{
z = 2;
}
}
 

just a little optimization:
z = 2;
while(1)
{
if(x & y)
{
z = 0; //parking lot full
}
else if( x ^ y)
{
z = 1;
}
else
{
z = 2;
}
}

BTW: why not use a cheaper MCU like pic10f200 and assembly?
 

May be it will be helpful

z = 2;
while(1)
{
if(x & y)
{
z = 0; //parking lot full
}
else if( x & !y)
{
z = 1;
}
else if(!x & y)
{
z=1;
}
else
{
z = 2;
}
}

thank you for your help but my lectuere required me to use FOR WHILE, increment and decrements. if in VB I know how to do but this is c language , I have no ideas.
 

hi my lcd power up and all my led shoen that the circuit is work put no any change in lcd screen > it 20 *4
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top