Dim Frequ As Word : Frequ = 961 'Programm-Default-Werte
Dim Stereo As Byte : Stereo = 1 'alles Ein
Dim Driver As Byte : Driver = 1
Dim Licht As Byte : Licht = 1
Dim Dummy_ee As Eram Long 'Werte fürs EEPROM
Dim Frequ_ee As Eram Word
Dim Stereo_ee As Eram Byte
Dim Driver_ee As Eram Byte
Dim Licht_ee As Eram Byte
Declare Function Menu(menuitems() As String , Byval Maxentry As Byte , Byval Default As Byte ) As Byte
Declare Function Frequenz(byval Default As Word) As Word
Declare Sub To Ic -pll
Declare Sub Showadc(byval Anz_mod As Byte)
If Frequ_ee <> &HFFFF Then 'abgespeicherte Default-Werte
Frequ = Frequ_ee
Stereo = Stereo_ee
Driver = Driver_ee
Licht = Licht_ee
End If
Portd.4 = Not Licht.0 'Display-Licht; LOW-Aktiv
To Ic -pll ' schiebt frequ, stereo u. driver i.d. Chip
Call To Ic -pll
Loopend:
Locate 1 , 10 : Lcd "ok" ; Spc(3)
Wait 1
Loopend2:
Loop
End
Function Menu(menuitems() As String , Byval Maxentry As Byte , Byval Default As Byte ) As Byte
Local Curent As Byte
Local Mlen As Byte
Local Drehgeber_alt As Word
Local Lauf As Byte
Do
If Setbutton = 0 Then
Menu = Curent
Waitms 500
Exit Function
End If
If Drehgeber <> Drehgeber_alt Then
If Drehgeber > Drehgeber_alt Then
Incr Curent
If Curent > Maxentry Then
Curent = 1
End If
End If
If Drehgeber < Drehgeber_alt Then
Decr Curent
If Curent = 0 Then
Curent = Maxentry
End If
End If
For Lauf = 1 To Mlen
Shiftcursor Left
Next Lauf
Lcd Menuitems(curent);
Drehgeber_alt = Drehgeber
End If
Loop
End Function
Function Frequenz(byval Default As Word) As Word
Local S As String * 5
Local Drehgeber_alt As Word
Local Lauf As Byte
Drehgeber = Default
Drehgeber_alt = Drehgeber
S = Str(drehgeber)
S = Format(s , " 00.0" )
Lcd S
Do
If Drehgeber <> Drehgeber_alt Then
If Drehgeber > 1080 Then
Drehgeber = 875
End If
If Drehgeber < 875 Then
Drehgeber = 1080
End If
Drehgeber_alt = Drehgeber
For Lauf = 1 To 5
Shiftcursor Left
Next Lauf
S = Str(drehgeber_alt)
S = Format(s , " 00.0" )
Lcd S
End If
If Setbutton = 0 Then
Frequenz = Drehgeber_alt
Waitms 500
Exit Function
End If
Loop
End Function
Sub To Ic -pll
Local Seriellword As Word
Local Lauf As Byte
Seriellword = Frequ
Seriellword.11 = Stereo.0
Seriellword.14 = Driver.0
'locate 2 , 1
'lcd bin(seriellword )
Chipena = 1 'Chip selektieren
For Lauf = 1 To 16
Datas = Seriellword.0 'Datenbit 0 anlegen
Clock = 1 'und übergeben
Waitus 250
Clock = 0
Shift Seriellword , Right 'n?chstes Bit in Position 0 schieben
Next Lauf 'Chip deselektieren
Chipena = 0
End Sub
Sub Showadc(byval Anz_mod As Byte)
Local Adc_h As Word
Local Adc_val As Word '10 bit
Adcsr.adfr = 1 'free running
Adcsr.adsc = 1 'starten
Cursor Noblink
Cursor Off
Do
Adc_val = Adcl
Adc_h = Adch
Shift Adc_h , Left , 8
Adc_val = Adc_val Or Adc_h
Waitms 100
Loop Until Setbutton = 0
Adcsr.adsc = 0
Adcsr.adfr = 0 'free running aus
Locate 1 , 10
Waitms 500
End Sub
Drehimpuls1 Alias Pind.2
Drehimpuls2 Alias Pinb.0
Onint0:
If Drehimpuls1 = 1 Then 'steigende Flanke
If Drehimpuls2 = 1 Then
Decr Drehgeber
Else
Incr Drehgeber
End If
Else 'fallende Flanke
If Drehimpuls2 = 0 Then
Decr Drehgeber
Else
Incr Drehgeber
End If
End If
Return
Onint1: 'nur zum Aufwachen!
Return作者: 箫天 时间: 2013-7-3 19:13
'在网上看到有一个关于M8控制BH1415的BASCOM程序,编译不能通过,哪位高人能帮忙看看嘛?
Dim Frequ As Word : Frequ = 961 'Programm-Default-Werte
Dim Stereo As Byte : Stereo = 1 'alles Ein
Dim Driver As Byte : Driver = 1
Dim Licht As Byte : Licht = 1
Dim Dummy_ee As Eram Long 'Werte fürs EEPROM
Dim Frequ_ee As Eram Word
Dim Stereo_ee As Eram Byte
Dim Driver_ee As Eram Byte
Dim Licht_ee As Eram Byte
Declare Function Menu(menuitems() As String , Byval Maxentry As Byte , Byval Default As Byte ) As Byte
Declare Function Frequenz(byval Default As Word) As Word
Declare Sub Toic_pll
Declare Sub Showadc(byval Anz_mod As Byte)
If Frequ_ee <> &HFFFF Then 'abgespeicherte Default-Werte
Frequ = Frequ_ee
Stereo = Stereo_ee
Driver = Driver_ee
Licht = Licht_ee
End If
Portd.4 = Not Licht.0 'Display-Licht; LOW-Aktiv
Toic_pll ' schiebt frequ, stereo u. driver i.d. Chip
Function Menu(menuitems() As String , Byval Maxentry As Byte , Byval Default As Byte ) As Byte
Local Curent As Byte
Local Mlen As Byte
Local Drehgeber_alt As Word
Local Lauf As Byte
Do
If Setbutton = 0 Then
Menu = Curent
Waitms 500
Exit Function
End If
If Drehgeber <> Drehgeber_alt Then
If Drehgeber > Drehgeber_alt Then
Incr Curent
If Curent > Maxentry Then
Curent = 1
End If
End If
If Drehgeber < Drehgeber_alt Then
Decr Curent
If Curent = 0 Then
Curent = Maxentry
End If
End If
For Lauf = 1 To Mlen
Shiftcursor Left
Next Lauf
Lcd Menuitems(curent);
Drehgeber_alt = Drehgeber
End If
Loop
End Function
Function Frequenz(byval Default As Word) As Word
Local S As String * 5
Local Drehgeber_alt As Word
Local Lauf As Byte
Drehgeber = Default
Drehgeber_alt = Drehgeber
S = Str(drehgeber)
S = Format(s , " 00.0" )
Lcd S
Do
If Drehgeber <> Drehgeber_alt Then
If Drehgeber > 1080 Then
Drehgeber = 875
End If
If Drehgeber < 875 Then
Drehgeber = 1080
End If
Drehgeber_alt = Drehgeber
For Lauf = 1 To 5
Shiftcursor Left
Next Lauf
S = Str(drehgeber_alt)
S = Format(s , " 00.0" )
Lcd S
End If
If Setbutton = 0 Then
Frequenz = Drehgeber_alt
Waitms 500
Exit Function
End If
Loop
End Function
Sub Toic_pll
Local Seriellword As Word
Local Lauf As Byte
Seriellword = Frequ
Seriellword.11 = Stereo.0
Seriellword.14 = Driver.0
'locate 2 , 1
'lcd bin(seriellword )
Chipena = 1 'Chip selektieren
For Lauf = 1 To 16
Datas = Seriellword.0 'Datenbit 0 anlegen
Clock = 1 'und übergeben
Waitus 250
Clock = 0
Shift Seriellword , Right 'n?chstes Bit in Position 0 schieben
Next Lauf 'Chip deselektieren
Chipena = 0
End Sub
Sub Showadc(byval Anz_mod As Byte)
Local Adc_h As Word
Local Adc_val As Word '10 bit
Adcsr.adfr = 1 'free running
Adcsr.adsc = 1 'starten
Cursor Noblink
Cursor Off
Do
Adc_val = Adcl
Adc_h = Adch
Shift Adc_h , Left , 8
Adc_val = Adc_val Or Adc_h
Waitms 100
Loop Until Setbutton = 0
Adcsr.adsc = 0
Adcsr.adfr = 0 'free running aus
Locate 1 , 10
Waitms 500
End Sub
Drehimpuls1 Alias Pind.2
Drehimpuls2 Alias Pinb.0
Onint0:
If Drehimpuls1 = 1 Then 'steigende Flanke
If Drehimpuls2 = 1 Then
Decr Drehgeber
Else
Incr Drehgeber
End If
Else 'fallende Flanke
If Drehimpuls2 = 0 Then
Decr Drehgeber
Else
Incr Drehgeber
End If
End If
Return
Onint1: 'nur zum Aufwachen!
Return 作者: zzzd 时间: 2013-7-4 15:10
To Ic -pll
这个函数起名有问题,TO是专用字不能用- 号也有问题,应该是小划线,将函数名改为改名成ICPLL程序就可以通过了。作者: 箫天 时间: 2013-7-4 16:47
zzzd 发表于 2013-7-4 15:10
To Ic -pll
这个函数起名有问题,TO是专用字不能用- 号也有问题,应该是小划线,将函数名改为改名成ICPLL程 ...