In message <199705201824.TAA09374@carlton.innotts.co.uk>, David Dobbs writes: >Hi, > We have just started using the PIC 16C84 but at the moment we are >unable to get much sense out of the software. Although it compiles and >programs the switch and lamp circuit does not work. >1)On assembly we get the following messages: > > Message[302] F:\PIC\PROJECTS\TEST\TEST.ASM 16 : Register in operand >not in bank 0. Ensure that bank bits are correct. This is to warn you that TRISA is in Bank 1. If it annoys you, you can mask off the warning with something like: NOBANK equ 07fh BSF STATUS,RP0 MOVWF TRISA &NOBANK ; Configure port (One of many ways to handle this situation. YMMV) >2)We don't seem to be able to input to porta. > >Listing: > >INIT BSF STATUS,RP0 ;Set up page 1 of registers. > MOVLW B'11111' > MOVWF TRISA ;Sets porta as an input port. > > CLRF PORTA ;Clear porta. Here is the problem: you need to go back to Bank 0 to access PORTA. TRISA and PORTA are in the same place in alternate banks, so this instruction is actually clearing *TRISA*. Hence all pins get set to output! Move the CLRF to after the BCF STATUS,RP0 (or before the BSF), and all should be well. Regards, David.