Page 1 of 1

RXINT and 18F4331

Posted: Thu May 13, 2010 5:09 pm
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

Re: RXINT and 18F4331

Posted: Fri May 14, 2010 7:18 am
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.

Re: RXINT and 18F4331

Posted: Fri May 14, 2010 8:38 am
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.

Re: RXINT and 18F4331

Posted: Fri May 14, 2010 4:23 pm
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?

Re: RXINT and 18F4331

Posted: Fri May 14, 2010 4:35 pm
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

Re: RXINT and 18F4331

Posted: Mon May 17, 2010 7:20 am
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"

Re: RXINT and 18F4331

Posted: Mon May 17, 2010 3:07 pm
by Frank123
Non ça ne marche pas. C'est la première chose que j'ai essayé.

Re: RXINT and 18F4331

Posted: Mon May 17, 2010 4:04 pm
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.

Re: RXINT and 18F4331

Posted: Wed May 19, 2010 8:54 am
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