If im not wrong, an ISR is supposed to do minimal processing when it receives a data serially(via UART).
Im planning on implementing such a protocol for communication between 2 systems via uart.
This is a rough situation of how i plan on coding the ISR.
Assume 2 system A & B where A is sending a message to B:
Keyword is used to indicate start of message(Established-data/length cannot be the keyword).
ChannelOK,Length of data,RxLength,RxData,Packet received flag in B’s process are default 0.Length of data=no. of(all data)in bytes(ex:if all data=1,Length of data=1)
A's Process
Send Keyword
Send Length of data
Send all data
B's Process
Rx Interrupt
enter ISR
ISR: if(Received Byte == Keyword && !ChannelOK)
{
Set ChannelOK
}
if(ChannelOK && RxLength)
{
Set Length of data=received byte
ChannelOK=0
RxLength=0
}
if(Length of data != 0 && RxData)
{
Store Data
--Length of data
if(Length of data==0)
{
Set Packet received flag
RxData=0
}
}
if(ChannelOK)
{
Set RxLength
}
if(Length of data)
{
Set RxData
}
Reset to Interrupt Again
My doubt is: B has so many stuff to do in the ISR while A is sending continuously. Asumming A sends data at 7.5Mbps(11 bits per transfer), the ISR has to reset the interrupt ever (11/7.5M) seconds. This seems very very small. Will data be lost if i fail to reset the interrupt on time or will it be stored in the 16 byte FIFO so that an interrupt can be immediately triggered the second i reset the interrupt or must i slow down A Tx process by waiting for an ACK for each byte(slows down a lot)???
Im a newbie to ISR’s.Please do help
Any ISR designs or protocols for serial data communication would be useful
Thanks