CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PWM 18F452 question
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
[terminate]



Joined: 08 Jan 2006
Posts: 26

View user's profile Send private message

PostPosted: Mon Jan 16, 2006 6:31 pm     Reply with quote

and so i figured out the problem (after 2 weeks of gutwrentching testing). It was the code!

it should've been while(TMR2IF=0); rather than ==

:(
[terminate]



Joined: 08 Jan 2006
Posts: 26

View user's profile Send private message

PostPosted: Tue Jan 17, 2006 12:14 am     Reply with quote

this is SO strange.

Now it's not working?

Does anyone know? Desperately seeking an answer

(the problem is that the motor isn't running continuously)
newguy



Joined: 24 Jun 2004
Posts: 1911

View user's profile Send private message

PostPosted: Tue Jan 17, 2006 12:34 am     Reply with quote

[terminate] wrote:
and so i figured out the problem (after 2 weeks of gutwrentching testing). It was the code!

it should've been while(TMR2IF=0); rather than ==

:(


Wrong.

Code:
while (TMR2IF == 0);


This means "test to see if TMR2IF is equal to zero", and sit in the while loop if it is. In other words, pause at that point until TMR2IF is NOT equal to zero.

Changing it by taking out one of the = now means "make TMR2IF equal to zero" then the while statement tests to see if its argument is true (1). It isn't, because you set it to 0, so it doesn't pause at all.
[terminate]



Joined: 08 Jan 2006
Posts: 26

View user's profile Send private message

PostPosted: Tue Jan 17, 2006 1:16 am     Reply with quote

any idea what's wrong?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group