 Possibly a bug in Keil Simulator
Samitha Ransara
Hello guys,
I'm trying to simulate this simple code with Keil UV4..
//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include <C8051F360.h>
//-----------------------------------------------------------------------------
// Global Constants
//-----------------------------------------------------------------------------
#define SYSCLK 24500000 // System clock in Hz
//-----------------------------------------------------------------------------
// Function Prototypes
//-----------------------------------------------------------------------------
void OSCILLATOR_Init (void);
void PORT0_Init(void);
void PORT1_Init(void);
void PORT2_Init(void);
void XBar_Init(void);
//-----------------------------------------------------------------------------
// Global Variables
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// main () Routine
//-----------------------------------------------------------------------------
void main (void)
{
PCA0MD &= ~0x40; // Disable watchdog timer
// Initialize Port I/O
PORT0_Init();
PORT1_Init();
PORT2_Init();
XBar_Init();
OSCILLATOR_Init (); // Initialize Oscillator
while (1)
{
} // end of while(1)
} // end of main()
//-----------------------------------------------------------------------------
// PORT_Init ()
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void PORT0_Init ()
{
unsigned char SFRPAGE_save = SFRPAGE; // Save the current SFRPAGE
SFRPAGE = CONFIG_PAGE; // Switch to the necessary SFRPAGE
P0MDOUT = 0x0E;
P0SKIP = 0x0F;
SFRPAGE = SFRPAGE_save; // Restore the SFRPAGE
}
void PORT1_Init ()
{
unsigned char SFRPAGE_save = SFRPAGE; // Save the current SFRPAGE
SFRPAGE = CONFIG_PAGE; // Switch to the necessary SFRPAGE
P1MDOUT = 0x3F;
P1MDIN = 0xFF;
P1SKIP = 0x3F;
SFRPAGE = SFRPAGE_save; // Restore the SFRPAGE
}
void PORT2_Init ()
{
unsigned char SFRPAGE_save = SFRPAGE; // Save the current SFRPAGE
SFRPAGE = CONFIG_PAGE; // Switch to the necessary SFRPAGE
P2MDIN = 0xFC;
P2MDOUT = 0xFC;
P2SKIP = 0xFF;
SFRPAGE = SFRPAGE_save; // Restore the SFRPAGE
}
void XBar_Init ()
{
unsigned char SFRPAGE_save = SFRPAGE; // Save the current SFRPAGE
SFRPAGE = CONFIG_PAGE; // Switch to the necessary SFRPAGE
XBR0 = 0x01;
XBR1 = 0x40;
SFRPAGE = SFRPAGE_save; // Restore the SFRPAGE
}
void OSCILLATOR_Init (void){
unsigned char SFRPAGE_save = SFRPAGE; // Save the current SFRPAGE
SFRPAGE = CONFIG_PAGE; // Switch to the necessary SFRPAGE
OSCICN |= 0x03; // Initialize internal oscillator to
// highest frequency
RSTSRC = 0x04; // Enable missing clock detector
SFRPAGE = SFRPAGE_save; // Restore the SFRPAGE
}
and I'm using c8051F366. In the simulation I can see the values of
registers are changing, but they are not graphically shown in the
relevant peripheral simulation windows, next to register which is
being changed. For example, if I go Port2 peripheral window, I can
see the value P2MDOUT has changed to 0xFC but not ticks to indicate
the bits which set and not set! I think this is a bug, or I'm doing
some stupid thing which I cant figure it out.
Same thing happens for P1MDOUT, P1SKIP and P2SKIP with regards to
the above code.
In my case, I can see the value P2MDOUT has changed to 0xFC but
only 6th and 7th ticks are showing up (which equals to 0xC0
graphically). If I click the fifth check-box (which indicates the 5th
bit of P2MDOUT) then the IDE automatically put ticks such a way that
0xFC is correctly showing up.
IDE-Version:
µVision V4.20.03.0
Copyright (C) 2011 ARM Ltd and ARM Germany GmbH. All rights
reserved.
Tool Version Numbers:
Toolchain: PK51 Prof. Developers Kit Version: 9.01
Toolchain Path: C:\Keil\C51\BIN\
C Compiler: C51.Exe V9.01
Assembler: A51.Exe V8.02
Linker/Locator: BL51.Exe V6.22
Librarian: LIB51.Exe V4.24
Hex Converter: OH51.Exe V2.6
CPU DLL: S8051.DLL V3.72
Dialog DLL: DCYG.DLL V2.66
Target DLL: BIN\SiC8051F.dll V3.4.5.0
Dialog DLL: TCYG.DLL V2.66
|