This is bad coding, pure and simple. Try not to mix 'C' style directives in with assembly until you are more comfortable with assembly ... You should have written this as:- clrf SR5PATT ; move SR5PATT into W -> will set Zero flag in STATUS if W becomes zero movf SR5PATT, W ; test Zero flag, skip bsf instruction if not set btfsc STATUS, Z bsf SR5PATT, 4 One line less (without comments), and no 'C' type directives :) Rgs Ian -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of jumanji Sent: Monday, 6 October 2003 2:15 am To: PICLIST@MITVMA.MIT.EDU Subject: [PIC:] problem with 'IF' Hello, I'm using mplab6.30 for a PIC18F452 The following code does not seem to work :( clrf SR5PATT if SR5PATT == 0 bsf SR4PATT, 4 else endif bit 4 of SR4PATT, does not get set; setting it outside the 'if'-routine does work. What am I doing wrong ? (I'm not super experienced with asm) Thanks -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics