Can anyone please help me with an example on how to set USART RECEIVE interrupt up?
I am using Flowcode v3.1.0.31
Thanks!
Regards
Jan
Custom Interrupts
- Steve
- Matrix Staff
- Posts: 3422
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
Hello Jan,
This is from the 16F87x datasheet, but the procedure should be similar for other devices as well:
The "Additional Enable Code" field will contain some C code that is run when you add the "Enable Interrupt" icon to your flowchart. You can use this to specify the settings for the RS232 module by setting the RCSTA register appropriately. You will also need to set the PEIE bit of the INTCON register here.
You also need to create and select a macro that is to be called when the interrupt occurs.
This is from the 16F87x datasheet, but the procedure should be similar for other devices as well:
This says what should go in the "Enable register", etc, fields.If the transfer is complete, flag bit RCIF
(PIR1<5>) is set. The actual interrupt can be enabled/
disabled by setting/clearing enable bit RCIE
(PIE1<5>)
The "Additional Enable Code" field will contain some C code that is run when you add the "Enable Interrupt" icon to your flowchart. You can use this to specify the settings for the RS232 module by setting the RCSTA register appropriately. You will also need to set the PEIE bit of the INTCON register here.
You also need to create and select a macro that is to be called when the interrupt occurs.
-
- Flowcode V4 User
- Posts: 12
- Joined: Sun Mar 11, 2007 6:02 pm
- Location: South Africa
- Contact:
Hi Steve,
Thank you, your input helped me a lot! I am using an 18F242, but I have experimented a bit, and it seem to work fine now.
The most difficult part for me (being new to flowcode), is to find the correct syntax or functions to access some of the registers en control bits. It seem that there are a number of them already defined.
Is there a document that explains how (PIR1<5>) can be accessed and used in C code block? Maybe with an example here and there?
I saw in another forum threat a discussion about Watchdog timers - it is actually so easy and straight forward to clear the watchdog timer, but you need to know that the command is "clr_wdt()"! Is there any documentation that list/explain these already defined functions?
Thanks again!
Best Regards
Jan
Thank you, your input helped me a lot! I am using an 18F242, but I have experimented a bit, and it seem to work fine now.
The most difficult part for me (being new to flowcode), is to find the correct syntax or functions to access some of the registers en control bits. It seem that there are a number of them already defined.
Is there a document that explains how (PIR1<5>) can be accessed and used in C code block? Maybe with an example here and there?
I saw in another forum threat a discussion about Watchdog timers - it is actually so easy and straight forward to clear the watchdog timer, but you need to know that the command is "clr_wdt()"! Is there any documentation that list/explain these already defined functions?
Thanks again!
Best Regards
Jan