You need to specify which bit to set or clear with the bsf and bcf instructions. Like bsf pa1,5 ;set bit 5 of register pa1 (status ;register) > > bsf pa1 ; selected page 1 > > bcf pa1 ; selected page 0 Or have you done a #DEFINE statement like: #DEFINE pa1 status,rp0 -Randie ________ Randie Ohtsji / ____/ /__ ____ ____ ___ _________ email: rohtsji@glenayre.com / /___/ / _ \/ __ \/ __ `/ / / / __/ _ \ Glenayre R & D / /_\ / / __/ / / / /_/ / /_/ / / / __/ Vancouver, B.C. CANADA \____/_/\___/_/ /_/\__,_/\__ /_/ \___/ Phone: (604) 293-1611 x4555 ________________________/ / Fax: (604) 293-4317 /_________________________/ > > > > I sent this message 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 > > >