USB to USB flash Drive File Copier - Page 2


+ Reply to Thread
Page 2 of 6 FirstFirst 123456 LastLast
Results 41 to 80 of 223
  1. #41
    Join Date
    Nov 2009
    Posts
    72

    Default

    about the DIR command, how will i be able to display the data that the vdip will return? will i also use an array of bytes like in your program? or there will be a different approach?

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

    Default

    Are you wanting to display the output on a LCD? If so then you will need to break the array up to fit on the screen and maybe do "line by line" refresh using the array parts that will fit...

    Below I was dumping the whole array to a PC terminal.
    Code:
    'Read from the VDIP
    SERIN2 PORTB.4,8588,[STR VDAT\96]
    'Send to PC terminal
    SEROUT2 PORTB.3, 24972,[STR VDAT,10,13]
    Dave
    Always wear safety glasses while programming.

  3. #43
    Join Date
    Nov 2009
    Posts
    72

    Default

    you mean right after i send the command

    SEROUT2 VinRXD,8588,["DIR",13]

    the commands that you wrote above will follow?

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

    Default

    Yes, almost instantly after the command to do something is sent to the VDIP it will respond.
    So you need to be ready to receive.

    I am wondering about the direct copy from one device to another the more I think about it. The VDIP will send data all at once but you have to tell the VDIP how much data it is to receive. So you will somehow have to figure that part out.

    Maybe there is a built in copy command with the VDIP?
    Dave
    Always wear safety glasses while programming.

  5. #45
    Join Date
    Nov 2009
    Posts
    72

    Default

    there is a CPS command which i have read in the manual that will copy the source disk to the target disk
    and the CPS-file which will copy a particular file from the source to the target disk. these are available only for the VDFC firmware..

    have you tried these commands already? do you think that using these commands, i will still be needing to tell the vdip how much data to recieve?

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

    Default

    No, I have not tried it. But if it is there it should work.
    Changing the firmware is easy. So give it a try.
    Dave
    Always wear safety glasses while programming.

  7. #47
    Join Date
    Nov 2009
    Posts
    72

    Default

    yes i would definitely do that.. but just to double check, after i have downloaded the reflash(ftd) for the VDFC firmware, will there be a need to rename it or do anything to it before saving it to the root of a flash disk?

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

    Default

    The file needs to be named FTRFB.FTD
    Put that file on the root of a USB stick and the VDIP should see it and re-do the firmware.
    Dave
    Always wear safety glasses while programming.

  9. #49
    Join Date
    Nov 2009
    Posts
    72

    Default

    this is the name of the file that i downloaded in the website: ftrfb_main_03_65VDFC.ftd, so i will rename it to FTRFB.FTD...

    now i will be redoing the firmware, i wii just be powering the vdip by its ground and vcc pins and i dont need to connect anything to the vdip yet right? how do i know if the firmware had already been installed?

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

    Default

    I always had the VDIP outputting to a terminal so I could see what was going on.
    There are two LEDs on board that blink in different sequences for different things. I do not remember the sequence but it is in the documentation.

    Yes, I know the docs are hard to find and not well organized. That is one of the things that is bothersome about the company that makes them.
    Dave
    Always wear safety glasses while programming.

  11. #51
    Join Date
    Nov 2009
    Posts
    72

    Default

    you are so right about that. They have a lot of PDF files about the vinculum but their contents are in a disorder. Anyway I have found the table of led behavior that indicates the status of the vdip but nothing i there indicates that a firmware had been installed.

    I also did the firmware installation already, i powered the vdip on and then inserted the flash drive containing the firmware at its root. the led behavior indicated that it went to power on and then USB Disk Initialization then USB Disk Ready and then just stayed like that.

    i do not have a level converter to connect the vdip to the computer so i do not have a view if my installation was a success.

    i was thinking, since i have an lcd module, can i view the responses of the vdip through it?

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

    Default

    You could use a PIC and the LCD, but it would be much easier to use a MAX232 or similar.
    If you are going to be working with this stuff you need the tools.
    Dave
    Always wear safety glasses while programming.

  13. #53
    Join Date
    Nov 2009
    Posts
    72

    Default

    ok i will get a max232 as soon as possible but for the mean time i will try to display the vdip's responses through my lcd module since i also need that in my projects.

    about your program, you were using the array of bytes to display the name of the file but for the file extension, you just used ".DAT" right? my project is a file transfer device using the vdip so i have to recognize all kinds of file extensions that are there. so do you think something like this would work?

    ["OPR ",x1,x2,x3,x4,x5,x6,x7,x8,"."x9,x10,x11,13]

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

    Default

    You have to tell the VDIP what to do at all times. It will read the files but then you have to have someway to "remember" what the file name and extension is if you want to do anything with it.

    So that is why I used an array. The app I was doing all of the files were DAT so I did not have to worry about that part of it.
    Dave
    Always wear safety glasses while programming.

  15. #55
    Join Date
    Nov 2009
    Posts
    72

    Default

    I've finally bought a max232 but i cannot find any schematic to connect it to the vdip and and also its connection to the computer. do you have any schematics that you can share with me? even just pin connections will do..

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

    Default

    Google must have been down for awhile when you tried to find the info. It is working now though. Here is one of the things that came up.
    Look at post #34
    http://www.todopic.com.ar/foros/inde...topic=24289.20

    And the data sheets for almost any part can be found on google too.
    Dave
    Always wear safety glasses while programming.

  17. #57
    Join Date
    Nov 2009
    Posts
    72

    Default

    Ive finally connected it into the computer's serial port and the vdip2 responded very well. i can already issue copy commands and the files were indeed copied from the source disk to the target disk. the problem is when i try to enter a sub directory, it only prints $00 $00 $00 $00... have you encountered this? I really need to view the files in the sub folders for file browsing.

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

    Default

    Cool!!! You are making progress.

    I did not play with sub directories much, I was just writing file to the root directory. But I do remember trying it.

    Are you using the Extended Command Set with your firmware?

    Looking at the
    Vinculum Firmware User Manual
    Version: 2.3
    Issue Date: 2007-12-03

    On page 30 section 6.2.1 Directory (DIR)
    This statement is made:
    Note that if the specified file is a directory, a size of zero will be displayed rather than a listing of the files in that directory.
    So maybe you are there and do not know it???
    Dave
    Always wear safety glasses while programming.

  19. #59
    Join Date
    Nov 2009
    Posts
    72

    Default

    I should thank you because you shared your knowledge with me that's why my project is developing. However, knowing the note from the firmware really hurt my feelings. how will i ever manipulate the file names for the file transfer if i cannot view them? Ive read in one of their manuals that the vdip can go down to 16 sud directories, how can they say that if they would only print zeroes?

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

    Default

    Quote Originally Posted by newbie View Post
    However, knowing the note from the firmware really hurt my feelings.
    Are you saying that I hurt your feelings?
    I only ran across that note about five minutes before I posted it after looking through the manual for clues to your problem.

    If I knew how to do what you are wanting I would gladly tell you how.

    After you receive the zeros, what happens if you send another DIR command?

    The manufacturer also has tech support if all else fails.
    Dave
    Always wear safety glasses while programming.

  21. #61
    Join Date
    Nov 2009
    Posts
    72

    Default

    oh no you got me misunderstood.. that just meant that i think I'm in a little bit of a trouble not being able to view the sub directories. I will ask the vinculum's customer support about this matter, and for the mean time i will be concentrating on the files located on the root..i wasn't successful the first time i interfaced the vdip2 to the pic16f877a. I could not get any response from the vdip. all i get are weird characters printed in the lcd even when the vdip is turned off. have you encountered this?

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

    Default

    OK. I get what you mean.

    Contact teck support and see what they say.

    In the mean time post your code and configs along with a schematic here and maybe if we are lucky someone will see the problem.
    Dave
    Always wear safety glasses while programming.

  23. #63
    Join Date
    Nov 2009
    Posts
    72

    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.

  24. #64
    Join Date
    Nov 2009
    Posts
    72

    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.

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

    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.

  26. #66
    Join Date
    Nov 2009
    Posts
    72

    Default

    are there any string manipulation commands in picbasic pro?

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

    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.

  28. #68
    Join Date
    Nov 2009
    Posts
    72

    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?

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

    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.

  30. #70
    Join Date
    Nov 2009
    Posts
    72

    Default

    thanks for the quick reply... so those are the serial type commands..I already know them and their functions I just didn't know that they are called that.

    Ive already visited the links..these will be big help. thank you.

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

    Default


    I do not know if anyone else calls them that.... But it works for me.
    Dave
    Always wear safety glasses while programming.

  32. #72
    Join Date
    Nov 2009
    Posts
    72

    Default

    Are you wanting to display the output on a LCD? If so then you will need to break the array up to fit on the screen and maybe do "line by line" refresh using the array parts that will fit...
    Any idea on how to do this? I was thinking to display arrays of 12 in every line so that it can support the 8.3 format set by the vinculum. the problem is, not all files follow the 8.3 format specially those with file names shorter than 8 characters. for example, i have a file named "pic.pdf" as you can see there will be 5 vacant array spaces for this line so the succeeding file's first 5 characters will occupy those vacant spaces then there will be a domino effect and the file names will be in a total disorder. do you have any idea on how i will know when it is the end of one file and the start of the next so that i can print it in a new line?

  33. #73
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,817

    Default

    Quote Originally Posted by newbie View Post
    Any idea on how to do this? I was thinking to display arrays of 12 in every line so that it can support the 8.3 format set by the vinculum. the problem is, not all files follow the 8.3 format specially those with file names shorter than 8 characters. for example, i have a file named "pic.pdf" as you can see there will be 5 vacant array spaces for this line so the succeeding file's first 5 characters will occupy those vacant spaces then there will be a domino effect and the file names will be in a total disorder. do you have any idea on how i will know when it is the end of one file and the start of the next so that i can print it in a new line?
    If I follow you . . . 10 is line feed, 13 is carriage return, 32 is a space so . . . "pic.pdf",32,32,32 would display as pic.pdf and 3 spaces, which using serout you would just put 3 spaces after pic.pdf but within the "" marks, I have not used the 10,13 codes with an lcd so I do not know if they work, and my bench is upside down right now so anyway you could preload your array with all 32s and then write your file name into it . . . best way to me is to tell the lcd where to print it.
    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.

  34. #74
    Join Date
    Nov 2009
    Posts
    72

    Default

    does the vdip issue a line feed and a carrage return in every end of a file?

    . . . best way to me is to tell the lcd where to print it.
    can i view it your way? how would you do it?

  35. #75
    Join Date
    Nov 2009
    Posts
    72

    Default

    I still haven't been able to get a response from the vdip when I connect it to the PIC and LCD. Still weird characters come out of the LCD. I'm using a 4Mhz xtal oscillator right now because when I tried to use a 20Mhz xtal the pic would not respond to any program..Do you think the oscillator has got something to do with it?

    If you could give me a schematic of vdip connected to the pic16f877a including the extra components, that would really help...

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

    Default

    I do not have a schematic so I will have to refer you back to the post BrianT made.
    http://www.picbasic.co.uk/forum/showthread.php?t=7700
    Dave
    Always wear safety glasses while programming.

  37. #77
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,817

    Default

    Quote Originally Posted by newbie View Post
    does the vdip issue a line feed and a carrage return in every end of a file?


    can i view it your way? how would you do it?
    Here is a Map of the LCD Display giving the address of each cell. simply do as the book says and use that address where you want the first character to appear.
    example:
    LCDOUT $fe, 128, "this example uses "
    LCDOUT $FE,192,"the first 2 lines"

    see the numbers 128, 192, find them on the chart.
    It makes no difference if you use decimal or hex representations. 128 = $80, $FE = 254
    LCDOUT 254,1 will clear all characters from the screen.
    Attached Images Attached Images  
    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.

  38. #78
    Join Date
    Nov 2009
    Posts
    72

    Default

    After a couple of tests I still have no success in interfacing the vdip to a pic16f877a microcontroller but i have found out that the program hangs whenever it reaches a serin2 command. I checked if the flowin was high but i wasn't...it was low the whole time the program was running so i'm pretty sure it wasnt trapped in an infinite loop. have any one encountered this?

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

    Default

    Can you post the code?

    When you setup the firm ware for the VDIP, what baud rate did you give it?

    You were able to communicate with the VDIP using a terminal, correct?
    What baud rate did you use then?
    Dave
    Always wear safety glasses while programming.

  40. #80
    Join Date
    Nov 2009
    Posts
    72

    Default

    The code i used was same as the code that i posted above...

    I used the default baud rate which is i think 9600...do you think i should change it to 2400?

    I also found out that it can be risky for flash drives.. it broke my disk just now..

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

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