Go Down

Topic: Serial interupt (SOLVED) (Read 407 times) previous topic - next topic

Feb 12, 2013, 01:44 pm Last Edit: Feb 12, 2013, 05:56 pm by michastro Reason: 1
Hello,
I'm working with UNO32, and I would like to use serial communication but through interrupt. For example, if a serial data arrived, an interrupt is trigger, and I process the data.
Thanks

johnwasser

The chipKIT "UNO32" is not an Arduino and does not have an ATmega processor so you're going to have trouble getting help here for it.  I would start reading the datasheet for the PIC32MX320F128 to see how to work with the hardware serial port.  Good luck!
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

PaulS

Serial data delivery is already interrupt based. Why is not checking Serial.available() in loop() sufficient?

For example with the timer2, I use:
void __ISR(_TIMER_2_VECTOR,IPL3AUTO) comms2_handler(void)
{
}
perhaps something like:
void __ISR(_UART_1_VECTOR,IPL3AUTO) comms2_handler(void)
{
}
?????


PaulS

S   e   r   i   a   l      d   a   t   a      a   r   r   i   v   e   s      s   l   o   w  l   y.

I still don't see why the arrival of one byte needs to interrupt the Arduino. What else is it doing?

I need this interrupt because in the same time I have several timers, and I want to manage special priorities order.
I have found the solution:

#include <plib.h> /* this gives the i/o definitions */

boolean received;

void setup()
{
received=false;
Serial.begin(38400);
}

void loop()
{
if (received)
{
  Serial.println("RECEIVED!!!");
  received=false;
}
}

extern "C" {
void __ISR(_UART_1_VECTOR, ipl4) U1_ISR(void)
{
  if(mU1RXGetIntFlag())
  {
    // Clear the RX interrupt Flag
    mU1RXClearIntFlag();

    // Handle Character
    received=true;
  }
}
}
and now I can choose the IPL I want!

Thanks

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy