Custom Interrupts

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

Moderators: Benj, Mods

Post Reply
janleroux
Flowcode V4 User
Posts: 12
Joined: Sun Mar 11, 2007 6:02 pm
Location: South Africa
Contact:

Custom Interrupts

Post by janleroux »

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

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

Hello Jan,

This is from the 16F87x datasheet, but the procedure should be similar for other devices as well:
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>)
This says what should go in the "Enable register", etc, fields.

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.

janleroux
Flowcode V4 User
Posts: 12
Joined: Sun Mar 11, 2007 6:02 pm
Location: South Africa
Contact:

Post by janleroux »

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

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

Flowcode creates C code which is then compiled by the "BoostC" compiler; this is located in the "boostc" subdirectory of Flowcode. Also in this subdirectory is a "boostc.pdf" file which may help.

janleroux
Flowcode V4 User
Posts: 12
Joined: Sun Mar 11, 2007 6:02 pm
Location: South Africa
Contact:

Post by janleroux »

Hi Steve,

Thanks!

Regards
Jan

Post Reply