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

How to send 1 byte of data as: "No Parity, 7-bit, 1stop

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







How to send 1 byte of data as: "No Parity, 7-bit, 1stop
PostPosted: Tue Mar 30, 2004 6:02 pm     Reply with quote

I am using PIC18F452 in my application and using RS-232 to communicate with my PC. I don't know howw to output a character as "N71" by using "PUTCHAR". Is there a technique to send a character as N71 with CCS compiler? Surprised
dyeatman



Joined: 06 Sep 2003
Posts: 1912
Location: Norman, OK

View user's profile Send private message

N71
PostPosted: Tue Mar 30, 2004 6:25 pm     Reply with quote

According to the PIC data sheet it cannot be done in hardware at all.

You can set up the S/W UART (#use RS232) and it can handle N71 bit data. I checked it and it seems to compile and work with no problems.

Good Luck
PICKYUSER
Guest







RE:dyeatman
PostPosted: Wed Mar 31, 2004 7:47 pm     Reply with quote

Hi dyeatman
I check the CCS manual and in the #USE RS232 section, CCS already stated that quote "5-7bits may not be used with internal SCI". Even so, I also tried to set : #USE RS232(.....,bits=7), but this does not work. The outputted data is still 8-bit.

Thanks anyway,
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Wed Mar 31, 2004 8:20 pm     Reply with quote

What are your transmit and receive pins? If you use the same pins as the hardware UART then CCS will automatically will use the built-in UART(which doesn't support what you want to do). Try changing the send and receive pins. this should make the compiler create a software UART.
dyeatman



Joined: 06 Sep 2003
Posts: 1912
Location: Norman, OK

View user's profile Send private message

S/W UART for 7 Bits
PostPosted: Wed Mar 31, 2004 8:38 pm     Reply with quote

Just speculation here since I haven't done it but simply reversing the Transmit and Rcv pins between C6 and C7 should, in theory, cause a S/W UART to be generated for those pins. Anyone kow for sure?? I am going to try to check this....

Dave

Update: I just checked and reversing C6/C7 does generate a S/W UART which should generate N71 if required
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Mar 31, 2004 9:39 pm     Reply with quote

How to use hardware pins for a soft USART:
http://www.ccsinfo.com/forum/viewtopic.php?t=17803
Charlie U



Joined: 09 Sep 2003
Posts: 183
Location: Somewhere under water in the Great Lakes

View user's profile Send private message

PostPosted: Wed Mar 31, 2004 9:47 pm     Reply with quote

Alright folks, this is pure speculation, because I haven't actually tried this, but . . . the serial data is transmitted LSB first, and the stop bit is a 1, so couldn't you just OR your data with 0x80 to set the MSB, aka the last bit, which will be the stop bit for N71, then transmit it as 8 bits. Yeah the stop bit will be long (2 bits minimum), but I haven't run into a situation, yet, where a long stop bit caused a problem.

Try this and see if it works.
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