USB, PIC18F2550 and VB


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default

    Thank you so much Bruce, that has been driving me mad for weeks on end. I've been working alot on the other code and kinda working around this, but it works very well indeed now. You're right, it now exits from the loop and back to the main routine. You're a genius !!

    Cheers again.

    Steve

  2. #2
    Join Date
    Feb 2005
    Location
    Essex, UK
    Posts
    154


    Did you find this post helpful? Yes | No

    Default

    Having now got that piece of code working it has presented this:

    If you remove power to the PIC and then reconnect, it of course first looks for the USB and data as per the Gosub DoUSBin etc. As at this stage the USB databuffers are empty, ie no data being sent, it stores the EEPROM variables as 0, instead of retaining the previously stored numbers.

    I have come up with this, what i think, long winded solution.

    Where by the top three lines of code read:
    Code:
    Main:
            Gosub DoUSBIN
            Gosub CheckData
            Gosub DoUSBoUT
    And then
    Code:
    CheckData:
        	If USBBuffer[9] = 0 Then
                Read 1, SecondsDelayOut     ' read previously stored
                Read 3, MinutesDelayOut     ' variables from EEPROM
                Read 5, HoursDelayOut       ' before they are blanked            
        	        SecondsDelayOut = SecondsDelay
        	        MinutesDelayOut = MinutesDelay
        	        HoursDelayOut = HoursDelay
                Return  
            Else 
    	        SecondsDelay = USBBuffer[11]
    	        MinutesDelay = USBBuffer[13]
    	        HoursDelay = USBBuffer[15]
    
    	        Write 1, SecondsDelay
    	        Write 3, MinutesDelay
    	        Write 5, Hoursdelay
            EndIf
    Return
    Obvioulsy in VB when i write the data again, i set BufferOut(10) = 1 to write the new variables.

    Is this the easiest way?

Similar Threads

  1. Sending data over USB via VB
    By Tissy in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 12th September 2005, 01:00

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts