Shop OBEX P1 Docs P2 Docs Learn Events
VDIP issue with BASIC Stamp — Parallax Forums

VDIP issue with BASIC Stamp

JokerBotJokerBot Posts: 1
edited 2007-11-15 15:56 in BASIC Stamp
I am currently communicating with the VDIP via the Basic stamp in the following UART configuration with the jumpers (J3, J4) set to high (UART):

Pin1 (5V) - 5V
Pin6 (TXD)- P1
Pin7 (GND)- GND
Pin8 (RXD) - P0
Pin10 (#CTS) - GND

The program reads the file information of the text file on the thumb drive, parses it to only retrieve file size, and pending on that file size, creates a loop to output the contents of the file. It succesfully worked, however, after I accidentally added a resistor to the TXD pin into P1 (1K Resistor), it no longer outputs and in fact, deletes the contents of the file. Could the resistor have fried some of the transistors of the VDIP or has my code changed sporadically via a spector (as i have not changed it and the output is different). Any help would be appreciated. The code is below:


' {$STAMP BS2px}


loopMaxValue VAR Byte
fileSize VAR Byte
byteSize VAR Byte
byteSize = 22
serStr VAR Byte (22)
t VAR Byte
t = 1


'*******************[noparse][[/noparse]INITIALIZE]******************
SEROUT 0,396,[noparse][[/noparse]"ipa",CR]
PAUSE 200
SEROUT 0,396,[noparse][[/noparse]"scs",CR]
PAUSE 200
'*************************************************


readIn:
SEROUT 0,396,[noparse][[/noparse]$01, $20, "1.txt", $0D]
SERIN 1, 396,[noparse][[/noparse]SKIP 8,HEX fileSize]
SEROUT 0,396, [noparse][[/noparse]$0A, $20, "1.txt", $0D]
IF ((fileSize//byteSize) > 0) THEN actualplusone
IF ((fileSize//byteSize) = 0) THEN actualpluszero

PAUSE 5000
END

actualplusone:
loopMaxValue = (fileSize/byteSize) + 01
GOSUB outputLoop
SEROUT 0,396, [noparse][[/noparse]$0A, $20, "1.txt", $0D]
DEBUG "end"
END

actualpluszero:
loopMaxValue = fileSize/byteSize
SEROUT 0,396, [noparse][[/noparse]$0A, $20, "1.txt", $0D]
GOSUB outputLoop
DEBUG "end"
END

outputLoop:
FOR t = 1 TO loopMaxValue
SEROUT 0,396,[noparse][[/noparse]$04, $20, "1.txt", $0D]
SERIN 1, 396,[noparse][[/noparse]SKIP (t-01)*21, STR serStr\byteSize-01\"*"]
DEBUG STR serStr
PAUSE 500
NEXT
RETURN

Comments

  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-11-14 19:55
    Hi, I think it is unlikely you damaged the drive by adding the resistor although it may be damaged through another cause. Scanning the program real quick if you can read the file size there should be no need for the two subroutines actualplusone and actualpluszero. I know you have had the program working at one time but I think I would begin by verifying I was acurately capturing the file size. You can check that using the first two lines of your code.

    SEROUT 0,396,[noparse][[/noparse]$01, $20, "1.txt", $0D]
    SERIN 1, 396,[noparse][[/noparse]SKIP 8,HEX fileSize]

    DEBUG·DEC filesize
    END

    Jeff T.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-11-15 15:56
    Also please scan your drive using chkdsk since there may be a file error or corrupt FAT entry. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.