I am familiar with BS2's and propellers but i am lost with this. When i try and compile this code, i get a series of errors... redefinition of VAR and redefinition of Label. What am i missing. Can anybody help? am i missing some more defines or includes?
Code:
Define OSC 4
include "bs2defs.bas"
Progress Var Byte
Relay1 var PORTC.2
Relay2 var PORTC.1
Relay3 var PORTC.0
StatLED var PORTA.0
OptoPin var PORTB.0
ADres var byte ' A-to-D result: one byte.
CS var PORTB.2 ' Chip select is pin 0.
AData VAR PORTB.7 ' ADC data output is pin 1.
CLK VAR PORTB.6 ' Clock is pin 2.
baud con 16468 ' N9600
i var byte
Start:
high CS ' Deselect ADC to start.
progress = 0
gosub One
Gosub Two
Gosub Three
If Progress = 3 then
completegood
Else
high Statled
endif
One: 'This will test the output of relay 1 and check its value through the ADC
High Relay1
Pause 10
'Run ADC code
Low Relay1
'Test ADC value to be within range 80-100
If (ADRes>80) and (ADres<100) then
i = 0
REPEAT
High StatLED
Pause 500
Low StatLED
Pause 500
i = i + 1
UNTIL i > 7
else
i = 0
REPEAT
High Relay1
Pause 500
Low Relay1
Pause 200
i = i + 1
UNTIL i > 7
ENDIF
return
Two:'This will test the output of relay 2 and check its value through the ADC
High Relay2
Pause 10
'Run ADC code
Low Relay2
'Test ADC value to be within range 105-140
If (ADRes>105) and (ADres<140) then
goto BLEDG
else
i = 0
REPEAT
High Relay1
Pause 500
Low Relay1
Pause 200
i = i + 1
UNTIL i > 7
ENDIF
return
Three:'This will test the output of relay 3 and check its value through the ADC
High Relay3
Pause 10
'Run ADC code
If Optopin = 1 then
Optogood
endif
Low Relay3
'Test ADC value to be within range 200-260
If (ADRes>200) and (ADres<260) then
goto BLEDG
else
i = 0
REPEAT
High Relay3
Pause 500
Low Relay3
Pause 200
i = i + 1
UNTIL i > 7
Progress = progress + 1
ENDIF
return
BLEDG: 'Tested out good so we will let everyone know.
i = 0
REPEAT
High StatLED
Pause 500
Low StatLED
Pause 500
i = i + 1
UNTIL i > 7
return
OptoGood: 'Tested out good so we will let everyone know.
i = 0
REPEAT
High StatLED
Pause 100
Low StatLED
Pause 100
i = i + 1
UNTIL i > 4
return
CompleteGood: 'Tested out good so we will let everyone know.
REPEAT
High StatLED
Pause 100
Low StatLED
Pause 300
end
ADC:
low CS ' Activate the ADC0831.
shiftin AData,CLK,msbpost,[ADres\9] ' Shift in the data.
high CS ' Deactivate '0831.
pause 500
serout 3,baud,[ADres]
pause 1000
Bookmarks