PIC18F44K22 RS232

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

Moderator: Benj

Dave Squibb
Flowcode v5 User
Posts: 72
Joined: Fri Oct 10, 2014 11:15 am
Has thanked: 14 times
Been thanked: 17 times
Contact:

PIC18F44K22 RS232

Postby Dave Squibb » Thu Nov 16, 2017 11:01 am

Good morning.
This simple program outputs RS232 on channel 1 (PortC,6) but not channel 2 (PortD,6).
I can output RS232 on PortD,6 using the software implementation.
Any ideas please?
Thanks,
Dave.

SerialTest.fcfx
(14.77 KiB) Downloaded 22 times

User avatar
LeighM
Matrix Staff
Posts: 1329
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 330 times
Been thanked: 480 times
Contact:

Re: PIC18F44K22 RS232

Postby LeighM » Thu Nov 16, 2017 2:05 pm

Hi,
Could you also post the generated C code file please?

Dave Squibb
Flowcode v5 User
Posts: 72
Joined: Fri Oct 10, 2014 11:15 am
Has thanked: 14 times
Been thanked: 17 times
Contact:

Re: PIC18F44K22 RS232

Postby Dave Squibb » Thu Nov 16, 2017 3:55 pm

Hi Leigh, C attached.

SerialText_C.docx
(8.21 KiB) Downloaded 24 times

User avatar
LeighM
Matrix Staff
Posts: 1329
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 330 times
Been thanked: 480 times
Contact:

Re: PIC18F44K22 RS232

Postby LeighM » Fri Nov 17, 2017 1:21 pm

Thanks.
That all looks OK.
Could you next try the attached CAL file, this is our latest, just in case you have older.
To go into your Flowcode 6 installation \CAL\PIC directory
Attachments
PIC_CAL_UART.c
(24.15 KiB) Downloaded 16 times

Dave Squibb
Flowcode v5 User
Posts: 72
Joined: Fri Oct 10, 2014 11:15 am
Has thanked: 14 times
Been thanked: 17 times
Contact:

Re: PIC18F44K22 RS232

Postby Dave Squibb » Fri Nov 17, 2017 2:59 pm

Still the same Leigh. On Channel 2 PortD,6 goes high but no data. Set to software on same pin all working.
Dave.

Dave Squibb
Flowcode v5 User
Posts: 72
Joined: Fri Oct 10, 2014 11:15 am
Has thanked: 14 times
Been thanked: 17 times
Contact:

Re: PIC18F44K22 RS232

Postby Dave Squibb » Wed Nov 22, 2017 12:16 pm

Hello, Any further thoughts on this please?
Thanks,
Dave

User avatar
LeighM
Matrix Staff
Posts: 1329
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 330 times
Been thanked: 480 times
Contact:

Re: PIC18F44K22 RS232

Postby LeighM » Wed Nov 22, 2017 12:30 pm

Hi Dave,
Sorry, this got pushed to one side, we'll source some hardware and look into it

User avatar
LeighM
Matrix Staff
Posts: 1329
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 330 times
Been thanked: 480 times
Contact:

Re: PIC18F44K22 RS232

Postby LeighM » Wed Nov 22, 2017 2:27 pm

Hi Dave,
The quickest way to resolve this is to edit the PIC18f45k22.h header file (or whichever device you are using 44/45/46)
The file is found in your Flowcode6 installation directory \compilers\pic\boostc\include
Comment out the definition for TX2STA at around line 100

Code: Select all

// #define TX2STA                 0x00000F72

Dave Squibb
Flowcode v5 User
Posts: 72
Joined: Fri Oct 10, 2014 11:15 am
Has thanked: 14 times
Been thanked: 17 times
Contact:

Re: PIC18F44K22 RS232

Postby Dave Squibb » Wed Nov 22, 2017 3:22 pm

Hi Leigh,

I tried to do this but "do not have permission to modify this file"

I need to change it for the PIC18F45K22 and PIC18F44K22

Any ideas?
Thanks,
Dave.

User avatar
LeighM
Matrix Staff
Posts: 1329
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 330 times
Been thanked: 480 times
Contact:

Re: PIC18F44K22 RS232

Postby LeighM » Wed Nov 22, 2017 3:26 pm

Hi Dave,
Ah right, that's a Windows thing, probably because they are under C:\Program Files (x86)
Maybe you can copy the files somewhere else, edit, then copy back?
Might get a Windows "Are you sure?" type dialogue.

Leigh

Dave Squibb
Flowcode v5 User
Posts: 72
Joined: Fri Oct 10, 2014 11:15 am
Has thanked: 14 times
Been thanked: 17 times
Contact:

Re: PIC18F44K22 RS232

Postby Dave Squibb » Wed Nov 22, 2017 3:58 pm

I've replaced the file with the modified one but still not working :?

User avatar
LeighM
Matrix Staff
Posts: 1329
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 330 times
Been thanked: 480 times
Contact:

Re: PIC18F44K22 RS232

Postby LeighM » Wed Nov 22, 2017 4:13 pm

So you removed TX2STA?

Just as a test you could edit Flowcode6\CAL\PIC\PIC_CAL_UART.c around line 319
Change

Code: Select all

#ifdef TX2STA

to

Code: Select all

// #ifdef TX2STA
#if 0

Although this is only for K22, it will break other builds.

Dave Squibb
Flowcode v5 User
Posts: 72
Joined: Fri Oct 10, 2014 11:15 am
Has thanked: 14 times
Been thanked: 17 times
Contact:

Re: PIC18F44K22 RS232

Postby Dave Squibb » Wed Nov 22, 2017 5:09 pm

That worked Leigh