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

SOLVED: dsPIC33CK64MP205 9 bit serial

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



Joined: 12 Nov 2012
Posts: 357
Location: South Africa

View user's profile Send private message

SOLVED: dsPIC33CK64MP205 9 bit serial
PostPosted: Wed Mar 04, 2020 10:03 am     Reply with quote

Good day All.
I was wondering if anybody played with this PIC.
Having trouble with 9 bit serial.
If I putc(0x131) I can see on a scope that I transmit 9 bits but bit 9 is low and not high.
Datasheet states that bits 8-15 on Txreg are unimplemented, yet there is a 9 bit mode and as I was saying there are 9 bits transmitted but bit 9 is always low.

Any thoughts.


Last edited by alan on Thu Mar 05, 2020 1:22 am; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19337

View user's profile Send private message

PostPosted: Wed Mar 04, 2020 11:46 am     Reply with quote

I've used 9bit with no problem.
Key is you need 9bit in the #USE_RS232, and the keyword 'LONG_DATA'.
If you don't have LONG_DATA selected, the extra 9th bit comes from
RS232_ERRORS and you have to set this bit separately. If you use
'LONG_DATA', getc returns a 16bit int and putc accepts a 16bit value.
alan



Joined: 12 Nov 2012
Posts: 357
Location: South Africa

View user's profile Send private message

PostPosted: Thu Mar 05, 2020 1:21 am     Reply with quote

Solved.
I am using the RS485.c driver file for all my projects, so everything regarding 9 bit serial are in there and have been using it for years now, of course by this time heavily modified. Laughing

But on this particular chip you need to put the 1st byte in register UxP1 which then appends a "1" to the serial byte and the rest of the message in the standard Tx register.
Ttelmah



Joined: 11 Mar 2010
Posts: 19337

View user's profile Send private message

PostPosted: Thu Mar 05, 2020 1:50 am     Reply with quote

The UART you have there doesn't actually support a normal 9bit mode. The
only way it generates 9bit is as an 'address', and the UxP1 register allows
the extra bit to be enabled for this. Not a good chip choice if you want to
actually do very much with 9bit.
Using it as you do, it'll work, but does mean you have to bodge....
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