How to attachInterrupt in my code

my code of rfid :
int buffer[14];
int *buffer_at;
int *buffer_end = buffer + sizeof(buffer);

String checksum;
boolean tagfound = false;

void setup()
Serial.println(“Serial Ready”);

Serial.println(“RFID Ready”);

void loop()

if (Serial1.available()){
buffer_at = buffer;
while ( buffer_at < buffer_end )
*buffer_at++ =;
tagfound = true;

if (tagfound){
buffer_at = buffer;
uint32_t result = 0;
// Skip the preamble
// Accumulate the checksum, starting with the first value
int checksum = rfid_get_next();
// We are looking for 4 more values
int i = 4;
// Grab the next value
int value = rfid_get_next();
// Add it into the result
result <<= 8;
//Serial.print(“Add =”);
result |= value;
//Serial.print(“Xor =”);
// Xor it into the checksum
checksum ^= value;

// Pull out the checksum from the data
int data_checksum = rfid_get_next();

// Print the result
Serial.print(“Tag: “);
if ( checksum == data_checksum )
Serial.println(” OK”);
Serial.println(" CHECKSUM FAILED");
// We’re done processing, so there is no current value

tagfound = false;



int rfid_get_next(void)
// sscanf needs a 2-byte space to put the result but we only need one byte.
int hexresult;
// Working space to assemble each byte
static char byte_chars[3];
// Pull out one byte from this position in the stream
buffer_at += 2;
return hexresult;

here i wanna make program where if that tag scan by reader it will call some process, and then if that other tag have been scan it will call other process and that first process will be interrupt.
so hopefully you could help me :mrgreen: :bulb: