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

problem with port_D helpme please

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







problem with port_D helpme please
PostPosted: Mon May 17, 2004 6:14 pm     Reply with quote

thank u friend for your help but a have a little I can't to set portD (output)
my pic is 16f877 and my code is:

#include "C:\proyecto2\programa pics\cad1.h"
#byte puertab = 06
#byte puertac = 07
#byte puertad = 08



void main()
{

setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_DIV_8);

set_tris_b(0x00);
set_tris_c(0x00);
set_tris_d(0x00);

while(true)
{
//int value0;
set_adc_channel(0);
delay_us(10); //Add this delay here
puertab = Read_ADC();
delay_us(10);

delay_us(10);
set_adc_channel(1);
delay_us(10); //Add this delay here
puertac = Read_ADC();
delay_us(10);

set_adc_channel(2);
delay_us(10); //Add this delay here
puertad = Read_ADC();
delay_us(10);


}
}


and cad1.h :

#include <16F877.h>
#device adc=10
#use delay(clock=4000000)
#fuses NOWDT,XT, NOPROTECT


I don't know what is the problem CCS or my code because all my code is OK but when I used "#byte puertad = 08" CCS writed:
"A numeric expression must appear here" on the number 8 .
please helpme . bye friend
Guest








Re: problem with port_D helpme please
PostPosted: Mon May 17, 2004 10:31 pm     Reply with quote

robertopi wrote:

#byte puertad = 08


The compiler doesn't like the leading zero. It's customary to write it in hex as
#byte puertad = 0x08
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Tue May 18, 2004 9:48 am     Reply with quote

Check this, are you working with low voltage ? If not NOLVP is mandatory.
Quote:


#fuses NOWDT,XT, NOPROTECT



You set AD conversion result will be 10 bit wide.
Quote:


#device adc=10


Commenting out //#device adc=10 the result of the AD conversion will be 8 bit wide. Default condition.

Then you can get the AD result in 8 bit format
Quote:


puertad = Read_ADC();



HTH

Humberto
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