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

Help me: USB CDC with flow control and Dynamic Baudrate

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



Joined: 03 Sep 2009
Posts: 1

View user's profile Send private message

Help me: USB CDC with flow control and Dynamic Baudrate
PostPosted: Thu Sep 03, 2009 11:13 pm     Reply with quote

How can I modify ex_usb_cdc.c to run PIC18F2550 like COM port with flow control enabled and change baudrate by PC software?
Thanks for your help.

Minh Tuan
Ttelmah
Guest







PostPosted: Fri Sep 04, 2009 2:21 am     Reply with quote

You don't....

The changes need to be in your 'physical' serial code beyond the USB stuff.
For example, if you look at the structure usb_cdc_carrier, this contains a byte, with bits reflecting the hardware flow control status, and carrier detect status. All you need to do, is read this byte, and make _your_ external hardware bits reflect this (and vice versa). Similarly, the driver will already receive from the PC, data, which it puts into usb_cdc_line_coding, when a baud rate change etc., is sent. You check the flag 'usb_cdc_got_set_line_coding', if if it goes 'true', read the structure, and make your serial connection match what the PC has requested (and then clear this flag).
Basically, whenever the PC asks for a change to the serial setup, it sends a 'set line coding' message to the USB device, containing the required settings. It is up to you whether you simply ignore them, or adjust your hardware to match. The USB driver _already_ receives these messages, stores them for you, and sets a flag.
You don't ned to change the USB drivers at all. They already handle the messages.

Best Wishes
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