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

PIC18F87J60 no UART2 interrupt

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



Joined: 07 Feb 2008
Posts: 164

View user's profile Send private message

PIC18F87J60 no UART2 interrupt
PostPosted: Mon Oct 03, 2016 9:34 am     Reply with quote

I can't seem to get UART on my PIC18F87J60 to generate an interrupt. PCWH version 5.021. TTL signals at good at RX2 (RG2) at 9600 baud

*h
Code:

#use rs232(baud=9600,UART2,parity=N,bits=8,ERRORS,stream=PC)



interrupt code:
Code:

//RS232 Com PC Interrupt
#INT_RDA2
void  RDA_isr(void)
   {
   Char_In= fgetc(PC);
   if ((Char_In >= 0x61) && (Char_In <= 0x7A))         //if lower case, then...
      Char_In = Char_In - 0x20;                     //change to upper case
   Char_In_Buffer = TRUE;
   }



Main:
Code:

//==============================================================================
void main()
{

char   Temp_In;


//Initialize external devices
lcd_init();
init_ext_eeprom();

Can_Edit= FALSE;                     //can't edit parameters on PC screen to start
Last_Menu= 0;                        //set both last and current menu to 0
Menu= 0;
output_low(Fan2_Drive);               // Set CCP2 output low
output_low(Fan1_Drive);               // Set CCP1 output low

setup_ccp1(CCP_PWM);                 // Configure CCP1 as Fan1 drive
setup_ccp2(CCP_PWM);                 // Configure CCP2 as Fan2 drive

setup_timer_2(T2_DIV_BY_16, Max_Duty, 1);  // 500 Hz     

set_timer1(0);           
setup_timer_1(T1_INTERNAL | T1_DIV_BY_1); 
setup_ccp3(CCP_CAPTURE_RE);   


//Interrupt enables:
//clear_interrupt(INT_CCP3);             // Clear the CCP1 interrupt flag before we enable CCP1 interrupts, so that we don't get an unwanted
//enable_interrupts(INT_CCP3);
enable_interrupts(INT_RDA2);         //enable PC communications
enable_interrupts(GLOBAL);            //enable global interrupts

//PC communication initialization
Char_In_Buffer= FALSE;
index= 0;
Got_Param_Num = FALSE;
Menu= 0;
for (index= 0 ; index <= 4 ; index++)
    Char_Buffer[index]= 0;

//Restore Operational values on boot-up

//write_ext_eeprom(2,0x33);

Temp_In = read_ext_eeprom(2);

delay_us(1);


//ee_backup();

//ee_restore();

While(TRUE)
   {
    Output_Control();   

   if (Char_In_Buffer)
      {
      Char_In_Buffer= FALSE;
      Get_PC_Message();
      }
   }
}



Anything look wrong here?

Thanks!
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