Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Monitoring the USB state
Author | Message | ||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
Geoff, would it be possible add another Read Only Variable: MM.USB to indicate when the Maximite is plugged into a USB host. (This would not guarantee any intelligence on the PC end.) maybe even an interrupt: ON USB goto xxxx MM Basic already sends the welcome message when the USB comes up. or is there a PEEK that does the job for me? Jim VK7JH MMedit  MMBasic Help |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
You could use either of these two: IF (PEEK(&HBF88, &H5060) AND 1) = 1 THEN PRINT "+5V is on the USB connector"
or IF (PEEK(&HBF88, &H5060) AND &B100000) = 0 THEN PRINT "There is a valid USB session" Note that the second one means that there is a computer host connected to the USB (it does not tell you that there is a a terminal emulator running on it - that is much harder). Geoff Geoff Graham - http://geoffg.net |
||||
TassyJim Guru Joined: 07/08/2011 Location: AustraliaPosts: 6100 |
Thanks Geoff, those 2 options will keep me happy. Jim VK7JH MMedit  MMBasic Help |
||||
vk2sja Newbie Joined: 07/06/2013 Location: AustraliaPosts: 26 |
Not sure if this is required/helpful but it seems that if you fire "ESC [0c" (that's zero c, and remove the spaces) off at the unknown device at the other end of your USB come serial link. Then if there is a DEC VT100 terminal emulator of some sort at the other end it should respond with "ESC [?1;#c" where the # is a number between 0 and 7. That's the DEC VT100 DA – Device Attributes ESC sequence. See: http://www.vt100.net/docs/vt100-ug/chapter3.html You could use this to see if you have a live VT100. Haven't tried it yet. Mileage may vary depending on how good the emulator is. Linux XTerm does seem to support it http://invisible-island.net/xterm/ctlseqs/ctlseqs.html |
||||
Print this page |