VINCULUM - Vmusic2 - Vdrive2 - Help


Results 1 to 11 of 11

Threaded View

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

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