LineR = ReadAD(AN5)
LineC = ReadAD(AN6)
LineL = ReadAD(AN7)
If LineR > 175 Then Set FollowerR Off
If LineR < 100 Then Set FollowerR On
If LineC > 175 Then Set FollowerC Off
If LineC < 100 Then Set FollowerC On
If LineL > 175 Then Set FollowerL Off
If LineL < 100 Then Set FollowerL On
;If (EyeR AND EyeL) > 80 Then FullFwd
If EyeR > (EyeL + 50) Then SoftRightFwd
If (EyeR AND EyeL) > 100 Then FullReverse
Sub FullFwd ;Charge!
PulseOut RServo,1 ms
Nop ;Need some delay here for PulseOut to work
PulseOut LServo,2 ms
wait ServoPeriod ms
end sub
Sub SoftRightFwd
PulseOut RServo,142 10us ;Need to re-zero pot
Nop ;Need some delay here for PulseOut to work
PulseOut LServo,2 ms
wait ServoPeriod ms
end sub
Sub FullReverse ;Avoid
PulseOut RServo,2 ms
Nop ;Need some delay here for PulseOut to work
PulseOut LServo,1 ms
wait ServoPeriod ms
end sub
goto Main
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Very strange, it seems that GCBASIC isn't liking the macro ... end macro block in a-d.h. The confusing part is that I've tried your code, and had no trouble with it myself.
I accidentally didn't include the absolute latest version of GCBASIC in update.zip yesterday - I put in one from earlier in the day, after I'd altered it for the bootloader but before I fixed the bug with the multiple or added support for large arrays. However, even this version should have been able to handle the macro! (I also neglected to change the date on GCBASIC, it still says 16/9/2007)
All I can recommend is that you check that you've got the correct version of gcbasic.exe - if it has yesterday's date on the .exe and "16/9/2007" in the assembly generated, it should be fine.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My apologies, another knucklehead move. Remember now when downloading the zipudate I had to leave the update process. This was because several instances of GCBASIC.exe were hung up in Windows Task Manager (from past failed compile attempts at my code). Then forgot to retry on the GCBASIC.exe update, Doh! Re-Installed again and now no compiler complaints.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just updated to latest zip to try the bootloader. A previously good program now complains about the a-d syntax. Thanks in advance.
---------- Capture Output ----------
> "C:\Program Files\GCBasic\Compile.bat" C:\PROGRA~1\CRIMSO~1\MarkIII\169F3D~1
Great Cow BASIC (0.9 10/2/2007)
Compiling C:\PROGRA~1\CRIMSO~1\MarkIII\169F3D~1 ...
Errors have been found:
a-d.h (74): Syntax Error
a-d.h (212): Syntax Error
a-d.h (217): Syntax Error
The message has been logged to the file C:\PROGRA~1\GCBASIC\ERRORS.TXT.
Press any key to continue
The program:
'Chip model
#chip 16f877A,20
'Setup 4 bit LCD
#define LCD_IO 4
#define LCD_DB4 PORTD.4
#define LCD_DB5 PORTD.5
#define LCD_DB6 PORTD.6
#define LCD_DB7 PORTD.7
#define LCD_RS PORTD.1
#define LCD_RW PORTD.2
#define LCD_Enable PORTD.3
Dir PortD out
'Setup Servo's
#define RServo PortB.1
#define LServo PortB.2
#define ServoPeriod 18 ;60hz refresh
Dir PortB.1 out
Dir PortB.2 out
#define FollowerR PortC.0
#define FollowerC PortC.1
#define FollowerL PortC.2
Dir PortC.0 out
Dir PortC.1 out
Dir PortC.2 out
Main:
cls
EyeR = ReadAD(AN2)
LCDInt(EyeR) ;EyeR
Print " "
EyeL = ReadAD(AN3)
LCDInt(EyeL) ;EyeL
Wait 3 10ms
LineR = ReadAD(AN5)
LineC = ReadAD(AN6)
LineL = ReadAD(AN7)
If LineR > 175 Then Set FollowerR Off
If LineR < 100 Then Set FollowerR On
If LineC > 175 Then Set FollowerC Off
If LineC < 100 Then Set FollowerC On
If LineL > 175 Then Set FollowerL Off
If LineL < 100 Then Set FollowerL On
;If (EyeR AND EyeL) > 80 Then FullFwd
If EyeR > (EyeL + 50) Then SoftRightFwd
If (EyeR AND EyeL) > 100 Then FullReverse
Sub FullFwd ;Charge!
PulseOut RServo,1 ms
Nop ;Need some delay here for PulseOut to work
PulseOut LServo,2 ms
wait ServoPeriod ms
end sub
Sub SoftRightFwd
PulseOut RServo,142 10us ;Need to re-zero pot
Nop ;Need some delay here for PulseOut to work
PulseOut LServo,2 ms
wait ServoPeriod ms
end sub
Sub FullReverse ;Avoid
PulseOut RServo,2 ms
Nop ;Need some delay here for PulseOut to work
PulseOut LServo,1 ms
wait ServoPeriod ms
end sub
goto Main
OOOPS, same compiler complaint even on simple LED on off program, no A-D involved.
Very strange, it seems that GCBASIC isn't liking the macro ... end macro block in a-d.h. The confusing part is that I've tried your code, and had no trouble with it myself.
I accidentally didn't include the absolute latest version of GCBASIC in update.zip yesterday - I put in one from earlier in the day, after I'd altered it for the bootloader but before I fixed the bug with the multiple or added support for large arrays. However, even this version should have been able to handle the macro! (I also neglected to change the date on GCBASIC, it still says 16/9/2007)
All I can recommend is that you check that you've got the correct version of gcbasic.exe - if it has yesterday's date on the .exe and "16/9/2007" in the assembly generated, it should be fine.
My apologies, another knucklehead move. Remember now when downloading the zipudate I had to leave the update process. This was because several instances of GCBASIC.exe were hung up in Windows Task Manager (from past failed compile attempts at my code). Then forgot to retry on the GCBASIC.exe update, Doh! Re-Installed again and now no compiler complaints.