sx-48 interuppts
Sawmiller
Posts: 276
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
·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
SXB
6K
Comments
thanks for looking
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"
·
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
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"
·
thanks
dan
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
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
dan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10