Jump to content
 
  • 0
ingbaker

Interrup with Mcc - Uart

Question

2 answers to this question

Recommended Posts

  • 0

I think specifically we need to know what processor you are trying to use as this differs from device to device.

The simplest and most generic answer would be to add the UART to your project and click on the checkbox to enable interrupts for the driver. After generating code you will have to set the callback which you want called when the interrupt occurs. After this you need to make sure you are enabling interrupts in your main code and it should work.

If you supply us with the details above I will post some screenshots for you on how to do this.

Just to show you the idea I picked the 16F18875 and added the EUSART as follows:
image.png

You can see I clicked next to "Enable EUSART Interrupts"

Then in my main I ensured the interrupts are enabled.

image.png

When I now run the code the ISR created by MCC is executed every time a byte is received. The ISR function is called EUSART_Receive_ISR and it is located in the eusart.c file. You can edit this function or replace it by setting a different function as ISR by calling EUSART_SetRxInterruptHandler if you want to change the behavior.

 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


 


×
×
  • Create New...