-
        

Ergebnis 1 bis 4 von 4

Thema: Bascom Problem

  1. #1
    Erfahrener Benutzer Fleißiges Mitglied
    Registriert seit
    02.03.2004
    Beiträge
    121

    Bascom Problem

    Anzeige

    Hallo, ich habe ein Problem mit Bascom. Ich habe einen Code der einwandfrei läuft, der auch übersrtzt wird, aber einen Fehler anzeigt. Wenn ich diesen Fehler doppelt anklicke, ist er im Listing garnicht vorhanden ???? In der angezeigten Zeile steht nur ein END SUB und der Fehler lautet:
    Illegal character[expected(,got "="]. Kann sich das einer erklären ?

  2. #2
    Erfahrener Benutzer Roboter Genie
    Registriert seit
    18.12.2006
    Ort
    Oderberg
    Alter
    25
    Beiträge
    870
    Naja irgendwo muss ja auch Fehler sein, auch wenn er ein fehlerfreies Ablaufen den Programms nicht verhindert.
    Poste mal den Code.
    MfG Christopher \/


  3. #3
    Erfahrener Benutzer Fleißiges Mitglied
    Registriert seit
    02.03.2004
    Beiträge
    121
    Code:
    $regfile = "M128def.dat"                                    'IT'S POSSIBLE USE DIFFERENT AVR-CHIPS
    $crystal = 14318000                                         'BUT this NOT TESTED
    $baud = 115200
    $hwstack = 128
    $framesize = 128
    $swstack = 128
    
    
    '-------------------------------------------------------------------------------
    Config Timer2 = Pwm , Prescale = 1 , Compare Pwm = Clear Up
    Ocr2 = 128
    'Config Clock = Soft
    'Enable Interrupts
    'Enable Timer1
    'Enable Urxc 'abilita RS232
    'On Timer1 Timer_1
    'On Urxc Rs_232 'salto per RS232
    'Config Date = Dmy , Separator = .
    '-------------------------------------------------------------------------------
     Avanti Alias Pina.0
     Led Alias Portg.1
     Vs_miso Alias Pinc.0
     Vs_mosi Alias Portc.1
     Vs_clock Alias Portc.2
     Xcs Alias Portc.3
     Xreset Alias Portc.4
     Dreq Alias Pinc.5
     Bsync Alias Portc.6
    '-------------------------------------------------------------------------------
    Config Avanti = Input                                       'pulsante avanti
    Config Led = Output                                         'led
    Config Vs_miso = Input                                      'serial input vs-1001
    Config Vs_mosi = Output                                     'serial out vs-1001
    Config Vs_clock = Output                                    'serial clock vs-1001
    Config Xcs = Output                                         'VS Chip Select
    Config Xreset = Output                                      'VS Reset
    Config Dreq = Input                                         'VS Data Request
    Config Bsync = Output                                       'VS Stream Request
    Config Portb.7 = Output
    Set Portb.7
    '-------------------------------------------------------------------------------
    Declare Sub Vs_init()
    Declare Sub Soft_reset()
    Declare Sub Vs_write(byval Vs_address As Byte , Byval Data1 As Byte , Byval Data2 As Byte)
    Declare Function Vs_read(byval Vs_address As Byte) As Word
    Declare Sub Send_mp3(byval Filename As String)
    Declare Sub Vs_info()
    '-------------------------------------------------------------------------------
    Const Timervorgabe = 11965
    Const Vs_rd = &B0000_0011                                   'Write command vs1001
    Const Vs_wr = &B0000_0010                                   'Read command vs1001
    Const Vs_mode = 0
    Const Vs_status = 1
    Const Vs_clockf = 3
    Const Vs_decode_time = 4
    Const Vs_audata = 5
    Const Vs_volume = 11
    '-------------------------------------------------------------------------------
    Dim B As Byte
    Dim I As Integer
    Dim J As Long
    Dim Curbyte As Long
    Dim S As String * 20
    Dim Sample_rate As Word
    Dim Bit_rate As Word
    Dim Is_stereo As Word
    Dim Audata As Word
    Dim Filename As String * 11
    Dim Mmc_data(512) As Byte                                   '512 byte
    Dim Tempo_new As Word
    Dim Tempo_old As Word
    Dim Flag_read As Bit
    Dim Flag_play As Bit
    Dim Comando As String * 10
    Dim Mode_low As Byte
    Dim Mode_hig As Byte
    Dim Volume As Word
    Dim Volume_low As Byte
    Dim Volume_hig As Byte
    Dim Tagpos As Long
    Dim Tagcheck As String * 3
    Dim Tagstring As String * 30
    '-------------------------------------------------------------------------------
    $include "Config_MMC.bas"                                   'include mmc
    
    If Gbdriveerror <> 0 Then End
    $include "Config_AVR-DOS.BAS"                               'include avr-dos
    
    B = Initfilesystem(1)                                       'init file system
    If B <> 0 Then Print "Errore MMC"                           'se errore
    '-------------------------------------------------------------------------------
    Bsync = 0
    Xreset = 0
    Xcs = 1
    Portg.0 = 1                                                 'res pull up
    Flag_play = 0                                               'sta suonando ?
    Flag_read = 1                                               'gia letto ?
    '-------------------------------------------------------------------------------
    '-------------------------- PROGRAM START -------------------------------------
    '-------------------------------------------------------------------------------
    'Print "Dir *.mp3"                                           'dir mp3
    'Print
    '-------------------------------------------------------------------------------
    '---------------------- crea una lista dei brani mp3 presenti sulla MMC --------
    '-------------------------------------------------------------------------------
    Open "Lista.txt" For Output As #9                           'create file.list in MMC
    S = Dir( "*.mp3")
    While Len(s) > 0
     'Print S ; " " ; Filedate() ; " " ; Filetime() ; " " ; Filelen()
     Print #9 , S                                               'memorizza la lista
     S = Dir()
    Wend
    Close #9
    '-------------------------------------------------------------------------------
    'Print "VS1001 Init"
    Vs_init                                                     'reset hardware e inizializza
    '-------------------------------------------------------------------------------
    '--------------------------- MAIN PROGRAMM -------------------------------------
    '-------------------------------------------------------------------------------
    Do
     Open "Lista.txt" For Input As #9                           'OPEN LA LISTA
     While Eof(#9) = 0
     Line Input #9 , S                                          'READ filename Mp3
     Call Send_mp3(s)                                           'play mp3
     Wend
     Close #9
    
     Loop
    End
    '-------------------------------------------------------------------------------
    '---------------------------- VS_info ------------------------------------------
    '-------------------------------------------------------------------------------
    Sub Vs_info()
      If Bsync = 0 And Flag_play = 1 And Flag_read = 1 Then     'per leggere inforamzioni
     Flag_read = 0
     Audata = Vs_read(vs_audata)
     Sample_rate = Audata And &H1E00
     Rotate Sample_rate , Right , 9
     Bit_rate = Audata And &H1FF
      Is_stereo = Audata And &H8000
     Rotate Is_stereo , Right , 15
     Locate 3 , 1
     Lcd Sample_rate ; "," ; Bit_rate ; " Kbs," ; Is_stereo     'print informations
    
     End If
    
     If Bsync = 0 And Flag_play = 1 And Flag_read = 0 Then
     Tempo_new = Vs_read(vs_decode_time)
    
    
     If Tempo_new <> Tempo_old Then Print Tempo_new ; " Sec"
     Tempo_old = Tempo_new
    
     End If
    
    
    End Sub
    '-------------------------------------------------------------------------------
    '---------------------- RS 232 -------------------------------------------------
    '-------------------------------------------------------------------------------
    Rs_232:
     Comando = Inkey()
     If Comando = "1" Then
     Mode_low.7 = 1
     Bsync = 0
     Vs_write Vs_mode , &H0 , Mode_low                          'no loudness
    
     End If
     If Comando = "2" Then
     Mode_low.7 = 0
     Bsync = 0
     Vs_write Vs_mode , &H0 , Mode_low                          'loudness
    
     End If
     If Comando = "3" Then
     Mode_low.1 = 0
     Bsync = 0
     Vs_write Vs_mode , &H0 , Mode_low                          'play normale
    
     End If
     If Comando = "4" Then
     Mode_low.1 = 1
     Bsync = 0
     Vs_write Vs_mode , &H0 , Mode_low                          'play veloce
    
     End If
     If Comando = "5" And Volume_low < 250 Then
     Volume_hig = Volume_hig + 5
     Volume_low = Volume_low + 5
     Bsync = 0
     Vs_write Vs_volume , Volume_hig , Volume_low               'volume down
    
     End If
     If Comando = "6" And Volume_low > 0 Then
     Volume_hig = Volume_hig - 5
     Volume_low = Volume_low - 5
     Bsync = 0
     Vs_write Vs_volume , Volume_hig , Volume_low               'volume up
    
     End If
     Comando = ""
    Return
    '-------------------------------------------------------------------------------
    '------------------------------ MP3 SUBROUTINES --------------------------------
    '-------------------------------------------------------------------------------
    Function Vs_read(byval Vs_address As Byte) As Word
     Xcs = 0                                                    'Xcs low
     B = Vs_rd
     Shiftout Vs_mosi , Vs_clock , B , 1
     Shiftout Vs_mosi , Vs_clock , Vs_address , 1
     B = 0
     Shiftin Vs_miso , Vs_clock , B , 1
     Vs_read = B
     Shift Vs_read , Left , 8
     B = 0
     Shiftin Vs_miso , Vs_clock , B , 1
     Vs_read = Vs_read + B
     Xcs = 1                                                    'Xcs high
    
     End Function
    '-------------------------------------------------------------------------------
    '-------------------------------- WRITE ROUTINE --------------------------------
    '-------------------------------------------------------------------------------
    Sub Vs_write(byval Vs_address As Byte , Byval Data1 As Byte , Byval Data2 As Byte)
     Xcs = 0
     B = Vs_wr
     Shiftout Vs_mosi , Vs_clock , B , 1
     Shiftout Vs_mosi , Vs_clock , Vs_address , 1
     Shiftout Vs_mosi , Vs_clock , Data1 , 1
     Shiftout Vs_mosi , Vs_clock , Data2 , 1
     Xcs = 1
    
     End Sub
    '-------------------------------------------------------------------------------
    '------------------------------- RESETTA E INIZILIZZA --------------------------
    '-------------------------------------------------------------------------------
    Sub Vs_init()
     Cls
     Cursor Off
     Locate 1 , 1
     Lcd "Init....."
     Wait 2
    
     Xreset = 0
     Waitms 5
     Xreset = 1
     Waitms 10
    
    
     Do : Led = Dreq : Loop Until Dreq = 1
     Vs_write Vs_mode , &H0 , &H4                               'reset
    
     Do : Led = Dreq : Loop Until Dreq = 1
     Mode_low.7 = 1
     Vs_write Vs_mode , &H0 , Mode_low                          'bass
    
     Do : Led = Dreq : Loop Until Dreq = 1
     Vs_write Vs_clockf , &H98 , &H0                            'clockf 24,xx MHz
    
     Do : Led = Dreq : Loop Until Dreq = 1
     Vs_write Vs_volume , &H0 , &H0                             'volume =0 massimo
    
    
    End Sub
    '-------------------------------------------------------------------------------
    '--------------------------- SOFT RESET VS1001 ---------------------------------
    '-------------------------------------------------------------------------------
    Sub Soft_reset
     Do : Led = Dreq : Loop Until Dreq = 1                      'wait Dreq
     Vs_write Vs_mode , &H0 , &H4                               'reset
    
     End Sub
    '-------------------------------------------------------------------------------
    '---------------------------- SEND FILE MP3 ------------------------------------
    '-------------------------------------------------------------------------------
    Sub Send_mp3(byval Filename As String)
     Locate 1 , 1
     Lcd "Play : " ; Filename
     Soft_reset                                                 'resetta vs1001
     Flag_read = 1                                              'per leggere una volta sample rate etc
     Flag_play = 0
    
     Tagpos = Filelen(filename) - 127                           'inizia a leggere dopo che c( stato letto il primo pacchetto
    
     Open Filename For Binary As #10
     Get #10 , Tagcheck , Tagpos
     If Ucase(tagcheck) = "TAG" Then
       Get #10 , Tagstring
       Locate 2 , 1
       Lcd "Title: " ; Left(tagstring , 13)
       Get #10 , Tagstring
       Locate 3 , 1
       Lcd "Artst: " ; Left(tagstring , 13)
       Get #10 , Tagstring
       Locate 4 , 1
       Lcd "Album: " ; Left(tagstring , 13)
     End If
     Close #10
    
     Open Filename For Binary As #10                            'apri il file mp3 e play song
    
     Do : Led = Dreq : Loop Until Dreq = 1                      'wait Dreq
    
     While Eof(#10) = 0
     Get #10 , Mmc_data(1) , , 512                              'preleva 512 byte
     Do : Led = Dreq : Loop Until Dreq = 1                      'wait Dreq
    
     For I = 1 To 16
     For J = 1 To 32
    
     Bsync = 1
     Shiftout Vs_mosi , Vs_clock , Mmc_data(curbyte) , 1
     Bsync = 0
     Incr Curbyte
     Next J
     Do : Led = Dreq : Loop Until Dreq = 1                      'wait Dreq
     Next I                                                     'first 32
     Curbyte = 1                                                'after 16 16x32=512 byte
     If Avanti = 0 Then Goto Esci                               'pulsante up
     Flag_play = 1                                              'playing primo pacchetto
     Wend
    
    Esci:
     Flag_play = 0                                              'stop play
     Close #10
     For I = 1 To 2048                                          'send 2048 zeros to clear buffer
     B = 0
     Shiftout Vs_mosi , Vs_clock , B , 1                        'send 2048 byte
    
     Next I
     Print "MP3 End"                                            'end song
    
     Waitms 100                                                 'aspetta 100
    End Sub

  4. #4
    Erfahrener Benutzer Roboter Genie
    Registriert seit
    19.07.2007
    Alter
    53
    Beiträge
    1.080
    In der Sub Vs_info() scheint ein "end if" zu fehlen, nach mahr hab ich nicht geschaut, aber das wäre ein Grund für die Fehlermeldung

    Gruß MeckPommER
    Mein Hexapod im Detail auf www.vreal.de

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •