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

Receive 7 bits communication

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



Joined: 31 Aug 2009
Posts: 6

View user's profile Send private message

Receive 7 bits communication
PostPosted: Mon Aug 31, 2009 12:59 pm     Reply with quote

I have a device thats send data = 7 bits and stop bit=2. How can i proceed to read this variable using PIC16F648A.
Ttelmah
Guest







PostPosted: Mon Aug 31, 2009 1:27 pm     Reply with quote

Just don't worry about it!...
When receiving, extra stop bits don't matter.
If you just receive the data as 8bit, one stop, and clear the top bit of the received byte, it'll receive correctly.

Best Wishes
Jasen



Joined: 31 Aug 2009
Posts: 6

View user's profile Send private message

PostPosted: Mon Aug 31, 2009 1:48 pm     Reply with quote

I create this following test program to make sure that the PIC16F648A will read correctly the 7 bits data.
Code:

#use rs232(baud=4800, xmit=pin_b2, rcv=pin_b1)
 if ( getc() == 12) output_high (pin_b6);

With external PC communication program, I simulated sending by RS232 the data 12. The output goes hi only when I set 8 bits data on the PC communication program. With 7 bits, the output keep low.

Tks, Jasen
Ttelmah
Guest







PostPosted: Mon Aug 31, 2009 2:20 pm     Reply with quote

You are not clearing the top bit (& 0x7F).....

Best Wishes
Jasen



Joined: 31 Aug 2009
Posts: 6

View user's profile Send private message

PostPosted: Mon Aug 31, 2009 2:52 pm     Reply with quote

Could you give me a Hint how to clearing top Bit.

Tks, Jasen
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Aug 31, 2009 3:23 pm     Reply with quote

You missed something... Embarassed

Though clearing a bit is standard C-code Ttelmah did give you the answer. Read his post 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