how to use the TXPPS register of the PIC16F18323? - Page 1
Forum section: electronics / general

author: FrankBuss
author_rank: Unknown
timestamp: December 26, 2017, 11:49:57 pm
content: In this datasheet:http://ww1.microchip.com/downloads/en/DeviceDoc/40001799C.pdfI can see the TXPPS register in table 4-4 on page 40, and I assume this can be used to select which output pin has the TX signal of the UART. But I can't find a description of the register.

author: hexreader
author_rank: Frequent Contributor
timestamp: December 26, 2017, 11:58:35 pm
content: Page 144 section 13.8.... maybe ....Will keep reading.....EDIT : on second thoughts... maybe page 145 register 13-2I see the problem, the datasheet is really hard to interpret. I have a suspicion that there is an error in the datasheet somewhere, but can't quite work it out.Table 3-1 does not even mention TXPPSEDIT2 : TX/CK output seems to have something to do with a mysterious and magical 'OUT' pin. I do not have that PIC to try the different options. Maybe post this question on the Microchip forum. The experts mostly reside there. It is currently beyond my understanding

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: December 27, 2017, 12:00:36 am
content: I wonder if that is a misprint - the way PPS on most PICs works is that for outputs, you set the <pinname>PPS to the required peripheral source, and for inputs, you use < peripheralfunction>PPS, e.g. RXPPS to select which port/pin to get that signal from, so you wouldn't have an output peripheral function with a PPS.Some chips may be different

author: hexreader
author_rank: Frequent Contributor
timestamp: December 27, 2017, 01:48:53 am
content: I even tried MCC (Microchip Code Configurator) for PIC16F18323 and XC8. I ended up more confused than ever when examining the .c and .h files generatedBy the way, I think you mis-typed the title of this thread. I think you mean PIC16F18323, not PIC18F18323.

author: cv007
author_rank: Frequent Contributor
timestamp: December 27, 2017, 01:55:22 am
content: The TX out pin is also CK in, so they have a PPS in register named TXPPS-makes sense, right? why name it CKPPS?The register is in the header file, but its confusing when they name the output function as the input name, I've run into this on 16f (I think they also sometimes combine like TXCK, gets confusing).Now, to come up with an output source selection, since the datasheet does not list TX/CK, there are 11 reserved of the 31 available to try (they list 00000 as reserved, but that has to be LATxx, so they have more than one datasheet problem). Maybe they have a similar 18f with a datasheet that works.In the RxyPPS register, put the number of the peripheral output you want in there (0-31, 0 means use LAT). Fire up the TX spitting out something, try the 31 combos in RxyPPS, when you see something you hit the target.

author: NorthGuy
author_rank: Super Contributor
timestamp: December 27, 2017, 05:10:02 am
content: There are two pins. For the asynchronous (UART) mode they're TX and RX. For synchronous mode they are CK and DT.With normal UART, TX is output only, so to set it, you set the pi's RxyPPS pin to this value:"10100 = Rxy source is EUSART TC/CK" (sic! - TX is misspelled as TC in my datasheet.It is different if you want synchronous mode. TX/CK pin might be an input. That's where TXPPS is used, which, in truth, is actually CKPPS.

author: FrankBuss
author_rank: Unknown
timestamp: January 04, 2018, 07:21:07 am
content: Quote from: cv007 on December 27, 2017, 01:55:22 amRight, I asked the Microchip support about it to be sure. And the TXPPS register is the xxxPPS register, and only if the UART is in slave mode for synchronous data transfers. Then it is used as the CK input. Quote from the support:QuoteLooks like they don't think it is difficult to figure it out, but I still feel like solving a crossword puzzleThese PPS and CLC features are really nice, but I wonder if it wouldn't be simpler and more flexible to just integrate a small CPLD in it instead of configuring lots of registers, and then program it in VHDL. I guess such a chip would be the only CPLD with 5V output, all other 5V CPLDs are discontinued. Had to think a bit how to use the fixed AND/OR combination with the inverter and GND settings to implement a given function with it, I'm a bit rusty in Karnaugh maps etc.

author: NorthGuy
author_rank: Super Contributor
timestamp: January 04, 2018, 03:45:32 pm
content: Quote from: FrankBuss on January 04, 2018, 07:21:07 amIt is not so puzzling if you think of the PPS as a MUX controlled by the xxxPPS register. The MUX has many inputs and only one output. The register controls which of the inputs is connected to the output.The output of the PPS MUX can either drive an output pin (in which case the PPS register belongs to the output pin) or an input of a peripheral module (in which case the PPS register belongs to the input of the module). Input pins or peripheral outputs cannot be driven by the PPS MUX, hence they cannot have PPS registers.Bidirectional points are a little bit more difficuit. They're driven by the PPS MUX, but at the same time they provide an output, which can serve as an input to another PPS MUX. So, if you want something bidirectional, you need to set up two PPS MUXes - two different PPS registers.