Goran: Wouter explains it well Use a shadow register as below For instance:- Bsf PORT_A,0 ; PORT_A is the name of the shadow register for GPIO (A) Movfw PORT_A ; get the shadow reg Movwf GPIO ; then transfer the whole reg to the port Call delay Bsf PORT_A,1 Movfw PORT_A Movwf GPIO Call delay Bcf PORT_A,0 ; PORT_A is the name of the shadow register for GPIO (A) Movfw PORT_A ; get the shadow reg Movwf GPIO ; then transfer the whole reg to the port Call delay Bcf PORT_A,1 Movfw PORT_A Movwf GPIO Call delay Goto $ ; stop here This will fix any read modify write problems that maybe causing the pins to become unset its straight line code and can be simplified by the following Bsf PORT_A,0 ;on PORT_A is the name of the shadow register for GPIO (A) Call Update_port Bsf PORT_A,1 Call Update_port Bcf PORT_A,0 ;off Call Update_port Bcf PORT_A,1 Call Update_port Update_port Movfw PORT_A ; get the shadow reg Movwf GPIO ; then transfer the whole reg to the port Goto delay Goto $ ; stop here The two code bits do the same thing but the second set uses less program space the example turns on led 0 then led 1 then turns off led 0 then led 1 but uses the update port section four times. Regards Steve -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of Goran Hosinsky Sent: 24 May 2006 17:51 To: PIC via ya.com Subject: [PIC] 12f629 bsf function I am trying to set selected bits in GPIO using bsf GPIO, n where n can be 0,1,2,4 The selected bit gets set ok but any bit which is already on is cleared at the same time. Why is this - and how should I do to set and clear bits individually? test code: bit 0 blinks once and then bit 1 is set: bsf GPIO,0 call delay bsf GPIO,1 loop goto loop Goran -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist