USB to USB flash Drive File Copier


Closed Thread
Results 1 to 40 of 223

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    Code:
    DEFINE OSC 20
    INCLUDE "modedefs.bas"
    
    DEFINE LCD_DREG     PORTC
    DEFINE LCD_DBIT     0
    DEFINE LCD_RSREG    PORTD
    DEFINE LCD_RSBIT    1
    DEFINE LCD_EREG     PORTD
    DEFINE LCD_EBIT     3
    DEFINE LCD_RWREG    PORTD
    DEFINE LCD_RWBIT    2
    DEFINE LCD_BITS     8
    DEFINE LCD_LINES    4
    Define LCD_CHARS    20
    DEFINE LCD_COMMANDUS    2000
    DEFINE LCD_DATAUS   50
    
    VTXD VAR PORTB.0 
    VRXD VAR PORTB.1 
    Flowin VAR PORTB.2 
    
            Pause 500       
    
    	Lcdout $fe,$C0, " Please Insert Your "
            Lcdout $fe,$94,	 "    Flash Drive        " 
            Pause 100    
    
    RESP	 VAR	 BYTE[16]
    
    X1	VAR	BYTE
    X2	VAR	BYTE
    X3	VAR	BYTE
    X4	VAR	BYTE
    X5	VAR	BYTE
    X6	VAR	BYTE
    X7	VAR	BYTE
    X8	VAR	BYTE
    
    checkvin:
    
    SEROUT2 VRXD,8588,["ECS",13]
    HIGH VRXD
    PAUSEUS 10
    SEROUT2 VRXD,8588,["IPA",13]
    HIGH VRXD
    PAUSEUS 10
    
    WAIT1
    IF Flowin = 1 THEN WAIT1
    SEROUT2 VRXD,8588,["DIR",13]
    PAUSE 100
    SERIN2 VTXD,8588,[STR RESP\8]
    
    X1 = RESP[0]
    X2 = RESP[1]
    X3 = RESP[2]
    X4 = RESP[3]
    X5 = RESP[4]
    X6 = RESP[5]
    X7 = RESP[6]
    X8 = RESP[7]
    X9 = RESP[8]
    X10 = RESP[9]
    X11 = RESP[10]
    X12 = RESP[11]
    
    PAUSE 100
    LCDOUT $FE,1,X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12
    PAUSE 2000
    As you can see I ripped a part of your code. pardon me for doing so. I just wanna see if the vdip would respond to the pic. This program is pretty short, I just wanted to display the first file it detects to the lcd. I wouldn't want to write a long program and then start wondering what part of the code went wrong after wards. Once I get a response even just one file name from the directory then will start to write my own program including the file browsing.

  2. #2
    Join Date
    Nov 2009
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    I can now view the files in the sub directories...this is my bad.. I was entering DIR (file), this command would only list the specified file and size. I did not see until now that these was another command that will change the current directory, its CD (folder). my bad sorry. now i can go on and make a program once i get responses from the vdip with the pic controlling it.

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Great!!! Progress!!!

    No problem ripping the code, that is what it is there for.

    Writing a little and testing is the way to do it. That is why ICSP is so handy.

    Keep us posted.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Nov 2009
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    are there any string manipulation commands in picbasic pro?

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by newbie View Post
    are there any string manipulation commands in picbasic pro?
    Yes and no.
    The serial type commands can manipulate strings up to a point.
    Using arrays you can do pretty much what ever you want.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Nov 2009
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    regarding the arrays..does it support string arrays? I haven't found any examples about string arrays in picbasic pro. I tried do something similar to your code but instead of storing characters i tried to store strings. I received errors upon compiling the code. Do you have some sample codes you can share? Also, what do you mean by serial type commands?

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    A string can be saved to an array and the serial type commands are.....
    SERIN
    SERIN2
    HSERIN

    This is all in the manual.
    More info is here
    http://www.picbasic.co.uk/forum/showthread.php?t=544

    And many examples are here
    http://www.melabs.com/resources/samples.htm
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. USB CDC Communications for Dummies!
    By Squibcakes in forum USB
    Replies: 104
    Last Post: - 15th January 2014, 14:43
  2. How to drive the Vinculum VDIP1 in UART mode
    By BrianT in forum Code Examples
    Replies: 41
    Last Post: - 23rd May 2013, 13:34
  3. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 21:17
  4. USB-FTDI[UM232R] with PIC16f877a
    By bjox in forum USB
    Replies: 1
    Last Post: - 23rd February 2008, 23:40
  5. PICs and USB Flash Drives
    By The Master in forum USB
    Replies: 2
    Last Post: - 23rd October 2007, 11:23

Members who have read this thread : 0

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

Tags for this Thread

Posting Permissions

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