Hello Alan
The code you are using should be copied to a custom interrupt component.
If you copy an interrupt component into your program, and double-click on it to open the configuration window, you can select 'Custom' in the 'Interrupt on' box.
Put a meaningful name in the 'Display name' box, and make sure the 'Enable Interrupt' option is selected.
Select the appropriate macro in the 'Will call macro' box ('RX232' in this case).
When you click on the 'Properties' button, you will see 3 text boxes, with the middle one (Disable code) greyed out.
Copy
- UCSRB |= ((1 << RXCIE) | (1 << RXEN));
into the top box (Enable code).
Copy
- ISR(USART_RXC_vect)
{
FCM_%n();
}
into the bottom box. The macro name you selected will be substituted for %n in the final C code.
We can ignore the 'Disable code' box for now.
That should be the interrupt configuration completed.
The macro called by the interrupt must read the data from the USART to clear the interrupt. Luckily the Flowcode RS232::ReceiveRS232Char() component function does this, and returns the data in a Flowcode variable.
The interrupt occurs on completion of the reception of each character.