VINCULUM - Vmusic2 - Vdrive2 - Help


Closed Thread
Results 1 to 11 of 11

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

    Welcome to the forum.

    Give this a try in the totally lost area.
    Code:
    SERIN2 PORTB.6,84,[DEC vol,WAIT(":"),DEC vol2]
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    May 2010
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    Hmm added the serin2 line and the code seems to hang on the jump and never return back to main, I wonder if there is something wrong with the open,read and close file commands I issued that is causing it not to spit up the data? Thus the serin2 can wait all day and never get anything.

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


    Did you find this post helpful? Yes | No

    Default

    These VDIP things can be a pain in the butt...

    Try reading the data into an array without any WAITs and see exactly what is being sent by the VDIP.
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    May 2010
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    I'm leaning towards this line being wrong.
    Code:
    serout PORTB.7, T9600, ["RD volume.txt", 13]  'read file
    The more I read it might be RDF instead of RD and I need to specify the number of bytes to read in there somewhere, I guess.

    And typo in the open command.

    Code:
    serout portb.7, T9600, ["OPR volume.txt", 13]
    serout portb.7, T9600, ["RDF XXXXX, 13]
    SERIN2 PORTB.6, 84,[DEC vol,WAIT(":"),DEC vol2]
    serout portb.7, T9600, ["CLF volume.txt", 13]
    At a lose what should be in XXXXX

    The subroutine above is hanging.
    Last edited by Allister; - 18th May 2010 at 04:08.

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


    Did you find this post helpful? Yes | No

    Default

    Code:
    serout PORTB.7, T9600, ["OPR volume.txt", 13] 'open file
    serout PORTB.7, T9600, ["RD", 13]  'read file
    Not sure if RDF will always work in your case because the amount of characters are not constant. But try the above...
    I missed the W earlier and I think once the file is opened the name is not used until after it is closed and you need to open it again.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    May 2010
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    I just wrote a simple program that should test the reading of the file and give me audible alerts, since I'm not setup with any type of IDE or debug.

    Here is the code so for those that are helping so we can be all on the same page. There are 4 files on the drive

    volume.txt that contains simply
    Code:
    10:225
    And three audio files named
    vol10.mp3
    vol225.mp3
    vol3.mp3

    In theory and hope,

    b0 should play vol10.mp3
    b1 should play vol225.mp3
    b2 should play vol3.mp3


    Code:
    @ DEVICE pic16f88,HS_OSC,WDT_OFF,MCLR_OFF,LVP_OFF,PROTECT_ON,CPD_ON,DEBUG_OFF
    
    Include "modedefs.bas"   
    Define   OSC 8
            
    CMCON = 7
    ANSEL = 0
    
    vol var byte
    vol2 var byte
    vol3 var byte
    
    vol = 0
    vol2 = 0
    vol3 = 3
    
    'in/out lines         
    OUTPUT PORTB.7   'send out
    input PORTB.6    'recieve in
    
    'Triggers
    input PORTB.0  'trigger
    input PORTB.1  'trigger
    INPUT PORTB.2  'trigger
    
    'PORTA.6 = OSC
    'PORTA.7 = OSC
    
    pause 5000 'wait for vmusic2 to read drive and stabilize
    serout PORTB.7, T9600, ["vsv 00",13] 'set full volume
    pause 1000 'give time for volume command to take effect
    
    gosub rdfile 'get numbers from text file
    
    main:
    
    if PORTB.0 = 0 THEN
        SEROUT PORTB.7, T9600, ["VPF vol",#vol,".mp3", 13]
        pause 2000 'debounce
    endif
    
    if PORTB.1 = 0 Then
        SEROUT PORTB.7, T9600, ["VPF vol",#vol2,".mp3", 13]
        pause 2000 'debounce
    endif
    
    if PORTB.2 = 0 Then
        SEROUT PORTB.7, T9600, ["VPF vol",#vol3,".mp3", 13]
        pause 2000 'debounce
    endif
    
    goto main
        
    
    rdfile: 'read variables in text file volume.txt
    serout PORTB.7, T9600, ["OPR volume.txt", 13]
    serout PORTB.7, T9600, ["RD", 13]
    SERIN2 PORTB.6, 84, [DEC vol,wait(":"),DEC vol2]
    serout PORTB.7, T9600, ["CLF volume.txt", 13]
    return
    
    end 'if it gets lost along the way ;)
    Right now as written above it doesn't return from the subroutine jump (it's stuck reading the file somewhere) confirmed when the control button b2 fails to function, remove the jump/recompile and b2 functions as expected.

    Remove the WAIT command with say

    Code:
    SERIN2 PORTB.6, 84, [DEC vol,DEC vol3,DEC vol2]
    And it still doesn't appear to return
    Last edited by Allister; - 18th May 2010 at 05:20.

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


    Did you find this post helpful? Yes | No

    Default

    I do not have a VDIP on the bench to test any of this but looking at the data sheet and my old code yours should work. But I have not used the VMUSIC, so maybe there is some difference there?

    One thing that might be causing trouble is not enough time from Opening the file and Reading it. You have read this?
    http://www.picbasic.co.uk/forum/show...7605#post47605
    See how Brian has the VDIP connected with a Flow pin and the WAIT LABELS in the code.

    Do you have the hardware to connect the output of the VDIP monitor to a PC terminal? You will need an inverter chip(MAX232 type).
    Would be a big help to you to see what the VDIP is doing.
    Dave
    Always wear safety glasses while programming.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts