Simple question regarding ports


Closed Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Posts
    13

    Default Simple question regarding ports

    Hi,

    Im using ADC with a PIC16F877A.

    1. Why do I see people using TRISA = %111111111 when port A is only 6 bits ?

    2. When using analog input and ADCIN, is channel 0 to 7 referring to AN0 to AN7 ?


    Thank you. I tried searching but couldnt find anything useful because the keywords are not specific enough.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rngd View Post
    Hi,
    1. Why do I see people using TRISA = %111111111 when port A is only 6 bits ?
    They are addicted to it. It does not matter whether you use all 8-bits or only 6-bits.
    DataSheet says : TRISA<7:6>are always read as '0'.

    Quote Originally Posted by rngd View Post
    Hi,
    2. When using analog input and ADCIN, is channel 0 to 7 referring to AN0 to AN7 ?
    DataSheet says:

    Code:
    <font color="#000080"><b>BIT </b></font><font color="#FF0000"><b>5</b></font>-<font color="#FF0000"><b>4</b></font>-<font color="#FF0000"><b>3   </b></font>CHS2:CHS0: Analog Channel <font color="#000080"><b>SELECT </b></font>bits
        <font color="#FF0000"><b>0</b></font>-<font color="#FF0000"><b>0</b></font>-<font color="#FF0000"><b>0 </b></font>= Channel <font color="#FF0000"><b>0 </b></font>(AN0)
        <font color="#FF0000"><b>0</b></font>-<font color="#FF0000"><b>0</b></font>-<font color="#FF0000"><b>1 </b></font>= Channel <font color="#FF0000"><b>1 </b></font>(AN1)
        <font color="#FF0000"><b>0</b></font>-<font color="#FF0000"><b>1</b></font>-<font color="#FF0000"><b>0 </b></font>= Channel <font color="#FF0000"><b>2 </b></font>(AN2)
        <font color="#FF0000"><b>0</b></font>-<font color="#FF0000"><b>1</b></font>-<font color="#FF0000"><b>1 </b></font>= Channel <font color="#FF0000"><b>3 </b></font>(AN3)
        <font color="#FF0000"><b>1</b></font>-<font color="#FF0000"><b>0</b></font>-<font color="#FF0000"><b>0 </b></font>= Channel <font color="#FF0000"><b>4 </b></font>(AN4)
        <font color="#FF0000"><b>1</b></font>-<font color="#FF0000"><b>0</b></font>-<font color="#FF0000"><b>1 </b></font>= Channel <font color="#FF0000"><b>5 </b></font>(AN5)
        <font color="#FF0000"><b>1</b></font>-<font color="#FF0000"><b>1</b></font>-<font color="#FF0000"><b>0 </b></font>= Channel <font color="#FF0000"><b>6 </b></font>(AN6)
        <font color="#FF0000"><b>1</b></font>-<font color="#FF0000"><b>1</b></font>-<font color="#FF0000"><b>1 </b></font>= Channel <font color="#FF0000"><b>7 </b></font>(AN7)
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3
    Join Date
    Feb 2008
    Posts
    13


    Did you find this post helpful? Yes | No

    Default

    Oh OK. Thank you very much.

Similar Threads

  1. Question on IO ports
    By studysession in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th February 2009, 18:10
  2. Really simple question for you experts :)
    By lew247 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th June 2008, 01:43
  3. SIMPLE question
    By ngeronikolos in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 5th February 2008, 18:27
  4. really simple, dumb question
    By picster in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 3rd March 2007, 22:02
  5. 16f872. config ports and serin question.
    By kitcat in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th July 2005, 03:03

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