This is a very quick and easy question: How do I move a literal value into a register?
I need to move the value 2 into a register with address 0x0800 of a dsPIC30F6014A. I have tried the following:

MOV #0x0002, [0x0802];

but I get an error message stating "Invalid ASM instruction (135): #0x0002"
What's wrong?

And can this be done in C (mikroC)?

I guess the problem is arising because you are tryin to move an immediate value directly to a memory location which your processor assembly won't allow, might be one of your operand should be a register, may be u have to use register as pointer to memory ....
Any suggestions guys????

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.