Help/Explanation needed


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2010
    Posts
    2

    Default Help/Explanation needed

    Hi all. I'm new to this forum and to PicBasicPro and need some help.

    This is my code:
    TRISA = 0
    Main:
    Pause 250
    High PortA.0
    Pause 250
    High PortA.1
    Pause 250
    Low PortA.0
    Puase 250
    Low PortA.1
    Goto Main
    End

    (Tried this as well: Symbol LED = PORTA.0, High LED AND PORTA.0 = 1)

    My expectation is that PORTA.0 will go high, then PORTA.1 will go high while keeping pin 0 high. But this is not the case. When I make any pin high, the rest go low. Is this the correct bahaviour?

    I underdstand PortA = 7 will cause pins 000111 to go high, but surely portA.x should not affect the state of the other pins? or am I wrong?

    I'm using a PIC16F676 with PicKit 2 Programmer.

    Thanks in advance

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Welcome to the forum.

    The PIC you are using has analog on PORTA. You will need to make it digital.
    Add this near the top of your code
    Code:
    ANSEL=%00000000
    CMCON=%00000111
    And this thread will be some good reading
    http://www.picbasic.co.uk/forum/showthread.php?t=561
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Feb 2010
    Posts
    2


    Did you find this post helpful? Yes | No

    Default

    Thanks a million. it worked!

Similar Threads

  1. ASCII Viewer Needed
    By sougata in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 19th January 2008, 05:29
  2. Code space needed with MPASM??
    By BrianT in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th September 2007, 10:24
  3. Programers Needed Still !
    By picawiner in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 5th June 2007, 13:51
  4. Newbee Hardware PWM clarification needed
    By emmett brown in forum General
    Replies: 3
    Last Post: - 9th July 2006, 09:18
  5. Circuit needed to allow a PIC to turn something on or off
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th October 2005, 21:17

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