Beginner help!


Results 1 to 15 of 15

Thread: Beginner help!

Threaded View

  1. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,172


    Did you find this post helpful? Yes | No

    Default Re: Beginner help!

    Welcome aboard!

    I'm not sure what you want to accomplish. Do you want to make 2 LEDs blink one after another, you just turn the LEDs ON/OFF directly:

    - PIC wired as in PBP manual (section 2.4 in v2.60).
    - have one LED on pin B0 as in example.
    - have another just like it on pin B1.
    - configure your particular PIC properly.
    - define proper oscillator and then do this:

    Code:
    TRISB = %00000000    ' set all Port B pins as output
    
    LED1 = PortB.0           ' assign LEDs to Port B
    LED2 = PortB.1
    
    LOOP:
    
    LED1 = 1                   ' turn ON LED 1
    LED2 = 0                   ' turn OFF LED 2
    PAUSE 100                ' wait a bit so the human eye can catch the blink
    
    LED1 = 0                  ' alternate the LEDs
    LED2 = 1
    PAUSE 100
    
    GOTO LOOP              ' start over
    If you use Port A, there may be other considerations in the configs (section 2.5.1).

    This is off the top of my head. It's not written for optimization, it's written so you can understand easily what is happening.

    If you dig around in your PBP folder, you will find sample programs. I'm not on my programming PC so I can't tell you exactly where. There is a BLINKY example in there already.

    Robert



    EDIT: I don't get it, code comments used to line up properly before....
    Last edited by Demon; - 24th April 2012 at 19:03. Reason: trying to line up the code properly

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