Difference between revisions of "83Plus:Ports:4D"
From WikiTI
(Documenting the USB ports. Starting with the easy ones.) |
(No difference)
|
Revision as of 13:31, 5 September 2010
Synopsis
Port Number: 4Dh
Function: USB Line State
This port reports the current states of the four functional USB lines.
Read Values
- Bit 0: Set if the D+ line is low.
- Bit 1: Set if the D+ line is high.
- Bit 2: Set if the D? line is low.
- Bit 3: Set if the D? line is high.
- Bit 4: Set if the ID line is low (i.e., a mini-A cable is connected.)
- Bit 5: Set if the ID line is high (i.e., no cable or a mini-B cable is connected.)
- Bit 6: Set if the Vbus line is high.
- Bit 7: Set if the Vbus line is low.
Write Values
- No effect
Comments
This port allows you to see the actual states of the four (functional) USB lines at any given time. This is mainly useful for checking the states of the ID and Vbus lines; while USB is active, the D+ and D? lines will change far too rapidly for you to get any useful information by polling this port.
I haven't tested what the actual cutoff voltages are, or whether there's any hysteresis. There may be, but it's a good idea to be cautious anyway (e.g., if you're waiting for Vbus to go high, wait for a little while afterwards to be sure that it stays high.)