What's the voltage on output pin when it's HIGH?


Closed Thread
Results 1 to 17 of 17
  1. #1
    Join Date
    Apr 2006
    Posts
    92

    Default What's the voltage on output pin when it's HIGH?

    Hi,

    I was wondering what voltage is produced on an output pin when it is toggled "HIGH"?

    I always assumed it was 5V, but when measuring it was only 1V, I wondered if my meter is off.

    I am looking for a way to produce a TTL level output pulse; 5V (and 0V) (Similar to the output of a Schmitt Trigger Pulse Oscillator or a 555 timer IC)

    Would I need a transistor for this, or can I just use the Pic by itself?

    Thanks for any advice.

    T
    Last edited by TonyA; - 22nd April 2008 at 21:29.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    when you set a pin to HIGH it should close to Vdd, if not, you probably forgot few things

    disable the Comparator
    disable the ADCs
    this pin is a open-collector type.
    This pin is a INPUT only.. can't be an OUTPUT
    etc etc etc

    http://www.picbasic.co.uk/forum/showthread.php?t=561

    since we don't know the PIC and I/O you're using...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Apr 2006
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    I am using 18F452, and reading portb.7.

    It lights an LED the way it should, but I only read 1-2V.

    Thanks,
    T

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by TonyA View Post
    I am using 18F452, and reading portb.7.

    It lights an LED the way it should, but I only read 1-2V.
    With or with out the LED attached?
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    With or with out the LED attached?
    And if WITH the LED attached, did you also include a current limiting resistor in series with the LED ?
    Keith

    www.diyha.co.uk
    www.kat5.tv

  6. #6
    Join Date
    Apr 2006
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by keithdoxey View Post
    And if WITH the LED attached, did you also include a current limiting resistor in series with the LED ?

    I don't remember... I'll test again and re-post.

    Thanks again,
    T

  7. #7
    Join Date
    Apr 2006
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    Yes, with the resistor and LED disconnected, I still read 2V out of the portb.7

    Code:
    'DEFINITIONS'
    DEFINE OSC 20
    DEFINE ADC_BITS 10        ' Set number of bits in result
    DEFINE ADC_CLOCK 3
    DEFINE ADC_SAMPLEUS 15
    
    'PORT SETUP'
    TRISA = %11111111       'set up all pins on portA as input pins
    ADCON1 = %10000010      'Set PORTA analog conversion and right justify result
    
    timeVar   var word
    pauseTime var byte
    
    
    
    main:
    
    adcin 0, timeVar
    
    pauseTime = timeVar / 12
    
    high portb.7
    
    pause pauseTime
    
    low portb.7
    
    pause pauseTime
    
    goto main
    I'm using the pic like this to provide a TTL pulse, (replacing a Schmitt trigger osc.). I had it hooked up in place of the Schmitt trigger and it works the way I expected, however I don't know why I only read 2V from my multi meter.

    The Schmitt trigger's pulse read close to 5V.
    Last edited by TonyA; - 22nd April 2008 at 23:59.

  8. #8
    Join Date
    Apr 2008
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    I see no code saying "port b shall be used for output" .... do you ?
    Ramon.

  9. #9
    Join Date
    Apr 2006
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ramonetnet View Post
    I see no code saying "port b shall be used for output" .... do you ?
    Ramon.
    I was wondering about that too, but when you say "portb.7 HIGH", doesn't that automatically take care of that?

    OR do you still have to define port b as output before the code?

    Thanks,
    T

  10. #10
    Join Date
    Apr 2008
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    a) instead of trying to imagine the possible combinations,
    I would go and program it !

    b) if you "select" Port A mode, why don't you specify the Port B mode of operation ?
    It is NOT so large and difficult ...

    c) if you say "HIGH PORTB.7" it means you write some data into the port,
    not that you somehow are telling the compiler to configure it for you.

    Let's do it and let's talk again. Ramon.

  11. #11
    Join Date
    Apr 2006
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    I added "TRISB = 0" and still read approximately 2.5V at portb.7

    Thanks,
    T

  12. #12
    Join Date
    Apr 2008
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    Then either :

    a) your Vdd is 2,5 volts

    b) your PIC is gone nuts

    c) any other I dont know right now - time to sleep here

    Cheers.

  13. #13
    Join Date
    Apr 2006
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    I'm sure that I'm getting 5V to power my PIC.

    T

  14. #14
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    How long is "pausetime"

    You are toggling the pin between high and low and your meter will probably not see the voltage stable for long enough to get a true reading.

    Currently the pin is operating on a 50% duty cycle and 2.5 volts just happens to be 50% or 5V !!!!

    Comment out the "low port b.7" statement which means once the LED comes on it will stay on but you will then have a stable condition on the pin to be able to measure.

    My guess is that it will then read 5V
    Keith

    www.diyha.co.uk
    www.kat5.tv

  15. #15
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by TonyA View Post
    I'm sure that I'm getting 5V to power my PIC.

    T
    Depends on where you are measuring your Voltage at.

    A - B, A - C , B - C ?


    <img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2534&d=1208936533">
    Attached Images Attached Images  
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  16. #16
    Join Date
    Feb 2003
    Posts
    432


    Did you find this post helpful? Yes | No

    Default

    also cant see what the code is meant to achieve because irrespective of whatever value you have for pausetime the led will alsways be at 50% brightness as the on and off times are the same.

    If you are trying to get a variable brightness then with pausetime being 0-255 you should have something like

    Code:
    main:
    
    adcin 0, timeVar
    
    pauseTime = timeVar / 12
    
    high portb.7
    
    pause pauseTime
    
    low portb.7
    
    pause (255-pauseTime)
    
    goto main
    which will give a total time of 255 but the on will vary from 0-255 whilst off will also change from 255-0
    Keith

    www.diyha.co.uk
    www.kat5.tv

  17. #17
    Join Date
    Apr 2006
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    Yes, you're right. The on-off time is too fast for the meter to register.

    I am just trying to achieve a TTL pulsing; 5V, 0V, on/off at different rates. The LED was put in there just for a visual reference, it's not part of my finished circuit.

    The purpose of this pulsing of the pic pin is to replace a Schmitt Trigger Pulse Oscillator.

    It is working the way I expected "in circuit", but I was just wondering why I couldn't read discreet 5V and 0V on my meter, (taking reading on the bare pin, not resistor or LED).

    If I had an Oscilloscope I guess I would see the TTL (I would see the square wave pulse).

    I'm starting to see the benefits of an Oscilloscope...

    Thanks for all the help, I appreciate it very much.

    T

Similar Threads

  1. SERIN MIDI out of Synch?
    By jncortes in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th June 2009, 20:08
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  4. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 03:46
  5. Another RTC, DS1287
    By DavidK in forum Code Examples
    Replies: 0
    Last Post: - 12th December 2006, 17:07

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts