CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC18F23k22 UART2 pins sharing with programmer

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
chrhartz



Joined: 29 Aug 2008
Posts: 7

View user's profile Send private message

PIC18F23k22 UART2 pins sharing with programmer
PostPosted: Mon Jan 08, 2024 3:20 pm     Reply with quote

I need two UARTS to connect to a PC and another serial device.

The PIC18F23k22 choosen supports two UARTS. Unfortunately the 2nd
UART shares the pins with the programming interface. (PGC and PGD)

It does not look like i can route them to alternative pins. :(

My programmer is a MPLAB ICD 3. I am using a TAG-Connect MCP cable
to make connection during flashing only. After flashing it is disconnected.

What are the best options to have both the programmer and serial device
connected at the same time? Multiplexer with program control or just two
resistors to the serial device to keep the programmer levels dominant and
hope that these resistors doesn´t disturb the signals at 115.300?

Cheers,
Chris
temtronic



Joined: 01 Jul 2010
Posts: 9232
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Mon Jan 08, 2024 3:40 pm     Reply with quote

DPDT DIP switch is what I used, yeah , I know, when the dinosaurs roamed....
Microchip do have 'ap notes' on this....
Ttelmah



Joined: 11 Mar 2010
Posts: 19529

View user's profile Send private message

PostPosted: Tue Jan 09, 2024 1:43 am     Reply with quote

Look at this:
[url]
http://www.embedinc.com/picprg/icsp.htm
[/url]
Remember the programmer also needs to control the MCLR. How this
is wired is critical.

You can handle the serial receive coming into the PIC, with a diode and
resistor. Look here:
[url]
https://www.electro-tech-online.com/threads/pic18f24k22-rx2-tx2-and-icsp.163904/
[/url]

The circuit in post 7 works OK.

A switch is very easy and safe. I've used at different times, jumpers,
two DIP switches, and a DPDT PCB mount switch.
temtronic



Joined: 01 Jul 2010
Posts: 9232
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jan 09, 2024 10:56 am     Reply with quote

hmm watching snow turn into rain.....

..any chance you can upgrade to the PIC18F46k22 version ??

eliminates the pin 'sharing', more memory too...

not that much bigger......

just thinking of possible options..
gaugeguy



Joined: 05 Apr 2011
Posts: 303

View user's profile Send private message

PostPosted: Tue Jan 09, 2024 12:27 pm     Reply with quote

Depending on your other requirements the PIC18F26K40 would be the same pinout but have pin selectable UARTs. It should also be less expensive than the PIC18F23K22.
newguy



Joined: 24 Jun 2004
Posts: 1908

View user's profile Send private message

PostPosted: Wed Jan 10, 2024 10:20 am     Reply with quote

The PIC18F26K40 has some pretty alarming entries in its errata. FYI.
Ttelmah



Joined: 11 Mar 2010
Posts: 19529

View user's profile Send private message

PostPosted: Wed Jan 10, 2024 10:57 am     Reply with quote

Just on the basis that more features are better, and having a very few errata,
I'd suggest the PIC18F27Q83. This is an absolute 'ripper' of a chip. Has five
UARTs, and PPS as well. It currently has no published errata, and I've used
it in half a dozen boards without any issues at all. In the UK costs under £2.
Low power (and you can make this better by turning off the peripherals
you are not using), 64MHz. Loads of ROM & RAM, DMA etc. etc.. A real
'keeper' of a chip.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Sun Jan 14, 2024 7:37 am     Reply with quote

Back in the dinosaur days I drove 4 UARTs from a PIC with only 1 UART port.

I used a CD4052 as an expander for both transmit and receive at TTL level.

Needed 2 spare pins to select which UART to drive.

You may/(may not) need to add resistors to bias off the non-selected UARTs.

I see that there are replacements for the original CD part.

Mike
temtronic



Joined: 01 Jul 2010
Posts: 9232
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Jan 14, 2024 9:09 am     Reply with quote

gee Mike that sounds a lot easier than when I added a PC 8bit quad UART to a PIC16F877...back when the 'big animals' roamed......
sigh...
sadly I still have 2-3 tubes of 4052, 4051 and 4053...collecting dust...

Jay
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Sun Jan 14, 2024 10:57 am     Reply with quote

I have used the PIC18F27Q84 and PIC18F47Q84, have had no issues with
them at all. Almost the same as the Q83 but a little better CAN module.
_________________
Google and Forum Search are some of your best tools!!!!
Ttelmah



Joined: 11 Mar 2010
Posts: 19529

View user's profile Send private message

PostPosted: Mon Jan 15, 2024 7:44 am     Reply with quote

Agreed, I was not looking at Can. Very Happy
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Thu Jan 18, 2024 6:11 am     Reply with quote

Quote:

gee Mike that sounds a lot easier than when I added a PC 8bit quad UART to a PIC16F877...back when the 'big animals' roamed......
sigh...
sadly I still have 2-3 tubes of 4052, 4051 and 4053...collecting dust...

I had considered relays/switches but prefered the solid state solution.

I also have some 4051/2/3 in the junk box, if I can find them.

They were useful for making chopper stabilised amplifiers in the 1970s!

It was relatively easy to to get ~1uV offset using cheap 741 type OPAs.

That was before the ready availability of OP07s and the like.

Could be tempted to go down the same route today, using a PIC to provide some of the functionality.

Very handy for thermocouples, strain-gauges, resistive current sensors etc.

Mike
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group