Some instructions causes a flag to be set. Don’t be confused about flags. It’s just another specific bit of a SFR’s 8 bits. They will be auto set or cleared according to a situation. For Addition and Subtraction of 8 bit values sometimes give results of 9 bits or negative numbers. How you find out that something like that happened. Simple, a flag will be set! This flag I’m talking about is in the status register. Read the datasheet to find which bit exactly it is before proceeding. After this kind of operation you can check the flag with btfsc or btfss instruction. Similarly there will be specific flags for interupts which you will soon learn.

example –

btfss STATUS,0

This will check if the carry bit is SET. If its SET it will skip the next instruction. Can you think of a application of this feature?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: