1 port with multi input and output function

Status
Not open for further replies.

yce_kelvin

New Member
hi, i am new on PIC.. i got a project which used PIC16C57C which are use for timer counting.
The portC as and output of 4 seven segment display and also the input of a time setting switch.

so, initially, i write the program, i configure the port c at output.. but then after i display the '0000' on 7 segment, i need to proceed to process 2 which detect the input of port c, to check the switch which got press and got signal in to MCU. So, how can i configure the port c bo be input??

what metter i try to configure it for eg:
....
....
movlw b'00001111' ; -- port c pin 0,1,2,3 as input
movwf trisc

btfsc portc,0
goto result
...
...
but it still not functioning..

is that possible for a port that change from output to input suddenly?

my other I/O port already fulfill with other application... any one can give me some suggestion? thank you very much...

wish some one can reply me as soon as posible.. thanks.
 
Code:
   movlw b'00001111' ; -- port c pin 0,1,2,3 as input 
   movwf trisc

Use TRIS PORTC instruction for PIC16C57C.

Code:
   movlw b'00001111' ; -- port c pin 0,1,2,3 as input 
   TRIS PORTC
 
to motion,
ok... i will try it now.. thank you so much.. later let u know success or not..

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