Hi I am fairly new to programming PICs and the BASIC language. I am trying to build a remote control tank style vehicle (two tracks and two servos to drive them). I have some code but its written in PICBASIC so I was wondering if someone could help me translate it into the right syntax for GCBASIC. I am using two PIC16F84A-20/P chips with an external 4MHz crystal oscillator. One for the receiver and one on the transmitter. When I define the chip at the top of the program would this setup be:
#chip 16F84A, 20 or
#chip 16F84A, 4
'Transmitter code for an Remote Controlled Robot Tank Vehicle
'Using a 16F84A-20/P and a 4MHz external crystal as a clock
symbol trisb = 134 'Port A TRIS register has the address 134 decimal
symbol trisa = 133 'Port A TRIS register has the address 133 decimal
symbol portb = 6 'Port B data register is set at address 6
symbol porta = 5 'Port A data register is set at address 5
low 1
input 0 'input 1 from joystick goes to port B pin0
input 2 'input 2 from joystick goes to port B pin2
start:
pot 0,50,B0 'reads potentiometer value from joystick on pin 0 of port B, with a scale of 50, and stores the result in B0
pot 2,50,B1 'reads potentiometer value from joystick on pin 2 of port B, with a scale of 50, and stores the result in B1
B0 = B0 * 5
B1 = B1 * 5
y:
if B0 <100 then yf 'B0 stores reading of Y axis pot ' less than 100 = forward
if B0 > 150 then yb 'greater than 150 = reverse
x:
if B1 <100 then xr 'B1 stores reading of X axis pot 'less than 100 = right
if B1 > 150 then xl ' greater than 150 = left
serout 1,n9600,(5) ' sends serial data of 5(nomove) to pin 1 of port B 'n9600 means its in TTL inverted mode
goto start
yf:
serout 1,n9600,(2) 'sends serial data of the number 2(reverse), at 9600 baud from pin 1 of port B
goto start
yb:
serout 1,n9600,(1) 'sends serial data of 1(forwared) to pin 1 out of port B
goto start
xl:
serout 1,n9600,(3) 'sends serial data of 3(left) to pin 1 out of port B
goto start
xr:
serout 1,n9600,(4) 'sends serial data of 4(right) to pin 1 of port B
goto start
end
'Receiver code for an Remote Controled Robot Tank Vehical
'Using a 16F84A-20/P and a 4MHz external crystal as a clock
symbol trisb = 134 'Port A TRIS register has the address 134 decimal
symbol trisa = 133 'Port A TRIS register has the address 133 decimal
symbol portb = 6 'Port B data register is set at address 6
symbol porta = 5 'Port A data register is set at address 5
poke trisa, 0 'configures all bits of PORT A as outputs
poke porta, 0 'sends data 0 (binary 0000 0000) to PORT A, keeps all port A outputs set to 0 when not receiving data from pots
low 0 'sets pin 0 of port B to logic low
input 1 'input from the receiver goes to port B pin1
prestart:
pause 400
poke porta, 10 'sends data 10 (binary 0000 1010) to PORT A(A1 & A3 are high) turns left and right servos to forward polarity
pause 200
poke porta, 5 'sends data 5 (binary 0000 0101) to PORT A(A0 & A2) turns left and right servos to reverse polarity
pause 200
poke porta, 6 'sends data 6 (binary 0000 0110) to PORT A(A1 & A2) turns left servo to reverse polarity and right servo to forward polarity
pause 200
poke porta, 9 'sends data 9 (binary 0000 1001) to PORT A(A0 & A3) turns left servo to reverse polarity and right servo to forward polarity
pause 200
poke porta, 0 'sends data 0 (binary 0000 0000) to PORT A(all bits low) joystick centered, both servos off, no movement
pause 200
start:
serin 1,n9600,B0 'receives serial data at 9600 baud from pin 1 of PORT B into variable B0
if B0 = 1 then forward
if B0 = 2 then backward
if B0 = 3 then left
if B0 = 4 then right
if B0 = 5 then nomove
goto start
The correct #chip line is
#chip 16F84A, 4
GCBASIC uses the clock speed specified here to calculate delays and a few other clock speed specific things. In #config, you'll need to specify the oscillator, and any other config settings. This #config line should work:
#config XT_OSC
By default GCBASIC will turn off the watchdog timer.
"symbol" is not required - PORTA, PORTB, and all other on-chip registers are automatically declared in GCBASIC. Poke is also unnecessary - for example, replace "poke porta, 0" with "porta = 0".
The if ... then in GCBASIC works differently to that in PICBASIC. In PICBASIC, a label follows the "then", whereas in GCBASIC a command follows the "then". Writing "if B0 <100 then goto yf" in GCBASIC is the same as writing "if B0 <100 then yf" in PICBASIC.
"delay" is implemented in GCBASIC for compatibility with several other languages. However, it can only handle delays of 255 ms or less. "delay 500" in PICBASIC = "Wait 50 10ms" in GCBASIC. This quirk is due to the fact that when the delay routines were written, GCBASIC could not deal with any variables larger than a byte. This has since been fixed, and the pause routine will be improved in the near future.
set PORTB.1 off
dir PORTB.0 in 'input 1 from joystick goes to port B pin0
dir PORTB.2 in 'input 2 from joystick goes to port B pin2
start:
pot PORTB.0, B0 'reads potentiometer value from joystick on pin 0 of port B, with a scale of 255, and stores the result in B0
pot PORTB.2, B1 'reads potentiometer value from joystick on pin 2 of port B, with a scale of 255, and stores the result in B1
y:
if B0 <100 then goto yf 'B0 stores reading of Y axis pot ' less than 100 = forward
if B0 > 150 then goto yb 'greater than 150 = reverse
x:
if B1 <100 then goto xr 'B1 stores reading of X axis pot 'less than 100 = right
if B1 > 150 then goto xl ' greater than 150 = left
SerSend 1, 5 ' sends serial data of 5(nomove)
goto start
yf:
SerSend 1, 2 'sends serial data of the number 2(reverse)
goto start
yb:
SerSend 1, 1 'sends serial data of 1(forward)
goto start
xl:
SerSend 1, 3 'sends serial data of 3(left)
goto start
xr:
SerSend 1, 4 'sends serial data of 4(right)
goto start
It might be easier to take advantage of the flexibility of the if command in GCBASIC, by combining some of those things on the one line as follows:
if B0 < 100 then SerSend 1, 2: goto start 'was yf
I think that I've got everything. If you need any more help, feel free to ask.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
set PORTB.1 off
dir PORTB.0 in 'input 1 from joystick goes to port B pin0
dir PORTB.2 in 'input 2 from joystick goes to port B pin2
start:
pot PORTB.0, B0 'reads potentiometer value from joystick on pin 0 of port B, with a scale of 255, and stores the result in B0
pot PORTB.2, B1 'reads potentiometer value from joystick on pin 2 of port B, with a scale of 255, and stores the result in B1
y:
if B0 <100 then SerSend 1, 2: goto start 'B0 stores reading of Y axis pot ' less than 100 = forward
if B0 > 150 then SerSend 1, 1: goto start 'greater than 150 = reverse
x:
if B1 <100 then SerSend 1, 4: goto start 'B1 stores reading of X axis pot 'less than 100 = right
if B1 > 150 then SerSend 1, 3: goto start ' greater than 150 = left
SerSend 1, 5 ' sends serial data of 5(nomove)
goto start
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've just compiled the above source without any problem.....
no errors!
would suggest you to reinstall the latest version from complete package, GPUTILS included.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Have you installed gputils to somewhere other than C:\Program Files? If so, then that is the cause of the problem. All versions of GCBASIC so far have had an address for gputils hard-coded into them.
The next version of GCBASIC will detect the gputils install directory based on information set by the gputils installer. The newest version of the compiler is at http://gcbasic.sourceforge.net/newfiles/update.zip - replace gcbasic.exe with the one from this file, and the problem should be solved.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You need to find the existing gcbasic.exe file and replace it with the one from the zip.
The problem is that GCBASIC was originally only programmed to look in C:\Program Files\gputils. I've fixed that by altering the gcbasic.exe file so that it can now find gputils wherever it is installed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, that seemed to work I dropped the code into the COMPILE.bat file and got an ASM and HEX file.
Hopefully the one last thing that I need a little help on is the configuration. Do I actually have to have a #config at the top of my code, because in the programmer there is an area where it will let me set the Configuration Word bits?
And I'm not sure what exactly to turn on and off for my particular application(Remote control tank robot). For the 16F84A that I'm using, the data sheet says that
bits 13-4 are Code Protection bits (CP)
bit 3 is /PWRTE
bit 2 is WDTE
bit 1-0 are FOSC1:FOSC0
I guess GCBASIC automatically turns the watchdog timer (WDTE) off
And according to the data sheet the oscillator should be set to 01 to turn on XT
So how should I set up these bits and where should I do it, in the code on in the programmer?
Thanks for all your help so far, it is very much appreciated, I can’t wait to get wired together and working!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using your notes from above I also reworked the receiver code, but when I tryed to compile it I got an error. Here is the error message and the receiver code:
GCBASIC error log for F:\Program Files\GCBASIC\RCode GCBASIC.txt and included files.
GCBASIC version: 0.9 9/11/2006
if B0 =1 then porta, 10: goto start 'Forward
if B0 =2 then porta, 5: goto start 'Backward
if B0 =3 then porta, 9: goto start 'Left
if B0 =4 then porta, 6: goto start 'Right
if B0 =5 then porta, 0: goto start 'Stop
end
Hopefully all these stupid questions arent holding back the release of the next version of gcbasic?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
There are two minor problems with your code. RecAHigh and RecALow are conditions that are true when a high and a low are being received respectively. For your program, you'll need:
#define RecAHigh PORTB.1 on
#define RecALow PORTB.1 off
The other problem (which GCBASIC isn't showing an error for) is in the setting of variables - you've used a comma where GCBASIC needs an equals sign. For example, if you replace "trisa, 0" with "trisa = 0" the program will work fine.
The hex file should work fine with all PIC programmers.
Don't worry about delaying the next version of GCBASIC - you're helping me to find and fix problems in GCBASIC or in the documentation that I wouldn't know about otherwise!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The problem is the "_PWRT_OFF". Change it to "_PWRTE_OFF", and the program should work.
Any errors with the #config line are caught by gputils, not by GCBASIC. Since gputils runs so quickly, it is difficult to see the messages it gives. A work around for this is to open makeasm.bat and add "pause" after gputils is called. This will pause the batch file until a key is pressed, giving time to look at any errors.
I'll make the next version of GCBASIC check that the .hex has been generated, and show any gputils warnings if it has not.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi I am fairly new to programming PICs and the BASIC language. I am trying to build a remote control tank style vehicle (two tracks and two servos to drive them). I have some code but its written in PICBASIC so I was wondering if someone could help me translate it into the right syntax for GCBASIC. I am using two PIC16F84A-20/P chips with an external 4MHz crystal oscillator. One for the receiver and one on the transmitter. When I define the chip at the top of the program would this setup be:
#chip 16F84A, 20 or
#chip 16F84A, 4
'Transmitter code for an Remote Controlled Robot Tank Vehicle
'Using a 16F84A-20/P and a 4MHz external crystal as a clock
'Hardware settings
#chip 16F84A, 20
#mem 68
#config
symbol trisb = 134 'Port A TRIS register has the address 134 decimal
symbol trisa = 133 'Port A TRIS register has the address 133 decimal
symbol portb = 6 'Port B data register is set at address 6
symbol porta = 5 'Port A data register is set at address 5
low 1
input 0 'input 1 from joystick goes to port B pin0
input 2 'input 2 from joystick goes to port B pin2
start:
pot 0,50,B0 'reads potentiometer value from joystick on pin 0 of port B, with a scale of 50, and stores the result in B0
pot 2,50,B1 'reads potentiometer value from joystick on pin 2 of port B, with a scale of 50, and stores the result in B1
B0 = B0 * 5
B1 = B1 * 5
y:
if B0 <100 then yf 'B0 stores reading of Y axis pot ' less than 100 = forward
if B0 > 150 then yb 'greater than 150 = reverse
x:
if B1 <100 then xr 'B1 stores reading of X axis pot 'less than 100 = right
if B1 > 150 then xl ' greater than 150 = left
serout 1,n9600,(5) ' sends serial data of 5(nomove) to pin 1 of port B 'n9600 means its in TTL inverted mode
goto start
yf:
serout 1,n9600,(2) 'sends serial data of the number 2(reverse), at 9600 baud from pin 1 of port B
goto start
yb:
serout 1,n9600,(1) 'sends serial data of 1(forwared) to pin 1 out of port B
goto start
xl:
serout 1,n9600,(3) 'sends serial data of 3(left) to pin 1 out of port B
goto start
xr:
serout 1,n9600,(4) 'sends serial data of 4(right) to pin 1 of port B
goto start
end
'Receiver code for an Remote Controled Robot Tank Vehical
'Using a 16F84A-20/P and a 4MHz external crystal as a clock
'Hardware settings
#chip 16F84A, 20
#mem 68
#config
symbol trisb = 134 'Port A TRIS register has the address 134 decimal
symbol trisa = 133 'Port A TRIS register has the address 133 decimal
symbol portb = 6 'Port B data register is set at address 6
symbol porta = 5 'Port A data register is set at address 5
poke trisa, 0 'configures all bits of PORT A as outputs
poke porta, 0 'sends data 0 (binary 0000 0000) to PORT A, keeps all port A outputs set to 0 when not receiving data from pots
low 0 'sets pin 0 of port B to logic low
input 1 'input from the receiver goes to port B pin1
prestart:
pause 400
poke porta, 10 'sends data 10 (binary 0000 1010) to PORT A(A1 & A3 are high) turns left and right servos to forward polarity
pause 200
poke porta, 5 'sends data 5 (binary 0000 0101) to PORT A(A0 & A2) turns left and right servos to reverse polarity
pause 200
poke porta, 6 'sends data 6 (binary 0000 0110) to PORT A(A1 & A2) turns left servo to reverse polarity and right servo to forward polarity
pause 200
poke porta, 9 'sends data 9 (binary 0000 1001) to PORT A(A0 & A3) turns left servo to reverse polarity and right servo to forward polarity
pause 200
poke porta, 0 'sends data 0 (binary 0000 0000) to PORT A(all bits low) joystick centered, both servos off, no movement
pause 200
start:
serin 1,n9600,B0 'receives serial data at 9600 baud from pin 1 of PORT B into variable B0
if B0 = 1 then forward
if B0 = 2 then backward
if B0 = 3 then left
if B0 = 4 then right
if B0 = 5 then nomove
goto start
forward:
poke porta, 10 'executes prestarts command
goto start
backward:
poke porta, 5
goto start
right:
poke porta, 6
goto start
left:
poke porta, 9
goto start
nomove:
poke porta, 0
goto start
end
The correct #chip line is
#chip 16F84A, 4
GCBASIC uses the clock speed specified here to calculate delays and a few other clock speed specific things. In #config, you'll need to specify the oscillator, and any other config settings. This #config line should work:
#config XT_OSC
By default GCBASIC will turn off the watchdog timer.
"symbol" is not required - PORTA, PORTB, and all other on-chip registers are automatically declared in GCBASIC. Poke is also unnecessary - for example, replace "poke porta, 0" with "porta = 0".
The if ... then in GCBASIC works differently to that in PICBASIC. In PICBASIC, a label follows the "then", whereas in GCBASIC a command follows the "then". Writing "if B0 <100 then goto yf" in GCBASIC is the same as writing "if B0 <100 then yf" in PICBASIC.
"delay" is implemented in GCBASIC for compatibility with several other languages. However, it can only handle delays of 255 ms or less. "delay 500" in PICBASIC = "Wait 50 10ms" in GCBASIC. This quirk is due to the fact that when the delay routines were written, GCBASIC could not deal with any variables larger than a byte. This has since been fixed, and the pause routine will be improved in the near future.
The "pot" command in GCBASIC is less flexible than that of PICBASIC - see http://gcbasic.sourceforge.net/help/pot.htm for more.
RS232 is also quite different. See http://gcbasic.sourceforge.net/help/ and look for the RS232 section.
Other equivalents are:
set PORTB.0 off = low 0
dir PORTB.2 in = in 2
Labels, GOTOs and comments are the same for GCBASIC and PICBASIC.
All that said, here is the translated send program:
'Transmitter code for an Remote Controlled Robot Tank Vehicle
'Using a 16F84A-20/P and a 4MHz external crystal as a clock
'Hardware settings
#chip 16F84A, 4
#mem 68
#config XT_OSC
'RS232 settings
'Define the first channel
#define SendAHigh SET PORTB.1 on
#define SendALow SET PORTB.1 off
'Initialize
InitSer 1, r9600, 1, 8, 1, none, invert '9600 bps, 1 start, 8 data, 1 stop, no parity, inverted
set PORTB.1 off
dir PORTB.0 in 'input 1 from joystick goes to port B pin0
dir PORTB.2 in 'input 2 from joystick goes to port B pin2
start:
pot PORTB.0, B0 'reads potentiometer value from joystick on pin 0 of port B, with a scale of 255, and stores the result in B0
pot PORTB.2, B1 'reads potentiometer value from joystick on pin 2 of port B, with a scale of 255, and stores the result in B1
y:
if B0 <100 then goto yf 'B0 stores reading of Y axis pot ' less than 100 = forward
if B0 > 150 then goto yb 'greater than 150 = reverse
x:
if B1 <100 then goto xr 'B1 stores reading of X axis pot 'less than 100 = right
if B1 > 150 then goto xl ' greater than 150 = left
SerSend 1, 5 ' sends serial data of 5(nomove)
goto start
yf:
SerSend 1, 2 'sends serial data of the number 2(reverse)
goto start
yb:
SerSend 1, 1 'sends serial data of 1(forward)
goto start
xl:
SerSend 1, 3 'sends serial data of 3(left)
goto start
xr:
SerSend 1, 4 'sends serial data of 4(right)
goto start
It might be easier to take advantage of the flexibility of the if command in GCBASIC, by combining some of those things on the one line as follows:
if B0 < 100 then SerSend 1, 2: goto start 'was yf
I think that I've got everything. If you need any more help, feel free to ask.
I tryed to compile your edited code and got this message:
GCBASIC error log for F:\Documents and Settings\Jason\Desktop\TCode GCBASIC.txt and included files.
GCBASIC version: 0.9 29/10/2006
Chip definition files could not be found!
This is what I compiled:
'Transmitter code for an Remote Controlled Robot Tank Vehicle
'Using a 16F84A-20/P and a 4MHz external crystal as a clock
'Hardware settings
#chip 16F84A, 4
#mem 68
#config XT_OSC
'RS232 settings
'Define the first channel
#define SendAHigh SET PORTB.1 on
#define SendALow SET PORTB.1 off
'Initialize
InitSer 1, r9600, 1, 8, 1, none, invert '9600 bps, 1 start, 8 data, 1 stop, no parity, inverted
set PORTB.1 off
dir PORTB.0 in 'input 1 from joystick goes to port B pin0
dir PORTB.2 in 'input 2 from joystick goes to port B pin2
start:
pot PORTB.0, B0 'reads potentiometer value from joystick on pin 0 of port B, with a scale of 255, and stores the result in B0
pot PORTB.2, B1 'reads potentiometer value from joystick on pin 2 of port B, with a scale of 255, and stores the result in B1
y:
if B0 <100 then SerSend 1, 2: goto start 'B0 stores reading of Y axis pot ' less than 100 = forward
if B0 > 150 then SerSend 1, 1: goto start 'greater than 150 = reverse
x:
if B1 <100 then SerSend 1, 4: goto start 'B1 stores reading of X axis pot 'less than 100 = right
if B1 > 150 then SerSend 1, 3: goto start ' greater than 150 = left
SerSend 1, 5 ' sends serial data of 5(nomove)
goto start
Together with GCBasic did you install the latest version of GPUTILS as well?
Yes
This is what is in my MAKEASM batch file, if thats any help?
@ECHO OFF
F:\progra~1\gputils\bin\gpasm -i -w2 compiled.asm
del compiled.cod>nul
REM Add the command to call your programmer application here
And this is whats in my COMPILE batch file
@ECHO OFF
F:
cd \PROGRA~1\GCBASIC
GCBASIC /NC %1 /O:compiled.asm /A:makeasm.bat
I've just compiled the above source without any problem.....
no errors!
would suggest you to reinstall the latest version from complete package, GPUTILS included.
Have you installed gputils to somewhere other than C:\Program Files? If so, then that is the cause of the problem. All versions of GCBASIC so far have had an address for gputils hard-coded into them.
The next version of GCBASIC will detect the gputils install directory based on information set by the gputils installer. The newest version of the compiler is at http://gcbasic.sourceforge.net/newfiles/update.zip - replace gcbasic.exe with the one from this file, and the problem should be solved.
Yeah I installed the gputils in F:\Program Files, my harddisk letter is F; is this the problem?
And when I tryed to install gcbasic from your link there I got this message:
Cannot find F:\Documents and Settings\Jason\Desktop\Messages.bat! Great Cow BASIC cannot operate without this file.
You need to find the existing gcbasic.exe file and replace it with the one from the zip.
The problem is that GCBASIC was originally only programmed to look in C:\Program Files\gputils. I've fixed that by altering the gcbasic.exe file so that it can now find gputils wherever it is installed.
Ok, that seemed to work I dropped the code into the COMPILE.bat file and got an ASM and HEX file.
Hopefully the one last thing that I need a little help on is the configuration. Do I actually have to have a #config at the top of my code, because in the programmer there is an area where it will let me set the Configuration Word bits?
And I'm not sure what exactly to turn on and off for my particular application(Remote control tank robot). For the 16F84A that I'm using, the data sheet says that
bits 13-4 are Code Protection bits (CP)
bit 3 is /PWRTE
bit 2 is WDTE
bit 1-0 are FOSC1:FOSC0
I guess GCBASIC automatically turns the watchdog timer (WDTE) off
And according to the data sheet the oscillator should be set to 01 to turn on XT
So how should I set up these bits and where should I do it, in the code on in the programmer?
Thanks for all your help so far, it is very much appreciated, I can’t wait to get wired together and working!
Oh yeah, also do you know if that hex file will work with any programmer, I have a Velleman PIC Programmer and Experimentation Board VM111?
Using your notes from above I also reworked the receiver code, but when I tryed to compile it I got an error. Here is the error message and the receiver code:
GCBASIC error log for F:\Program Files\GCBASIC\RCode GCBASIC.txt and included files.
GCBASIC version: 0.9 9/11/2006
Invalid variable name: SET PORTB
And here is the DOS Screen error message:
Great Cow BASIC (0.9 9/11/2006)
Compiling F:\Program Files\GCBASIC\RCode GCBASIC.txt ...
An error has been found:
-Invalid variable name: SET PORTB
The message has been logged to the file F:\PROGRA~1\GCBASIC\ERRORS.TXT.
Press any key to continue
'Receiver code for an Remote Controlled Robot Tank Vehicle
'Using a 16F84A-20/P and a 4MHz external crystal
'Hardware settings
#chip 16F84A, 4
#mem 68
#config XT_OSC
trisa, 0
porta, 0
'RS232 settings
'Define the first channel
#define RecAHigh SET PORTB.1 on
#define RecALow SET PORTB.1 off
'Initialize
InitSer 1, r9600, 1, 8, 1, none, invert '9600 bps, 1 start, 8 data, 1 stop, no parity, inverted
set PORTB.0 off
dir PORTB.1 in 'input 1 from transmitter goes to port B pin1
prestart:
Wait 40 10ms
porta, 10
Wait 20 10ms
porta, 5
Wait 20 10ms
porta, 6
Wait 20 10ms
porta, 9
Wait 20 10ms
porta, 0
Wait 20 10ms
start:
SerReceive 1, B0
if B0 =1 then porta, 10: goto start 'Forward
if B0 =2 then porta, 5: goto start 'Backward
if B0 =3 then porta, 9: goto start 'Left
if B0 =4 then porta, 6: goto start 'Right
if B0 =5 then porta, 0: goto start 'Stop
end
Hopefully all these stupid questions arent holding back the release of the next version of gcbasic?
There are two minor problems with your code. RecAHigh and RecALow are conditions that are true when a high and a low are being received respectively. For your program, you'll need:
#define RecAHigh PORTB.1 on
#define RecALow PORTB.1 off
The other problem (which GCBASIC isn't showing an error for) is in the setting of variables - you've used a comma where GCBASIC needs an equals sign. For example, if you replace "trisa, 0" with "trisa = 0" the program will work fine.
The hex file should work fine with all PIC programmers.
Don't worry about delaying the next version of GCBASIC - you're helping me to find and fix problems in GCBASIC or in the documentation that I wouldn't know about otherwise!
I used to have just the #config XT_OSC
then I changed it to #config XT_OSC,_WDT_OFF,_PWRT_OFF,_CP_OFF
When I add these parameters to the config line I dont get a hex file when compiled, I still get the asm and list files though.
The problem is the "_PWRT_OFF". Change it to "_PWRTE_OFF", and the program should work.
Any errors with the #config line are caught by gputils, not by GCBASIC. Since gputils runs so quickly, it is difficult to see the messages it gives. A work around for this is to open makeasm.bat and add "pause" after gputils is called. This will pause the batch file until a key is pressed, giving time to look at any errors.
I'll make the next version of GCBASIC check that the .hex has been generated, and show any gputils warnings if it has not.