Hi Luis, Barry explained the various assembler options, but I thought I would have a go at your question on "if"/"Else"/"endif". These three instructions are "conditional assembly" directives. You can use these directives for selecting options in your application. For example, if there was a possibility that you would have to change the PCLATH register before executing a "goto" instruction, you could use the code: if (((HIGH $) & 0x018) != ((HIGH Label) & 0x018)) movlw HIGH Label ; If the code page of the Destination movwf PCLATH ; is Different from the current ; Code Page, Update PCLATH else ; Code Page of Current = Destination nop ; Do not change the PCLATH Register nop endif goto Label & 0x07FF ; Goto the Specified Label In the first statement, I am comparing the code page (which is specified in bits 11 & 12 of the address) of the current address against the code page of the destination address. If they are different, then the PCLATH register will be updated to the value of the destination. Else, PCLATH will not be changed. The "HIGH" directive returns bits 8-15 of the constant it is applied to. "&" is the bitwise "AND" operator. There are a lot of different ways to describe "HIGH": HIGH Constant = (Constant & 0x0FF) / 0x0100 = (Constant & 255) / 256 = (Constant & 0x0FF) >> 8 = (Constant >> 8) & 0x0FF I don't know if you were present a few days ago, but there was a discussion about conditional assembly and the possibility of having a different number of instructions depending on the conditional assembly execution path. If you look at the sample code above, you will see if the PCLATH register is not updated, then an equal number of "nop" instructions are executed. This was not put in to make sure the timing was the same, but to make sure the number of instructions are the same. If you fail to do this, you will probably get a "Phase Error" which indicates that the length of the code generated by the final assembler pass is different from the length of the code generated by the first assembler pass. This type of error is VERY DIFFICULT to find and fix. If you are new to programming, I would recommend that you do not use conditional assembly code as it can be very confusing and has the opportunity for difficult problems to find and debug (like the Phase Error described above). myke > ----- Original Message ----- > From: "Luis Fernando Antoniasse" > To: > Sent: Wednesday, April 18, 2001 1:51 PM > Subject: [PIC]: Some questions > > > > Hi all, > > > > I have seen some codes in assembler that I can not undertand > > very well. > > > > For exemple: > > What it means, not the instruction but > > the codes on the sequence? > > > > movlw (1< > What mean (1< > > > or > > bsf RCSTA ^ 0x080 > > What mean ^ 0x080 > > > > or > > movlw (1< > What means (1< > > > And what about IF,ELSE,ENDIF? > > What is the best way to use this or when I must use this? > > > > Thanks in advanced, > > > > Luis Fernando > > > > -- > > 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