Is it possible?
Thierry Donze
Posts: 4
I have to find an interface to transform in RS232 format an analogic format supplying 200 pulses per nautical mile. This means that if we start from a minimal speed of 0,1 Knot,·a pulse are coming every 180 seconds, is there any function able to measure this and if not if there any possibility to make Stamp 2 working with a background task?
Thansk for your answers
Thansk for your answers
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
1. Measure the time between a pulse.
2. Report the time via RS-232 to some RS-232 terminal device.
3. Go back to 1 and repeat.
It sounds like your device is generating pulses every 180 seconds, 200 seconds, etc based on the speed the boat is going -- 200 pulses per nautical mile, with the spacing between pulses depending on speed.
The BS2 does NOT have a 'background' task, or a multi-tasking operating system. However, 180 seconds is a very long time for the BS2, so it can be doing something in the background while measuring the time between two pulses.
Now, it also has the 'PULSIN' command, which is accurate to 2 micro-seconds, and while doing that it can't do anything else (like do a SEROUT command). However, your timing needs seem to be much wider than that.
You might try the 50 mSec 'tick' generator IC at http://www.rhombus-tek.com/co-processors.html
This will give you an accurate 'tick' clock you can use to time long duration events like the 180 seconds between pulses. And they talk about a PBasic level multi-tasking approach you can use.
For sure during the test, I will have maybe to separate the calculation, when the speed will become too high around 30 Knots
I will check it asap, and will keep you inform as you were answering me.
Thanks and regards for your help
1. Does the length of the pulse change with speed? If it does, maybe you can measure the length of the pulse at low boat speeds, and measure the time between pulses at high speeds.
2. You could use an external clock/calendar chip. There are app notes on how to interface to one. If the time between pulses it so long that the FREQIN statement times out, then use the time from the calendar chip to calculate the interval.