Quote Originally Posted by Darrel Taylor View Post
Sweet!
Doesn't matter, the VB program will pick up when it connects, and sometimes when it disconnects.
<br>
Darrell, thanks to your help I now have the USBDemo running on my EasyPic6 and everything appears to work except an annomaly with the RA4 pushbutton. When I initially power up, the VB6 window shows all four pushbutton lights on (GREEN). When I push each of the RA2-RA5 pushbuttons on the EasyPic6, the lights go temporarily out while the pushbutton is depressed, which is expected. However, when RA4 is released it stays unlit, unlike the other pushbuttons. Then if I power down and power backup or if I reset, it is lit again along with the others, and the sequence described above happens again if I depress the buttons.
I don't understand why the RA4 pushbutton doesn't operate like the others as a momentary switch. I checked the code and it appears it should. Is there some reason for this? I thought it might even be a problem with my EasyPic6, but the RA4pushbutton is operating normally in other codes I have that use it on the EASYPIC6. I didn't do anything about changing the capacitors on the EasyPic6 that

I also notice that the RX window continuously shows 10 line entries of "USBDemo" and when you click the Clear RX button, it immediately repopulates the RX window with the same 10 entries. I am trying to understand this and presume that these entries are due to the TMR0 interrupt executing every 100 usec to run the goto at DoUSBService, which reloads the TMR0. I presume each time this reload takes place and the TMR0 overflows, a USBDemo line appears in the RX window. Am I understanding what is happening???

I am TOTALLY impressed with this code and the functionality Steve created in this demo! He is to be highly commended for sharing this since it helps people (like me) to finally understand at a basic level how to incorporate a USB interface into our applications.
Now I have to figure out how to modify it for a specific application that operates this way...am explaining in hopes you or someone else on this thread will have some ideas:
1) the Main code wakes up from SLEEP mode every night at midnight and executes 6-12 ultrasonic range finder measurements which are averaged and the average result is logged into EEPROM, and then it goes back to SLEEP till next midnight.
2) This data logging occurs every night at midnight. If at any time a USB cable is plugged into the USB connector (which will only happen once every 30 days to download the 30 averaged range measurements from EEPROM), it must recognize this as an interrupt to the normal data logging application and permit the User on the other end of the USB interface (a laptop) to recover the 30 averaged range measurements from EEPROM to the laptop and export them into a spreadsheet.
Now that I have the USB interface working, I am struggling with how best to support this scenario with an interrupt that recognizes when the USB cable is connected. I thought I might use an RBIE: RB Port Change Interrupt in the MCU code that would be created by the laptop User when one of the RBx boxes in the VB6 User Interface is clicked. Do you have any better suggestions as to how to do this??

Would also appreciate any pointers you might have to the best approach for a midnight to midnight interrupt without having to add a RTC to my application. I thought a TMR1 approach with 24 hr delays might work for this, but have doubts that it would keep time accuracy well enough to always happen exactly at midnight. Any ideas are appreciated??