News:

;) This forum is the property of Proton software developers

Main Menu

HSerial_Baud declare.

Started by dr-zin, Oct 07, 2022, 05:05 AM

Previous topic - Next topic

dr-zin

Hi again.  A quick question (maybe).  I normally don't use hardware serial techniques, but I thought I'd give it a try this time.  When I try to set up HSerout, I can't find a reference to inverted polarity streams.  The manual says that the baud can be calculated based on the xtal frequency, but doesn't give details like the Serout command, which I use frequently.  Is inverted mode possible with this command, and if so, how do you specify it in the declare statement?  Do you calculate the baud with the same formula as with Serout?  Any pointers would be helpful, as the documentation here is a little hazy, and I'm sure many of you use this technique all the time.  Thanks in advance, Paul.

joesaliba

Depends which PIC you are using you can receive inverted data.

For example, on an PIC18F26K22, setting BAUDCON.5 will receive inverted data.

There is no need to calculate the BAUD rate. The following will do the trick: -

Declare Hserial_Baud = 9600 ' UART1 Baud rate for HRsout
This was taken from page 421 of the Positron manual, which I strongly suggest you have a read.

Regards

Joe

John Drew

Paul,
Earlier PICs could not invert serial so an inverter was necessary when using hardware.
Which device are you using?
John

dr-zin

Yes, Drew.  I am looking to use an 18F4455, as I have a few of them.  Micros are hard to source now, with long back-order times.  I normally use the 16F series, but I bought up some 18F chips a while back thinking I would use them some day.  I also have a couple of 18F4520s, so that is an option also.  I can set up a MAX3232 inverting chip if required, but I don't need to go with the full RS-232 +/-12V format, as I don't have to transmit the signal.  Maybe just a simple hex inverter chip may solve this if there is no software command solution.  I can see why there are no Declare options if this is not offered in hardware.  Thanks for the info.

tumbleweed

You're in luck. For both of those devices (18F4520 and 18F4455), look at the RXDTP and TXCKP bits in the BAUDCON register.

dr-zin

Thank you also TW.  I will look for those registers and see if I can flip some bits.  Regards, Paul