How compatible is the Xiao to an Arduino e.g. Nano?

One of the problems I have is after putting the Serial.print(func); into the interrupt routine in DCC_interrupt routine, where do I put the Serial.begin( ); command?
I tried in the DCC_Decoder.cpp and it throws up an error, presumably as there isn’t a void setup(): section.
I put it in the program void setup() section and I just get a continuous output of "1"s whether there is an input on pin 2 of the Xiao or not.

Keith