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.

No instruction found at 0x4, MCU 8051

Status
Not open for further replies.

PG1995

Full Member level 5
Joined
Apr 18, 2011
Messages
248
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
3,758
Hi

Please have a look on the linked video. Why does it say "No instruction found at 0x4" when I specifically included the END statement? In my view the PC doesn't point to location 0x4 because END signals termination of the code. I'm new to assembly language. Please help me with it. Thanks a lot.

https://www.youtube.com/watch?v=aSXmKVv1hdY

Regards
PG
 

Can you Post your code here
 

Code:
ORG 0H

	value EQU 43H
	MOV A, #value
	MOV R0, #value
END
 

Hi PG1995,
Can you tell me which simulator you've used ?
and which version ?
Because the same code which you've post is successfully implemented at Keil uVision3 .
And I've not used the simulator which you've shown in video. So please let me know about it.
 

I don't know the said simulator, but as an obvious explanation, the processor doesn't know what to do after MOV R0, #value. 0x4 would be the next instruction address, which is empty.

You are apparently under the assumption, that an END statement commands the processor to do something. But that's not the case. It's just end of code text. The intended processor behaviour has to be designed by you, e.g. repeat a loop.
 
  • Like
Reactions: PG1995

    PG1995

    Points: 2
    Helpful Answer Positive Rating
Yes 0x4 is the PC address of next instruction after the END

You may write another program and see
 
  • Like
Reactions: PG1995

    PG1995

    Points: 2
    Helpful Answer Positive Rating
Thanks a lot, FvM, bassa.

@Jigar: It's MCU 8051 IDE.

I have included a loop.

Code:
ORG 0H

	Repeat:
	value EQU 43H
	MOV A, #value
	MOV R0, #value
	SJMP Repeat
END


NEW CODE:

I have also tried to write another program using DB for 8051. Please have a look on the video and please help me with the queries below (you can also find the same queries embedded in the video): https://www.youtube.com/watch?v=RKn9tEpM5XE

Code:
ORG 0H

	MOV A, 80H
	MOV R0, 81H

	ORG 80H
	DB  10
	DB  12

END

Q1: There is some problem with the code because see what value the "A" has taken on. Similarly, the value for R0 is also wrong.

Q2: The value of PC goes up by 2 for every line. I have read that this instruction MOV A, 80H occupy two bytes instead of one and that's the reason PC goes up by '2' for every line of the code. But can't that instruction be saved on a single byte so that the PC goes up by only '1' byte? In other words, can't it all, both instruction and data, fit one byte?

Regards
PG
 
Last edited:

When you want to write assembler language, it's necessary to understand how the respective processor works. Your code doesn't do what you expect it to do. You need to pay attention to the difference between code and data memory and how they can be accessed with specific instructions.

In your example, you are defining ROM constants. But MOV A, 80H accesses RAM not ROM.

Regarding instruction length, please consider which information need to be coded in a particular instruction, review in the instruction description in user manual how it's done, and you'll surely understand why the lengths are as they are.
 
  • Like
Reactions: PG1995

    PG1995

    Points: 2
    Helpful Answer Positive Rating
Code:
ORG 0H

	Repeat:
	value EQU 43H
	MOV A, #value
	MOV R0, #value
	SJMP Repeat
END

Replace it with
Code:
	value EQU 43H
ORG 0H

	Repeat:
	MOV A, #value
	MOV R0, #value
	SJMP Repeat
END

MOV A, 80H will access SFR.

Code:
ORG 0H

	MOV A, 80H
	MOV R0, 81H

	ORG 80H
	DB  10
	DB  12

END

Replace it with :

Code:
ORG 0H

	MOV Dptr,#80H
	Clr A
	Movc A,@A+Dptr

	Inc Dptr
	Clr A
	Movc A,@A+Dptr

	ORG 80H
	DB  10
	DB  12

END
 
  • Like
Reactions: PG1995

    PG1995

    Points: 2
    Helpful Answer Positive Rating
Q1: There is some problem with the code because see what value the "A" has taken on. Similarly, the value for R0 is also wrong.

You have to use MOVC command in order to access code memory (see example code give in post #9)

Q2: The value of PC goes up by 2 for every line. I have read that this instruction MOV A, 80H occupy two bytes instead of one and that's the reason PC goes up by '2' for every line of the code. But can't that instruction be saved on a single byte so that the PC goes up by only '1' byte? In other words, can't it all, both instruction and data, fit one byte?

it is ISA (Instruction Set Architecture) of 8051 you cannot change it but you can use another command or method for substitute original

refer these simple tutorials
**broken link removed**
 
  • Like
Reactions: PG1995

    PG1995

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top