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

Anyone know the difference?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mKm
Guest







Anyone know the difference?
PostPosted: Wed May 21, 2008 3:16 am     Reply with quote

Guys, could anyone please tell me the difference between the following statements:

[code]if(OpticalEncoder)

and


[code]if(input(OpticalEncoder))

[/code]Do these work the same way in MicroC?
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Wed May 21, 2008 4:08 am     Reply with quote

Experiment. Put the statements in a test program that maybe blinks a led.
Somethings like learning to write have to be taught but many things can be discovered by experimenting. Coding involves a bit of teaching of syntax but if the statement compiles then experimenting is the better way to proceed.
If you have CCS C and micro C then test with both
Matro
Guest







PostPosted: Wed May 21, 2008 5:14 am     Reply with quote

In first case, "OpticalEncoder" is a C variable.
In second case, "OpticalEncoder" corresponds to a pin of the PIC that shall be defined through a #DEFINE directive.

Matro
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Wed May 21, 2008 9:13 am     Reply with quote

Example 1:

Code:
int1 opticalencoder;

if(opticalencoder)
{
  do_stuff_here;
}


Example 2:

Code:
#define opticalencoder PIN_B0

if(input(opticalencoder))
{
  do_stuff_here;
}


That's the difference. Clear as mud?

Ronald
mKm
Guest







got it
PostPosted: Wed May 21, 2008 7:24 pm     Reply with quote

Even clearer... Smile ...Thank you...
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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