Simple problem?


Results 1 to 6 of 6

Thread: Simple problem?

Threaded View

  1. #1
    Join Date
    Aug 2006
    Location
    Arizona
    Posts
    5

    Question Simple problem?

    Hi,
    I can't figure out what I'm sure is a simple solution to my problem. I have a NO button that I am trying to just turn on/off an led. I'm using PicBasic (not the pro version) and a 16F818 chip. I've attached my schematic and my code follows. My problem is: when I first power up LEDa and LEDb light up, and when I push the button LEDb turns off and LEDa stays on. My code has nothing to do with LEDb (B1), yet pushing the button affects it. And LEDa stays on constantly. Here's my code:

    POKE $8F,%01100000 'SET CLOCK SPEED @4MHZ
    SYMBOL TrisB=$86 'PortB data direction Address
    SYMBOL PortB=$06 'PortB Pin Address
    SYMBOL led=Pin0
    SYMBOL pb=Pin7

    Poke TrisB,128 'portB 0 to 6 outputs, 7 input

    Poke PortB,0 'All off to start
    Pause 1000

    Start:
    If pb=1 then light '??
    LOW led 'LED off
    GOTO Start 'Return to start

    light:
    High led 'LED on
    GOTO Start 'Return to start

    END

    Thanks in advance,
    Ed
    Attached Images Attached Images
    Last edited by FastEddie; - 2nd March 2007 at 05:26.

Similar Threads

  1. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 20:17
  2. Simple program - Strange problem!
    By Megahertz in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 19th December 2009, 22:52
  3. 16F676 Really simple, stupid problem - Help!
    By Jayhovah in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 1st May 2008, 03:28
  4. PIC18F4525 & LCD simple code problem
    By aggie007 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd November 2007, 16:29
  5. Need help on pic to pic flow control (simple problem I think)
    By khufumen in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th January 2006, 00:34

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