Simple If.. Then help:


Results 1 to 7 of 7

Threaded View

  1. #1
    Tear's Avatar
    Tear Guest

    Default Simple If.. Then help:

    In this very simple code I am just trying to play with the if statement. I have set port A pin 0 to be an input and have it hotwired to be high. However, the led connected to port B pin 0 WONT TURN ON. The led for port B pin 1 is just a heartbeat. I know that my circuit is wired correctly, and I can't see anything wrong in this code. Any help would be appreciated.



    TRISA.0 = 1
    loop1:
    if PORTA.0 = 1 then
    PORTB.0 = 1
    endif
    high PORTB.1
    goto loop1
    end


    EDIT: I went back and changed the line:

    PORTB.0 = 1

    to
    high PORTB.0

    After this change the led is always on even when I disconnect PORTA.0 from the 5 volt supply. It seems as if the IF statement is being ignored. Also, I dont have resistors connected to any of the PORTA or PORTB pins. I dont think this is the problem though.
    Last edited by Tear; - 17th June 2005 at 17:13. Reason: Additional information

Similar Threads

  1. Simple RF remote control code
    By Bruce in forum Code Examples
    Replies: 13
    Last Post: - 22nd January 2014, 10:45
  2. Simple Blinking LED - WTF!!
    By johnnylynx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 1st February 2010, 06:19
  3. Simple LCD code not working!...WHY?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 29th November 2009, 19:48
  4. Replies: 0
    Last Post: - 2nd February 2009, 23:23
  5. Replies: 4
    Last Post: - 7th September 2005, 14:11

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