The Godfather talking
Share your stuff or I will make you regret it.
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 08, 2016, 09:03:58 21:03


Login with username, password and session length


Pages: [1]
Print
Author Topic: 8051 "two codes in flash"  (Read 1634 times)
0 Members and 1 Guest are viewing this topic.
ktasdelen
Newbie
*
 Muted
Offline Offline

Posts: 23

Thank You
-Given: 16
-Receive: 5


« on: November 10, 2009, 10:45:39 10:45 »

Hi Everybody

I have 2 codes:
for example, First code :0x0000-0x1fff
second code : 0x3000 - 0x7fff

I want to learn " how can I run these codes together"

can anybody help me or suggest any source?
Logged
sam_des
Active Member
***
Offline Offline

Posts: 221

Thank You
-Given: 47
-Receive: 111


« Reply #1 on: November 10, 2009, 11:09:04 11:09 »

Hi,

Can you be more informative ? Huh

I wonder why people never think that whatever they say or write may seem completely nonsense even if it makes perfect sense to themselves ?  Roll Eyes

reagrds,
sam_des
Logged

Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 3816

Thank You
-Given: 567
-Receive: 2049


There is no evidence that I muted SoNsIvRi


« Reply #2 on: November 10, 2009, 12:46:52 12:46 »

Problem maybe in the translation, if the native is say english and is translated to spanish, how do you know, it was translated correctley. even if you translate back to english it may look ok.
granted the question is not easy to work out.

he has two code samples (and we know that he can't run both at the same time.(unles we missed something like the 8051 can multitask Smiley ) so does he want a way to select order they are run or what?
Logged

Note: If you have no posts other than, I want or reporting a dead link Then you can't complain If I remove your post So Stop Leeching
Ichan
Hero Member
*****
Offline Offline

Posts: 840

Thank You
-Given: 312
-Receive: 387



WWW
« Reply #3 on: November 10, 2009, 12:52:12 12:52 »

Hi,

I'm interested to know what kind of application you aim for with that two code in one.

A bootloader usually is a small code that run another code if some condition satisfied, perhaps you could learn from it.

-ichan
Logged

There is Gray, not only Black or White.
aplank
Junior Member
**
Online Online

Posts: 84

Thank You
-Given: 70
-Receive: 108


« Reply #4 on: November 10, 2009, 03:40:51 15:40 »

Well,

I noticed this was posted on the Keil forum earlier and the guys there were equally baffled.

http://www.keil.com/forum/docs/thread15913.asp


Logged
ktasdelen
Newbie
*
 Muted
Offline Offline

Posts: 23

Thank You
-Given: 16
-Receive: 5


« Reply #5 on: November 10, 2009, 07:14:01 19:14 »

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).

Logged
oldvan
V.I.P
Senior Member
*****
Offline Offline

Posts: 375

Thank You
-Given: 152
-Receive: 106


If the van is a Rockin'...


WWW
« Reply #6 on: November 10, 2009, 07:29:27 19:29 »

Perhaps a timer interrupt can alternately flag one then the other as active,
and code can check this flag, co-operative time sharing?
Logged

Give a man a fish and you feed him for a day.
Teach a man to fish and he will sit around in a boat drinking beer all day.
sphinx
Hero Member
*****
Offline Offline

Posts: 504

Thank You
-Given: 232
-Receive: 124



« Reply #7 on: November 10, 2009, 07:54:45 19:54 »

why cant you just use a simple pin change check to which programpart to run. doesnt sound too strange to me to use different program to tell which to use. maybe a bit like a 110/220 switch or 2 in one chip for different languages, or just as simple as to use same chip in 2 different hardwares that are a bit modified.

regards
Logged

the more you learn, the lesser you get to understand. is it then good know alot but not understand what you know or.......
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2018

Thank You
-Given: 514
-Receive: 477


Top Topic Starter


« Reply #8 on: November 10, 2009, 09:31:30 21:31 »

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:
Code:
// =========== 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:
Code:
// =========== 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.
« Last Edit: November 10, 2009, 09:50:12 21:50 by metal » Logged

nothing to say..
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC