Can't Blink 2 LEDs


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2007
    Posts
    6

    Default Can't Blink 2 LEDs

    I am trying to blink 2 LEDS, like the railroad cross signal, but can't get it to work on a 12f629. I need to use the codes defined at below, which will make reassigning variables for other purposes easy. When I run this, only the "LEDBottom" blinks, which is that last one that the code executes. LEDTop stays on permanently. Can someone help?

    Here's what I have:

    'set input/output pins
    TRISIO = %111100 '1=input, 0=output

    'define variables
    LEDTop var GPIO.0
    LEDBottom var GPIO.1
    TurnOn var byte
    TurnOff var byte

    'set variables
    turnon = %0
    turnoff = %1

    'start of program
    LEDtop = turnoff
    Ledbottom = turnoff

    InputLoop:
    ledtop = turnon
    ledbottom = turnoff
    pause 500
    ledtop = turnoff
    ledbottom = turnon
    pause 500
    goto inputloop




    P.S. I don't want to use this:
    InputLoop:
    GPIO=%000001
    pause 500
    GPIO=%000010
    pause 500
    GOTO InputLoop

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    Hi,

    May be just
    Code:
    CMCON = 7
    Missing ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Oct 2007
    Posts
    6


    Did you find this post helpful? Yes | No

    Talking It works...

    Thanks Acetronics!!!

Similar Threads

  1. Code to control 4 LEDs and 2 servos
    By The Master in forum Off Topic
    Replies: 2
    Last Post: - 26th November 2008, 13:33
  2. USB-FTDI[UM232R] with PIC16f877a
    By bjox in forum USB
    Replies: 1
    Last Post: - 23rd February 2008, 22:40
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  4. Using LEDs as light sensors
    By skimask in forum Code Examples
    Replies: 3
    Last Post: - 30th December 2006, 22:19
  5. Can anyone help a beginner in a struggle?
    By douglasjam in forum mel PIC BASIC
    Replies: 1
    Last Post: - 5th May 2005, 23: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