Pulse Out


Closed Thread
Results 1 to 6 of 6

Thread: Pulse Out

  1. #1
    Join Date
    Dec 2004
    Location
    USA
    Posts
    36

    Question Pulse Out

    What is the difference between:

    1.
    HIGH portx.n
    pause 10
    LOW portx.n

    2.
    portx.n = 1
    pause 10
    portx.n = 0

    3.
    PULSEOUT portx.n, 1000

    ???
    Klaus

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    The main difference will be the amount of code generated.

    Due to my fear(or challenge depending) of bad code space usage, i'll use your example #2. Yeah in that case you must set the according TRIS register but... it's always a good practice to do it anyway
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Dec 2004
    Location
    USA
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    Thanks for the quick reply Steve.

    When I tried it, I found that #3 used the least amount of code, but I'll go back and count those bytes again just to make sure.

    Klaus

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Can be right or wrong depending on how m,any time you use the Pulseout in the same code, do a simple copy/paste 2-3-4-5 times and compare all of your 3 method. I bet the second will take less codespace or really close to. Well just a bet. My brain-cells and fingers feel lazy now...
    Last edited by mister_e; - 24th June 2005 at 05:25.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    Dec 2004
    Location
    USA
    Posts
    36


    Did you find this post helpful? Yes | No

    Default

    Finally had time to run some quick experiments.

    Option #1 added 14 bytes

    Option #2 added 10 bytes

    and Option #3 added a healthy 100 bytes to my code.

    Looks like you were right Steve, but I ran these at 1AM. Results at that time (for me at least) are probably as reliable as results after 3 or 4 beers.

    BR
    Klaus

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by khoog
    Results at that time (for me at least) are probably as reliable as results after 3 or 4 beers
    good apertizer
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Pulse Capture and byte building
    By boroko in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st July 2009, 01:59
  2. Single digit 7 Seg LED clock - PIC16F88
    By thirsty in forum Code Examples
    Replies: 4
    Last Post: - 17th July 2009, 08:42
  3. Replies: 3
    Last Post: - 13th September 2008, 17:40
  4. Not quite got my finger on the pulse
    By Sean_Goddard in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th January 2007, 12:32
  5. Pulse Frequency Multiplication
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 21st August 2005, 10:39

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