Go to Post Dean's "All Denim" (now referred to as "Deanim") look is apparently catching on. - AndyB [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 01-11-2003, 14:34
WizardOfAz's Avatar
WizardOfAz WizardOfAz is offline
Lead Mentor
AKA: Bill Bennett
FRC #1011 (CRUSH)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Tucson, AZ
Posts: 101
WizardOfAz will become famous soon enough
Send a message via AIM to WizardOfAz
using the MPLAB IDE MPLAB SIM simulator

I've seen very little written about the MPLAB SIM. I'm starting to learn how to use it, but maybe others have already gotten much farther. This thread is dedicated to people sharing hints and kinks, and helping solve problems and answer questions, about the MPLAB SIM.

For starters, there are a few macros that can be defined that affect code execution. One is particularly useful for running in the simulator: _SIMULATOR. Without this, you have two problems with the "default" code:
(1) statusflag.NEW_SPI_DATA will never be 1, so your user code in Process_Data_From_Master_uP will never be called by the loop in main.c.
(2) TXINTF will never be 1 so Wait4TXEmpty will loop forever causing your program to hang the first time it tries to print anything.

To set this macro, click Project->Build Options->Project, click the MPLAB C18 tab, click the ADD button to the right of macro definitions, type _SIMULATOR, OK, OK.

There is a hazard here - if you leave this macro enabled, your code WILL NOT RUN successfully on a real controller. You want to only use this setting for running in the SIM. You have to take the macro out, then rebuild before download the code to a controller.

The other macros I see used in the code are:
UNCHANGEABLE_DEFINITION_AREA
_NO_BOOTLOADER
_SNOOP_ON_COM1
_FRC_BOARD
Anybody figured out when these are useful?

Finally, it would be real handy to be able to view output of printf and other print calls in the simulator. Anybody figured out a way?
You can sort of do it with a watch on a string in a fixed location, and have the print routines put their output there. A better way would be better.....

Bill
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 15:26.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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