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

#use rs232 ..... STOP bit / PARITY bit (default settings)

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



Joined: 27 Apr 2011
Posts: 19

View user's profile Send private message

#use rs232 ..... STOP bit / PARITY bit (default settings)
PostPosted: Thu Oct 01, 2015 5:49 am     Reply with quote

hi

When using the #use rs232, i have seen many CCS exampls that declare as follows...

#use rs232(baud=9600, xmit=PIN_A2,rcv=PIN_A3)

Many of the examples do not state the arguments STOP and PARITY bits. So if i do not state the two arguments, does that mean the CCS compiler will default set the PIC UART to the following values....
8 bits
No PARITY bit
1 STOP bit

Thanks
temtronic



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

View user's profile Send private message

PostPosted: Thu Oct 01, 2015 6:37 am     Reply with quote

It _should_ be in the manual under USE RS232..... but yes, the CCS default is the 'defacto' standard of 8 bits, no parity and 1 stop bit.
You should always add 'ERRORS' to the options when using a hardware UART.It'll prevent the code from 'locking up' when an 'overrun' condition happens. That's when more than 2-3 characters come into the UART and not serviced.

Jay
haseeb



Joined: 27 Apr 2011
Posts: 19

View user's profile Send private message

PostPosted: Thu Oct 01, 2015 6:51 am     Reply with quote

thanks for the information and confirmation Smile

i did check before i uploaded the post.....it says in the CCS manual (under #use rs232) that the the STOP bit is default 1 bit.....however there is no mention of the default values for PARITY and DATA bits
Ttelmah



Joined: 11 Mar 2010
Posts: 19436

View user's profile Send private message

PostPosted: Thu Oct 01, 2015 7:02 am     Reply with quote

The chip itself (if using the hardware UART), cannot generate parity, and generates just one stop bit. 'Parity' on the PIC (except for a few of the DSPic's) has to be generated in software, by switching to using 9 bits, and writing the parity bit into this 9th bit. So as originally implemented (before the software RS232 was added), these defaulted to what the chip could do.
Unfortunately the compiler has moved on, but some parts of the manual leave out things like this that were 'implicit' in the early versions....
Funnily though, I'm sure the manual _used_ to actually say that 8,N,1 was the default. It looks as though this has been 'lost' somewhere in the past!....
temtronic



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

View user's profile Send private message

PostPosted: Sat Oct 03, 2015 5:51 am     Reply with quote

The only terminal that I used that needed 2 stop bits was the Teletypes like the ASR-33. Being 100% mechanical even at the lightning speed of 110 Baud, it took 'quite awhile' for it to get ready to print the next character.

Now my remote energy control systems use 22-n-2 . That's 22 bits, no Parity, 2 stop bits and run at 24 baud, yes 24 characters per second. Have to use software driver for the communications as no UART understands 22 bits OR 24 baud !

Jay
guy



Joined: 21 Oct 2005
Posts: 297

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

PostPosted: Sun Oct 04, 2015 4:07 pm     Reply with quote

DMX512 also has 2 stop bits if I remember correctly.
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