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.

Trouble in working with mplab simulator

Status
Not open for further replies.

Murugesh_89

Full Member level 5
Full Member level 5
Joined
Nov 23, 2012
Messages
266
Helped
7
Reputation
12
Reaction score
6
Trophy points
1,298
Location
India
Activity points
3,267
Hi,
I want to work with mplab simulator debugger. So i started with the very basic program.

Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include<18f45k22.h>
#fuses NOWDT,INTRC_IO,MCLR,NOPUT,DEBUG,NOPROTECT,NOBROWNOUT,NOLVP
#use delay( clock = 8M )
unsigned long count = 0;
 
void main()
{
    count = 0;
 
    while( 1 )
    {
        delay_ms(200);
        count++;           
    }
}



I run the program and after 15 seconds in my wrist watch i halted the execution. I want the variable "count" to be 75 but instead it showing some values around 200.

I repeated this for various timing but the "count" value is showing wrongly.

I am using MPLAB 8.92 and selected MPLAB SIM under debugger.

Could anybody pls correct me?
 
Last edited by a moderator:

Hi , MPLAB sim is not a real time simulator , use the time from stopwatch instead.
 

The simulator runs as fast as your computer lets it. The simulation times are accurate but not real-time as mdorian stated.

To check the program simulation running time, use 'Debugger/Stopwatch' from the menu bar. Make sure you reset it if you are timing the delay between different parts of the program. It is very useful when used in conjuction with 'Set PC at cursor' and breakpoints or for timing loops.

Brian.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top