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
Maybe can be a problem of my small micro?
Most likely not. I would guess it is a problem with the code, but lacking the code it is hard to verify that.
What do u think about this?
I think that given the scarcity of information, any statement about the nature of the problem can be classified as speculation.
What do u think about this? I have no idea what micro (u) think about this, what I think is that you are trying to run before you have even learned to crawl, that is a surefire way of breaking a leg. learn to crawl, THEN learn to walk, THEN learn to run. 1) read "the bible" and the datasheet for your device a couple of times to familiarize yourself with the contents. 2) work through (I did NOT say 'read') the Keil "getting started guide" 3) do some simple projects (start with 'blinky') gradually adding complexity 4) go back to whatever running it is you are trying to do way too early.
Erik
I understand your example. But in my code i have this:
First iteraction SP=10 (setpint) PV=0 (value read from ADC) Kp=1 P=KP*(SP-PV)=1*(10-0)=10 Second iteraction SP=10 (setpint) PV=6 (value read from ADC) Kp=1 P=KP*(SP-PV)=1*(10-6)=4 but my pid->iState should be 10+4=14, and it is 4
i dont know why dont save the old value in pid->iState
Are There Anybody that help me with my project?? Maybe i can send the code for see it!!!
It is very important for me!! Thanks
You've checked only this part of your code? You have to ensure, that there is no underflow/overflow/division by 0 in the whole code and under all circumstances (for example extreme user input). The "updating problem": It helps a lot if you screw down your code to the interesting core and debug it. If this fails you can show this very short program and all the necessary information to the forum. And don't forget to mention the controller, hardware, RTX. Check the datasheet of the controller and the camera. It seems you didn't.
Sorry. "Camera" belongs to an other thread I read in parallel.
OK! Im working with an emulator (EPM900) and an evaluation board (MCB900), my micro is Philips P89LPC936, under RTX-51.
Independent of my PID, the problem is the var update. For example:
void Write (void) _task_ WRITE _priority_ 1 { int Ub=0; while (1){ Ub+=1; TXRX_putByte(Ub); //send to serial port } void main (void){ os_start_system (WRITE); }
The var Ub always is 1, never update the value ???????
Recently i debugg my code in the simulator of uvision and all var are updated!!! Why dont work in my board?????????
Recently i debugg my code in the simulator of uvision and all var are updated!!! Why dont work in my board????????? DUH, the simulator simulates.
if there is e.g. a baudrate error, the simulating thing will still work, if the internal XRAM in the device is not enabled the simulating thing will still work, ....
if the var you are hunting is in xdata, I'll bet you dollars to doughnuts that you have not modified startup.a51 to enable your XDATA.
BTW this newfangled thing that only few know about called a datasheet will tell you what is needed.
looking at the Keil manual and the startup code will show you why this must be at the start of startup.a51.
java
you be please ignoring sir eracs terrrible sarcasem.
he is be thinking he be funny,,, but he is just crazy yes.
rahib, what happened? where is praise? where is the submission :) :) :) where is the propaganda ?! it is sir erac you are talking about maaaaaaan !!!!
now seriously: your friend did not provide vital data that could have solved his problem earlier and save us time, headache and heartache! instead he offered money. YUK.
HI Eric!! First thanks for your reply.
My code startup is: START900.A51 because i use Philips P89LPC936. It has 512 bytes of xdata.
I have modificated only this:
; <o> XDATASTART: XDATA memory start address <0x0-0xFFFF> ; the absolute start-address of XDATA memory XDATASTART EQU 0x000 ; ; <o> XDATALEN: XDATA memory length <0x0-0xFFFF> ; the length of XDATA memory in bytes. XDATALEN EQU 0x200 ;
i say no!!!!!!
i asking his help and ansewrs and he be ignored me
i think he liking to heat poeple up and spit the bit out yes???
he say lots but not say much for poeple to be using.
now he is not sir but he being something other yes!!!!
why are taking this so seriously? ok, I sometimes also think that I'd rather jump into a swimming pool filled with Pirenia fish rather than being bashes by Erik, but (un)fortunately he often knows what he is talking about (like this one!). so relax and enjoy the bottomless well of knowledge (gee, I'm poetic!)
IF i enable Use On-Chip XRAM i cant compile the aplication because :"ADRESS SPACE OVERFLOW".
OK!!! A simple questions:
Have i configurate START900.A51 for use On-Chip XRAM??? Is It necessary??
you do this ardours task of reading the datasheet and find that e.g. this is an example, not supposedly correct ORL AUXR1,#0x40 will enable the internal xram. Then right after the STARTUP: label (the one branched to from 0) you insert the proper instruction based on what you found in the datasheet.
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.
View all questions in Keil forum