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 support@ccsinfo.com

what is Best coding?

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



Joined: 23 Sep 2003
Posts: 12
Location: South KOREA

View user's profile Send private message Send e-mail Yahoo Messenger MSN Messenger

what is Best coding?
PostPosted: Fri Feb 18, 2005 4:11 am     Reply with quote

Dear Master.

Someone use
#bit A0 = porta.0

#define ON 1

if(A0 == ON)


another one use

if(input(pin_a0))

what is best code?
_________________
Hello~?

This is South KOREA
My name is Sanghyouk Kim But Call me Nick
Sorry I'm poor English
EdWaugh



Joined: 07 Dec 2004
Posts: 127
Location: Southampton, UK

View user's profile Send private message

hi again
PostPosted: Fri Feb 18, 2005 5:04 am     Reply with quote

both look alright to me but if your using the CCS compiler I would use:
Code:

if(input(pin_a0));

you don't need to redefine a bit to represent pin_a0 because its already done just use pin_a0 to mean that pin. You also don't ned to do a comparison because the pin evaluates to 1 or 0 ie True or False which is already the result your looking for in an if() statement. I think the CCS manual talks about this somewhere try and look in that. I think my code might compile more efficient as well.

ed
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