Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

very little problem using mikroC 8.2 with PIC18F2420.

Status
Not open for further replies.

Hasher

Junior Member level 1
Joined
Apr 14, 2009
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,458
movlb

I'm using mikroC 8.2 with PIC18F2420.

I got this error message : "0xFD6: argument not found" when I try to build a project that has this piece of code

NOTE: in Hi-Tech PICC-18 I have no errors in building
NOTE: 0xFD6 is the address location of TMR0L

Code:
void delay()
{
	asm {
		ST1:
			MOVLW 0x24
		 	MOVLB 0x0F
		 	SUBWF 0xFD6 , w
			BNC ST1  }

}
 

movlb assembly

The PIC micro cannot directly access the location 0xFD6. All memory between 0X000 and 0XFFF is in banks of 256 bytes. The MOVLB instruction loads the bank select register with 0x0F which points to the 256 bytes in the range 0XF00 to 0XFFF.
You then use SUBWF 0XD6, W to subtract W from register 0xD6 in Bank 0XF00 which is the register you want i.e. 0XFD6.

Code should be as follows :

void delay()
{
asm {
ST1:
MOVLW 0x24
MOVLB 0x0F
SUBWF 0xD6 , w <------**
BNC ST1 }

}
 

tmr0l 18f swordfish

Oppppps!

I got this error message : "0xD6: argument not found"
 

movlb asm

Try MOVLB 0x00



void delay()
{
asm {
ST1:
MOVLW 0x24
MOVLB 0x00
SUBWF 0xD6 , w
BNC ST1 }

}

Added after 37 minutes:

Nah, scrub the last post.

Try

void delay()
{
asm {
ST1:
MOVLW 0x24
SUBWF 0xD6 ,W,0
BNC ST1 }

}

If this does not work try

void delay()
{
asm {
ST1:
MOVLW 0x24
MOVLB 0x0F
SUBWF TMR0L , w
BNC ST1 }

}
 

movlb instruction

Yes that wroked!

Code:
void delay()
{
asm {
ST1:
MOVLW 0x24
MOVLB 0x0F
SUBWF TMR0L , w
BNC ST1 }

}


BUT I got another error message and the code is still colored with red:
"Demo limit"

Does that means it doesn't support asm code?

Added after 11 minutes:

Oooooooooooohhhhhhhhh!!

I know what was the problem!

When put this code in my big C program It generates more than 2K hex file.

The Demo version supports up to 2K hex file.

Mine is 10K hex file!

I have to buy it!!! :cry:
 

argument not found mikroc

Use SDCC for PIC. It is free and unlimited. Or learn assembly language, it is much more rewarding.
 

very little problem

Or C18 the SE version is free and is the official 18F compiler.

I'm partial to Swordfish BASIC myself.
 

Re: very little problem

blueroomelectronics said:
Or C18 the SE version is free and is the official 18F compiler.

Acually I'm using Hi-Tech PICC-18 (it is working fine) but I used the mikroC to check the serial communication part that disn't work with PICC-18

:D
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top