Connect with us

connect 24 V digital signal to a microcontroller

Discussion in 'Microcontrollers, Programming and IoT' started by Emam, Apr 28, 2015.

Scroll to continue with content
  1. Emam

    Emam

    60
    4
    Jul 7, 2014
    Hello,

    I have a digital signal between 0- 24 V. In terms of logic states I know that for
    Voltages between 0 … 5 V I have state '0' and for voltages between 15 … 24 V I have state '1'.

    I would like to use this signal as input of my TTL microcontroller (Pic18F).

    Could you please give me some easy ways to convert this signal to TTL signal that I can use with my microcontroller?

    Many thanks and bests regards
     
  2. BobK

    BobK

    7,682
    1,686
    Jan 5, 2010
    You can make this using a voltage divider.

    The inputs on 18F PICs are either TTL or Schmitt trigger. For TTL inputs:

    Low: < 0.8V
    High: > 2.0V

    For Schmitt trigger inputs (with Vdd = 5V):

    Low < 1V
    High > 4V

    So, if you are using a TTL input, use a divider of 1/7

    Low = 0 to 0.71
    High = 2.14 to 3.42

    These margins however, look a little to close to me.

    And for the Schmitt trigger inputs (look at your datasheet to see which are which), it is not possible to map the ranges onto valid input voltages. A divider that brings 5V to below 1V to be a low will bring 15V down to 3V which will not be read as high.

    A better method would be to use any divider that gets 24 down to < 5 then use a comparator to distinguish the low and high voltages. For example: Using a divider of 1/6

    low = 0 to 0.833
    high = 2.5 to 4V

    Set the comparator to (2.5 + 0.833) / 2 = 1.67V to get the largest margins possible, and can be used with either a TTL or Schmitt trigger input since it will output close to 0 for low and close to 5V for high.

    Bob
     
    Emam and hevans1944 like this.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-