IF AND WHILE DIRECTIVES

Status
Not open for further replies.

HAMZAZAYYAD

New Member
HI
PLEASE HELP ME

what is the diffrant between instructions and the directives?

and
can i write this command?

if PORTA==01h (excute something)

while PORTA==01h (excute something)

THANK YOU A LL
 
You don't mention what language you're taking about?.

But assuming it's assembler?, an instruction is something the processor can run, a directive is an instruction to the assembler (and nothing at all to so with the PIC).
 
hi
thank you
I uses assembly langu and pic16f84a

i try it in my program with mplab simulator , but it does not work correctly????
 
HAMZAZAYYAD said:
hi
thank you
I uses assembly langu and pic16f84a

i try it in my program with mplab simulator , but it does not work correctly????

They aren't executable instructions, just directives telling the assembler what to do.

For example:

Code:
#ifndef 	TXINV
   #define 	TXLOW 	BCF	PORTA, 6
   #define 	TXHIGH 	BSF	PORTA, 6
#else
   #define 	TXLOW 	BSF	PORTA, 6
   #define 	TXHIGH	BCF	PORTA, 6
#endif

This piece of assembler directives checks if a name 'TXINV' has been previous defined, if so it defines two lines of code one way, or if not it defines them the other way. This enables you to use an inverting, or a non-inverting output, by simply defining (or not) a single name at the beginning of the program. It's from one of my new Manchester radio tutorials.

Your example didn't include any code at all, so wouldn't produce anything.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…