MPSIM going buggy!

Status
Not open for further replies.

AGCB

Member
I've been working on a program and all of a sudden when I try to simulate it the execution line jumps to weird places. It jumps from line 62 back to the beggining and I don't see any reason for it. It did this earlier and I deleated all the MPLAB files for that project and opened a new project. It was ok for quite a while but now does the same thing. I've attached the code. Any ideas?
 

Attachments

  • try_this2.asm
    8.1 KB · Views: 170
I didn't look at it all but if I remember correctly the cblock directive needs to be accompanied with a RAM address to start the variable declaration.

Like so:
Cblock 0x20 (whatever start of GP RAM is)
File1
File2
File3
endc

What's line 62? Where exactly in the program is it?
 
Hi AGCB,
I just downloaded you asm file and opened it up in mplab
Code:
line 62    movwf    instr            
line 63     movfw    result

It could the line 63 typo ' movfw ' instead of movwf


Cheers Bryan
 
The instruction movwf instr is writing to location 2 which is the program counter. As already pointer out your cblock needs an address.

Mike.
 
The instruction movwf instr is writing to location 2 which is the program counter...
Mike.

OK. I don't know where my brain picked up that 'movfw' instruction, but it thought it was a legal instrution.

But I don't understand what you mean by "The instruction movwf instr is writing to location 2 which is the program counter". How or why does that work?
 
PIC Midrange Instruction Set
MOVFW is a Microchip pseudo mnemonic it will work with MPLAB

So I think you're saying that my code should have worked with the 'MOVFW'. That's how I understand that link you gave.

This then gets back to the question to POMMIE's statement "movwf instr is writing to location 2 which is the program counter". Is this so? And if so, what am I not getting?

These Fs and Ws are posibly getting mixed up in the discusion!
 
Last edited:
I,m posting a up to date code here. The program works up to the point where I have put the double row of x's. So far it has not displayed the file 'result' as a decimal number. I'm still working. I have made all the corrections suggested plus many more. Thanks
 

Attachments

  • try_this2.asm
    8.6 KB · Views: 160
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…