Problème interruption Rx UART1 sur PIC18F46K22.

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
oliviermalherbe
Posts: 10
Joined: Mon Jan 13, 2020 4:00 pm
Been thanked: 1 time
Contact:

Problème interruption Rx UART1 sur PIC18F46K22.

Post by oliviermalherbe »

Bonjour,

J'ai effectuer de nombreux essais avec Flowcode 6 pour essayer d'activer l'interruption sur Rx de l'USART1 sur un PIC18F46K22.
J'ai déjà tester une réception via l'USART1 sans interruption et cela fonctionne correctement, mais impossible de faire fonctionner l'interruption et l'exécution d'une macro associée.

J'utilise un bloc custom interrupt, et j'ai consulter la notice du 18F46K22, mais je ne suis pas sur du "Enable code" et du "Handler code" que j'ai rentré.

Quelqu'un a-t-il déjà rencontré ce genre de problème et pourrait m'aider ?
Je joints mon programme ci-dessous.

Merci par avance.

Olivier.
Attachments
Flowcode1.fcfx
(6.76 KiB) Downloaded 189 times

chipfryer27
Valued Contributor
Valued Contributor
Posts: 617
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 195 times
Contact:

Re: Problème interruption Rx UART1 sur PIC18F46K22.

Post by chipfryer27 »

Salut Olivier

Désolé pour mon français. Google Traduction <s>

En regardant votre Flowcode, je ne sais pas comment vous sauriez s'il ne fonctionne pas. Si je lis correctement: -

Vous réglez votre horloge
Vous initialisez l'UART
Vous activez l'interruption sur le RXin

Vous entrez ensuite une boucle pour dix itérations. Dans la boucle, vous faites clignoter une LED Marche / Arrêt pendant seulement 200 ms. Ce serait très sombre, voire pas du tout visible.

Vous entrez alors dans une boucle sans fin qui continue d'allumer la LED.

Si votre interruption se produit, vous éteindrez alors la LED pendant seulement 200 ms avant de quitter la routine et de la réactiver immédiatement. Le remarqueriez-vous réellement?

Choses à essayer: -
Augmentez tous vos délais. Cela vous donnera une chance de voir si quelque chose fonctionne.
Essayez d'utiliser l'interruption RXINT0 au lieu de votre code et voyez si cela fonctionne.

J'espère que cela t'aides

For those without Google Translate <s> :-

Hi Olivier

Sorry for my French. Google Translate <s>

Looking at your Flowcode, I'm not sure how you would know if it is not working. If I read correctly :-

You set your clock
You initialise the UART
You enable interrupt on the RXin

You then enter a loop for ten iterations. In the loop you flash an LED On / Off for only 200mS. It would be very dim if at all visible.

You then enter an endless loop that keeps switching the LED On.

If your interrupt occurs, you would then switch Off the LED for only 200mS before exiting the routine and immediately switching it back On. Would you actually notice this?

Things to try:-
Increase all your delays. This will give you a chance to see if anything is working.
Try using the RXINT0 interrupt instead of your code and see if this works.

Hope this helps

Post Reply