Keil Logo Arm Logo

Discussion Forum

Possibly a bug in Keil Simulator

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Samitha Ransara
Posted
29-Nov-2011 05:02 GMT
Toolset
C51
New! Possibly a bug in Keil Simulator

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

Read-Only
Author
erik malund
Posted
29-Nov-2011 14:00 GMT
Toolset
C51
New! RE: Possibly a bug in Keil Simulator

Possibly a bug in Keil Simulator
would not be a surprise

The Keil simulator was a fairly simple project wehrn the '51s all had "standard I/O". Today with the plethora of variants it is not to be expected that all nooks and crannies of all derivatives are properly handled.

do report your bug to Keil support

Erik

Read-Only
Author
Samitha Ransara
Posted
30-Nov-2011 02:49 GMT
Toolset
C51
New! RE: Possibly a bug in Keil Simulator

Hi Eric,
Yes I know. But I was surprised as this is is pretty simple thing! The graphical representation of GPIO registers should be one of the most simple and obvious thing, which Keil should've tested, before they release their tool.

Cheers..

Read-Only
Author
erik malund
Posted
30-Nov-2011 14:33 GMT
Toolset
C51
New! no, it is not

The graphical representation of GPIO registers should be one of the most simple and obvious thing

no, it is not, just to mention a few SILabs have several flavors of "port configuration" and the NXP LPC9xx have another.

Erik

Read-Only
Author
Samitha Ransara
Posted
1-Dec-2011 20:23 GMT
Toolset
C51
New! Agreed!

Hi Eric,
Thanks again.

Found a temp solution. I'm using a different device (different in name, but works similarly) for simulation, rather than the device which I'm writing the code. I'm using the simulation only for checking the peripherals and sometimes the interrupt system, as such simulating using a different device would not really matters to me.

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.