RXINT and 18F4331

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
Frank123
Posts: 36
Joined: Fri Jan 15, 2010 5:17 pm
Location: Saint-Nazaire - France
Has thanked: 1 time

RXINT and 18F4331

Post by Frank123 »

Hello
I recently use Flowcode V4 and therefore I get .fcf Flowcode of V3.
Unable to run RXINT. I do a lot of change in the .fcd but the only one that works is to resume my old version (find on this forum) :

Code: Select all

[USART_RX]
Name="Réception USART"
UseExplicitHandlerCode=1
FlagReg=
FlagBit=
HandlerCode="if (pir1 & (1 << RCIF))\n{\n  FCM_%n(); // call selected macro\n}\n"
UseExplicitEnableCode=1
EnReg=
EnBit=
EnableCode="intcon.PEIE = 1; // Enable peripheral interrupts\nintcon.GIE = 1;  // Enable global interrupts\npie1.RCIE = 1;   // Enable USART receive interrupts\nrcsta.CREN=1;    // Enable reception\n"
DisableCode="pie1.RCIE = 0; // Disable USART receive interrupts\n" 
OptCnt=0
TmrOpt=0
Frank
Electronics teacher

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

Re: RXINT and 18F4331

Post by Steve »

Please post your current V4 FCD file and the old V3 FCD file (with your modifications) and we'll try to create a new V4 one for you.

Frank123
Posts: 36
Joined: Fri Jan 15, 2010 5:17 pm
Location: Saint-Nazaire - France
Has thanked: 1 time

Re: RXINT and 18F4331

Post by Frank123 »

V3 FCD File
18F4331.fcd
PIC18F4331 V3
(12.46 KiB) Downloaded 316 times
V4 FCD File
18F4331.fcd
PIC18F4331 V4
(8.48 KiB) Downloaded 337 times
Only USART_RX (add by me) is ok on this.
Frank
Electronics teacher

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

Re: RXINT and 18F4331

Post by Steve »

You might want to try the st_bit() and cr_bit() functions instead of using the "dot" notation.

Do you get specific error messages when compiling, or is the program compiling ok but not working as expected?

Frank123
Posts: 36
Joined: Fri Jan 15, 2010 5:17 pm
Location: Saint-Nazaire - France
Has thanked: 1 time

Re: RXINT and 18F4331

Post by Frank123 »

the program compiling ok but not working as expected with "RXINT" and it's working well with "Réception USART".

Is't possible to me to change in c code and recompil directly ? How to ?

Frank
Frank
Electronics teacher

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

Re: RXINT and 18F4331

Post by Steve »

Hi Frank,

Aaah, I see the problem now - sorry I was slow on the uptake.

It looks like the EnableCode entry of the RXINT function might need to change from this:

Code: Select all

EnableCode="st_bit(pie1, RCIE);\n"
...to this...

Code: Select all

EnableCode="st_bit(intcon, PEIE);\nst_bit(pie1, RCIE);\n"

Frank123
Posts: 36
Joined: Fri Jan 15, 2010 5:17 pm
Location: Saint-Nazaire - France
Has thanked: 1 time

Re: RXINT and 18F4331

Post by Frank123 »

Non ça ne marche pas. C'est la première chose que j'ai essayé.
Frank
Electronics teacher

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: RXINT and 18F4331

Post by Benj »

The RXINT interrupt allows for incoming data to interrupt the program so you can pull it from the incoming UART buffer and process it straight away ready for the next incoming byte.

When the PIC device starts up it enables the UART interface but the receive function is switched off.

Calling the ReceiveByte macro at the start of your program before enabling the interrupt will enable the receive function and your interrupts should work from then on.

Frank123
Posts: 36
Joined: Fri Jan 15, 2010 5:17 pm
Location: Saint-Nazaire - France
Has thanked: 1 time

Re: RXINT and 18F4331

Post by Frank123 »

thank you Ben,
it works with it.
I do not understand why one RS232Send is needed before initializing the interrupt but I would look at the C.

Frank
Frank
Electronics teacher

Post Reply