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

Output current limitation ?

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



Joined: 10 May 2004
Posts: 17
Location: barcelona

View user's profile Send private message

Output current limitation ?
PostPosted: Fri Dec 14, 2007 8:22 am     Reply with quote

hello,

i have a problem using the RA5 pin of a PIC16f688.
I use this pin to supply 2 analog sensors with 3.3V.
This need 7mA only to work!!!
i´m using a lithium batery regulated to 3.3V and when i put the line HIGH the out is only about 2.5V, not 3.3V . This is very strange, its look like the PIN RA5 that cant give the current necesary and down the voltage. The specifications say 25mA maximum current every PIN.
I think the hardware is ok, is this a software limitation???

any ideas????

thanks a lot!!!!!

alex
Sad Shocked

This is the code,


Code:

#include <16F688>
#device ADC=8
#fuses INTRC_IO,PUT,NOMCLR, NOWDT,NOPROTECT,BROWNOUT
#use delay(clock = 8000000)

#use rs232(baud=9600, xmit=PIN_C4, rcv=PIN_C5, parity=N, bits=8)

//#use STANDARD_IO(A)
//#use STANDARD_IO(C)

#define x18       PIN_A0
#define y18       PIN_A1
#define xrate     PIN_A4
#define yrate     PIN_C0
#define x3        PIN_C1
#define y3        PIN_C2
#define z3        PIN_C3
#define pulsador  PIN_A2
#define bateria   PIN_A3

main()
{

   int i = 0;
   long val = 0;
   int flag1 = 0;
   int flag2 = 0;

   int sensor[7] = {0,0,0,0,0,0,0};

   //set_tris_A(0x00);
   //set_tris_C(0x00);

   setup_comparator(NC_NC_NC_NC);

   setup_adc( ADC_CLOCK_INTERNAL );
   setup_adc_ports( sAN0|sAN1|sAN3|sAN4|sAN5|sAN6|sAN7 );
   set_adc_channel( 0 );

   output_high(PIN_A5);

   while(TRUE)
   {

      if( (!input(pulsador)) && !flag1 ) // pulsador
      {
         flag1 = 1;
         putc(209);
         putc(255);
         delay_ms(10);
         putc(209);
         putc(255);

      }
      else if ( (input(pulsador)) && flag1 )
      {
         flag1 = 0;
         putc(209);
         putc(0);
         delay_ms(10);
         putc(209);
         putc(0);
      }

      if( (!input(bateria)) && !flag2 )
      {
         flag2 = 1;
         putc(210);
         putc(255);
         delay_ms(10);
         putc(210);
         putc(255);
      }
      else if ( (input(bateria)) && flag2 )
      {
         flag2 = 0;
         putc(210);
         putc(0);
         delay_ms(10);
         putc(210);
         putc(0);
      }

      for(i=0;i<8;i++)
      {
         if(i!=2)
         {
            set_adc_channel( i );
            delay_ms(1);
            val = read_adc();
            val = (val*200)/255;
            if(val != sensor[i]){
               sensor[i] = val;
               putc(201+i);
               putc(val);
            }
         }
      }

   }

}
Ttelmah
Guest







PostPosted: Fri Dec 14, 2007 8:38 am     Reply with quote

Logic lines, will never go 'to' the supply line, when under load. The 'output high' specification for your chip, is Vdd-0.7v at 3mA, using a 4.5v supply, on the industrial version chip. The normal versions have the same droop, at a lower current of just 1.3mA. On a lower supply, expect this to be slightly worse (the internal gates don't get turned on as hard), and with your higher current. What you are seeing, is totally normal for the outputs.

Best Wishes
nicenoise



Joined: 10 May 2004
Posts: 17
Location: barcelona

View user's profile Send private message

PostPosted: Fri Dec 14, 2007 9:54 am     Reply with quote

thanks,

but if i put a pull up resistor (1k or minus), its possible that this voltage go to 3.3V????

any diferents option???
amcfall



Joined: 20 Oct 2005
Posts: 44

View user's profile Send private message

PostPosted: Fri Dec 14, 2007 10:08 am     Reply with quote

nicenoise wrote:
thanks,

but if i put a pull up resistor (1k or minus), its possible that this voltage go to 3.3V????

any diferents option???


Use a transistor to switch the voltage.

Avery
nicenoise



Joined: 10 May 2004
Posts: 17
Location: barcelona

View user's profile Send private message

PostPosted: Fri Dec 14, 2007 11:06 am     Reply with quote

yeah,
i had had a smd mosfet, the bs170, but it was a drop of 0,3V...
i put out...
do you know a mosfet without drop voltage??? or minimum... (<0,1V)...

thanks a lot!!!

alex
SET



Joined: 15 Nov 2005
Posts: 161
Location: Glasgow, UK

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

PostPosted: Fri Dec 14, 2007 1:04 pm     Reply with quote

Use a PNP transistor - your output going low will then switch transistor on, dont forget base resistor! The collector-emitter drop can be very low, usually under 0.1v
amcfall



Joined: 20 Oct 2005
Posts: 44

View user's profile Send private message

PostPosted: Fri Dec 14, 2007 2:09 pm     Reply with quote

nicenoise wrote:
yeah,
i had had a smd mosfet, the bs170, but it was a drop of 0,3V...
i put out...
do you know a mosfet without drop voltage??? or minimum... (<0,1V)...

thanks a lot!!!

alex


I don't have any PN's here but I have used the tiny SOT-23 logic level MOSFETS from Fairchild with great luck. You'd need a P channel, should have a negligible voltage drop (on resistance of milliohms).

Avery
mcafzap



Joined: 07 Sep 2003
Posts: 46
Location: Manchester, UK

View user's profile Send private message

PostPosted: Sun Dec 16, 2007 1:52 pm     Reply with quote

Have a look at http://www.zetex.com/3.0/pdf/ZXTP25015DFH.pdf

There are several other very low Vcesat devices on this site, all of which have a reasonable gain meaning you don't need much current to drive them.
Guest








PostPosted: Sun Dec 16, 2007 4:31 pm     Reply with quote

thanks a lot,
i try to find this transistor...

alex
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