![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
I just want to ask how to correctly initialize a PORT in PIC16F877a cause its my first time using usually i used PIC16F84A due to more inputs a shift to pic16f877a but my problem is that i cannot correctly initialize PORTA of PIC16F877a due to the ADC function sharing with the port. Because i want to used my PORTA as an input for my sensors which i cannot distinguish either analog or digital.
Is the common sensor which is compose of IR and Phototransistor output an analog or digital signal? |
|
|
|
|
|
|
(permalink) | ||
|
Quote:
Quote:
|
|||
|
|
|
|
|
(permalink) |
|
If you look in the data sheet it has this code snippet to setup port A.
Code:
BCF STATUS,RP0 BCF STATUS,RP1 ; Bank0 CLRF PORTA ; Initialize PORTA by ; clearing output ; data latches BSF STATUS, RP0 ; Select Bank 1 MOVLW 0x06 ; Configure all pins MOVWF ADCON1 ; as digital inputs MOVLW 0xCF ; Value used to ; initialize data ; direction MOVWF TRISA ; Set RA<3:0> as inputs ; RA<5:4> as outputs ; TRISA<7:6>are always ; read as '0'. Mike. |
|
|
|
|
|
|
(permalink) |
|
Im using a pic-lite compiler it doing my program, im not good in assembly, can you convert this to a c code.
|
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Need help badly on Inchworm and MPLAB | thushy | Micro Controllers | 14 | 11th March 2007 06:05 PM |
| 8051 port initialization | 4electros | Micro Controllers | 5 | 30th January 2007 12:34 PM |
| PIC16F877A interfacing with Serial Port | jasbertfalutine | Micro Controllers | 10 | 18th June 2006 07:25 AM |
| Chip talk | dreamproject | Electronic Projects Design/Ideas/Reviews | 8 | 2nd April 2005 07:24 PM |
| Motor control interface | dreamproject | Micro Controllers | 0 | 31st March 2005 03:48 AM |