On Sun, 7 Nov 1999 08:57:39 +1100 "Paul B. Webster VK2BZC" writes: >Alan Smith wrote: > >> I am relatively new at programming PICS and I have encountered my >> first uncrackable bug! > > No problems! > >> My problem is: I can't seem to control IO pin 10 in a certain region >> of code. The instruction I am using is as follows: bcf portB,4. > > Rule No.1 Don't use BSF/ BCF/ ANDWF/ COMF/ ORWF /IORWF or any >similar >instruction with the I/O register as destination, on a PORT register. >Always set it using the MOVLW mask; MOVWF PORTx sequence you used for >the OPTION and TRIS set-ups. If necessary, keep a "shadow" register >with the settings you want on the outputs, modify that one bit at a >time >and copy to teh PORT. > You can violate rule number 1 if you're careful and allow enough time for the pin to settle. Also, new parts, such as the 18c452 have another register called lata, latb, latc, latd, etc. that are actually the output LATCHES. You can do read/modify/write on these since the read reads the latch, not the pin. If you want to actually read the pin (like for input...), you still have porta, portb, etc. Harold Harold Hallikainen harold@hallikainen.com Hallikainen & Friends, Inc. See the FCC Rules at http://hallikainen.com/FccRules and comments filed in LPFM proceeding at http://hallikainen.com/lpfm ___________________________________________________________________ Get the Internet just the way you want it. Free software, free e-mail, and free Internet access for a month! Try Juno Web: http://dl.www.juno.com/dynoget/tagj.