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 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.

  2. #2
    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.

  3. #3
    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!

  4. #4
    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

  5. #5
    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.

  6. #6
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    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. The PICs are packed full of hardware. The hardware elements operate independently from the controlling processor (although they may be synchronised and share elements 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.
    Thanks Melanie, that was exactly what I was looking for and it answered all my questions in one go

    I realise I've got a lot of learning to do yet as regards and interupts and various other functions, but It's given me the urge to learn a lot more and work hard at ait till I get it doing exactly what I want,
    I'm reasonably good with analogue electronice and originally I was just going to do something the old fashioned way, untill I realised that If I learnt how to program I can do loads more.

    By the way, sorry to all concerned if my previous post seemed to be a bit "hostile" I was getting pretty wound up with everyone assuming things and not taking any notice of what I'd already said.
    Don't worry though, I wont ask stupid questions again, I'll just sit and read from now on

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


    Did you find this post helpful? Yes | No

    Default

    I should probably keep quiet...but

    I thought post #3 did a fair job at answering the question too.

    And about the stupid questions and reading more.
    If people would do that, then we would not need this forum.

    Personally I am happy to see new people come in that want to learn and not just copy paste code.

    As far as the accuracy of the GPS. The only way to be more accurate is to use a DGPS set up. Now that the WAAS system has been in place for a few years, I think most commercial products have that built in.
    Dave
    Always wear safety glasses while programming.

  8. #8
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    A PIC can indeed do several things at once. It's just a matter of getting familiar with
    hardware options the PIC you're using has. Like Melanie already said, firmware is going
    to execute line-by-line, but built-in hardware goodies open up a whole new avenue to
    real multi-tasking. You just need to get familiar with all your options.

    And don't hold back on posting or asking questions here. That's what this forum is for.

    I learn something new just about every time I login here just by reading & thinking about
    some of the questions asked, so keep em coming. I still have a lot to learn myself..;o}
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by karenhornby View Post
    By the way, sorry to all concerned if my previous post seemed to be a bit "hostile" I was getting pretty wound up with everyone assuming things and not taking any notice of what I'd already said.
    Don't worry though, I wont ask stupid questions again, I'll just sit and read from now on
    <font color=red> <h3><b>It did seem hostile, funny thing, big red letters are like that. . .</font color></b></h3>Apology accepted!
    I cannot grasp what <b>Automotive</b> purpose requires a speed measurement which requires accuracy equaling two hundred thousandths of an inch per second (5mmps), weapons systems yes, cars, no.<br>Questions are seldom stupid or unwelcome, often they are well worn due to having been asked several times in the past, but not stupid. Please ask your questions, learn from those who exceed your personal knowledge<b> and</b> from those who do not.
    Last edited by Archangel; - 12th April 2008 at 00:17.
    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.

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


    Did you find this post helpful? Yes | No

    Unhappy

    Hi, Karen

    You seem tired ... and should rest some little time.

    I was just explainng you HOW and WHY your different things could be done by the same Pic ...
    By the way, add the regulating calculations to the duties the Pic will have to do ...

    Will you use PID or Fuzzy to drive your Solenoïd ???

    a little question :


    This Doppler shift is directly
    proportional to velocity of the receiver along
    the direction to the satellite, regardless of the
    distance to this satellite.
    Must I think from that it can't work in a deep forest, a narrow mountain valley, or between high buidings, ???

    Alain

    PS: That's you who talked about "blondes" at first ... not me !
    ************************************************** ***********************
    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 " !!!
    *****************************************

  11. #11
    Join Date
    Mar 2008
    Posts
    79


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    Hi, Karen

    You seem tired ... and should rest some little time.

    I was just explainng you HOW and WHY your different things could be done by the same Pic ...
    By the way, add the regulating calculations to the duties the Pic will have to do ...

    Will you use PID or Fuzzy to drive your Solenoïd ???

    a little question :



    Must I think from that it can't work in a deep forest, a narrow mountain valley, or between high buidings, ???

    Alain

    PS: That's you who talked about "blondes" at first ... not me !
    LOL
    thanks everyone
    The need for 100% accuracy 24/7 isnt essential, I was actually thinking of having the display so I can see when I'm getting near the speed limit the cops WILL ticket me
    and
    Its mainly going to be there as a backup to the actual speedo (they have been known to break) and the other reason.. is the reason someone (wish I could remember who) when asked why he did something said:
    because I can.
    I just thought it would be a good way of learning how several part of the pic work, how to program the various bits, see it working everytime I drive, and more important,. anytime anyone asks about it I can not only say waht it was, but also say "I did it"
    yes.. I admit i'll like boasting once its finished

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