hi;
my question is "how two applications can cooperate?"
I have two programs.
0000-7fff user space - user program can be change and program ISP(In System Programming)
f800-ffff boot space - main program can be program by parallel programmers.
main program will never change.
I can program mcu, no problem.
I wonder that can main program control user program?
for example
when I give an order, main program can do this (run or stop the user program).
Wait Wait Wait.. You have to reprogram ISP code (f800-ffff boot space) because this area is protected against flash write instructions and what you want in this case is to modify the original ISP code in order to make it respond to your commands or events, and be aware to change the value of N which identifies how many blocks you will use for ISP space when you use a parallel programmer. In your case N = 4, 512 bytes/Block.
I meant you have to modify the ISP code in order to run or stop the user code (0000-7fff user space). You can use serial communication or a pin in your processor to loop in main so as to send it to ISP code when you want to stop and loop forever in the ISP code waiting for another command to run the user code again. If you tell us what exactly you want to do and mention the microcontroller type/number as well as the codes I might be able to help you more because I modified an RS-232 ISP code to run on RS-485 instead and was able to send user code to ISP code and vice versa, but it was a bit of work and experiments a month ago because I am new to 8051 assembler.
For example you can go to ISP code as follows:
// =========== Goto ISP definition ===========
#define GotoISP() ((void (code *) (void)) 0xF800) ();
Now You can use GotoISP() to jump to ISP using a pin on the controller, in this case P3.2:
// =========== Main Function ===========
void main(void){
for(;;){
if ((P3 & (0x01<<2)) == 0){
GotoISP();
}
// User code
}
}
This is what I use to manually go to ISP after I reset the controller. BTW, not all 8051 microcontrollers automatically go to ISP program, so I need to know which microcontroller you are using. Some of them will automatically go to ISP provided that the first location in user code is 0xFF. But the problem with that is you have to ensure that you insert 0xFF at the first location in you assembler or C languages in the ISP code.