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

Questions about lcd_putc() and the A/D setup?

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



Joined: 25 Aug 2005
Posts: 65
Location: Huntington Beach, CA

View user's profile Send private message

Questions about lcd_putc() and the A/D setup?
PostPosted: Thu Oct 06, 2005 2:32 am     Reply with quote

1) When setting up the A/D isn't the first line redundant with the third?

setup_adc_ports(ALL_ANALOG);
setup_adc( ADC_CLOCK_INTERNAL );
set_adc_channel( 0 );

If one is only using pin 0 isn't the following all that is needed?

set_adc_channel( 0 );
setup_adc( ADC_CLOCK_INTERNAL );

2) Why and when are the two different print statements for an LCD required?

printf(lcd_putc,"............)

lcd_putc("................)
Foppie



Joined: 16 Sep 2005
Posts: 138
Location: The Netherlands

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Thu Oct 06, 2005 2:42 am     Reply with quote

1) no, it is needed to declare what port is analog and what port is the Vref
look into the .h file of your used PIC to see which declaration you should use

2) with printf() you can use a string and I thought lcd_putc() only accepts characters. But I'm not quit sure about the last part...
Ttelmah
Guest







PostPosted: Thu Oct 06, 2005 5:00 am     Reply with quote

lcd_putc, is just the routine to send a character. in CCS C, there is a 'shortcut', for contant strings only, where if they are put as the 'target' for a function that wants individual bytes, the routine will be repeately called for each character in turn.
printf, is the full 'formatted output' routine, which allows variabes to be converted for output. It happens to have as one 'subset' possibility, the same ability to send a constant string. The compiler generates the same code for each. Normally you would use printf, where you want to do more than just print a constant string.

Best Wishes
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