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

    hi guys thanks for the replies but i think i got it...
    the weird characters were carriage returns ($0d).
    Name:  IMG0278A.jpg
Views: 14578
Size:  54.5 KB
    i used this code..
    Code:
    CRET VAR BYTE
    CRET = $0D
    SERIN2 VinTXD,84,[WAIT(CRET),STR FILE1\12 \CRET,WAIT(CRET), STR FILE2\12 \CRET,WAIT(CRET),STR FILE3\12 \CRET,WAIT(CRET),STR FILE4\12 \CRET]
    as you can see i waited for every occurrence of the carriage return and saved the characters found between them into an array of string.

    the weird characters that you can see at the end of some files names in the lcd are i think blank or null arrays since i allocated 12 array places for every file name found but not all of them would be 12 characters long..some are less.

    now could you suggest any better way of storing these file names?
    because i think if i do it this way, my pic microcontroller would quickly run out of space to save all of the characters from the file names and if the flash drive inserted is very populated then the files names not saved in the array would not be displayed.

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    If the file names are always the same, you could assign them each a number, and store the names in eprom, or if they have all the same name with a number, even easier, just display the name followed by the number received. Unless I am missing something due to inadequate supply of coffee .
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Default

    You might try what Joe suggested before and pre-populate the arrays with a known value.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Nov 2009
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    If the file names are always the same, you could assign them each a number, and store the names in eprom, or if they have all the same name with a number, even easier, just display the name followed by the number received.
    here is the rule about the files from the vinculum:
    Filenames are made up of an 8 character main part and an optional 3 character extension. The presence of a ’dot’ character in the filename indicates the boundary between the main part and the extension. The name may be up to 12 characters long, including the ‘dot’ character.

    can you give me a sample code about this? I'm not that familiar with eproms.

    You might try what Joe suggested before and pre-populate the arrays with a known value.
    ive been thinking about doing that..but the thing is if the length of the file names is less than 12, i might have trouble retrieving only the arrays that were inserted with the file name characters. if i include the arrays that were not over written by the file name characters and still contains the pre loaded value, the vdip2 would respond "command failed".

  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
    ive been thinking about doing that..but the thing is if the length of the file names is less than 12, i might have trouble retrieving only the arrays that were inserted with the file name characters. if i include the arrays that were not over written by the file name characters and still contains the pre loaded value, the vdip2 would respond "command failed".
    What if you populate the array with a character that would probably not be used in a file name, (~), and parse the array for that before the array is used again.

    Or, have a "working" array. This would be one that stored arrays are parsed into for using.

    Stored array with (~) character
    Stored array re-written into sandbox array
    Sandbox array is sent to VDIP
    Start over with next stored array.

    Maybe....
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Nov 2009
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    What if you populate the array with a character that would probably not be used in a file name, (~), and parse the array for that before the array is used again.

    Or, have a "working" array. This would be one that stored arrays are parsed into for using.

    Stored array with (~) character
    Stored array re-written into sandbox array
    Sandbox array is sent to VDIP
    Start over with next stored array.

    Maybe....
    are saying its like this:
    say you have an array named FILE1 with 12 array places, i will pre-load it with (~) so...
    FILE1 = [~][~][~][~][~][~][~][~][~][~][~][~]

    and then when i receive a file named "vdip.txt" from the vdip serially, then the array would be like:
    FILE1 = [v][d][i][p][.][t][x][t][~][~][~][~]
    am i right with this? please correct me if im wrong...

    then when i want to send command to the vdip that i want to copy that particular file, i will be sending the "CPS" command plus the array of bytes stored in FILE1 including the bytes that contains [~] back to the vdip, but the vinculum is very strict with the spelling...if i include these bytes it will respond with "command failed" if only i could remove those unneeded bytes before sending it back to the vdip...

    am i getting your idea right?

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


    Did you find this post helpful? Yes | No

    Default

    Thinking more about this the "~" will not do you any good. Still need to re-write the array but...

    Assume file names should only contain letters and numbers. The problem is other characters are showing up..
    So when the file name is read from the VDIP say it is saved into "arrayF". Before "arrayF" is used again it needs checked for bad characters. Right?

    Again have a working array that will be used and/or reused to send back to the VDIP, "arrayW".

    The bad characters are at the end of the name?
    What if you check each bit of "arrayF" and IF the bit equals A-Z or 0-9 then that bit will be written to "arrayW". When the first bad character bit is found the re-write loop stops.
    Now "arrayW" should only contain valid characters.

    This thread should give you some ideas on how to process the arrays.
    http://www.picbasic.co.uk/forum/showthread.php?t=8876

    I hope this is on the correct track.
    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, 13:43
  2. How to drive the Vinculum VDIP1 in UART mode
    By BrianT in forum Code Examples
    Replies: 41
    Last Post: - 23rd May 2013, 12:34
  3. Simple USB Comms Problem
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th January 2010, 20:17
  4. USB-FTDI[UM232R] with PIC16f877a
    By bjox in forum USB
    Replies: 1
    Last Post: - 23rd February 2008, 22:40
  5. PICs and USB Flash Drives
    By The Master in forum USB
    Replies: 2
    Last Post: - 23rd October 2007, 10: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