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

12F675 -> PIN_A3 doesn't work

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



Joined: 23 May 2005
Posts: 3

View user's profile Send private message

12F675 -> PIN_A3 doesn't work
PostPosted: Sat Jul 09, 2005 4:03 am     Reply with quote

hi,

i wrote a little programme to drive 3 leds and a MOSFET driver.
unfortunately the blue led doesn't work because i get only floating level at the GPIO3 output.

here's the code:

Code:

#include<12F675.h>
#fuses INTRC, NOWDT, NOCPD, NOPROTECT, NOMCLR, NOPUT, INTRC_IO, NOBROWNOUT
#use delay (clock=4000000)
#use fast_io(A)

#define LED_RED PIN_A5
#define LED_WHITE PIN_A4
#define LED_BLUE PIN_A3

#define PWM_OUTPUT PIN_A0
#define BUTTON_INPUT PIN_A2

void main()
{

   port_a_pullups(false);

   setup_comparator(NC_NC_NC_NC);
   setup_adc(ADC_OFF);
   setup_adc_ports (NO_ANALOGS);

   set_tris_a(0b00000100);

   output_a(0xff);

   while (1)
   {
   }

}



thanks!
Ttelmah
Guest







PostPosted: Sat Jul 09, 2005 4:29 am     Reply with quote

It never will.
I'm afraid to say 'RTFM'....
On the 12F675, if you read the data sheet, you will find that pin GP3, is _only_ useable as an input. This is because the pin is multiplexed with the programming voltage input, which has to be able to pull the pin well above the +ve supply rail. As such there cannot be a pull-up FET present on the pin, and so the pins where this is done, are always made either 'input only', or 'open collector outputs'. On the 675, it is made input only.
Modify your hardware and your code. Move the LED to pin A2, and put the input push button on A3.

Best Wishes
i2c2k



Joined: 23 May 2005
Posts: 3

View user's profile Send private message

PostPosted: Sat Jul 09, 2005 4:31 am     Reply with quote

ok, thanks!
40inD



Joined: 30 Jul 2007
Posts: 112
Location: Moscow, Russia

View user's profile Send private message

PostPosted: Mon Apr 14, 2008 11:10 pm     Reply with quote

Is PIN_A2 used for something like this too? In my PIC it does not want to go HIGH.
Matro
Guest







PostPosted: Tue Apr 15, 2008 1:30 am     Reply with quote

40inD wrote:
Is PIN_A2 used for something like this too? In my PIC it does not want to go HIGH.

Nothing similar for this pin but you have to activate the weak pull-up.
Look for "WPU" register int he datasheet.

Matro.
40inD



Joined: 30 Jul 2007
Posts: 112
Location: Moscow, Russia

View user's profile Send private message

PostPosted: Tue Apr 15, 2008 2:04 am     Reply with quote

In datasheet:
Quote:
The weak pull-up device is automatically disabled if the pin is in Output mode
Matro
Guest







PostPosted: Tue Apr 15, 2008 2:19 am     Reply with quote

40inD wrote:
In datasheet:
Quote:
The weak pull-up device is automatically disabled if the pin is in Output mode

If your pin is an output you should be able to have a high level. The pin isn't an open drain one.
Check that COUT is disabled.
You can post a short excerpt of your code.

Matro.
40inD



Joined: 30 Jul 2007
Posts: 112
Location: Moscow, Russia

View user's profile Send private message

PostPosted: Tue Apr 15, 2008 2:28 am     Reply with quote

Quote:
Check that COUT is disabled.

How to check this?
Matro
Guest







PostPosted: Tue Apr 15, 2008 2:52 am     Reply with quote

These 2 lines shall be present in your code
Code:

   setup_comparator(NC_NC);
   setup_vref(FALSE);


You can also read CM2:CM0 value during code execution and check that it is 0b111 (for example with a "if" statement that toggles a LED).

Notice that the comparator is active by default. That's why you have to disable it.

Matro.
40inD



Joined: 30 Jul 2007
Posts: 112
Location: Moscow, Russia

View user's profile Send private message

PostPosted: Tue Apr 15, 2008 3:02 am     Reply with quote

Hmm. Not helps!
I just moved output to other pin...
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