View previous topic :: View next topic |
Author |
Message |
Lukas
Joined: 21 Jul 2009 Posts: 2
|
GPIO0 & GPIO1 for PIC12f675 |
Posted: Mon Aug 31, 2009 10:23 am |
|
|
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
|
|
Posted: Mon Aug 31, 2009 12:10 pm |
|
|
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
|
|
Posted: Mon Aug 31, 2009 3:45 pm |
|
|
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
|
|
Posted: Tue Sep 01, 2009 2:18 am |
|
|
Hi, thanks for the advises I've solved the problem!
(now i assigned every pin to a specific function and all works properly)
Thank you very much |
|
|
|