Beginner in need of help !!


Closed Thread
Results 1 to 40 of 72

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Beginner in need of help !!

    I will drop the pause below the osc value, thanks for that tip
    Like Tabsoft wrote, you generally want your DEFINEs at the top of the program but it's for readabillity. In reallity it makes no difference because they are not runtime commands.

    Another little note
    Code:
            for loop1 = 1 to 1000
                HIGH LED
                PAUSE 1
            NEXT LOOP1
    What's the purpose of setting the LED high inside the loop?
    There's nothing inherently wrong in doing it but it does take (a little) bit of time.

    Also, now that you're starting to get the hang of it you might want to consider ditching the HIGH/LOW commands and simply set the pin directly, LED=1, LED=0. For this to work you need to clear the corresponding TRIS-bit first (TRISO.2 = 0 ' Set GPIO.2 to output). Doing it this way executes faster and consumes less codespace since it doesn't waste resources clearing the TRIS bit each and every time (which is what HIGH/LOW does for you).

    Again, you're not doing anything "wrong" - it all works fine, I'm just pointing out a couple of things you could improve and take with you to the next project.

    /Henrik.

  2. #2
    Join Date
    Jan 2015
    Posts
    45


    Did you find this post helpful? Yes | No

    Default Re: Beginner in need of help !!

    Thanks guys, I will have a play

    Rob

Similar Threads

  1. Beginner help!
    By Recognize in forum General
    Replies: 14
    Last Post: - 26th April 2012, 15:55
  2. pic24 beginner
    By robertpeach in forum General
    Replies: 23
    Last Post: - 13th August 2009, 12:57
  3. need help! to beginner
    By emilhs in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 6th May 2009, 19:44
  4. Beginner at PB
    By alphahr in forum Off Topic
    Replies: 1
    Last Post: - 21st April 2008, 18:43
  5. Can anyone help a beginner in a struggle?
    By douglasjam in forum mel PIC BASIC
    Replies: 1
    Last Post: - 6th May 2005, 00:29

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