[SOLVED !] How to read TTL input of a displacement transducer


Closed Thread
Page 1 of 3 123 LastLast
Results 1 to 15 of 36
  1. #1
    Member amod's Avatar
    Join Date
    Mar 2018
    Posts
    147
    Thumbs Up
    Received: 38
    Given: 5
    Total Downloaded
    326.89 MB

    0 Not allowed!

    Default How to read TTL input of a displacement transducer

    Hello, I want to read TTL input coming from displacement transducer.I don't have any circuit to read TTL.

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Prolific Poster normnet's Avatar
    Join Date
    Jul 2004
    Posts
    2,423
    Thumbs Up
    Received: 81
    Given: 48
    Total Downloaded
    1.40 GB

    0 Not allowed!

    Default Re: How to read TTL input of a displacement transducer

    Data sheet?

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,702
    Thumbs Up
    Received: 361
    Given: 173
    Total Downloaded
    2.08 GB

    0 Not allowed!

    Default Re: How to read TTL input of a displacement transducer

    TTL is standard 5 Volts, with a threshold of approximately 2.5 Volts or over for a 1, and under approximately 2.5 Volts for a 0.

    Any standard 5 Volt operating microcontroller will read TTL on an input pin that has gone high or low. If using a 3.3 Volt microcontroller to read a TTL value, you can place a few silicon diodes in series to reduce the voltage by approx approx 0.63 Volts per diode to the input pin, or a resistor to lower the voltage to the pin. I always preferred a resistor in series.

    The output from most of those transducers is a stream of pulses, so a simple frequency meter code may do the trick. I'm sure I wrote code for someone on the forum a few years back to count pulses in a certain time period. i.e. A slower frequency counter. Check the Wiki or do a search.
    Last edited by top204; 8th February 2020 at 15:35.

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,600
    Thumbs Up
    Received: 81
    Given: 33
    Total Downloaded
    6.78 GB

    1 Not allowed!

    Default Re: How to read TTL input of a displacement transducer

    Quote Originally Posted by top204 View Post
    I'm sure I wrote code for someone on the forum a few years back to count pulses in a certain time period. i.e. A slower frequency counter. Check the Wiki or do a search.
    I think this is the one Les!
    Regards

    Joseph

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,702
    Thumbs Up
    Received: 361
    Given: 173
    Total Downloaded
    2.08 GB

    0 Not allowed!

    Default Re: How to read TTL input of a displacement transducer

    Thanks Joseph, but the UltraSonic Receiver code I wrote many years ago counts the time between the transmit and receive pulses. i.e TOF (Time Of Flight)

    I did a quick search and the thread with my code is here:

    Pulse counting, storing and reading back

    It may not be what you require, but it may give you some clues as to what to do.

    Crickey.... I can't believe it was 8 years ago that I wrote that code. Where does the time go. :-(
    Last edited by top204; 8th February 2020 at 21:40.

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,600
    Thumbs Up
    Received: 81
    Given: 33
    Total Downloaded
    6.78 GB

    0 Not allowed!

    Default Re: How to read TTL input of a displacement transducer

    Quote Originally Posted by top204 View Post
    Crickey.... I can't believe it was 8 years ago that I wrote that code. Where does the time go. :-(
    Don't tell Les, I have been on this forum for 15 years now.
    Regards

    Joseph

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,702
    Thumbs Up
    Received: 361
    Given: 173
    Total Downloaded
    2.08 GB

    1 Not allowed!

    Default Re: How to read TTL input of a displacement transducer

    But the one good thing about that Joseph is that we have a lot of good friends on this forum, and for that I will always be glad.

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  15. #8
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,600
    Thumbs Up
    Received: 81
    Given: 33
    Total Downloaded
    6.78 GB

    0 Not allowed!

    Default Re: How to read TTL input of a displacement transducer

    Quote Originally Posted by top204 View Post
    But the one good thing about that Joseph is that we have a lot of good friends on this forum, and for that I will always be glad.
    Much true!!
    Regards

    Joseph

  16. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  17. #9
    Member amod's Avatar
    Join Date
    Mar 2018
    Posts
    147
    Thumbs Up
    Received: 38
    Given: 5
    Total Downloaded
    326.89 MB

    0 Not allowed!

    Default Re: How to read TTL input of a displacement transducer

    my program.It does not work
    '************************************************* ***************'* Name : UNTITLED.BAS *
    '* Author : [select VIEW...EDITOR OPTIONS] *
    '* Notice : Copyright (c) 2020 [select VIEW...EDITOR OPTIONS] *
    '* : All Rights Reserved *
    '* Date : 2/11/2020 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************
    ;-------------------------------------------------------------------------------
    ;**** Added by Fuse Configurator ****
    ; Use the Fuse Configurator plug-in to change these settings


    Device = 16F886


    Config1 FOSC_INTRC_NOCLKOUT, WDTE_OFF, PWRTE_OFF, MCLRE_OFF, CP_OFF, CPD_OFF, BOREN_OFF, IESO_OFF, FCMEN_OFF, LVP_OFF, DEBUG_OFF
    Config2 BOR4V_BOR40V, WRT_OFF


    ;**** End of Fuse Configurator Settings ****
    ;-------------------------------------------------------------------------------








    Xtal 4
    OSCCON=%01110001
    All_Digital On


    Dim DG1 As Byte
    Dim DG2 As Byte
    Dim DG3 As Byte
    Dim DG4 As Byte
    Dim DIGIT As Byte
    Dim DG As Byte
    Dim COUNTT As Byte

    Dim NUMB As Word
    Dim N As Word
    Dim telbit As Byte
    Dim teller As Float




    ADCON1=%10000000
    ADCON0=%01000011
    TRISA=%00111101
    TRISB=%00000000
    TRISC=%11110000
    ANSELH=%00000001
    ANSEL=%00000001
    CM1CON0=0
    CM2CON0=0
    VRCON=0


    GoSub DIGITCALC

    '-------------------------------------------------------------------------

    main:

    If PORTA.2=1 Then 'counter increase
    If telbit=0 Then
    Inc teller
    EndIf
    telbit=1
    Else
    telbit=0
    EndIf

    If PORTA.3=1 Then 'counter decrease
    If telbit=0 Then
    teller=teller-1
    EndIf
    telbit=1
    Else
    telbit=0
    EndIf
    N=teller
    GoSub DISPLAY
    GoSub DIGITCALC
    GoTo main






    'light up four digit seven segment display
    DISPLAY:


    For COUNTT=0 To 99


    PORTB=DG1
    PORTC.3=0
    DelayUS 1000
    PORTC.3=1


    PORTB=DG2
    PORTC.2=0
    DelayUS 1000
    PORTC.2=1


    PORTB=DG3
    PORTC.1=0
    DelayUS 1000
    PORTC.1=1

    PORTB=DG4
    PORTC.0=0
    DelayUS 1000
    PORTC.0=1


    Next COUNTT


    Return


    '_________________________________________________ _______________






    'sending numbers to each digit
    DIGITCALC:


    DIGIT=0
    LP1:
    If N<1000 Then DS1
    N=N-1000
    DIGIT=DIGIT+1
    GoTo LP1
    DS1:
    GoSub FND
    DG1=DG



    DIGIT=0
    LP2:
    If N<100 Then DS2
    N=N-100
    DIGIT=DIGIT+1
    GoTo LP2


    DS2:
    GoSub FND
    DG2=DG


    DIGIT=0
    LP3:
    If N<10 Then DS3
    N=N-10
    DIGIT=DIGIT+1
    GoTo LP3


    DS3:
    GoSub FND
    DG3=DG


    DIGIT=N
    GoSub FND
    DG4=DG

    Return






    '_________________________________________________ _________________________




    'lighting up each segment of display according to numbers
    FND:


    FND0:
    If DIGIT>0 Then FND1
    DG=%00000011 '%0111 1110
    GoTo FNDEND


    FND1:
    If DIGIT>1 Then FND2
    DG=%10011111 '%0100 1000
    GoTo FNDEND


    FND2:
    If DIGIT>2 Then FND3
    DG=%00100101 '%0011 1101
    GoTo FNDEND


    FND3:
    If DIGIT>3 Then FND4
    DG=%00001101 '%0110 1101
    GoTo FNDEND


    FND4:
    If DIGIT>4 Then FND5
    DG=%10011001 '%0100 0011
    GoTo FNDEND


    FND5:
    If DIGIT>5 Then FND6
    DG=%01001001 '%0110 0111
    GoTo FNDEND


    FND6:
    If DIGIT>6 Then FND7
    DG=%01000001 '%0111 0111
    GoTo FNDEND


    FND7:
    If DIGIT>7 Then FND8
    DG=%00011111 '%0100 1100
    GoTo FNDEND


    FND8:
    If DIGIT>8 Then FND9
    DG=%00000001 '%0111 1111
    GoTo FNDEND


    FND9:
    DG=%00011001 '%0110 1111


    FNDEND:








    Return
    '______________________________


  18. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  19. #10
    Member amod's Avatar
    Join Date
    Mar 2018
    Posts
    147
    Thumbs Up
    Received: 38
    Given: 5
    Total Downloaded
    326.89 MB

    0 Not allowed!

    Default Re: How to read TTL input of a displacement transducer

    Is there any special circuit for it to read by 16f886

  20. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  21. #11
    Senior Member Stephen Moss's Avatar
    Join Date
    Jan 2006
    Posts
    557
    Thumbs Up
    Received: 33
    Given: 7
    Total Downloaded
    3.87 GB

    0 Not allowed!

    Default Re: How to read TTL input of a displacement transducer

    The All_Digital command is now Obsolete and does nothing, the compiler automatically sets all I/O pins as Digital but if you want to be sure/like to see that it is set in code then you should set ANSEL to 0.

    Check your OSCCON settings, you have told the compiler your running at 4MHz but you appear to have the Oscillator set to 8MHz.

    As Les said TTL has been a standard for logic signals for decades, provided you have configured the I/O Pin as a digital input and disabled any peripherals (have pin priority on some devices) that also use those pins you should not have any problems reading unless it is changing faster then than time interval between reads in which case you could keep catching the same level at random for several reads in a row creating the illusion that it is not working.

    You ask if there is a special circuit to read the sensor with your device but you have only given a fraction of the information required for anyone to help, without a manufactures name/part number for the transducer or better still a link to a data sheet so that people know what you are trying to read and what it is outputting how could anyone begin to think about what such a circuit would be.

    You make it sound like the transducer output is a simple = 0 no displacement and 1 = displacement but I would think that these days the majority if not all transducers would provide an more detailed output that indicates both the amount and direction of displacement either via a pulse train as Les suggested, analogue voltage or variable pulse width.

  22. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  23. #12
    Senior Member Stephen Moss's Avatar
    Join Date
    Jan 2006
    Posts
    557
    Thumbs Up
    Received: 33
    Given: 7
    Total Downloaded
    3.87 GB

    0 Not allowed!

    Default Re: How to read TTL input of a displacement transducer

    Forgot to ask in previous post but why is Teller defined as a float?

    You only appear to be incrementing/decrementing Teller by 1 so I would think an integer value would do and so you could make it a Byte, Word or if you will be going negative a signed Byte/Word. Additionally you have defined N as a word and have in your code N=Teller. So you are trying to copy a 32 bit float value into a 16 bit integer value.

  24. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  25. #13
    Member amod's Avatar
    Join Date
    Mar 2018
    Posts
    147
    Thumbs Up
    Received: 38
    Given: 5
    Total Downloaded
    326.89 MB

    0 Not allowed!

    Default Re: How to read TTL input of a displacement transducer

    After defining teller as word values increases when I move displacement sensor upwards but values are not decreasing when iam moving it downwards.

  26. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  27. #14
    Member amod's Avatar
    Join Date
    Mar 2018
    Posts
    147
    Thumbs Up
    Received: 38
    Given: 5
    Total Downloaded
    326.89 MB

    0 Not allowed!

    Default Re: How to read TTL input of a displacement transducer

    Click image for larger version

Name:	IMG-20200214-WA0014.jpg
Views:	18
Size:	83.5 KB
ID:	3885sensor details

  28. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  29. #15
    Member amod's Avatar
    Join Date
    Mar 2018
    Posts
    147
    Thumbs Up
    Received: 38
    Given: 5
    Total Downloaded
    326.89 MB

    0 Not allowed!

    Default Re: How to read TTL input of a displacement transducer

    My displacement sensor has 90 shift.

  30. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. PIC18F46K20 Can't read digital input on port D
    By normnet in forum Proton Plus Compiler v3
    Replies: 9
    Last Post: 20th May 2011, 20:20
  2. 18F26K22 Can't read Analog input on AN0
    By arifcan in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 14th May 2011, 13:45
  3. [SOLVED !] MultiTask? Read input while performing output
    By t0pP8uZz in forum Proton Plus Compiler v3
    Replies: 9
    Last Post: 2nd November 2009, 12:51
  4. Torque transducer
    By [email protected] in forum The Lounge
    Replies: 12
    Last Post: 28th September 2007, 21:06
  5. [SOLVED !] 2 TTL outputs to 1 PIC input?
    By ChrisB in forum Proton Plus Compiler v3
    Replies: 22
    Last Post: 5th January 2006, 06:37

Posting Permissions

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