isp mode for 8051 using rs232 handshake protocol

Status
Not open for further replies.

blazes16

Newbie level 4
Joined
Mar 20, 2013
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,330
i need to know how to assign the rst pin and psen pin to rs232 in c code for the handshake protocol. i cannot start the coding because i cannot assign it.
 

You can't do that. RST and PSEN are dedicated pins, you can't use them for your own evil purposes.
 

I'm not sure what you mean by "isp mode" and RS-232. First of all, an 8051 doesn't HAVE an isp mode (unless you are using some other variant--WHICH ONE?). Secondly, RS-232 is a communications protocol, it has nothing to do with isp. Thirdly, an 8051 doesn't explicitly implement RS-232, it has a UART which handles the data transmit and receive lines; you'll have to create the handshaking lines in your software.
 

i'm using the p89c51rd2h which has the in system(ISP)/in application(IAP) programming function. the ISP in the datasheet are about manually reset the uC by bringing the RESET pin low and manually bring the PSEN pin high circuits. i want to do a c code where i can trigger it using software so i do not have to manually bring it to ISP mode. yes,i have done it referring to assembly language. i'm doing it in c language. i'll put the code for you to check if it can work or not because i cannot test it without knowing how to toggle the RESET pin and PSEN pin.

Code:
#include <reg51.h>
sbit CTS = RST;   //don't know how to set//
sbit RTS = PSEN; //don't know how to set//
void init();
void transmit();
void TODelay();
void main()
{
 init();
 transmit();
 ISP();
}

void init()
{
 TMOD=0x20;  
 TH1=0XFD; 
 SCON=0x50;
 TR1=1;
}

void transmit()
{
 while(RTS = 1)
 {
  CTS = 1;
  while(RI == 0)
  RI = 1;
  SBUF = 0;
 }
 TODelay();
 CTS = 0;
 TODelay();
}

void ISP()
{
 AUXR1 = 0x20;
 R0 = ; 
 R1 =0x06;
 DPTR = 0x00;
 while(ACC == 0);
 system("C:\Program Files\Flash Magic\FlashMagic.exe");
 ACC = 1;
}

void TODelay()
{
 TMOD = 0x01;
 TL0 = 0x00;
 TH0 = 0x35;
 TR0 = 1;
 while (TF0 == 0);
 TR0 = 0;
 TF0 = 0;
}
 

I'm not really familiar with this device, but from what I can see I don't think you can reprogram the entire device (like ISP), you can only use IAP to program sections of the ROM.

I think you've got a chicken-and-egg situation: if your application code asserts RESET, then your application will stop running.

But I think you can use the bootloader to reprogram the device on startup.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…