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 CCS Technical Support

receive interrupt dspic30f3011 problem

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







receive interrupt dspic30f3011 problem
PostPosted: Wed Mar 25, 2009 2:57 am     Reply with quote

hello!

We do not become the communication.
Anything which sends data whether we have the problem does not have the problem.
It is an authentication thing whether it is an interrupt problem.
Code:

#include <30F3011.h>
#FUSES HS                       //High speed Osc (> 4mhz)
#FUSES PR                       //Promiary Oscillator
#FUSES RESERVED                 //Used to set the reserved FUSE bits

#use delay(clock=20000000)
//#use rs232(baud=19200,parity=N,xmit=F5,rcv=F4,bits=8)
//#use rs232(baud=9600, UART2,stream=pc_host)
#use rs232(baud=9600,parity=N,xmit=PIN_F5,rcv=PIN_F4,bits=8,stream=pc_host)
char pc_data[20];
int i;
int mun =0;
int LED_Flag;
int no_flag;
int bat;
int temp;
int delay_flag = 0;

#int_RDA2
void  RDA2_isr(void)
{
            pc_data[0] = fgetc(pc_host);
            output_bit(pin_E3,1);         //GREEN
            delay_ms(500);
            output_bit(pin_E3,0);         //GREEN
            delay_ms(500);

}


void main()
{


    delay_ms(1000);
       output_bit(pin_E1,1);         //GREEN
       delay_ms(100);
       output_bit(pin_E1,0);         //GREEN
       delay_ms(100);



        delay_ms(1);
        #use rs232(baud=19200, UART1A)
        printf("%c%c",0xa3,1);
        printf("%c%c%c",0xa1,0,0);
        printf("%c Roll Indy Check  %c",0xa2,0);


      output_bit(pin_E8,0);         //RS485 Enabled

   enable_interrupts(INT_RDA2);
   enable_interrupts(intr_GLOBAL);


    while(true)
   {


      if((pc_data[0]=='S')   )
       {
            output_bit(pin_E1,1);         //GREEN
            delay_ms(500);
            output_bit(pin_E1,0);         //GREEN
            delay_ms(500);
            pc_data[0] = 'A';

       }




        i++;

        #use rs232(baud=19200, UART1A)
        printf("%c%c%c",0xa1,0,1);
        printf("%c da= %c %c %c",0xa2,pc_data[0],i,0);
        delay_ms(100);
         
   }
}
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Wed Mar 25, 2009 7:43 am     Reply with quote

I don't see obvious problems at first look, just some less important things. The delay in RDA2 may cause overun errors, that block further receiption, cause no error handling is defined for UART2. Double initialization of UART1 duplicates the code but does no harm, hopefully. Furthermore, I'm not sure what's the role of RX485 enable in your hardware.

You didn't tell which part of the communication fails, you should be able to give more info, cause some code actions are monitored by LEDs.
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