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 support@ccsinfo.com

Transmit Data Polarity

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



Joined: 18 Dec 2007
Posts: 76

View user's profile Send private message Send e-mail

Transmit Data Polarity
PostPosted: Mon Dec 16, 2019 2:47 am     Reply with quote

Transmit Data Polarity

I have a general question about the data polarity of the EUSART in normal ASYNCHRONOUS HARDWARE mode.
I need to communicate with an inverted RS232 signal.
Now I use a pair of inverters and all works fine but I like to keep the hardware as simple as possible and therefore I want to remove one or even two inverters.

PCW compiler 5.091
Underneath the accompanying chapters of the used PIC16(L)F18855/75.
33.1 EUSART Asynchronous Mode

33.1.1.3 Transmit Data Polarity
The polarity of the transmit data can be controlled with the SCKP bit

33.1.2.2 Receiving Data
The receiver data recovery circuit initiates character reception on the falling edge of the first bit


Can I remove the outgoing (TX) inverter IC and use the "Transmit data polarity" function for this line?
Is the RX timing not affected by the "invert" function?

The incoming RX signal has no "data polarity" function right?
What do you suggest to invert the incoming RX signal? For example the COMPARATOR MODULE or CONFIGURABLE LOGIC CELL (CLC)?

Please give me your suggestions.
Ttelmah



Joined: 11 Mar 2010
Posts: 19358

View user's profile Send private message

PostPosted: Mon Dec 16, 2019 4:17 am     Reply with quote

You have basically answered yourself.

Yes, you can invert the transmit.
Timings don't change.
Yes, you can invert the RX using the CLC. However this still results
in using extra pins, and beware that the ports you can use are
restricted. The CLC output can share a pin with the UART I/P. So only
one extra pin is needed for the CLC input.
bschriek



Joined: 18 Dec 2007
Posts: 76

View user's profile Send private message Send e-mail

PostPosted: Mon Dec 16, 2019 4:46 am     Reply with quote

Thank you Ttelmah for your help.
Now I know for sure I have to "invert" the incoming RX signal one way or another.
What's the easiest way to find out the right code for the CLC module? I know the MPLAB X IDE has a feature to create the code for the CLC registers but maybe there is another way. As you know the CLC has an enormous amount of registers to declare.
temtronic



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

View user's profile Send private message

PostPosted: Mon Dec 16, 2019 5:32 am     Reply with quote

While you can remove the inverters between the PIC and the other device, you may expose the PIC to possible damage. Normally you use a 'MAX232' type device to connect a PIC( any computer) to other 'RS-232' devices. These 'MAX232' devices are designed to be electrically 'rugged', and can withstand a fair amount of EMI, spikes, noise,etc. Removing them, removes that protection. Depending on cabling, distance, speed, etc. you also run the risk that the PIC will NOT be compatible with other 'RS232' devices. A lot of devices( most today ?) do not conform to the official specs laid out for true 'RS-232'. So while your PIC works on the bench with your device, it may not function 100% in the real world or say with a replacement device.
Now the odds are pretty good, it probably will, maybe, OK, should work but WHY take the chance ? Space can't be an issue, so is it cost ? 50 cents to be 100% compatible and protected is a LOT less than what it cost for the time spent typing this reply !!

Jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19358

View user's profile Send private message

PostPosted: Mon Dec 16, 2019 6:16 am     Reply with quote

Routes:
1) Use the MPLAB code configurator. This contains the CLC configuration
tool.
2) A simple inverter is very basic to do. The XOR basic setup, with the
second input programmed to a logic 1 does this. LCxMODE = 001.

I do agree with Temtronic's comment on ruggedness. A buffer or even
better the MAX232 really is a great safety feature....
bschriek



Joined: 18 Dec 2007
Posts: 76

View user's profile Send private message Send e-mail

PostPosted: Mon Dec 16, 2019 8:53 am     Reply with quote

Yes, you are right. Better use a buffer IC with overvoltage / surge protection.
But now I got the thoughts of the Experts, thanks again.
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