Can a pic do several things at once?


Closed Thread
Results 1 to 32 of 32

Hybrid View

  1. #1
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Squibcakes View Post
    A cheaper option would be to use a hall sensor mounted on your drive shaft and have the pic count the rpm. Convert that to mph and voila! You have your speed.
    (If you want to get even more fancy, you could then hook the pic into your throttle and hey presto!, you've just built a cruise control for your car. Lets see the GPS do that!!)

    Good luck.

    Squib
    I would have considered that but I've already got something similar, its my speedometer, my reason for wanting to do the above is the accuracy of speed derived from GPS signals, where using sensors on the driveshaft or anywhere else will never be anywhere near accurate due to tyyre sizes, and even the tyre pressure dropping would change the speed reading's accuracy thats why I ruled out sensors on the cars mechanical bits

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Talking

    Hi, Karen

    I think you could use one and only Pic ...

    Let's see ...

    Speed : you can't read digits @ more than 2 Hz ... and how often can you retrieve data from the GPS ???
    DS1820 : Needs around 1 sec to make it's measure ... same comment for reading.

    the PWM clock also can be used as the digits Multiplexing clock ...

    Controling Solenoïds : aha ... that look dealing with a turboCharger wasteGate ... which is the PWM refreshing rate 40 Hz ? 100 Hz ? 200 Hz ?

    No matter ... the PWM can Handle that with little trickery ( look at the recent convenient Thread on how to do that ... on MkBasic forum !!! )

    Sooo, that lets plenty of time to make calculations on temp, GPS Data, Solenoid drive ...
    just have a neat "scenario" ( Organigram ) and it's in the pocket !!!

    Alain

    PS: Mhhhh, Blondes put their hands under car hoods now ??? That's really THE news !!!
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Just a thought. I have a satnav and it always says im going 5mph slower than the speedometer says. I also know that the speedometer says im going about 2mph slower than i really am so the satnav is about 7mph out. I know that in theory it should be incredibly accurate but it never seems to be. Might just be my satnav though.

    Are you allowed to use GPS to calculate speed? What about if you lose the signal or something else goes wrong?

    My personal choice would be checking how fast the axle is rotating although i wonder if its possible to do something similar to a laser mouse.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Speed is just to show how much speed you have won with the brand new boost and injection programmings ...

    no critical functions involved ...

    what did you say about planet heating ??? .... ah, it's a transmission packet error !

    Alain
    Last edited by Acetronics2; - 11th April 2008 at 17:19.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Just for the heck of it.
    Here is what we use for our ground applicators.
    http://www.dickey-john.com/products/...sing/radar-ii/
    Doubt if it would work for Karen. Only goes to 66 mph.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Old School

    Hi Karen,
    Call me old school, I believe your speedometer can be more accurate than a GPS bird 20 miles in space. Any decent speedometer shop should be able to put it right on, plus if the car is newer than the early eighties, you can access the VSS sensor for the pulses to operate the PIC.
    JS
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  7. #7
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Hi Karen,
    Call me old school, I believe your speedometer can be more accurate than a GPS bird 20 miles in space. Any decent speedometer shop should be able to put it right on, plus if the car is newer than the early eighties, you can access the VSS sensor for the pulses to operate the PIC.
    JS
    Quote Originally Posted by The Master View Post
    Just a thought. I have a satnav and it always says im going 5mph slower than the speedometer says. I also know that the speedometer says im going about 2mph slower than i really am so the satnav is about 7mph out. I know that in theory it should be incredibly accurate but it never seems to be. Might just be my satnav though.

    Are you allowed to use GPS to calculate speed? What about if you lose the signal or something else goes wrong?

    My personal choice would be checking how fast the axle is rotating although i wonder if its possible to do something similar to a laser mouse.
    Quote Originally Posted by Acetronics View Post
    Hi, Karen

    I think you could use one and only Pic ...

    Let's see ...

    Speed : you can't read digits @ more than 2 Hz ... and how often can you retrieve data from the GPS ???
    DS1820 : Needs around 1 sec to make it's measure ... same comment for reading.


    the PWM clock also can be used as the digits Multiplexing clock ...

    Controling Solenoïds : aha ... that look dealing with a turboCharger wasteGate ... which is the PWM refreshing rate 40 Hz ? 100 Hz ? 200 Hz ?.

    No matter ... the PWM can Handle that with little trickery ( look at the recent convenient Thread on how to do that ... on MkBasic forum !!! )

    Sooo, that lets plenty of time to make calculations on temp, GPS Data, Solenoid drive ...
    just have a neat "scenario" ( Organigram ) and it's in the pocket !!!

    Alain

    PS: Mhhhh, Blondes put their hands under car hoods now ??? That's really THE news !!!
    Why don't people read things fully and properly instead of just seeing the bits they want?
    In the order highlighted (and not highlited) above...

    GPS Speed accuracy:

    speed measurement with accuracy approaching 0.01 knot (Knot is used by GPS satellites and has top be converted to MPH or KPH) is possible by using GPS Doppler data.
    Way too complex to explain how the speed is calculated here in a few lines, but If you want to read up about it I suggest you start here http://nujournal.net/HighAccuracySpeed.pdf


    HOW did you measure your speed?
    and how did you work out your sat nav was 5mph out?
    this is actually impossible once it has a lock on 3 or more satellites, again read the above article.
    Also i suggest if your still not sure then have your sat nav compared against a police calibrated speedometer, or laser gun, they are calibrated.

    Yes I am allowed to use GPS for speed, nothing in the rulebook says I cant, and besides If you had seen what I said earlier, I have a speedometer in the car already, the GSP speed will just be a backup so I can see A: my "REAL speed" and B: have a warning if I go over a preset limit (which I set in the program)

    The GPS unit I will be using will be able to calculate data at a frequency rate of between 1 and 5hz, depending on how I program it.
    Most standard "off the shelf" gps units output data at 1Hz.
    The GPS will only be SENDING DATA to the pic, the pic will NOT be talking to the gps unit once it's set up.

    As to update speed, on a bynote:
    ALL the calculations regarding converting gps data to speed is already done in the GPS unit, the ONLY thing the pic will be doing in regard to that, is taking a serial output from the gps, looking for a certain data sentence, and just displaying the speed on a 7 segement display.
    No major calculations in the pic, other than converting knots to MPH.

    The DS1820? I dont see the relevance as it's only going to be measuring the outside temperature from behind the front bumper of the car and does not need to be highly accurate or update often.

    Controlling Solenoids:
    I dont see a problem at all with this, all I'm going to be doing is sending either 1 or 2 ports high (switching the solenoid) once a certain state has been reached, and they will STAY high untill I finish my journey or decide to turn them off before that.
    There is no high speed switching, its only on once and thats it.
    Turbo? it wont be going anywhere near the turbo at all, it was never mentioned.

    I asked what to me seemed to be a simple question because I'm new to programming Pic's, in fact I only got the development board working this week, now to you "experts" it may have seemed a stupid question, but like I said in the beginning of this post, I just wanted a straight answer .. can it be done or do I need 2 pics.

    Oh and for those that didn't see it earlier, i want to use GPS because of the accuracy, IF I was to use a sensor connected to the driveshaft or anything it's never going to be as accurate, and would need a mechanic to fit it and so on, the gps option I can program myself, so no other people needed to work on my car.

    btw whats wrong with blondes working under car hoods?
    Women can do almost anything these days, this isnt 1960 anymore.

  8. #8
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    What truely amazes me is how people ask for help and opinions and then get pissed off when someone offers to help. Go help yourself!
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  9. #9
    Join Date
    Mar 2008
    Location
    Texas, USA
    Posts
    114


    Did you find this post helpful? Yes | No

    Default

    Karen, don't be too hard on them. By nature, we (PIC'ers) want to fix every problem in the world, even if it's not broken. They meant well and I don't think anyone thinks your project is stupid. Chock it up to TGIF brain fog!
    No, I'm not Superman, but I did stay at a Holiday Inn Express last night!

  10. #10
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I compared my satnav against my speedometer and found it to be 5mph different. Unfortunately i dont have access to police speed checking devices unless i want to pay a fine. Come to think of it i cant remember how i worked out my speedometer was 2mph out. I do remember that it was about that though. Obviously it is just "about" i dont have a way of testing things accurately.

    My satnav is usually connected to about 5 satellites at a time but i have noticed that even a little bad weather can cause problems. I dont think its that reliable and my satnav is supposed to be one of the best ones out.

    Why exactly do you need something thats more accurate than a speedometer? I can understand if you would rather see a number instead of a dial but why go to the extreme of GPS?

    I understand that wheel size and tyre pressure can affect your mph but i thought you should have it callibrated for different wheel sizes. as for tyre pressure i dont think it will affect it that much. Will your display have a decimal point? Can it display "10.54mph"? Unless you have a decimal point then i dont think it would make a difference

  11. #11
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Question : Can you get a pic to do more than one thing at once?

    Definitive Answer : Yes and No (answers like this is a girl thing).

    Explanation : The PIC can ONLY execute one program instruction at a time at any instant in time. So technically the answer is NO. However there are two riders to this...

    1. Some PICs are packed full of additional hardware. Those hardware elements operate independently from the controlling processor (although they may be synchronised and share things like the clock). So, YES, you can SIMULTANEOUSLY perform an ADC operation, Hardware PWM, Comparator Function, Capture Compare, SERIAL I/O, Op-Amp operation etc etc (providing you have a PIC with the appropriate hardware built-in) whilst your software is doing something completely different AT THE SAME TIME.

    2. Whilst I said that the PIC can only execute one instruction at any given instant (and this holds true) the definition of an 'instant' is something else altogether. If you now define 'an instant' to be 1mS (one millisecond), a 40MHz PIC can execute 10,000 instructions in that 'instant'. To the casual observer, the PIC can be handling multiple software tasks simultaneously, in truth though, it is still only doing ONE thing at a time (just happens to be doing it damn quick).

    So, here is where you work out EXACTLY what you need your PIC to do, and what your particular definition of 'an instant' is going to be. That will define if you can get your single PIC to perform all the tasks you need it to in your available time slot.

  12. #12
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by karenhornby View Post
    I would have considered that but I've already got something similar, its my speedometer, my reason for wanting to do the above is the accuracy of speed derived from GPS signals, where using sensors on the driveshaft or anywhere else will never be anywhere near accurate due to tyyre sizes, and even the tyre pressure dropping would change the speed reading's accuracy thats why I ruled out sensors on the cars mechanical bits
    Well thats your call, but as others have said, this approach would be more accuate than a gps. Whats more, the car needs to be moving to get an accurate speed (and direction). It would look a bit funny when your stopped at the traffic lights and your display shows you are moving at 1mph. I guess you need to take this into concideration and perhaps using a sensor on the shaft show zero speed when the car is stopped.

    Oh yeah, and as far as nmea is concerned, the pic (speed) can handle it just fine untill the you start processing very long strings where you run out of memroy.

    One problem I have had though is when sitting in a waitstring($GPVTG) waiting for that string to arrive, the pic can't do anything else. In those cases you could use a second pic just.... but then it all starts to get messy.

    Thats my 2c worth.

    Squib

    squib

Similar Threads

  1. SMS via pic
    By kenandere in forum GSM
    Replies: 15
    Last Post: - 10th March 2010, 10:00
  2. Replies: 67
    Last Post: - 8th December 2009, 02:27
  3. Midi, Interrupts and Pic better than SX28?
    By Lajko in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th September 2008, 00:26
  4. pic to pic ir link versus wired link : help please anyone
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th May 2008, 21:01
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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