Using PORTA as output


Closed Thread
Results 1 to 6 of 6
  1. #1

    Default Using PORTA as output

    Hi all,

    I have a problem about using 16F628's PORTA as an output. I want to use only one bit for an output but I cant.
    CODE :

    Best Regards.

    @ DEVICE pic16F628a
    @ DEVICE pic16F628a, WDT_ON
    @ DEVICE pic16F628a, PWRT_ON
    @ DEVICE pic16F628a, PROTECT_OFF
    @ DEVICE pic16F628a, MCLR_OFF
    @ DEVICE pic16F628a, INTRC_OSC_NOCLKOUT

    TRISB = %00000000
    TRISA = %11111110
    PORTA = 0
    PORTB = 0

    OPTION_REG.7=1
    CMCON=7

    MAIN:
    HIGH PORTA.5
    PAUSE 1000
    LOW PORTA.5
    PAUSE 1000
    GOTO MAIN

    END

  2. #2
    Join Date
    Jun 2006
    Location
    Greece
    Posts
    302


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by microcozmoz View Post
    Hi all,

    I have a problem about using 16F628's PORTA as an output. I want to use only one bit for an output but I cant.
    CODE :

    Best Regards.

    @ DEVICE pic16F628a
    @ DEVICE pic16F628a, WDT_ON
    @ DEVICE pic16F628a, PWRT_ON
    @ DEVICE pic16F628a, PROTECT_OFF
    @ DEVICE pic16F628a, MCLR_OFF
    @ DEVICE pic16F628a, INTRC_OSC_NOCLKOUT

    TRISB = %00000000
    TRISA = %11111110
    PORTA = 0
    PORTB = 0

    OPTION_REG.7=1
    CMCON=7

    MAIN:
    HIGH PORTA.5
    PAUSE 1000
    LOW PORTA.5
    PAUSE 1000
    GOTO MAIN

    END
    You have only PORTA.0 as output in TRISA

  3. #3


    Did you find this post helpful? Yes | No

    Default

    This code is only for example.Change High PORTA.5 to High PORTA.0 ...

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


    Did you find this post helpful? Yes | No

    Default Rtfds !!!

    Hi, µcosmos

    a look at the datasheet could show you the reason why ...

    See table 3.2 " Pinout assignment " ... or table 5.1 !!!

    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 " !!!
    *****************************************

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Thank you for your advice!! I must rtfds....

  6. #6
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    When using HIGH or LOW commands, it does not matter whether the pin is registered to be as an input or output pin.

    HIGH and/or LOW already set the pin as an output pin.

    Just make sure that the pin is not an input only pin.


    ----------------------

Similar Threads

  1. Bit Banging input to output on PIC16F876A
    By Bronurstomp in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 26th June 2008, 19:50
  2. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 03:46
  3. HSEROUT Newbie question/problem
    By Mark Scotford in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 11th July 2006, 14:44
  4. Output PIC module
    By freelancebee in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th September 2005, 20:10
  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