Proton acemisine yardım

ahmet433

Üye
Katılım
11 Ara 2012
Mesajlar
4
Puanları
1
Yaş
60
ben çok acemiyim elimdeki c ile yazılmış dosyayı bas dosyaına çevirip protonda hex çıkışı almak istediğimde şöyle bir hata veriyor:
error:[line 28] item threshold not found!(untitled.bas)
error:[line 29] item sensitivity not found!(untitled.bas)
.....
....
....
error:[line 49] item target not found!(untitled.bas)


kod şu şekilde: lütfen koddaki yalnış yeri gösterebilirmisiniz

'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2020 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 12.04.2020 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
Device = 16F876A
Xtal = 4
Config XT_OSC,WDT_OFF,PWRTE_ON,BODEN_OFF,CP_OFF,CPD_OFF,LVP_OFF

Define LCD_Type = 0
Define LCD_DTPin PORTC.4
Define LCD_RSPin PORTC.0
Define LCD_ENPin PORTC.3
Define LCD_Lines 2
Define LCD_Interface 4

Define Adin_Res 10 ' 10-bit result required
Define Adin_Tad 32_FOSC ' AD conversion clock
Define Adin_Stime 20 ' 20us AD sample time

CCP1_Pin = PORTC.2

threshold As Byte
sensitivity As Byte
duty As Byte

sample1 As Word
sample2 As Word
sample3 As Word
sample4 As Word
gb1 As Word
gb2 As Word
gb3 As Word
gb4 As Word
s1 As Word
s2 As Word
s3 As Word
s4 As Word

temp1 As Float
temp2 As Float
temp3 As Float
battery_voltage As Float
target As Word
size As Word

i As Byte

PORTB_Pullups = On
ADCON1 = $84
TRISA = $0B
TRISB = $FF
TRISC = $00
DelayUS 500
Clear 'Clear variables
Print $FE, 1 'Clear display
duty = 10
threshold = 2
DelayUS 500
Print $FE, 1, "** BRN Pi-1 **"
Print $FE, $C0, "Digital Detector"
DelayMS 2000

Print $FE, 1, "Made in TURKEY"
Print $FE, $C0, " ** Baron66 ** "
DelayMS 2000

Print $FE, 1

While 1 = 1
TRISA.5 = 0
PORTA.5 = 1
DelayUS 200
TRISA.5 = 0
PORTA.5 = 0
DelayUS 10

sample1 = ADIn 0
DelayUS 790

TRISA.5 = 0
PORTA.5 = 1
DelayUS 200
TRISA.5 = 0
PORTA.5 = 0
DelayUS 50

sample2 = ADIn 0
DelayUS 750

TRISA.5 = 0
PORTA.5 = 1
DelayUS 200
TRISA.5 = 0
PORTA.5 = 0
DelayUS 90

sample3 = ADIn 0
DelayUS 710

TRISA.5 = 0
PORTA.5 = 1
DelayUS 200
TRISA.5 = 0
PORTA.5 = 0
DelayUS 150

sample4 = ADIn 0
DelayUS 650

temp1 = ADIn 1
temp2 = temp1 * 0.0048
temp3 = temp2 * 110
battery_voltage = temp3 / 10 + 0.3

'Ground
If PORTB.0 = 0 Then GoSub GroundBalance

'Sound+
If PORTB.2 = 0 Then
duty = duty + 10
If duty > 100 Then duty = 100
GoSub Beep
End If

'Sound-
If PORTB.1 = 0 Then
duty = duty - 10
If duty < 0 Then duty = 0
GoSub Beep
End If

'Sens-
If PORTB.3 = 0 Then
GoSub Beep
threshold = threshold + 10
If threshold > 100 Then threshold = 100
End If

'Sens+
If PORTB.4 = 0 Then
GoSub Beep
threshold = threshold - 10
If threshold < 0 Then threshold = 0
End If

sensitivity = (100 - threshold) / 10

GoSub Calculate

Print $FE, $80, "V:", Dec duty / 10, " "
Print $FE, $84, "S:", Dec sensitivity, " "
If 10.3 < battery_voltage Then
Print $FE, $88, "B:", Dec2 battery_voltage, "V "
Else
Print $FE, $88, "B:LOW "
End If

If target > threshold Then
HPWM 1,duty,1260 'Sound On
size = target / 10
If size > 15 Then size = 15
For i = 0 To size
Print $FE, $C0 + i, ".>---------------"
Next
Else
Print $FE, $C0, "--------------"
HPWM 1,0,0 'Sound Off
End If
Wend

GroundBalance:
gb1 = sample1 + 2
gb2 = sample2 + 2
gb3 = sample3 + 2
gb4 = sample4 + 2
DelayMS 150
Return

Calculate:
s1 = sample1 - gb1
s2 = sample2 - gb2
s3 = sample3 - gb3
s4 = sample4 - gb4
If s1 < 0 Then s1 = 0
If s2 < 0 Then s2 = 0
If s3 < 0 Then s3 = 0
If s4 < 0 Then s4 = 0
target = s4 + s1 + s2 + s3
Return

Beep:
HPWM 1,duty,1260
DelayMS 150
HPWM 1,0,0
Return
 
Derleyici değişkenlerin başta tanımlanmasını istiyor olabilir.
 
Bunlar derleyici için özel isim
olabilir. Değişken isimlerini değiştirip
yeniden deneyiniz.
 
hocam daha yeni başladım bir şeyler oğrenmek istiyorum biraz daha açıklama yapabilirmisiniz değişkenleri nasıl belirtisem kabul eder acaba kodu biraz incelerseniz mümkünse
 
threshold As Byte
sensitivity As Byte
duty As Byte

sample1 As Word
sample2 As Word
sample3 As Word
sample4 As Word
gb1 As Word
gb2 As Word
gb3 As Word
gb4 As Word
s1 As Word
s2 As Word
s3 As Word
s4 As Word

temp1 As Float
temp2 As Float
temp3 As Float
battery_voltage As Float
target As Word
size As Word


bunların başına tek tek dim gelecek.

mesela:
dim treshold as byte
dim ..... as byte
dim .... as float
gibi

birde define yerine declare olacak
 
çok teşekkürler işime yaradı ama hala başka hata veriyor geldiğim noktada şöyle bir hata veriyor:
ERROR [line 141]:item threshold not found (untitled.bas)
ERROR [line 142]:item threshold not found (untitled.bas)
ERROR [line 142]:item threshold not found (untitled.bas)
ERROR [line 148]:item threshold not found (untitled.bas)
....
..
ERROR [line 164]:item threshold not found (untitled.bas)


biraz düzeldikten sonra durum bu:

'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2020 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 12.04.2020 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
Device = 16F876A
Xtal = 4
Config XT_OSC,WDT_OFF,PWRTE_ON,BODEN_OFF,CP_OFF,CPD_OFF,LVP_OFF

Define LCD_Type = 0
Define LCD_DTPin PORTC.4
Define LCD_RSPin PORTC.0
Define LCD_ENPin PORTC.3
Define LCD_Lines 2
Define LCD_Interface 4

Define Adin_Res 10 ' 10-bit result required
Define Adin_Tad 32_FOSC ' AD conversion clock
Define Adin_Stime 20 ' 20us AD sample time

Declare CCP1_Pin = PORTC.2

Dim treshold As Byte
Dim sensitivity As Byte
Dim duty As Byte

Dim sample1 As Word
Dim sample2 As Word
Dim sample3 As Word
Dim sample4 As Word
Dim gb1 As Word
Dim gb2 As Word
Dim gb3 As Word
Dim gb4 As Word
Dim s1 As Word
Dim s2 As Word
Dim s3 As Word
Dim s4 As Word

Dim temp1 As Float
Dim temp2 As Float
Dim temp3 As Float
Dim battery_voltage As Float
Dim target As Word
Dim size As Word

Dim i As Byte

Declare PORTB_Pullups = On
ADCON1 = $84
TRISA = $0B
TRISB = $FF
TRISC = $00
DelayUS 500
Clear 'Clear variables
Print $FE, 1 'Clear display
duty = 10
threshold = 2
DelayUS 500
Print $FE, 1, "** BRN Pi-1 **"
Print $FE, $C0, "Digital Detector"
DelayMS 2000

Print $FE, 1, "Made in TURKEY"
Print $FE, $C0, " ** Baron66 ** "
DelayMS 2000

Print $FE, 1

While 1 = 1
TRISA.5 = 0
PORTA.5 = 1
DelayUS 200
TRISA.5 = 0
PORTA.5 = 0
DelayUS 10

sample1 = ADIn 0
DelayUS 790

TRISA.5 = 0
PORTA.5 = 1
DelayUS 200
TRISA.5 = 0
PORTA.5 = 0
DelayUS 50

sample2 = ADIn 0
DelayUS 750

TRISA.5 = 0
PORTA.5 = 1
DelayUS 200
TRISA.5 = 0
PORTA.5 = 0
DelayUS 90

sample3 = ADIn 0
DelayUS 710

TRISA.5 = 0
PORTA.5 = 1
DelayUS 200
TRISA.5 = 0
PORTA.5 = 0
DelayUS 150

sample4 = ADIn 0
DelayUS 650

temp1 = ADIn 1
temp2 = temp1 * 0.0048
temp3 = temp2 * 110
battery_voltage = temp3 / 10 + 0.3

'Ground
If PORTB.0 = 0 Then GoSub GroundBalance

'Sound+
If PORTB.2 = 0 Then
duty = duty + 10
If duty > 100 Then duty = 100
GoSub Beep
End If

'Sound-
If PORTB.1 = 0 Then
duty = duty - 10
If duty < 0 Then duty = 0
GoSub Beep
End If

'Sens-
If PORTB.3 = 0 Then
GoSub Beep
threshold = threshold + 10
If threshold > 100 Then threshold = 100
End If

'Sens+
If PORTB.4 = 0 Then
GoSub Beep
threshold = threshold - 10
If threshold < 0 Then threshold = 0
End If

sensitivity = (100 - threshold) / 10

GoSub Calculate

Print $FE, $80, "V:", Dec duty / 10, " "
Print $FE, $84, "S:", Dec sensitivity, " "
If 10.3 < battery_voltage Then
Print $FE, $88, "B:", Dec2 battery_voltage, "V "
Else
Print $FE, $88, "B:LOW "
End If

If target > threshold Then
HPWM 1,duty,1260 'Sound On
size = target / 10
If size > 15 Then size = 15
For i = 0 To size
Print $FE, $C0 + i, ".>---------------"
Next
Else
Print $FE, $C0, "--------------"
HPWM 1,0,0 'Sound Off
End If
Wend

GroundBalance:
gb1 = sample1 + 2
gb2 = sample2 + 2
gb3 = sample3 + 2
gb4 = sample4 + 2
DelayMS 150
Return

Calculate:
s1 = sample1 - gb1
s2 = sample2 - gb2
s3 = sample3 - gb3
s4 = sample4 - gb4
If s1 < 0 Then s1 = 0
If s2 < 0 Then s2 = 0
If s3 < 0 Then s3 = 0
If s4 < 0 Then s4 = 0
target = s4 + s1 + s2 + s3
Return

Beep:
HPWM 1,duty,1260
DelayMS 150
HPWM 1,0,0
Return
 
Declare CCP1_Pin = PORTC.2

Dim treshold As Byte
Dim sensitivity As Byte
Dim duty As Byte
treshold değil, threshold olacak.

Birde code tag kullanın, aşağıdaki gibi gözüksün paylaştıklarınız:
Kod:
Declare CCP1_Pin = PORTC.2

Dim threshold As Byte
Dim sensitivity As Byte
Dim duty As Byte
 

Forum istatistikleri

Konular
127,956
Mesajlar
913,902
Kullanıcılar
449,606
Son üye
rasit.

Yeni konular

Çevrimiçi üyeler

Geri
Üst