Why we have to set the adcon1 in this 7-segment display using PIC 16F877?

Status
Not open for further replies.

newbie111

Member level 2
Joined
Nov 29, 2009
Messages
51
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
h.k
Activity points
1,609
adcon1

**broken link removed**


Code:
MOVLW  0X06  
  MOVWF  ADCON1

This example is to make a "1' on the 7 segment

how come we have to set the adcon1 ?


Thanks
 

Re: adcon1

Hi,

When your PIC powers up, the default ADCON1 sets all the analogue ports ON.
So as you are wanting to use the ports as Digital you must appropriately set them by means of loading 0x06 to ADCON1.
See the datasheet for further details of how to use ADCON1.

Notice that its only setting them to Digital, you still have to set the TRIS register for the input or output direction you require.
 

    newbie111

    Points: 2
    Helpful Answer Positive Rating
Re: adcon1

Thank you for your reply.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…