Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   MPLAB Variable Simulator? (http://www.chiefdelphi.com/forums/showthread.php?t=25503)

Chris_Elston 17-02-2004 21:21

MPLAB Variable Simulator?
 
This is really the first time I've used this MPLAB software and the first time I've coded in C language. Normally I code in Ladder Logic, (Programming Logic Controllers), Visual Basic, or what ever proprietary language or mnemonic language of the week that might be in whatever servo controller I get my hands on. However I’ve notice a nice tool in MPLAB I'd like to know a bit more about.

When I program my C program offline, I see that I can use the MPLAB simulator much like a Visual Basic debugger. The problem is I can't see or figure out how to simulate variables to keep executing in my code. Example:

My offline debugging gets STUCK in a loop here:

PHP Code:

/*******************************************************************************
* FILE NAME: ifi_utilities.c
*
* DESCRIPTION:

snippppeddd a few lines of code…..........................................


/* Used when transmitting data serially.  It waits for each byte to finish.   */
void Wait4TXEmpty(void)
{
#ifndef _SIMULATOR
  
while (!TXINTF)
  {
    continue;
  }
#endif


I need to be able to SIMULATE the variable !TXINTF so that I can get past this part of the code while performing a STEP function in the debugger. I am sure may other spots will be required to be simulated imputs also to get the loop area where the user code is executing. Is there anyway in MPLAB to setup this variables and many more to toggle or force values?

deltacoder1020 17-02-2004 21:27

Re: MPLAB Variable Simulator?
 
what you actually need to do is define the macro "_SIMULATOR" - hence the #ifndef lines around that particular loop. there are certain parts of the code that will get stuck without that macro defined. just go into the mplab project settings window and look for where you can define preprocessor macros, and add _SIMULATOR to the list.

Chris_Elston 17-02-2004 21:37

Re: MPLAB Variable Simulator?
 
I eye! Captain. Found it under Build Options. Well give that a whirrlly gig..

Mark McLeod 18-02-2004 12:08

Re: MPLAB Variable Simulator?
 
You'll also find yourself running into problems if you are using the internal timer interrupts. The easiest way around that is to add your own #ifdef _SIMULATOR around the timer initializations to turn the interrupts off for debugging.


All times are GMT -5. The time now is 20:04.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi