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

Serial port terminal with 9 bit support [Solved]
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
PrinceNai



Joined: 31 Oct 2016
Posts: 479
Location: Montenegro

View user's profile Send private message

Serial port terminal with 9 bit support [Solved]
PostPosted: Mon Sep 19, 2022 10:26 am     Reply with quote

Hi,

I'm trying to monitor 9-bit serial communication (part of a project from another topic) on my PC. So far I haven't been able to find any software to support that. I tried Terraterm, Coolterm, Yat, Realterm and like 20 others. Does PC even support that format of data?

I'm able to see what is going on the line with a logic analyzer, but it would be nice to have a monitoring program.
Jerson



Joined: 31 Jul 2009
Posts: 125
Location: Bombay, India

View user's profile Send private message Visit poster's website

PostPosted: Mon Sep 19, 2022 8:33 pm     Reply with quote

Most terminals online will support 9 bits. Maybe you're looking for the wrong keywords.

It would be 8bit data with parity. Most terminals will support this.

Look for @bray terminal My favourite on Win
PrinceNai



Joined: 31 Oct 2016
Posts: 479
Location: Montenegro

View user's profile Send private message

PostPosted: Mon Sep 19, 2022 10:41 pm     Reply with quote

Dear Jerson,

it is 9 bit data. Not 8 + parity. PIC is able to send and receive that. And so far no online terminal that I found supports it..
Ttelmah



Joined: 11 Mar 2010
Posts: 19510

View user's profile Send private message

PostPosted: Mon Sep 19, 2022 10:49 pm     Reply with quote

Evey terminal program shoud offer proper 9bit support.
The exception would be if your hardware serial port does not support it.
SIO that comes with the compiler does offer this. If it is not there in the
port settings, then it almost certainly implies that you do not have a
real serial port, but something like a USB serial without support for this.
8 bit with parity is not 9bit. It uses 9 bits but not with the extra bit as
data. It is possible to cheat this for limited use as 9nit, but it is not going
to be a useable way to monitor 9bit data.
\i suspect your problem is the actual serial port you are trying to use
does not support 9bit. Only a few of the better USB to RS232 adapters
offer this.
PrinceNai



Joined: 31 Oct 2016
Posts: 479
Location: Montenegro

View user's profile Send private message

PostPosted: Mon Sep 19, 2022 11:34 pm     Reply with quote

Ttelmah, I've used your code to send and receive 9bit. Reliable as a bomb. Alas, no terminal program offers 9 bit. Development is done on 18f46k22, and this one has 9 bit support on UART.

Last edited by PrinceNai on Tue Sep 20, 2022 12:41 am; edited 3 times in total
PrinceNai



Joined: 31 Oct 2016
Posts: 479
Location: Montenegro

View user's profile Send private message

PostPosted: Mon Sep 19, 2022 11:39 pm     Reply with quote

To make it clear: PIC does send and receive 9 bit data. I'd just like to see that in a terminal. But you're right, of course. I'm using a cheap serial - usb and a logic probe on PIC RX.
chaphill



Joined: 07 May 2019
Posts: 21
Location: Chappell Hill, Tx

View user's profile Send private message

PostPosted: Tue Sep 20, 2022 12:02 pm     Reply with quote

I have used 9 bit communication to multiple boards in data acquisition systems for a number of years. There are four ways that you can communicate with a PC that I am aware of.
1. Use the 8 bit plus parity setting on the pc side and just ignore the 9th bit. That will allow you to monitor the traffic and such, you just won't know what the 9th bit is doing.
2. If you write your own custom program to communicate with the 9 bit bus and use the 9th bit to indicate an address from a pc used as a bus master to the slaves you can also use the 8 bit plus parity, with the parity bit set low at all times except manually set the parity bit high for the one address byte. I have used this for years with no problems.
3. Use a pic with two serial ports to do the "dirty work" of sending and receiving 8 bit data on the pc side and translate the data received from the pc to set the first bit high for the address to slaves (first byte in the block for my protocol). This again was with my protocol of the bus master being the pc.
4. My preferred method is just get a logic analyzer and be done with it.
Ttelmah



Joined: 11 Mar 2010
Posts: 19510

View user's profile Send private message

PostPosted: Tue Sep 20, 2022 12:44 pm     Reply with quote

The point you are missing is that the standard PC UART does not support
9bit operation. A few do. There is a Startech chip, and an FTDI one that
do. These come with their own drivers that support 9bit operation.
The standard Windows drivers do not offer this.
I've merrily monitored 9bit busses with these by just using their driver,
and routing the serial inout to the display. In Linux it is relatively easier
I found at least two serial programs in the past that when used with a
UART that supported 9bit did offer it. I'm sure that SIO was one that did
but that was a long time ago, so not sure that the current versions do.

The key thing though is you need to be starting with a PC UART that
supports 9bit operation. You are not going to get anywhere until you have
this.
PrinceNai



Joined: 31 Oct 2016
Posts: 479
Location: Montenegro

View user's profile Send private message

PostPosted: Tue Sep 20, 2022 2:28 pm     Reply with quote

I guess it's going to be a logic analyzer, then :-)
temtronic



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

View user's profile Send private message

PostPosted: Wed Sep 21, 2022 5:58 am     Reply with quote

Kinda surprised no one has said to simply build/program a PIC 'interface module' to receive the 9 bit data and send to PC as 2 bytes. Hardware is a PIC and a USB<>TTL module. Then cut YOUR custom terminal program to handle the data.
It's a lot cheaper than a logic analyzer, and YOU can control how the data is presented on the screen. as long as the USB speed is 2x faster than the PIC side there won't be any delay in throughput.

or am I missing something ?
jeremiah



Joined: 20 Jul 2010
Posts: 1348

View user's profile Send private message

PostPosted: Wed Sep 21, 2022 7:19 am     Reply with quote

Putty has an option for 9 data bits. Have you tried that?
https://www.putty.org/
PrinceNai



Joined: 31 Oct 2016
Posts: 479
Location: Montenegro

View user's profile Send private message

PostPosted: Thu Sep 22, 2022 9:38 am     Reply with quote

Guys,

Thanks for all the answers and suggestions. At the end I went with a logic analyzer (from China, 5€, but it more than does the job to see what is going on on the line at a 19.20 baud speed. At 2Ms/s it can run forever). My problem here was that data comes fast, every 200ms. Different lengths of the messages. Since I'm a one man band and it takes me at least 20s from the start of the capture to actually trigger what I want to capture, that are a lot of characters that look identical. Same address every time. And the software doesn't have any filtering options that I'm aware of. But when I saw the format, it was easy to write something that just fills the buffer in a PIC with 512 characters and then export watch window from Mplab via .txt to Excel.

Maybe I was just lazy and wanted something with that built in. Record, export, analyze.
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Thu Sep 22, 2022 12:46 pm     Reply with quote

Not cheap, but the best logic analyzer I've ever used: https://www.saleae.com/

Not affiliated in any way, just a satisfied customer.

If the link doesn't appear due to the site's anti-advertising filters, just google "saleae". You'll have to dig a bit, but I'd be very surprised if their software does not include 9 bit serial decode.
PrinceNai



Joined: 31 Oct 2016
Posts: 479
Location: Montenegro

View user's profile Send private message

PostPosted: Fri Sep 23, 2022 7:10 am     Reply with quote

That is the software I use, Logic 2.4. Even their 1.x software worked great. It decodes and shows all the data, with tons of options for serial. Number of bits (up to 64 per transfer), inverted/non inverted, LSB or MSB first,... What I haven't been able to do with it or I just didn't find the way is to present that data in a bit more readable form.
chaphill



Joined: 07 May 2019
Posts: 21
Location: Chappell Hill, Tx

View user's profile Send private message

PostPosted: Sat Sep 24, 2022 8:18 am     Reply with quote

The Saleae logic analyzer is the one i use as well. The software handles the 9 bit protocol just fine, even handling a nonstandard baud rate from a module I designed before I knew any better. I highly recommend it.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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