HI!!
I declared 3 global var, i call it inside diferent task and every execution this var should be updates but not to do it. I have a 8051 under evaluation board. Maybe can be a problem of my small micro? What do u think about this?
Thanks
Thanks Erik, But i have declared a global var in this way: int idata Uc; my program : Memory model: Large: var in Xdata Code size: Large: 64k OS: RTX-51 full
My task that only acumulate a value not work.
void PIDb (void) _task_ B _priority_ 1 { Uc+=(value);
If my var is in idata is necesary enable xram?? Im trying all and it not work. Im sure that it is a small thing but i cant find ...
This is my serial port initialization:
P2M1 = 0; /* P2 output modo 1, LEDs */ P1M1 = 0; /* P1 output modo 1 -> COM1 activado */ BRGCON = 0x00; /* Para evitar que BRGEN este activo cuando inicializamos el baud rate */ SCON = 0x52; /* initialize UART (Modo 1: 8 bits, enable Tx) */ BRGR0 = 0xF0; /* 9600 baud, 8 bits, no paridad, 1 bit de stop */ BRGR1 = 0x02; BRGCON = 0x03; /* Activamos BRGEN */
...
You probably don't want to use the large memory model then, if you do not want to have variables in XDATA by default.
read up on memory models in the manuals.
If I change my memory model my code dont compile because adress space overflow...
Read up on memory models in the manuals.
It will be worth the effort. Understanding why you should always try to use the small memory model is worth every minute of the research.
If you do also need to use your (internal) XDATA, which you still can with a small memory model, then you have been given advise above how to enable it.
Ok, I understand why is better use small memory model but i dont know how apply to my code because i have too many error when i change the model...
Maybe i cant do it because my English level is regular and it is very difficult understand the manual. Thanks
Right. I had a quick look at your datasheet and I think (But I may be wrong) that the on chip XDATA is enabled by default because your chip has no external address lines. I can not see an SFR bit to control it either.
When you compile in small model, what errors do you get first? Is it "Address space overflow" and if it is which address space (IDATA?) does it say in the error message.
IDATA and DATA are very limited in size and you have to leave room for the stack also.
Any large variables (or arrays or structs) you want to force into XDATA to free up DATA/IDATA just declare them as XDATA.
OK, Thanks Mike!! I change my project to Small model. Now i have my global var in xdata and my code compile ok. But my global var not update the value, maybe can to be because in option target i cant put Use On-Chip XRAM?????
Copy and paste here the error you get when you try to compile with 'Use on-chip xdata' selected.
Are you sure you have enough XDATA your program requires?
No, im not sure. My micro is Philips P89LCP936, and when i compile my code: Program size: data=105.1 xdata=1286 code=10216 -0 errors, 0 warning but if i put Use On-chip XRAM: TOO MANY ERRORS ERROR L107:ADRESS SPACE OVERFLOW SPACE: XDATA SEGMENT: ?RTX?TASKCONTEXT?1 .... ... ERROR L105:PUBLIC REFERS TO IGNORED SEGMENT SYMBOL: UBMAN SEGMENT: ?XD?MAIN .... ... ERROR L118:REFERENCE MADE TO ERRONEUS EXTERNAL SYMBOL: ?RTX_... MODULE: RTXCONF.OBJ ADRESS:... ...
I have 3 errors type.
In datasheet of my micro i can read:
The various P89LPC933/934/935/936 memory spaces are as follows: -DATA 128 bytes of internal data memory space (00H:7FH) accessed via direct or indirect addressing, using instructions other than MOVX and MOVC. All or part of the Stack may be in this area. -IDATA Indirect Data. 256 bytes of internal data memory space (00H:FFH) accessed via indirect addressing using instructions other than MOVX and MOVC. All or part of the Stack may be in this area. This area includes the DATA area and the 128 bytes immediately above it. -SFR Selected CPU registers and peripheral control and status registers, accessible only via direct addressing. -XDATA (P89LPC935/936) ‘External’ Data or Auxiliary RAM. Duplicates the classic 80C51 64 kB memory space addressed via the MOVX instruction using the SPTR, R0, or R1. All or part of this space could be implemented on-chip. The P89LPC935/936 has 512 bytes of on-chip XDATA memory.
In Option target in uvision3 :
8051-based microcontroller with 2 clock highspeed core, 16K Bytes ISP/IAP Flash, 512 Bytes Data EEPROM, 256 Bytes RAM, 512 Bytes AUX RAM, Dual DPTR, 23(26) I/O Lines, 2 Timers/Counters, UART, I2C, SPI, 2 Analog Comparators, CCU, two 8-bit 4-ch ADC/DAC, WDT, RTC
so you are trying to fit 1286 XDATA bytes into 512 bytesr of XRAM space.
Sorry but they just won't go.
If you compile without ticking the "use on-chip xram" the compiler assumes you have plenty off-chip xram, so no errors but your code does not work because you have no off-chip xram.
Sorry but they just won't go. finally we got to the crus of the matter which, once more show that my crawl, walk, run method is the ONLY mmethid to get to where you can present such matters in a way that they can be resolved in a forum in less than a week or two. Not to forget that if the OP had done his crawling and walking, this matter would have been obvious to him and no thread would ever have been initiated.
Erik
I know this sounds a little cruel, but I just HAVE to say this: instead of paying bribes to people to do your homework, go buy new hardware! paying people to do your assignments. SHAME SHAME SHAME ON YOU! YUK !!!!!!!!!!!!
OK, Thanks. But then...What i can do??