HELP FOR DIRECTIVES

Status
Not open for further replies.

HAMZAZAYYAD

New Member
HOW CAN I USE ADIRECTIVES LIKE WHILE , IF ,AS AN INSTRUCTION
HELPFUL IN APROGRAMLIKEAN EXAMPLE:
WHILE PORTA,1==0
GOTO LOOP5
ENDW
LOOP5
BCF PORTB,3
 
HAMZAZAYYAD said:
HOW CAN I USE ADIRECTIVES LIKE WHILE , IF ,AS AN INSTRUCTION
HELPFUL IN APROGRAMLIKEAN EXAMPLE:
WHILE PORTA,1==0
GOTO LOOP5
ENDW
LOOP5
BCF PORTB,3

Use BTFSS or BTFSC - have a look on the PICList for examples of various control structures using them!.
 
I beleive Microchip assembler has some instructions, branch if bit set and branch if bit clear - I don't remember their mnemonics off the top of my head

other brand microcontrollers should have similar instructions
 
To use high level directives like while/wend you need a higher level language. Have a look at the free to use **broken link removed** or **broken link removed**. This may help you.

Personally, I'd try to learn assembler. Have a look at .

Mike.
 
how can i use two sub prog

hi
i need help


linker

CODEPAGE NAME=vectors START=0x0 END=0x1F PROTECTED

CODEPAGE NAME=page START=0x20 END=0x3FF








when i uses a sub program only, no errors
but when i uses more than one sub program ,this error apear


Copyright (c) 2005 Microchip Technology Inc.
Error - section 'INT_VECTOR' can not fit the absolute section. Section 'INT_VECTOR' start=0x00000000, length=0x0000005a
Errors : 1
BUILD FAILED: Mon Jun 06 14:59:42 2005



whats wrong??


my program USES PIC16F84A WITH ASSEMBLY ,MPLAB


SUB PROGRAM
/
//
/
//
RETURN

SUB PROGRAM1
//
/
//
RETURN

SUB PROGRAM2
/
//
/
//
RETURN




MAIN CODE
start


/
/
/
/
call SUB PROGRAM1
/
/
/
/

call SUB PROGRAM2


/
/
/

en
 
It looks like you are trying to assemble code that is written for a PIC18 chip. I think you should read the sticky and look at Nigel's tutorials.

Mike.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…