Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

MPLAB Sim

Status
Not open for further replies.
MPLAB Sim problem

I am using MPLAB and I have created some code to scan some switches to create a serial output of switch position. I have used a PIC16F84. PortA as input and PortB, bit0 as the serial output. The code builds. I have programmed in some possible switch positions so that I can get an output. My question is to do with the 'Watch' window that is used during Debugging. There is a choice of SFRs and Symbols to select and watch. The SFRs are present, but the window that displays Symbols is greyed out. Why is this? I tried a simple Mplab tutorial and it worked fine, with the Symbol window black and active. I can't see what I have done differently.

Any ideas?

Eddie Price
 
Last edited:
Hi 3Vo

The Build was successful. There were some messages: Message(302), something to do with choice of Bank when configuring the ports and Message(305) wrong file type, which I didn't understand. I will try some more tutorials.

I liked your tutorials, but I don't fancy having to learn c. I seem to manage with assembler, which is fine for the amount of programming that I want to do.

Eddie Price
 
Hi,

If you attach your .asm file then we can reproduce your Error report and run Sim to see what you problems are.
 
Hi

I have some more questions about using MPLAB SIM. I still get the problem with the Watch window. I tried a tutorial example from the Microchip web site and got the same problem. However, the program works, so its an inconvenience rather than a major problem.

My new problem is to do with using the Logic Analyzer. I am creating serial data that is being output to one pin - RA0. So I select RA0 as a channel in the Analyzer, Run the program and look at the output, but I am unable to observe the whole string of bits. There should be about 30 bits and I am only seeing about 10. I have tried to find something in the MPLAB User Manual, but couldn't find anything. The Analyzer window has buttons for Trigger Position, Trigger PC=, Time Base and Mode, and I can't find any mention of these in the user manual.

It is obviously a useful debugging tool, but can someone tell me how to use it

Eddie Price
 
First the trace buffer has to be large enough to hold the processor cycles used to generate all 30 bits. Debugger>Settings>OSC-TRACE is where you can change the buffer size.

Then set a breakpoint just prior to the generation of the serial bits. Run to that breakpoint. The run again to collect the trace. Maybe have stop trace when buffer is full set.
 
Hi again

Yes I found the stopwatch very useful in setting up the delays for producing the '1's and '0's for the serial data. I have now managed to produce the assembler for the transmitter for my train controller. I am now working on the receiver software to decode the serial data. It would be nice to have a stimulus file of the output from the Tx. Is there any way of doing this via the workbook?

Still have the problem of being unable to read symbols in the Watch window. I tried some of the tutorial examples from Microchip web site and they have the same problem. My version of MPLAB is 8.53. I don't know if that has any significance.

Eddie Price
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top