I sent this messsage earlier today from my machine at work and think I used the wrong address, dammm machine:-( Hi all, Hope this gets through only I'm not using my normal PC base! Having some problems, code I think with a 16C64 and port B. The code snippets below show 'A the initialisation of the ports and 'B the code to talk to the port. The idea is that at the start of the prog, data from some BCD switches is read into the pic. The problem is that whilst the pulses and port A are working correctly, port B aint. It seams to be sitting high, 5v. 10k's pulling it down only take the voltage down to about 1.4v, thus any lines high from the BCD switches are not distinguishable from the others and the value read from the port is always FF. If I completely ground the lines from the port this has no effect other than the pic seems to ignore any value from this port. When the lines are grounded, a current of about 160uA is flowing through them. What have I forgotten or got wrong? Code A init clrf porta ; clear port clrf portb ; clear port clrf portc ; clear port clrf portd ; clear port clrf porte ; clear port bsf pa1 ; selected page 1 movlw b'00000101' ; set initialisation of rtcc movwf optreg ; load option reg with prescale of 64 movlw b'1111' ; set port a i/o movwf trisa ; set the ddr movlw b'11111111' ; set port b i/o movwf trisb ; set the ddr movlw b'00000000' ; set port c i/o movwf trisc ; set the ddr movlw b'00000000' ; set port d i/o movwf trisd ; set the ddr clrf trise ; set port e i/o bcf pa1 ; selected page 0 call clearreg ; subroutine to clear all registers call bcdget ; subroutine to get bcd switch settings movlw .100 ; put initial value in rtcc movwf rtcc movlw b'10100000' ; enable global & rtcc interrupts movwf intcon Code B bcdget clrf porte ; start with a clear port bsf switch12 ; turn on switch 1+2 power call delay1 ; allow time for port voltage to settle movfw portb ; get switch settings movwf r0 ; and put into reg bcf switch12 ; turn off switch 1 nop bsf switch34 ; turn on switch 3+4 power call delay1 movfw portb movwf r1 bcf switch34 nop ; end sub return -- Philip Martin email philip@philmart.demon.co.uk Royal Quays, North Shields. -- Philip Martin email philip@philmart.demon.co.uk Royal Quays, North Shields