USB to USB flash Drive File Copier


Closed Thread
Results 1 to 40 of 223

Hybrid View

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


    Did you find this post helpful? Yes | No

    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.

  2. #2
    Join Date
    Nov 2009
    Posts
    72


    Did you find this post helpful? Yes | No

    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..

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


    Did you find this post helpful? Yes | No

    Default

    The baud rate in your code is not for 9600. The baud you are using is from my code.
    You need 84, I think...

    What do you mean broke? What happened?
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Nov 2009
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    I tried changing the baud rate of the vdip to 2400 using its SBD command but it does not work...the vdip only works properly when the computer terminal's baud rate is 9600. you used the 2400 baud rate in your program right? how about your vdip? what was its baud rate?

  5. #5
    Join Date
    Nov 2009
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    about my flash drive after using it for testing it suddenly could not be read by the computer. It can be detected normally and even assigns to a proper letter but when i open it, the computer prompts "please insert a disk in drive F " or something like that...

    anyways moving on...
    Ive read that 4Mhz oscillators are pretty much unreliable with 9600 baud rate so i might have to change it.. the problem is I cant get any program running in my pic when i change its clock to 20Mhz..is there any other component that needs to be changed?

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


    Did you find this post helpful? Yes | No

    Default

    When you set up the VDIP's firmware there is a place to set the baud rate and hand shaking. If I remember correctly this is on the first tab of the firmware set up program.

    I had mine set for 4800 7E1.

    The OSC needs to match the DEFINE in your code.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    Nov 2009
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    Ive changed the baud rate of the pic in the program to 84 and when nothing changed, i tried 8276. I based the baud rate codes from the table in this page:
    http://melabs.com/resources/ser2modes.htm
    ..but still the program hangs up when it encounter a serin2 command. still the flowin is low so no infinite loop is happening.

    any other suggestions?
    Last edited by newbie; - 27th January 2010 at 15:16. Reason: additional info

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


    Did you find this post helpful? Yes | No

    Default

    Re-read this.
    http://www.picbasic.co.uk/forum/showthread.php?t=7700

    Post your current code and a schematic.
    Dave
    Always wear safety glasses while programming.

  9. #9
    Join Date
    Nov 2009
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    Code:
    INCLUDE "modedefs.bas"
    
    DEFINE LCD_DREG     PORTB
    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
    
    VinTXD VAR PORTC.7 'AD0
    VinRXD VAR PORTC.6 'AD1
    FlowIn VAR PORTC.5 'AD2
    
            Pause 500       ' Wait for LCD to startup
    
    mainloop:	
    		Lcdout $fe, 1,  "********************"
            Lcdout $fe,$C0, "   PORTABLE FILE    " 
    		Lcdout $fe,$94, "  TRANSFER DEVICE   "  
    		Lcdout $fe,$d4,	"********************"
            Pause 3000       ' Wait 2 secondS
    		
    
    
    NUMS	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
    X9	VAR	BYTE
    X10	VAR	BYTE
    X11	VAR	BYTE
    X12	VAR	BYTE
    
    StartDisk:
    
    
    HIGH VinRXD
    PAUSEUS 1000
    SEROUT2 VinRXD,8588,["ECS",13]
    LCDOUT $FE,1, "1"
    HIGH VinRXD
    PAUSEUS 1000
    SEROUT2 VinRXD,8588,["IPA",13]
    LCDOUT $FE,1, "2"
    HIGH VinRXD
    PAUSEUS 1000
    SEROUT2 VinRXD,8588,["A:",13]
    LCDOUT $FE,1, "3"
    HIGH VinRXD
    PAUSEUS 100
    SEROUT2 VinRXD,8588,["DIR",13]
    LCDOUT $FE,1, "4"
    PAUSEUS 1000
    WAIT1
    IF FLOWIN = 1 THEN WAIT1
    SERIN2 VinTXD,8588,[STR NUMS\12]
    LCDOUT $FE,1, "5"
    
    X1 = NUMS[0]
    X2 = NUMS[1]
    X3 = NUMS[2]
    X4 = NUMS[3]
    X5 = NUMS[4]
    X6 = NUMS[5]
    X7 = NUMS[6]
    X8 = NUMS[7]
    X9 = NUMS[8]
    X10	= NUMS[9]
    X11	= NUMS[10]
    X12	= NUMS[11]
    
    PAUSE 100
    LCDOUT $FE,1,X1,X2,X3,X4,X5,X6,X7,X8,x9,x10,x11,x12
    PAUSE 2000
    goto StartDisk
    here is my code. its almost the same as the one that i posted earlier..

    i changed the baud rate back to 8588 in the program and tried to change the vdip's baud rate to 4800 in the comport monitor using the SBD $710200 (change baud rate to 4800) command but the monitor just printed weird characters and then the comport monitor stopped responding. When i restarted the connection, the vdip was still working properly in 9600 baud rate and not in 4800.

    i also tried to change the baud rate of the vdip using a newly modified firmware with 4800 set as its baud rate. I saved it in a flash drive and inserted it to the vdip but when I entered the command FWU ftrfb.ftd (firmware upgrade ftrfb.ftd), the monitor printed "No Upgrade". obviously that was a failure.

    I haven't made a circuit diagram yet since im still testing with breadboards. I do have a working PIC development board where i interfaced the lcd and the vdip..here are the pin connections.

    LCD DATA LINES - PORTB
    LCD RS BIT - PORTD.1
    LCD RW BIT - PORTD.2
    LCD E BIT - PORTD.3

    VinTXD(AD0) - PORTC.7
    VinRXD(AD1) - PORTC.6
    RTS(AD2) - PORTC.5
    CTS(AD3) - GND

    OSC 4MHZ

  10. #10
    Join Date
    Nov 2009
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    line feed is 10 right? if i would have the line feed to an IF statement, how would i get the compiler to understand that I am pertaining to 10 as the line feed and not the number itself? would i need to put a preceding sign like # or $ or should i just put 10 without the "" marks?

    Just have the string terminate when EOF is returned.
    are you talking about the array of bytes as the string in here? or is there a way to save the group of characters into one string constant?
    Last edited by newbie; - 9th February 2010 at 17:46. Reason: additional question

  11. #11
    Join Date
    Nov 2009
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    hi! here's what has happening to my project so far... ive been interfacing a vdip2, a pic16f877a and a 4x20LCD. i can already print the responses of the vdip to the LCD..but my problem is that some characters appear in between the file names which do not appear when the vdip is connect to the pc. ive searched the ascii tables http://www.ascii-code.com/ to see if these characters have an equivalent hex code so that i can use it for the wait() command in picbasic pro..but i did not find the characters in the table. i first thought that it was a line feed but when i used the code $0A(line feed) for the serial wait() command, it did not work... do you have any idea on these characters are? ive attached some images, you might want to take a look on what these characters look like...Name:  IMG0273A.jpg
Views: 14980
Size:  43.1 KB

    Name:  1.jpg
Views: 15008
Size:  42.7 KB

    Name:  2.jpg
Views: 14981
Size:  45.3 KB

    Name:  3.jpg
Views: 15075
Size:  45.5 KB

    Name:  IMG0272A.jpg
Views: 14833
Size:  43.9 KB

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


    Did you find this post helpful? Yes | No

    Default

    Looks like you about have it!!! Good job!!!

    Look at the data sheet for the display and there should be a "Character Font Table". Those characters show up there.

    Why the commands are being sent to your display and how to fix it I do not know...
    Thinking....
    Dave
    Always wear safety glasses while programming.

  13. #13
    Join Date
    Nov 2009
    Posts
    72


    Did you find this post helpful? Yes | No

    Default

    i have a data sheet of the display...some of the characters of the are found in there but some aren't. these reason i have my eyes set on these weird character is because i think they would be the key to sorting the file names since the appear in between them.basing on the pictures above, do you have any idea on how i can sort the file names so that i can print only one file name per line? ive been trying joe's suggestion but so far i have no success.
    Attached Images Attached Images

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by newbie View Post
    i have a data sheet of the display...some of the characters of the are found in there but some aren't. these reason i have my eyes set on these weird character is because i think they would be the key to sorting the file names since the appear in between them.basing on the pictures above, do you have any idea on how i can sort the file names so that i can print only one file name per line? ive been trying joe's suggestion but so far i have no success.
    Hi Newbie,
    Sometimes weird characters are due to the clock or baud being off. They can occur if the LCD's power is not bypassed adequately with a capacitor. What I do to check things like this is to make a counter loop which outputs a count from 0 to xxx and also outputs a space after and also outputs the counter variables actual count, and I watch for the character to appear and see what number makes it so.
    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.

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