Re: Could PIC handle this?
From: Noel Henson (noel_at_noels-lab.com)
Date: 12/14/04
- Previous message: Craig Bergren: "Re: HP 64000 using 6800 Pascal Cross Compiler"
- In reply to: johannes m.r.: "Re: Could PIC handle this?"
- Next in thread: Nicholas O. Lindan: "Re: Could PIC handle this?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 13 Dec 2004 18:03:29 -0800
johannes m.r. wrote:
> Noel Henson wrote:
>> David wrote:
>>> Could a PIC handle interfacing via rs232 with a GPS unit, and
>>> comparing the location against a list of ~5000 stored positions, and
>>> alerting (LED/LCD) if any points are considered close enough (~1-2km,
>>> using haversine formula, perhaps)?
>>>
>>> I guess the points would have to be stored on a CF/MMC card. They
>>> would be updated/changed time to time...
>>
>> I think even a smallish PIC could handle this. If you needed to go really
>> inexpensive, you could use a part without a USART and emulate it
>> yourself.; For memory you could go with an 8-pin serial FLASH part and
>> skip the overhead of CF/MMC; unless of course the storage had to be
>> removable.
>
> I'd really be interested in that. Doesn't that mean comparing the distance
> from a specified point on earth to one of 5000 different positions?
> According to a quick google search, which reveals this article:
> http://en.wikipedia.org/wiki/Great_circle_distance there're some
> calculations which are rather complex for a 8 bit processor I guess :-?
>
> Regards,
> j.
There are some calculations but they're not that bad. You simply need the
magnitude of the distance, not the actual distance. You simply square the
differences between the longitude and latitude of each pair of points you
are comparing. There is no need for a square-root. I do this on another
project; only about 2000-3000 items in my lists. You can also do some
optimizations by simply comparing the sum of differences in longitude and
latitude. It's not perfect but it will get you in the ball park quickly.
Then you can use magnitude to select the best from the presorted set. You
may also be able to store the data in FLASH in an optimized way; perhaps
twice, one ordered by longitude, spiraling by latitude and once the
opposite way.
What kind of response time is necessary?
How close are the points? Miles? Feet?
Noel
- Previous message: Craig Bergren: "Re: HP 64000 using 6800 Pascal Cross Compiler"
- In reply to: johannes m.r.: "Re: Could PIC handle this?"
- Next in thread: Nicholas O. Lindan: "Re: Could PIC handle this?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|