Hello
I Always used Atmel AT89C51RE2 but there the production stopped we changed over to Silicon C8051F580 processor.
now I am facing problems with the memory. when I add variables after downloading the program wont run. the compiler give Program Size: data=78.3 xdata=172 code=10749
so to mine point there is enough space. maybe something with parameters?
with regards
Jos
Of course the program runs.
There are only 3 ways to stop a CPU from running: 1. no power; 2. something external is holding it in reset; 3. your code has put it into a "sleep" state.
Otherwise, the CPU will always be running; ie, fetching stuff from CODE memory, and executing it. Of course, what it's fetching may be junk - but it will still be running.
"so debugging is also impossible."
Not at all! The debugger lets you see where it's going wrong!
OK - make that four:
4. The clock has stopped.
Hello Andrew
thanks for your response.
I will try to explain what I am doing.
Our company has a monitorsystem and I am working on the substations. Normally the substations do not have the ability to store measurements. This is what I am trying to achieve.
on the old board with the AT89C51RE2 it works.
but as I told before this processor is obsolete and we changed over to C8051F580
what should have same memory space.
First I get the firmware running without datalogging, to see if the hardware was ok. now I am adding the routinges for datalogging. therefore I need more variables, after adding those variables the problems starts.
the program did not start.
in the C8051F580 I use a startup program and found out that the program hangs in the first routine ( I will add a part of the code later) when I reduce the amount of variables it runs again.
Now I am using some structures, what seems to work but I find that the variables are corrupted.
maybe I use some wrong arguments in the code (pragma?)
here the startup file
?C_STARTUP: LJMP STARTUP1
RSEG ?C_C51STARTUP
STARTUP1:
IF IDATALEN <> 0 MOV R0,#IDATALEN - 1 CLR A IDATALOOP: MOV @R0,A DJNZ R0,IDATALOOP ENDIF
I use this argument in the main routine
SFRPAGE = ACTIVE_PAGE;
if you can help me further, please
thanks in advance
So where, exactly, is it hanging?
And what, exactly, is the point at which it goes from "working" to "hanging"?
Look at the instructions for posting source code: www.danlhenry.com/.../keil_code.png
you are missing the watchdog disable in startup
this is mine memory model
//memory model for Titan //version: //date 02 march 2018 #include "defines.h" #include "memory.h" signed char iPos = -1; //pointer received data signed char xdata channel=0; signed char xdata Address; signed char xdata iMessLen=0; unsigned char idata hexstring[8]; unsigned char xdata Uart_Buffer_Pointer = 0; //unsigned char xdata Uart[Uart_Buffer_In_Size]; unsigned char xdata rMessage[Uart_Buffer_In_Size]; // data for processcom unsigned char xdata sMessage[Uart_Buffer_Out_Size]; // data for Sendbuffer unsigned char xdata LMessage[Uart_Log_Output]; unsigned char idata Uart_Tx_Index; unsigned char idata Uart_Tx_SendLen; unsigned char idata mem[0x10]; unsigned char idata CalData[0x10]; unsigned char idata ScheduledKanalen=0x00; // Mask of kanalen used in scheduling unsigned char idata MeasuredKanalen=0x00; // Mask of kanalen measured since last readout signed int xdata Kanalen[NUMANAIN] = {-32768,-32768,-32768,-32768}; unsigned char xdata Dig[2]; // Control for digital in and out unsigned char LRCResult(); unsigned char xdata ucLRC; //clock //signed int date=0; long idata seconds=0; long idata longvalue=0; //datalogging bit memory_overwrite_flag = 0; bit memory_overflow_flag = 0; bit setlogging_flag =0; bit forced_logging_flag =0; bit setmask_flag = 0; //uart bit uart_rx_valid=0; //data received valid bit uart_tx_flag=0; //data transmitted valid bit ti_1_busy; bit rx_valid; bit sendserialnumber; bit TX_Ready =0; struct TimeProfile idata Tprofile; struct LogProfile idata Lprofile;
this is the start of mine program
SFRPAGE = ACTIVE_PAGE; PCA0MD &= ~0x40; // Disable watchdog timer PORT_Init(); // Initialize Port I/O SYSCLK_Init (); // Initialize Oscillator TIMER0_Init (); // Initialize Timer0 TIMER2_Init (); // Initialize Timer2 SPI0_Init (); UART0_Init (); // Initialize UART LED_1 = OFF; LED_2 = OFF; LED_3 = OFF; //SFRPAGE = ACTIVE2_PAGE; //disabling this line will activate wd but out of control EA = 1; RX_EN = OFF; TX_EN = OFF; readcaldata(); ADC_Init(); Watchdog_Init (); if ((RSTSRC & 0x02) == 0x00) // First check the PORSF bit. if PORSF { // is set, all other RSTSRC flags are // invalid // Check if the last reset was due to the Watch Dog Timer if (RSTSRC == 0x08) { EA = 1; // Enable global interrupts } } // Calculate Watchdog Timer Timeout // Offset calculated in PCA clocks // Offset = ( 256 x PCA0CPL5 ) + 256 - PCA0L // = ( 256 x 255(0xFF)) + 256 - 0 // Time = Offset * (12/SYSCLK) // = 255 ms ( PCA uses SYSCLK/12 as its clock source) PCA0MD &= ~0x40; // Disable watchdog timer PCA0L = 0x00; // Set lower byte of PCA counter to 0 PCA0H = 0x00; // Set higher byte of PCA counter to 0 PCA0CPL5 = 0xFF; // Write offset for the WDT PCA0MD |= 0x40; // Enable the WDT watchdog still not working well EA = 1; // Enable global interrupts </prev> Also I use the standard startupfile from Keil/Silicon
who cares about your memory model, your problem is not disabling the WD in startup
and it's incomplete, anyhow; eg, where are the array size definitions?
Not sure that this would generally be called a "memory model" - it's just a list of (presumably global?) variables.
www.silabs.com/.../mcu_constantly_reset-2DbM
thanks Erik
I will try Jos
Note that this was the very first reply given to your cross-post on the SiLabs forum:
www.silabs.com/.../hello_i_am_jos-5BRm
Thus showing the importance of keeping up-to-date with all the threads if you're going to cross-post the same questions to multiple places!
Be sure to go back and thank 'delu' on the SiLabs forum ...