measuring pulses with "while" dosn´t work...

General discussion on mikroC PRO for 8051.
Post Reply
Author
Message
fbiasoto
Posts: 20
Joined: 12 May 2010 16:43

measuring pulses with "while" dosn´t work...

#1 Post by fbiasoto » 19 Aug 2010 16:00

I´m trying to use a while command to wait a logic level change. It does´t work.
I´m doing this:

bit level;
sbit RXTAG at P3.B4;
unsigned char f;



level=0
for(f=0;f<8;f++)
{
level=~level;
while(level==RXTAG){}
etc
etc
etc
}

the logic level of pin P3.4 changes but the software freeze on line while(level==RXTAG){}

Any sugestion?

Thanks

CVMichael
Posts: 239
Joined: 30 Apr 2009 02:36
Location: Canada, Toronto

Re: measuring pulses with "while" dosn´t work...

#2 Post by CVMichael » 19 Aug 2010 19:25

Try this:

while((!level) == (!RXTAG)){}

fbiasoto
Posts: 20
Joined: 12 May 2010 16:43

Re: measuring pulses with "while" dosn´t work...

#3 Post by fbiasoto » 19 Aug 2010 20:57

I wil try this.
I had solve the problem by myself.

For some reason while(RXTAG==level){}; does´t work, but while(level==RXTAG){}; works

Thanks CVMichael

fbiasoto
Posts: 20
Joined: 12 May 2010 16:43

Re: measuring pulses with "while" dosn´t work...

#4 Post by fbiasoto » 20 Aug 2010 18:36

Well, while((!level) == (!RXTAG)){} doesn´t work.

Post Reply

Return to “mikroC PRO for 8051 General”