VINCULUM - Vmusic2 - Vdrive2 - Help


Closed Thread
Results 1 to 11 of 11

Hybrid View

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

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

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

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

  5. #5
    Join Date
    May 2010
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    I have the hardware but not at my current location, thus my handicap.

    As for timing I had thought of that and put delays in there but it didn't seem to help, but I might revisit that area. Until then I'll cross my fingers that someone else around these parts might be able to toss a lead as to why it's not working.

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


    Did you find this post helpful? Yes | No

    Default

    This has been bugging me enough to dig out a VDIP1 and take it along with me.

    Here is what I got working. First off the "flash stick" was loaded with a file named VOLUME.TXT with 10:255 written in it so I think we are using the same file.

    I do not have a VDIP Music module so this is working with a standard VDIP1. The attachment shows the firmware setting.
    Name:  VDIP_FIRM.png
Views: 736
Size:  34.6 KB
    Below is my complete code. The long pauses are just there to make sure the VDIP is initialized before sending any commands to it.
    The LCD displays 10 for VAR VOL and 255 for VAR VOL2.
    I hope this helps.
    Code:
    '  18F6680  VDIP
    ' 1384 BYTES
        DEFINE OSC 20
        @ __CONFIG    _CONFIG1H, _OSC_HS_1H
        @ __CONFIG    _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H
        @ __CONFIG    _CONFIG4L, _LVP_OFF_4L
        DEFINE LCD_DREG     PORTG
        define LCD_DBIT     0
        DEFINE LCD_RSREG    PORTE
        DEFINE LCD_RSBIT    0
        DEFINE LCD_EREG     PORTE
        DEFINE LCD_EBIT     1
        DEFINE LCD_BITS     4
        DEFINE LCD_LINES    4                         
        DEFINE LCD_COMMANDUS    3000
        DEFINE LCD_DATAUS   150
        
        RXD     VAR PORTE.2    'VDIP PIN 6 - DATA FROM VDIP
        TXD     VAR PORTE.3    'VDIP PIN 8 - DATA TO VDIP
        FLOW    VAR PORTE.4    'VDIP PIN 9 - VDIP RTS
        VOL     VAR BYTE
        VOL2    VAR BYTE
        
        PAUSE 5000
        PAUSE 5000   'SAFE START UP TIME FOR VDIP
        LCDOUT $FE,1,"MACKRCKIT"
        lcdout $FE,$D0," U.S.A."
    
        'INTIALIZE VDIP STICK
        HIGH TXD
        PAUSE 5
        SEROUT2 TXD,84,["ECS",13] 
        HIGH TXD
        PAUSEUS 10
        SEROUT2 TXD,84,["IPA",13]
        HIGH TXD
        PAUSEUS 10
        WAIT11:IF FLOW = 1 THEN WAIT11
        
        START:PAUSE 5000
        serout2 TXD, 84, ["OPR VOLUME.TXT", 13] 'open file
        WAIT01:IF FLOW = 1 THEN WAIT01
        serout2 TXD, 84, ["RD VOLUME.TXT", 13]  'read file
        SERIN2 RXD, 84, [DEC VOL,DEC VOL2]    
        WAIT13:IF FLOW = 1 THEN WAIT13
        serout2 TXD, 84, ["CLF VOLUME.TXT", 13]  'close file
        GOSUB DISPLAY
        GOTO START
        
        DISPLAY:
        LCDOUT $FE,1,"VOL ",DEC VOL
        lcdout $FE,$C0,"VOL2 ",DEC VOL2
        lcdout $FE,$D0," U.S.A." 
        PAUSE 250
        RETURN
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    May 2010
    Posts
    9


    Did you find this post helpful? Yes | No

    Default

    Dave thanks for continuing to look into this, I set it aside right now as it was frustrating me too much, but I will give you code a shot in the next few days and see what happens. I will re-breadboard it later this week and give your code a try.

    The only settings that differ on my setup is that I wasn't using CTS/RTS flow detection, but just the same I'm getting responses from the Vmusic (like the "Stopped" to signify end of song) so i know that communication both ways is working.

    Again thanks for the help, I'll let you know if it works.
    Last edited by Allister; - 24th May 2010 at 14:22.

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