fork download
  1.  
  2.  
  3. void __ISR(_UART_1_VECTOR, ipl1) IntUart1Handler(void)
  4. {
  5. // Is this an RX interrupt?
  6. if(INTGetFlag(INT_SOURCE_UART_RX(UART_MODULE_ID)))
  7. {
  8. // Clear the RX interrupt Flag
  9. INTClearFlag(INT_SOURCE_UART_RX(UART_MODULE_ID));
  10.  
  11. // Echo what we just received.
  12. PutCharacter(UARTGetDataByte(UART_MODULE_ID));
  13.  
  14. }
  15.  
  16. // We don't care about TX interrupt
  17. if (INTGetFlag(INT_SOURCE_UART_TX(UART_MODULE_ID)))
  18. {
  19. INTClearFlag(INT_SOURCE_UART_TX(UART_MODULE_ID));
  20. }
  21. }
  22. //
  23. void PutCharacter(const char character)
  24. {
  25. while(!UARTTransmitterIsReady(UART_MODULE_ID))
  26. ;
  27.  
  28. UARTSendDataByte(UART_MODULE_ID, character);
  29.  
  30.  
  31. while(!UARTTransmissionHasCompleted(UART_MODULE_ID))
  32. ;
  33. }
  34. //
  35. // eg.
  36. // WriteString("*** UART Interrupt-driven Application Example ***\r\n");
  37. // Helper functions
  38. void WriteString( char *string)
  39. {
  40. while(*string != '\0')
  41. {
  42. while(!UARTTransmitterIsReady(UART_MODULE_ID))
  43. ;
  44.  
  45. UARTSendDataByte(UART_MODULE_ID, *string);
  46.  
  47. string++;
  48.  
  49. while(!UARTTransmissionHasCompleted(UART_MODULE_ID))
  50. ;
  51. }
  52. }
  53.  
  54.  
  55. void UART1Trans_fail( void)
  56. {
  57.  
  58. P_Debug_O=1;
  59. if(UARTTransmitterIsReady(UART_MODULE_ID))
  60. {
  61. UARTSendDataByte(UART_MODULE_ID, U1TX_Buffer[U1TX_Index]);
  62. // IO_FLAG.U1TXP=1; //Uart1 TX in processing flag hand up
  63. IO_FLAG.U1TXReady=0;
  64. }
  65. // P_Debug_O=0;
  66. if(UARTTransmissionHasCompleted(UART_MODULE_ID))
  67. {
  68. // IO_FLAG.U1TXP=0;
  69. if(U1TX_CNT==0) //check need to send next byte
  70. {
  71. IO_FLAG.U1TXReady=1;
  72. IO_FLAG.U1TXP=0;
  73. }
  74. U1TX_CNT--;
  75. U1TX_Index++;
  76. }
  77.  
  78. // while(!UARTTransmissionHasCompleted(UART_MODULE_ID)) ;
  79. P_Debug_O=0;
  80. }
  81. //
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘__ISR’:
prog.c:3:34: error: expected declaration specifiers before ‘IntUart1Handler’
 void __ISR(_UART_1_VECTOR, ipl1) IntUart1Handler(void)
                                  ^
prog.c:24:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 {
 ^
prog.c:39:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 {
 ^
prog.c:56:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
 {
 ^
prog.c:80:1: error: expected ‘{’ at end of input
 }
 ^
stdout
Standard output is empty