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

Toggling DCD

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



Joined: 14 Oct 2006
Posts: 33

View user's profile Send private message

Toggling DCD
PostPosted: Sat Dec 03, 2011 5:26 pm     Reply with quote

Trying the USB to Serial thing on my 18f4550 and was wondering Is it possible to toggle the DCD (Data Carrier Detect)?

I need to receive DCD signal on the computer.
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Sun Dec 04, 2011 3:20 am     Reply with quote

DCD, in the USB serial emulation, is controlled by the structure usb_cdc_carrier, and the bit in this 'active'. If you set:

usb_cdc_carrier.active=FALSE;

then DCD will be turned off to the PC. Set it 'TRUE' again to turn carrier detect back on.

Best Wishes
acidice333



Joined: 14 Oct 2006
Posts: 33

View user's profile Send private message

PostPosted: Sun Dec 04, 2011 5:39 am     Reply with quote

Yeah I tried that. well I used =1 instead of =true but it didn't work.

I used the SIOW app to monitor the DCD status and even if I toggle it on and off, the status never changes??
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Sun Dec 04, 2011 7:44 am     Reply with quote

Remember you need to send something, or there won't be a transaction to send the change. It is not automatically updated. Classic would be to send a 'break'.

Best Wishes
acidice333



Joined: 14 Oct 2006
Posts: 33

View user's profile Send private message

PostPosted: Sun Dec 04, 2011 3:41 pm     Reply with quote

Yeah I tried that and still no go :( outputtted a char just to see if the program works and it does.

I guess I'll just have to use the FTDI chip instead :(

Im using compiler version 4.120, which I doubt matters.
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Sun Dec 04, 2011 4:16 pm     Reply with quote

See the problem. The driver is not implementing the 'LINE_STATE_CHANGE' output. If you set the DCD off, and reinitialise, the PC will see it as off, but it depending on how the PC code works, it won't see the line change once it is initialised.
Can't you use RTS/CTS, which is the normal way to stop output?.

Best Wishes
acidice333



Joined: 14 Oct 2006
Posts: 33

View user's profile Send private message

PostPosted: Mon Dec 05, 2011 12:25 am     Reply with quote

Sadly no :( This legacy device uses DCD
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Mon Dec 05, 2011 3:04 am     Reply with quote

It is not terribly hard to add the required part to the USB code. It depends how happy you are with modifying the supplied code....

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