i am having some difficulty in accessing the general purpose registers of pic for assembly level coding .
i am getting the error: error in built in assembly
do we need to access the registers through their RAM address or do we need the define the variables in flowcode or something else?
i have tried the former two but to no avail.
program in which external variable is used:
bsf _status,5 ;Go to bank 1
movlw 00h ;Put 00000 into W
movwf _trisb ;Move 00000 onto TRISA - all pins set to output
bcf _status,5 ;Come back to Bank 0
movlw AAh
movwf _FCV_A
addlw _FCV_A ,0
movwf _portb
program in which register address is used
bsf _status,5 ;Go to bank 1
movlw 00h ;Put 00000 into W
movwf _trisb ;Move 00000 onto TRISA - all pins set to output
bcf _status,5 ;Come back to Bank 0
movlw AAh
movwf 25h
addlw 25h,0
movwf _portb
both didn't work
plz help.
i am using Flowcode V3 for PIC
accessing registers in asm
-
- Posts: 14
- Joined: Thu Apr 17, 2008 10:10 am
- Contact:
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: accessing registers in asm
Hello
After compiling your code I was given a line number that indicated the problem was with the following line of code.
Changing the code to the following fixed the problem
So the completed code is now.
After compiling your code I was given a line number that indicated the problem was with the following line of code.
Code: Select all
addlw _FCV_A ,0
Code: Select all
addwf _FCV_A ,0
Code: Select all
asm{
bsf _status,5 ;Go to bank 1
movlw 00h ;Put 00000 into W
movwf _trisb ;Move 00000 onto TRISA - all pins set to output
bcf _status,5 ;Come back to Bank 0
movlw AAh
movwf _FCV_A
addwf _FCV_A ,0
movwf _portb
}
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 14
- Joined: Thu Apr 17, 2008 10:10 am
- Contact:
Re: accessing registers in asm
Thanks Ben, that worked fine.
But i am still not able to access the registers using their respective addresses in the RAM.
please help
But i am still not able to access the registers using their respective addresses in the RAM.
please help
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: accessing registers in asm
Hello
You must use the register name. BoostC does not seem to support the direct register addresses.
You must use the register name. BoostC does not seem to support the direct register addresses.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 14
- Joined: Thu Apr 17, 2008 10:10 am
- Contact:
Re: accessing registers in asm
but the general purpose registers in PIC don't have any name. they have to be used by using their addresses in RAM.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: accessing registers in asm
Hello
Can you not use a variable instead then the compiler can assign the register dynamically.
Can you not use a variable instead then the compiler can assign the register dynamically.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel