More than a single function


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Jan 2010
    Posts
    88

    Default More than a single function

    Hello All,

    I have been watching videos and seeing actual products that use PICs and have noticed the PICs doing two things at once. For instance, I have witnessed two separate outputs flashing at different rates. Kind of like watching two vehicles with their turn signals on and the flashing lights go in sync and out of phase with each other and then back in sync again.

    How can one do this with PBP? Another example is pwming an output at one frequency while another output is at a different frequency. I thought the PIC can only do one thing at a time. Anyone have any example code?

    Thanks,
    Tony

  2. #2
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: More than a single function

    Anyone have any example code?
    This uses interrupt routines and Timers as one example.

    http://www.picbasic.co.uk/forum/cont...le-LED-flasher

    Have you considered Persistence of Vision? Some visual routines use this by changing a display at 60Hz so the display looks static but other parts of the program are executing many times in between the display refreshes, changing another LED for example.

    Clear as mud?
    It is just a case of perception it is not real magic just an illusion!

  3. #3
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: More than a single function

    This is a good demonstration

    http://www.picbasic.co.uk/forum/cont...ck-by-Pimentel

    of the reinvention of the wheel.

  4. #4
    Join Date
    Jan 2010
    Posts
    88


    Did you find this post helpful? Yes | No

    Default Re: More than a single function

    I was thinking something more along these lines.


  5. #5
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: More than a single function

    Looks simple depending on the pic you are using.
    Post your code.

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: More than a single function

    See post #3 in this thread ...

    MIBAM - (Mirror Imaged Bit Angle Modulation)
    Cylon Scanner
    http://www.picbasic.co.uk/forum/showthread.php?t=10564
    DT

  7. #7
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: More than a single function

    Quote Originally Posted by ERMEGM View Post
    Hello All,

    I have been watching videos and seeing actual products that use PICs and have noticed the PICs doing two things at once. For instance, I have witnessed two separate outputs flashing at different rates. Kind of like watching two vehicles with their turn signals on and the flashing lights go in sync and out of phase with each other and then back in sync again.

    How can one do this with PBP? Another example is pwming an output at one frequency while another output is at a different frequency. I thought the PIC can only do one thing at a time. Anyone have any example code?

    Thanks,
    Tony
    A PIC can only do one thing at a time. Or should I say it can only run one program at a time unlike computers for example. As Darrel has shown PBP can be used to give the effects you want. The appearance that you get of two things being done at the same time is an illusion created by POV.

    If anyone has a way to make a PIC multitask please let me know.

  8. #8
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: More than a single function

    PIC's can do many things at the same time.

    It can only execute one instruction of the program at a time ...
    But simultaneously, all the hardware peripherals are doing their "thing" too.

    Timers are counting, the A/D can be converting, LCD drivers are scanning, USARTS and SSP modules are sending/receiving data... etc.

    It can be difficult to keep track of everything that's going on.
    But when you do get a handle on it ... amazing feats of magic will follow.

    You cannot say PIC's only do one thing at a time.
    DT

  9. #9
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: More than a single function

    Thanks Darrel

    You cannot say PIC's only do one thing at a time.
    That was what I was trying not to say.

    But they can only execute one instruction at a time.
    Is what I was trying to say. But you said it better.

Similar Threads

  1. Single button function
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 40
    Last Post: - 4th April 2020, 18:33
  2. Multiple RETURNS within a single subroutine
    By BrianT in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 21st June 2009, 16:43
  3. single sided PCB
    By schu4647 in forum General
    Replies: 1
    Last Post: - 10th December 2008, 18:22
  4. Replies: 5
    Last Post: - 23rd February 2005, 17:35
  5. Tx and Rx of Single Pin PIC's
    By Dwayne in forum Code Examples
    Replies: 0
    Last Post: - 26th May 2004, 14:55

Members who have read this thread : 1

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