USB to USB flash Drive File Copier - Page 5
+ Reply to Thread
Page 5 of 6 FirstFirst 123456 LastLast
Results 161 to 200 of 223
  1. #161
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,926

    Default

    Darn...

    Check the pick with a one second blink to see if it is running at the expected speed?

    Using a 232 type chip between PIC and PC?

    Post the exact code and configs you are testing with.

    Maybe we will see some thing.
    Dave
    Always wear safety glasses while programming.

  2. #162
    Join Date
    Mar 2010
    Posts
    40

    Default

    i testing with the code i post b4..i got connect to 232 using max232..i already test the mode with 84,8276

    INCLUDE "modedefs.bas"

    DEFINE OSC 20
    DEFINE LCD_DREG PORTA
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 5
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 4
    DEFINE LCD_RWREG PORTB
    DEFINE LCD_RWBIT 6
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50

    TXD VAR PORTC.7 'AD0 TXD VDIP2 connect RX
    RXD VAR PORTC.6 'AD1 RXD VDIP2 connect TX
    Flow VAR PORTC.0 'AD2 RTS

    Start:
    HIGH RXD
    PAUSEUS 10
    SEROUT2 RXD,84,["ECS",13]
    HIGH RXD
    PAUSEUS 10
    SEROUT2 RXD,84,["IPA",13]
    HIGH RXD
    PAUSEUS 10
    SEROUT2 RXD,84,["A:",13] 'choose source disk
    HIGH RXD
    PAUSEUS 100
    SEROUT2 RXD,84,["DIR",13]
    GOTO Start

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

    Default

    I would like to see you test a simple "hello world" to the PC without the VDIP involved.
    At this point we do not know where the problem is. Need to narrow it down.
    Dave
    Always wear safety glasses while programming.

  4. #164
    Join Date
    Mar 2010
    Posts
    40

    Default

    i did not connect to the VDIP..just connect with max232...
    HIGH RXD
    SEROUT2 RXD,84,["ECS",13]

    and i change to
    HIGH RXD
    SEROUT2 RXD,84,["hello",13]

  5. #165
    Join Date
    Mar 2010
    Posts
    40

    Default

    DEFINE OSC 20
    TXD VAR PORTC.7 'AD0 TXD VDIP2 connect RX
    RXD VAR PORTC.6 'AD1 RXD VDIP2 connect TX
    FlowIn VAR PORTC.0 'AD2 RTS

    StartDisk:
    RXD=1
    SEROUT2 VinRXD,84,["hello"]
    pauseus 1000
    GOTO StartDisk


    now i testing with this code...and i wan to ask is after i set the configuration bit..the hex code will become 24kb...and the pic16f873A program memory only 4k is this got problem?

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

    Default

    There is no way that little bit of code would make a hex that large.

    The data sheet says the program memory is 7.2K Bytes.

    I really have no idea what you are doing or looking at.

    Can you make a LED blink with this chip?
    Dave
    Always wear safety glasses while programming.

  7. #167
    Join Date
    Mar 2010
    Posts
    40

    Default

    i know so a little bit cant have so large hex code....

    before i set the configuration bit.. the hex code size is small..after i export it..it become large...

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

    Default

    Looking at your code you have the TX and RX mixed up and here
    SEROUT2 VinRXD,84,["hello"]
    VinRXD does not exist.

    Try this code without the VDIP. Connect as shown in the comments.
    Code:
    @ __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF   
        DEFINE OSC 20
        TXD VAR PORTC.6   'CONNECT TO MAX232 PIN #11
                          'MAX232 PIN#14 TO DB9 #2
        RXD VAR PORTC.7 
        
        StartDisk:
        SEROUT2 TXD,84,["hello",$d,$a]
        pauseus 1000
        GOTO StartDisk
    Dave
    Always wear safety glasses while programming.

  9. #169
    Join Date
    Mar 2010
    Posts
    40

    Default

    when i add in this line

    @ __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF

    and compile .. get error

    Error[118] C:\USERS\DESKTOP\PIC16F873A\PIC TO HYT\ABC.ASM 157 : Overwriting previous address contents (2007)
    Error[118] C:\USERS\DESKTOP\PIC16F873A\PIC TO HYT\ABC.ASM 157 : Overwriting previous address contents (2007)

  10. #170
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,926

    Default

    Ok. You must be setting the configuration bits in the *inc file.
    Commnt that line and use those settings.

    Fir more of what I am talking about
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    Dave
    Always wear safety glasses while programming.

  11. #171
    Join Date
    Mar 2010
    Posts
    40

    Default

    follow the code u given already success print hello to hyperterminal...

    is that means if i modified the code n connect to VDIP2 module..

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

    Default

    Yes, we are going now!!!

    Connect the VDIP to the PC with the MAX232 chip like you had when you saw the firmware message.

    Connect the VDIP's input to the same wire you now have connected to the PC from the PIC.

    What we will do is send commands to the VDIP from the PIC and have the VDIP send the response to the PC...
    We do need to add another connection for flow control. The "FLOWIN" signal from the VDIP will tell the PIC it is OK to send another command. I am using the VDIP1 so check the VDIP2 pin out. I think they are the same...
    Try to connect FLOWIN on a non ADC pin for now. Change the code below to your pin.
    The below should cause the VDIP to diplay on the terminal a
    D:\>
    every 1.5 seconds..
    Code:
    VinRXD  VAR PORTC.6 'DATA TO VDIP PIN #8 ON VDIP1
    FLOWIN  VAR PORTD.6 'FLOW CONTROL FROM VDIP PIN #9 ON VDIP1
    
    START:
    HIGH PORTD.2  'LED
    PAUSE 250
    LOW PORTD.2
    PAUSE 250
    SEROUT2 VinRXD,84,["ECS",13] '9600 TRUE
    HIGH VinRXD
    PAUSEUS 10
    SEROUT2 VinRXD,84,["IPA",13]
    HIGH VinRXD
    PAUSEUS 10
    WAIT111:
    IF FLOWIN = 1 THEN WAIT111
    PAUSE 1000
    GOTO START
    Dave
    Always wear safety glasses while programming.

  13. #173
    Join Date
    Mar 2010
    Posts
    40

    Default

    thx..
    i wan to ask..this
    "HIGH PORTD.2 'LED
    PAUSE 250
    LOW PORTD.2
    PAUSE 250"

    line is for ?

    and why need put this "HIGH VinRXD"line?

    because i test on without the HIGH VinRXD it also can send to the VDIP2 and display to the hyperterminal..
    if that this HIGH VinRX necessary?

  14. #174
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,926

    Default

    because i test on without the HIGH VinRXD it also can send to the VDIP2 and display to the hyperterminal..
    if that this HIGH VinRX necessary?
    So you got it working???

    The LED is something I like to do to see it the PIC is running. A heart beat. . . .

    The HIGH VinRXD is just a little insurance to put the pin in the correct state before transmitting data. Yes, it is not always needed.
    Dave
    Always wear safety glasses while programming.

  15. #175
    Join Date
    Mar 2010
    Posts
    40

    Default

    ya thankyou very much...i get it work and succes send comment to the VDIP2.now working on the 2 line LCD..because it cant display the file name correctly...

  16. #176
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,926

    Default

    Quote Originally Posted by fokus_1116 View Post
    ya thankyou very much...i get it work and succes send comment to the VDIP2.now working on the 2 line LCD..because it cant display the file name correctly...
    COOL Glad to have helped.

    For the LCD problem maybe it is the same as newbie was having?
    Dave
    Always wear safety glasses while programming.

  17. #177
    Join Date
    Mar 2010
    Posts
    40

    Default

    ya almost the same...

  18. #178
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,926

    Default

    If you can not figure it out from what we did with newbie let us know and we will try to figure it out.

    Good luck!
    Dave
    Always wear safety glasses while programming.

  19. #179
    Join Date
    Mar 2010
    Posts
    40

    Default

    i think another prob is ..i using 4bit....i will try using 8bit to test it..

  20. #180
    Join Date
    Mar 2010
    Posts
    40

    Default

    i follow the way newbie show to the LCD...but i only can show 1 or 2 file name only..then keep on repeat the second file name..

  21. #181
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,926

    Default

    Hey, at least you are getting something

    I do not think newbie ever showed us his last code so I am not sure what you are using. Sounds like a loop problem but to be sure post your current code so we can have a look at it.
    Dave
    Always wear safety glasses while programming.

  22. #182
    Join Date
    Mar 2010
    Posts
    40

    Default

    Code:
    INCLUDE "modedefs.bas"
    @ __config     _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF 
    DEFINE OSC 20
    DEFINE SER2_BITS 8
    DEFINE LCD_DREG     PORTA 'LCD Data line
    DEFINE LCD_DBIT     0
    DEFINE LCD_RSREG    PORTB  'RS bit
    DEFINE LCD_RSBIT    5
    DEFINE LCD_EREG     PORTB 'E bit
    DEFINE LCD_EBIT     4
    DEFINE LCD_RWREG    PORTB 'RW bit
    DEFINE LCD_RWBIT    6
    DEFINE LCD_BITS     4
    DEFINE LCD_LINES    2
    DEFINE LCD_CHARS    20
    DEFINE LCD_COMMANDUS    2000
    DEFINE LCD_DATAUS   50
    
    
    VinTXD VAR PORTC.7 'AD0 TXD VDIP2 connect RX
    VinRXD VAR PORTC.6 'AD1 RXD VDIP2 connect TX
    FlowIn VAR PORTC.0 'AD2 RTS
    T VAR PORTC.0 'push button
    D VAR PORTC.1 ' PUSH BUTTON FOR DISPLAY
    
    
    FILE1 VAR BYTE[12]
    FILE2 VAR BYTE[12]
    FILE3 VAR BYTE[12]
    
    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
    X13  VAR    BYTE
    X14  VAR    BYTE
    X15  VAR    BYTE
    X16  VAR    BYTE
    X17  VAR    BYTE
    X18  VAR    BYTE
    X19  VAR    BYTE
    X20  VAR    BYTE
    X21  VAR    BYTE
    X22  VAR    BYTE
    X23  VAR    BYTE
    X24  VAR    BYTE
    X25  VAR    BYTE
    X26  VAR    BYTE
    X27  VAR    BYTE
    X28  VAR    BYTE
    X29  VAR    BYTE
    X30  VAR    BYTE
    X31  VAR    BYTE
    X32  VAR    BYTE
    X33  VAR    BYTE
    X34  VAR    BYTE
    X35  VAR    BYTE
    X36  VAR    BYTE
    
    CRET VAR BYTE
    CRET = $0D
    
    StartDisk:
    pause 3000
    HIGH VinRXD
    
    SEROUT2 VinRXD,84,["ECS",13]
    LCDOUT $FE,1, "1"
    pause 2500
    PAUSEUS 1000
    HIGH VinRXD
    PAUSEUS 3000
    SEROUT2 VinRXD,84,["IPA",13]
    LCDOUT $FE,1, "2"
    pause 2500
    HIGH VinRXD
    PAUSEUS 1000
    SEROUT2 VinRXD,84,["A:",13]
    LCDOUT $FE,1, "3"
    pause 2500
    HIGH VinRXD
    PAUSEUS 1000
    SEROUT2 VinRXD,84,["DIR",13]
    LCDOUT $FE,1, "4"
    'pause 2500
    PAUSEUS 1000
    WAIT1
    IF FLOWIN = 1 THEN WAIT1
    SERIN2 VinTXD,84,[WAIT(CRET),STR FILE1\12 \CRET,WAIT(CRET),STR FILE2\12 \CRET,WAIT(CRET),STR FILE3\12 \CRET]
    LCDOUT $FE,1, "5"
    'pause 2500
    
    X1 = FILE1[0]
    X2 = FILE1[1]
    X3 = FILE1[2]
    X4 = FILE1[3]
    X5 = FILE1[4]
    X6 = FILE1[5]
    X7 = FILE1[6]
    X8 = FILE1[7]
    X9 = FILE1[8]
    X10 = FILE1[9]
    X11 = FILE1[10]
    X12 = FILE1[11]
    X13 = FILE1[0]
    X14 = FILE1[1]
    X15 = FILE1[2]
    X16 = FILE1[3]
    X17 = FILE1[4]
    X18 = FILE1[5]
    X19 = FILE1[6]
    X20 = FILE1[7]
    X21 = FILE1[8]
    X22 = FILE1[9]
    X23 = FILE1[10]
    X24 = FILE1[11]
    
    
    
    PAUSE 100
    LCDOUT $FE,1,X1,X2,X3,X4,X5,X6,X7,X8,x9,x10,x11,x12
    "actually i not really understand for this line "SERIN2 VinTXD,84,[WAIT(CRET),STR FILE1\12 \CRET,WAIT(CRET),STR FILE2\12 \CRET,WAIT(CRET),STR FILE3\12 \CRET]" "

    the code of this can display only 1 file name...but if i add another line LCDOUT the LCD display 2 same file name...
    Last edited by ScaleRobotics; - 4th July 2011 at 19:41. Reason: added code tags

  23. #183
    Join Date
    Mar 2010
    Posts
    40

    Default

    dear mackrackit,
    i already figure out..how to make it display..but the array part need got some prob.. it that got other way to make the file store at X

    X1 = FILE1[0]
    X2 = FILE1[1]
    X3 = FILE1[2]
    X4 = FILE1[3]
    X5 = FILE1[4]
    X6 = FILE1[5]
    X7 = FILE1[6]
    X8 = FILE1[7]
    X9 = FILE1[8]
    X10 = FILE1[9]
    X11 = FILE1[10]
    X12 = FILE1[11]
    X13 = FILE2[0]
    X14 = FILE2[1]
    X15 = FILE2[2]
    X16 = FILE2[3]
    X17 = FILE2[4]
    X18 = FILE2[5]
    X19 = FILE2[6]
    X20 = FILE2[7]
    X21 = FILE2[8]
    X22 = FILE2[9]
    X23 = FILE2[10]
    X24 = FILE2[11]

  24. #184
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,926

    Default

    "actually i not really understand for this line "SERIN2 VinTXD,84,[WAIT(CRET),STR FILE1\12 \CRET,WAIT(CRET),STR FILE2\12 \CRET,WAIT(CRET),STR FILE3\12 \CRET]" "
    This line WAITS for a carriage return (CRET) then will take the next 12 character and place then in the array FILE1 or FILE2 and so on.


    other way to make the file store at X
    The X~ array is just a dummy array to give a place to play with things, parse if needed. It is not really needed.
    Dave
    Always wear safety glasses while programming.

  25. #185
    Join Date
    Mar 2010
    Posts
    40

    Default

    mackrackit,

    can i use 2D array in picbasic pro compile or the pic16f873A can support the 2D array?

  26. #186
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,926

    Default

    Dave
    Always wear safety glasses while programming.

  27. #187
    Join Date
    Mar 2010
    Posts
    40

    Default

    dear sir..

    i plan to use 2d array to store the file name and then display it to the LCD..

    but cant make it success ... is that any suggestion to make it the array work?

  28. #188
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,926

    Default

    The best I can do is tell you to start a new thread about the 2D array problem. I have not tried them myself.

    Be sure to post your code when you start the new thread...
    Dave
    Always wear safety glasses while programming.

  29. #189
    Join Date
    Mar 2010
    Posts
    40

    Default

    i already tired to try the 2d array but it still cannot work....

    is that any way to store the file name except using the 2d array?

  30. #190
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,926

    Default

    If you do not want to post your code and ask about why it does not work I guess there is not much anyone can do to help. You have not even explained exactly what you are trying to do.

    It seems like you now have the VDIP running. So if you want help with arrays or something else start a new thread as suggested.
    Dave
    Always wear safety glasses while programming.

  31. #191
    Join Date
    Mar 2010
    Posts
    40

    Default

    so sorry,
    i got post my coding..but dunno y cant display...

    now the coding not at me..later i will post again for the coding...thank for your inform

  32. #192
    Join Date
    Mar 2010
    Posts
    40

    Default

    dear sir,

    y when i put the line @Put2D(X,Y) then cannot compile got error

    Error[108] C:\USERS\PIC16F873A\ARRAY TEST 2\ARRAY2.ASM 311 : Illegal character (()
    Attached Files Attached Files

  33. #193
    Join Date
    Mar 2010
    Posts
    40

    Default

    dear mackrackit
    below is my code..it like stuck at some where please help..
    INCLUDE "modedefs.bas"

    @ __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF
    ;----------------------------------------------------------------
    DEFINE OSC 20
    DEFINE LCD_DREG PORTA 'LCD Data line
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTB 'RS bit
    DEFINE LCD_RSBIT 5
    DEFINE LCD_EREG PORTB 'E bit
    DEFINE LCD_EBIT 4
    DEFINE LCD_RWREG PORTB 'RW bit
    DEFINE LCD_RWBIT 6
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_CHARS 20
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
    ;---------------------------------------------------------------
    VinTXD VAR PORTC.7 'AD0 TXD VDIP2 connect RX
    VinRXD VAR PORTC.6 'AD1 RXD VDIP2 connect TX
    FlowIn VAR PORTC.0 'AD2 RTS
    T VAR PORTC.0 'push button
    D VAR PORTC.1 ' PUSH BUTTON FOR DISPLAY
    ;----------------------------------------------------------------
    X VAR BYTE SYSTEM
    Y VAR BYTE SYSTEM
    ;----------------------------------------------------------------
    ;----------------------------------------------------------------
    ; -- Working with 2D arrays ---

    Width CON 8 ; Number of bytes in a Row
    Length CON 10 ; Number of Rows in the array
    ;---------------------------------------------------------------------------
    ArraySize CON Width * Length ; Total size of the array
    MyArray VAR BYTE[ArraySize] ; The Array

    Idx VAR BYTE ; Index, points to 1D array locations
    Xidx VAR BYTE ; 2D column Index
    Yidx VAR BYTE ; 2D row Index
    ArrayData VAR BYTE ; holding register for array data

    ;----[Get a value from the 2D array]----------------------------------------
    Get2D:
    Idx=(Yidx*Width+Xidx) MIN (ArraySize-1) ; find Index, limit to ArraySize
    ArrayData = MyArray(Idx) ; retrieve value from the array
    RETURN

    ;----[Put a value in the 2D array]------------------------------------------
    Put2D:
    Idx=(Yidx*Width+Xidx) MIN (ArraySize-1) ; find Index, limit to ArraySize
    MyArray(Idx) = ArrayData ; store the value in the array
    RETURN

    ;----[Set entire array to 0's]----------------------------------------------
    Clear2D:
    FOR Idx = 0 TO ArraySize-1
    MyArray(Idx) = 0
    NEXT Idx
    RETURN

    ;----[Turn the Subroutines into Functions]----------------------------------
    ASM
    #Get2D macro X, Y
    MOVE?BB X, _Xidx ; copy users X value to Xidx
    MOVE?BB Y, _Yidx ; copy users Y value to Yidx
    L?CALL _Get2D ; call the Get subroutine
    endm ; value is returned in ArrayData
    #define Get2D(X, Y) #Get2D X, Y ; allows paretheses in macro
    ;-----------------------
    #Put2D macro X, Y ; value should be in ArrayData
    MOVE?BB X, _Xidx ; copy users X value to Xidx
    MOVE?BB Y, _Yidx ; copy users Y value to Yidx
    L?CALL _Put2D ; call the Put subroutine
    endm
    #define Put2D(X, Y) #Put2D X, Y ; allows paretheses in macro
    ;-----------------------
    #Clear2D macro
    L?CALL _Clear2D ; call the Clear subroutine
    endm
    #define Clear2D() #Clear2D
    ENDASM

    ;----------------------------------------------------------------
    ;a var BYTE[12]

    FILE1 VAR BYTE[12]
    FILE2 VAR BYTE[12]
    FILE3 VAR BYTE[12]
    ;X VAR BYTE


    CRET VAR BYTE
    CRET = $0D
    ;----------------------------------------------------------------
    StartDisk:
    pause 3000
    HIGH VinRXD

    SEROUT2 VinRXD,84,["ECS",13]
    LCDOUT $FE,1, "1"
    PAUSEUS 1000
    HIGH VinRXD
    PAUSEUS 1000
    SEROUT2 VinRXD,84,["IPA",13]
    LCDOUT $FE,1, "2"

    HIGH VinRXD
    PAUSEUS 1000
    SEROUT2 VinRXD,84,["A:",13]
    LCDOUT $FE,1, "3"

    HIGH VinRXD
    PAUSEUS 1000
    SEROUT2 VinRXD,84,["DIR",13]
    LCDOUT $FE,1, "4"

    PAUSEUS 1000
    ;------------------------------------------------------------
    WAIT1
    IF FLOWIN = 1 THEN WAIT1
    SERIN2 VinTXD,84,[WAIT(CRET),STR FILE1\12 \CRET]
    LCDOUT $FE,1, "5"
    @ Clear2D ; clear the array
    FOR Y = 0 TO Length-1 ; fill the array with data
    FOR X = 0 TO Width-1
    ArrayData =FILE1[X] ; value to put in array
    @ Put2D(X,Y)
    NEXT X
    NEXT Y

    ;--------------------------------------------------------------------------------
    PAUSE 1000
    FOR Y = 0 TO Length-1
    FOR X = 0 TO Width-1
    @ Get2D(X,Y)
    NEXT X
    LCDOUT $FE,1,ArrayData
    pause 500
    NEXT Y
    goto StartDisk

  34. #194
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,926

    Default

    So you got the new version of PBP?

    Where did you get it?
    Dave
    Always wear safety glasses while programming.

  35. #195
    Join Date
    Mar 2010
    Posts
    40

    Default

    u use the 2.46version...
    the code i use it like stuck only can run until the code below then stop
    INCLUDE "modedefs.bas"

    @ __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF
    ;----------------------------------------------------------------
    DEFINE OSC 20
    DEFINE LCD_DREG PORTA 'LCD Data line
    DEFINE LCD_DBIT 0
    DEFINE LCD_RSREG PORTB 'RS bit
    DEFINE LCD_RSBIT 5
    DEFINE LCD_EREG PORTB 'E bit
    DEFINE LCD_EBIT 4
    DEFINE LCD_RWREG PORTB 'RW bit
    DEFINE LCD_RWBIT 6
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_CHARS 20
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
    ;---------------------------------------------------------------
    VinTXD VAR PORTC.7 'AD0 TXD VDIP2 connect RX
    VinRXD VAR PORTC.6 'AD1 RXD VDIP2 connect TX
    FlowIn VAR PORTC.0 'AD2 RTS
    T VAR PORTC.0 'push button
    D VAR PORTC.1 ' PUSH BUTTON FOR DISPLAY
    ;----------------------------------------------------------------
    X VAR BYTE SYSTEM
    Y VAR BYTE SYSTEM
    ;----------------------------------------------------------------
    ;----------------------------------------------------------------
    ; -- Working with 2D arrays ---

    Width CON 8 ; Number of bytes in a Row
    Length CON 10 ; Number of Rows in the array
    ;---------------------------------------------------------------------------
    ArraySize CON Width * Length ; Total size of the array
    MyArray VAR BYTE[ArraySize] ; The Array

    Idx VAR BYTE ; Index, points to 1D array locations
    Xidx VAR BYTE ; 2D column Index
    Yidx VAR BYTE ; 2D row Index
    ArrayData VAR BYTE ; holding register for array data

    ;----[Get a value from the 2D array]----------------------------------------
    Get2D:
    Idx=(Yidx*Width+Xidx) MIN (ArraySize-1) ; find Index, limit to ArraySize
    ArrayData = MyArray(Idx) ; retrieve value from the array
    RETURN

    ;----[Put a value in the 2D array]------------------------------------------
    Put2D:
    Idx=(Yidx*Width+Xidx) MIN (ArraySize-1) ; find Index, limit to ArraySize
    MyArray(Idx) = ArrayData ; store the value in the array
    RETURN

    ;----[Set entire array to 0's]----------------------------------------------
    Clear2D:
    FOR Idx = 0 TO ArraySize-1
    MyArray(Idx) = 0
    NEXT Idx
    RETURN

  36. #196
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,926

    Default

    Sorry, I have not used arrays like that.
    You may want to go here
    http://www.picbasic.co.uk/forum/showthread.php?t=12870
    Dave
    Always wear safety glasses while programming.

  37. #197
    Join Date
    Mar 2010
    Posts
    40

    Default

    what array you using? can show it?

  38. #198
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,926

    Default

    I have shown it several times starting in post#8 of this thread.
    Dave
    Always wear safety glasses while programming.

  39. #199
    Join Date
    Mar 2010
    Posts
    40

    Default

    using this way of array...if i got 10 file..then need to copy the X1X2 until X120? this way of array i have try it..it simple and easy...if i dunno the pendrive have how many file?

  40. #200
    Join Date
    Nov 2009
    Posts
    72

    Default

    you can try storing storing all the file names that your PIC's array is capable of storing then when your cursor goes down to the last file name, do another serin but this time use the waitstr function and wait for the last file name in your list. you will then receive an new batch or list of file names. You can do this again and again if there are too many file names in your flash drive. As for going up to view the previous files names., you can save the last file name every batch and when you want to get to a specific batch, do a serin and wait for the last file name of the batch before that particular batch where you want to get to. i would advice that you lessen the file names per batch because based on my experience, the pic hangs when for example you are set to receive 8 files but receives only 7 or less. This is just my idea. its not yet complete though.. there are so many other ways to address to the problem of getting all the file names from a flash drive printed in you lcd.

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