Searching \ for '[PIC]: Some questions' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Some questions'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Some questions'
2001\04\18@140400 by Fernando Antoniasse

flavicon
face
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<<TMR2 ON) +1
What mean (1<<TMR2 ON)+1

or
bsf RCSTA ^ 0x080
What mean ^ 0x080

or
movlw (1<<ADCS1) | (1<<ADON)
What means (1<<ADCS1) | (1<<ADON)

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


2001\04\18@150010 by Barry Gershenfeld

picon face
Well, it's been a whole hour and no one's answered yet. :)

At 02:51 PM 4/18/01 -0300, you wrote:
>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<<TMR2 ON) +1
>What mean (1<<TMR2 ON)+1

The << operator means "shift left".  So the number 0x01 gets
shifted left some number of times, that number in this case
being whatever "TMR2" is equated to.


>or
>bsf RCSTA ^ 0x080
>What mean ^ 0x080

The ^ operator is "exclusive OR".   So the value RCSTA
will be XOR'ed with 0x080, which in effect changes
bit 7 to it's opposite state.  This is a trick we
use to make register addresses that are not in page
zero, look like they are in page zero, because the
compiler gets mad if they aren't.


>or
>movlw (1<<ADCS1) | (1<<ADON)
>What means (1<<ADCS1) | (1<<ADON)

0x01, shifted left "ADCS1" times, as explained above.

>And what about IF,ELSE,ENDIF?
>What is the best way to use this or when I must use this?

You don't have to use these, but you will want to later
when you want to do something clever.  These words
affect whether some of your code is compiled or not.
This is a different thing than whether the program makes
a decision at run time -- if you use these, the "untrue"
parts of the code are left out completely.

An example is code that you want to be present when
you are debugging, but want to leave out when  you
compile the "real thing".  It makes it so you don't
have to use you editor to put in and take out a lot
of statements.  It lets you use one source code file
where you might otherwise want to write many "versions"
of the same thing.

Barry

--
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


2001\04\18@180624 by Olin Lathrop

face picon face
> For exemple:
> What it means, not the instruction but
> the codes on the sequence?
>
> movlw (1<<TMR2 ON) +1
> What mean (1<<TMR2 ON)+1
>
> or
> bsf RCSTA ^ 0x080
> What mean ^ 0x080
>
> or
> movlw (1<<ADCS1) | (1<<ADON)
> What means (1<<ADCS1) | (1<<ADON)
>
> And what about IF,ELSE,ENDIF?

Sounds like you need to read the MPASM manual.  The PDF should be on the
Microchip web site.  You can probably get a paper copy from your local
Microchip office.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, spam_OUTolinTakeThisOuTspamembedinc.com, http://www.embedinc.com

--
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


2001\04\18@212907 by myke predko

flavicon
face
I'm resending this because I do not believe I sent the correct tag
originally.

If you got it twice, I apologize,

myke
{Original Message removed}

2001\04\19@015650 by David Huisman

flavicon
face
Myke,

Well done. I purchased your little PIC reference book and am very impressed.
It is full of useful information.

Thanks

Regards

David Huisman

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...