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

GPIO0 & GPIO1 for PIC12f675

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



Joined: 21 Jul 2009
Posts: 2

View user's profile Send private message

GPIO0 & GPIO1 for PIC12f675
PostPosted: Mon Aug 31, 2009 10:23 am     Reply with quote

Hi I'm a new user of CCS, and I've a little problem with the GPIO0 and GPIO1 of the PIC12f675.
When I write a program, for example to have the outputs high, if I use the GPIO5 or GPIO4 the things works perfect but on GPIO0 and GPIO1 the signal stay always down
Down here is an example of code :
Code:

void main()

{

   setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
   set_tris_a( 0b00001100);
   enable_interrupts(INT_TIMER1);
   enable_interrupts(GLOBAL);

   setup_adc_ports( ALL_ANALOG );
   setup_adc(ADC_CLOCK_INTERNAL);


for(;;)
{

set_adc_channel( 2 );
delay_ms(2); 

value = read_adc(ADC_START_AND_READ);


if (value<Uvp)

    output_high(PIN_A5);
    output_high(PIN_A1);
    output_high(PIN_A0);
    output_high(PIN_A4);
}


There are some special settings that I have to do for those pins?
Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Aug 31, 2009 12:10 pm     Reply with quote

Post your compiler version. It's a 4-digit number in this format: x.xxx
It's given at the top of the .LST file, which will be in your project directory.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Aug 31, 2009 3:45 pm     Reply with quote

I'm surprised GPI4 is working.

In the PIC processors there are more hardware modules than I/O pins, that's why you have to assign a function for many of the pins. For example GPI1 can be either a digital I/O pin, analog in, comparator input or Vref input.

Code:
   setup_adc_ports( ALL_ANALOG );
What functionality do you think this call assigns to the pins with possible analog function?
Check the header file 12f675.h for the allowed parameters.
Lukas



Joined: 21 Jul 2009
Posts: 2

View user's profile Send private message

PostPosted: Tue Sep 01, 2009 2:18 am     Reply with quote

Hi, thanks for the advises I've solved the problem! Very Happy
(now i assigned every pin to a specific function and all works properly)
Thank you very much
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