PIC18F45K40 UART PIN Mapping

For general Flowcode discussion that does not belong in the other sections.
Post Reply
seokgi
Posts: 217
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 6 times
Been thanked: 7 times

PIC18F45K40 UART PIN Mapping

Post by seokgi »

Hello?
It's hard to find an MCU, so the MCU I finally got is the PIC18F45K40.
I want to receive GPIO input as Low Active or High Active. But it doesn't work correctly. So I'm using it in reverse. Any good way?

Next question. I want to use two UARTs in PIC18F45K40-I/PT. B Port is set well. However, C Port is not set and an error occurs. In the manual, C7 (Pin No. 1) is indicated as RX1. It would be nice to set it to a port supported by FC9, but many PCBs have already been made.

Please help.

Thank you.

medelec35
Matrix Staff
Posts: 2089
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 646 times
Been thanked: 704 times

Re: PIC18F45K40 UART PIN Mapping

Post by medelec35 »

Hello.
For the GPIO input active low for example, I have mentioned that here

For the UART component, you can only select ports that are designed to be available by the manufacturer.
From the datasheet (I have blanked the 28-pin ports), here are the available ports for channel1 and channel2.
Remap Pins UART Component.png
Remap Pins UART Component.png (75.8 KiB) Viewed 3159 times
As you can see, only B and C are avaiable for Channel2
If you want to use port C for both channels, then instead of using channel2 you could use the UART software (Timer) component.
Martin

seokgi
Posts: 217
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 6 times
Been thanked: 7 times

Re: PIC18F45K40 UART PIN Mapping

Post by seokgi »

Thank you for quick response.
In FC9, Channel1 has only B and D Port options. Occasionally, I see Port C. But when I compile, I get an error. C Port cannot be selected.

medelec35
Matrix Staff
Posts: 2089
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 646 times
Been thanked: 704 times

Re: PIC18F45K40 UART PIN Mapping

Post by medelec35 »

If you only can only see port B and D with channel1 then select a random pin.
It should then change from port D to Port C so you can then select the correct port C pin.
If you are still having issues can you either post your project file or PM it, if you want it to remain private?
Martin

seokgi
Posts: 217
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 6 times
Been thanked: 7 times

Re: PIC18F45K40 UART PIN Mapping

Post by seokgi »

Thank you.
That way C7 is sometimes set. However, after a while, it is changed back to D7 in an unrecognized situation. And when compiling in C7 state, a compile error appears.

It's my PG
Attachments
221102-01-PRT2COM.fcfx
(57.51 KiB) Downloaded 375 times

BenR
Matrix Staff
Posts: 1956
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 511 times
Been thanked: 700 times

Re: PIC18F45K40 UART PIN Mapping

Post by BenR »

Hello,

What error message are you getting.

I tried the following and it's compiling fine for me, reloading the project and still ok and assigned correctly.

ModbusSlave to Channel 1 TX C6 and RX C7
Monitor_Send to Channel 2 TX B6 and RX B7

You might need to check your using the latest version of the files by going to Help -> Library Updates.

Here's the project with my property changes.
221102-01-PRT2COM.fcfx
(57.72 KiB) Downloaded 480 times

seokgi
Posts: 217
Joined: Thu Dec 03, 2020 1:43 pm
Has thanked: 6 times
Been thanked: 7 times

Re: PIC18F45K40 UART PIN Mapping

Post by seokgi »

Thanks for your help, it worked out well. thank you.

Post Reply