led blink help needed


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2014
    Location
    Pakistan
    Posts
    19

    Default led blink help needed

      • hello
        I am beginer and practicing small codes so here is a code and i need help about it
        --------------------------------
        define osc 4
        Trisb =%01111111
        do
        high portb.7
        pause 300
        low portb.7
        pause 300
        loop until portb.2 = 0
        ---------------------------
        when i run this code led on start blinking but when i press button and make portb.2 low then operation of led should stop but it doesent stop ,it keep blinking whether there is 1 or 0 at portb.0
        what is wrong this code and how to correct it please guide me thanks







  2. #2
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: led blink help needed

    Which PIC are you using??

    make sure that you have analog inputs turned off.

    Most PIC's defalult to analog inputs turned on.

    Check the ANSEL register (or what ever the analog select register is for the PIC you are using)

    the "HIGH" and "LOW" command can mask this problem as it somehow disables the analog for that pin during that command (or something like that)
    anyway as I said, most PIC's default to analog inputs enabled.
    You need to turn off the analogs if you are just trying to blink an LED.

    Do you have the datasheet for your PIC?
    Last edited by Heckler; - 19th March 2014 at 16:13.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

Similar Threads

  1. 18F2550 and Blink Led
    By nuno106 in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 21st September 2022, 12:01
  2. need led blink program
    By asifiqbal in forum General
    Replies: 6
    Last Post: - 4th March 2014, 11:26
  3. Led blink and interrupt
    By critix in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th April 2012, 11:31
  4. blink led 12f683
    By mel4853 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 19th January 2010, 22:39
  5. Using HPWM to blink an LED?
    By Christopher4187 in forum General
    Replies: 8
    Last Post: - 7th August 2006, 00:48

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