View previous topic :: View next topic |
Author |
Message |
acidice333
Joined: 14 Oct 2006 Posts: 33
|
Toggling DCD |
Posted: Sat Dec 03, 2011 5:26 pm |
|
|
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: 19513
|
|
Posted: Sun Dec 04, 2011 3:20 am |
|
|
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
|
|
Posted: Sun Dec 04, 2011 5:39 am |
|
|
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: 19513
|
|
Posted: Sun Dec 04, 2011 7:44 am |
|
|
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
|
|
Posted: Sun Dec 04, 2011 3:41 pm |
|
|
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: 19513
|
|
Posted: Sun Dec 04, 2011 4:16 pm |
|
|
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
|
|
Posted: Mon Dec 05, 2011 12:25 am |
|
|
Sadly no :( This legacy device uses DCD |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19513
|
|
Posted: Mon Dec 05, 2011 3:04 am |
|
|
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 |
|
|
|