Shop OBEX P1 Docs P2 Docs Learn Events
sx-48 interuppts — Parallax Forums

sx-48 interuppts

SawmillerSawmiller Posts: 276
edited 2006-01-03 19:06 in General Discussion
hi guys ,
·still trying to get a position sensor working for a portable sawmill i have as a hobby...
its a magnostrictive position sensor, you input a pulse and it returns 2 pulses with the time between them being representitive of· the distance that the magnet is from the head...
its signal is generated in rs485 .... which is where part of the problem is, it generates a positive pulse of 2.5 and a negitive pulse of 2.5 at the same time, i have disconnected the negative and am only reading the pos... using my code , i get a timer reading of timerL 001 timerH 001 everytime no matter where the magnet is. could you look over my set up and interuppt code and point out the mistakes ?
thanks
dan

Comments

  • SawmillerSawmiller Posts: 276
    edited 2006-01-02 13:45
    btw the input pulse is on RB.0, the output is RB.4

    thanks for looking

    dan
  • BeanBean Posts: 8,129
    edited 2006-01-02 16:17
    Dan,
    What is the range of time between pulses that you want to measure ?
    An interrupt seems overly complecated to just measure time between pulses ?
    Can you just wait for the 1st pulse to start, then use PULSIN to measure the time between ?
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    "I hope the goonwave is not vaporware"
    ·
  • SawmillerSawmiller Posts: 276
    edited 2006-01-02 22:28
    hi bean,
    im tring to measure to within 1/32 of a inch over a 20 inch span ..
    the magnostrictive wave travels at the speed of sound
    340.29 M / sec
    or about 12250.44 inches/sec
    thought i needed all the speed i coould get
    pulsein is only 10 micro sec's right ?
    thought i would have to get into the milli seconds
    dan

    thanks for lookin
  • BeanBean Posts: 8,129
    edited 2006-01-02 23:42
    Okay so your look at pulses from 0 to 1632.59 micro seconds and 1/32" would be 2.55 microseconds.
    10 microseconds would be about 1/8".
    Are the pulses repeatable to 1/32" ?
    I would start with PULSIN and get that working, then work on getting more resolution.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    "I hope the goonwave is not vaporware"
    ·
  • SawmillerSawmiller Posts: 276
    edited 2006-01-03 02:02
    ok, will try that..

    thanks

    dan
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-01-03 16:54
    Sawmiller are you feeding the 2.5V + directly into the SX? If this is the case I·am concerned you are not allowing enough margin for noise to provide a strong signal, the motor for the sawmill will generate a significant amount of noise which may interfere with the signal you are trying to measure. Since you are using a differential +/- 2.5V system, why not use an op amp in a unity inverter configuration with the negative RS485 terminal connected to the positive input of the op amp and the positive RS485 terminal connected to the negative op amp terminal, the output will be -((V+)-(V-))=-((-2.5)-(2.5))=5.0V.

    An alternative approach would be to use the comparator function of the SX and use a voltage reference near 1.25V on the V- terminal of the comparator.

    Ask if you need a clarification on any of the jargon I used.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10

    Post Edited (Paul Baker) : 1/3/2006 5:02:08 PM GMT
  • SawmillerSawmiller Posts: 276
    edited 2006-01-03 18:30
    wow, most excellent... will have to look at that and google a bit for it... question is can i use the same circut in reverse ?· for the interogate pulse out ?

    my problem right now is getting the timer circut on the sx48 to work reliablly... i put the output of my query signal to the input of RB.4 so i can simulate the 2 pulses i would have coming in and try to measure between... not working yet, i get a number when i check the capture register, but it never changes no matter what pause i put between the 2 pulse signals..... so will get that fixed first, but thanks for the idea, am really light on circuts, do most of my work on the mill with a cutting torch and a welder

    danhop.gif
  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-01-03 19:06
    No it would require a different type of circuit to generate RS485 signals from a TTL output, the easiest would be to use an interface chip (if you go this route you may be able to do both ways using the same chip). Ill think other methods of generating RS-485 are possible, Ill get back to you once I think about it for a while.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
Sign In or Register to comment.