CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

problem in SERIAL - ISR EACH TIME REQUIRE MANUALY RESET

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
maq



Joined: 13 Aug 2009
Posts: 2

View user's profile Send private message

problem in SERIAL - ISR EACH TIME REQUIRE MANUALY RESET
PostPosted: Tue Aug 25, 2009 6:15 am     Reply with quote

I M DOING SERIAL COMM. B/W 2 PIC18F USING HARDWare RS232.

I HAVE A PROBLEM WHEN SENDING SERIAL DATA SECOND TIME .

IT DOES NOT RESPONSE WELL AS IN FIRST TIME WHEN I POWER IT.

EACH TIME I HAVE TO RESET THR PIC MANUALLY.

THEN IT RESPONSE WELL..

I ALSO CLEARED THE SERIAL INTERUPT AT THE END OF ISR .

BUT DIDNOT FIND ANY RESPONSE(SAME PROBLEM)

ANY BODY HOW TO DO?????
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Aug 25, 2009 6:58 am     Reply with quote

You will get a better response when you learn the basic rules of how to behave on a forum.

Don't start a new thread for the same or related questions. This is a double post from http://www.ccsinfo.com/forum/viewtopic.php?t=39998
maq



Joined: 13 Aug 2009
Posts: 2

View user's profile Send private message

PostPosted: Tue Aug 25, 2009 8:58 pm     Reply with quote

Thanx for your response.

I use this code to send data to hyper terminal.
It run well but when I receive data from hyperterminal. It halt.
I check on scope. It does not send any data.
I have to reset it each time.

Here is code:
Code:

#include <18F4550.H>
#include <string.h>
#fuses HS, NOWDT, BROWNOUT, NOPUT, NOLVP
#use delay(clock=20000000)      // 4 MHz OSC
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)

////////////////// INTERRUPT FUNCTION   /////////////////

#INT_RDA
void serial_isr()
{
 int i=0;
char ack[3];
char comp[3]="OK";

gets(ack);

if(strncmp(ack,comp,2)==0)
  {
  printf("i m right");
     do
     {

     output_high(PIN_D0);
     delay_ms(100);
     output_low(PIN_D0);
     delay_ms(100);
     i++;
     }while(i<10);
   }
else
{
printf("i m wrong");
 do
     {

     output_high(PIN_D1);
     delay_ms(100);
     output_low(PIN_D1);
     delay_ms(100);
     i++;
     }while(i<10);
}
clear_interrupt(INT_RDA);
}


/////////////////// MAIN FUNCTION /////////////////

void main()
{
enable_interrupts(INT_RDA);
 enable_interrupts(GLOBAL);
SET_TRIS_B( 0x26 );
 set_tris_D(0x00);

///////////////// for communication with slave1.

output_low(PIN_D0);
output_low(PIN_D1);

while(1)
{
   if(input(PIN_B5)==0)
    {
      puts("CMD");
      output_high(PIN_D3); 
 
     while(input(PIN_B5)==0);
    }
     //output_low(PIN_D2);
      output_low(PIN_D3);
}

}

Guide me......
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group