No problems installing on XP SP2. When attempting to launch GCBasic the Dos screen just flashes on then off really quick. Tried different compatibility modes, screen text size etc. and still no luck. On one odd occaison the Dos editor did stand still and said it did not recoginise .pif file? Any suggestions here, it seems like the editor is being hijacked or performing an illegal operation.
Thanks
Kent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
O.K. thanks. I am probably looking for an IDE type of environment.
A couple of other questions before going to far with this:
1) Is this compiler meant just for the eracer robot? (i.e. does it use an interpreter on the chip?)
2) If no, then how do you find out what chips are supported, speeds, etc.
3) Does the lanquage have a very close relative that will also compile?
4) Is there an example for a bare Pic?
Thanks again,
Kent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you want an IDE, try Crimson Editor or Notepad ++. I'll gladly add some step-by-step instructions on how to set these up if you'd like.
GCBASIC will work fine with robots other than the eracer - use the #chip directive to select the model and speed. Most 10/12/16 chips are supported. To use say a 20 MHz 16F877A, add this at the start of the program:
#chip 16F877A, 20
Similarly, for a 4 MHz PIC16F628A:
#chip 16F628A, 4
There are a few examples for a bare PIC chip - see the code on the Examples page of the website (http://gcbasic.sourceforge.net/examples.html). There's also some examples for a bare chip in the Demos folder.
There is no real close relative to GCBASIC for PIC chips, unfortunately.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Lots to learn here. Be forewarned I am a Newbie at programming. Have a fair amount of hardware to work with tho, so maybe I can get something simple off the ground.
Have the Notepad 2, and MPASM installed if that helps any. Got a PicKit1, and was hoping to use that as a programmer if possible. Could use a 12f675 or a 16f684 with this programmer.
So if someone could help me get a blinky led or demo program going with above it would be much arppreciated.
Any suggestions for a good Basic language book or online source? Have Googled a lot on this, but looking for an informed opinion.
Regards,
Kent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Having Notepad 2 is a good thing - use File > Launch > Open With, and select compile.bat as the destination. You might need to create a shortcut on your desktop for this to work.
To use PicKit1 with GCBASIC:
-Find the file "PICKit1 Classic.exe" and copy it to the GCBASIC directory
-Rename it to "download.exe"
-Add "download" to the bottom of "makeasm.bat"
Then whenever you compile a program, PicKit will be opened. All you'll need to do is open and download "compiled.hex".
I'd recommend you use the 16F684, as it has more I/O ports and RAM than the 12F629.
Here's an LED winking program which I will include in the demos for the next version (0.9.0.4). You'll need to change the #chip line to suit whatever chip you decide to use:
'A program to flash two LEDs on PORTB, bits 0 and 1
'Chip model
#chip 16F819, 20
'Main routine
Start:
'Turn one LED on, the other off
SET PORTB.0 ON
SET PORTB.1 OFF
wait 1 sec
'Now toggle the LEDs
SET PORTB.0 OFF
SET PORTB.1 ON
wait 1 sec
'Jump back to the start of the program
goto Start
When I started programming, I found "Programming for Dummies" to be very helpful. It has a good QBASIC tutorial, much of which can be applied to GCBASIC. I'll be working on the GCBASIC tutorial a little more myself over the next few weeks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Had a whirl this morning and making small progress. Decided to use the Crimson editor, because could not follow the Programmers Notepad2 instructions.
The problem now is setting up the tool or shortcut to compile the file. My settings are:
Menu Text: Compile GCBasic Source
Command: C:\Program Files\GCBasic\Compile.bat
Argument: $(FileName)
Initial Dir:$(FileDir)
Hot Key: None
Guess I don't know where the compiled file is even going or how to direct to the PicKit. The PicKit was added to the makeasm.bat file in the GCBasic directory. The PicKit does show up after the dos editor complains that it:
"cannot find the compiled.txt!"
"Could not find C:\Progra~1\GCBASIC\compiled.txt"
The PicKit uses the internal oscillator of the programmed chips so set:
#chip 16F684, 8
#config _INTRC_OSC_NOCLKOUT
Also setup PORTA.1, and PORTA.2 to take advantage of the onboard leds.
Any more suggestins?
Regards,
Kent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The compiler nows says it is successfully compiled. But, now getting a syntax error. The code is not sticking or being downloaded to the chip. The chip seems to exhibit proper behavior for a flash when trying to verify code.
Here is the code:
'A program to flash two LEDs on PORTB, bits 0 and 1
'Chip model
#chip 16F684,8
#config _CP_OFF, _CPD_OFF,_MCLRE_OFF,_WDT_OFF,_PWRTE_ON, _INTRC_OSC_NOCLKOUT
'Main routine
Start:
'Turn one LED on, the other off
SET PORTA.2 ON
SET PORTA.3 OFF
wait 1 sec
'Now toggle the LEDs
SET PORTA.2 OFF
SET PORTA.3 ON
wait 1 sec
Loop
'Jump back to the start of the program
goto Start
I have a feeling that the internal osc still not configured right, or some other config issue?
Regards,
Kent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found a similar problem, GCBasic adds in __CONFIG line _LVP_OFF, if the micro doesn't have the possibility ol low voltage programming, in the \gputils\header\*.inc (Configuration Bits section) there isn't the definition of _LVP_OFF. In this case the creation of *.hex is stopped.
Regards
stefano
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Latest go round is no compile errors and GCBasic says:
---------- Capture Output ----------
> "C:\Program Files\GCBasic\Compile.bat" C:\PROGRA~1\CRIMSO~1\PICKIT~1
Great Cow BASIC (0.9 21/8/2006)
Compiling COMPILED.TXT ...
Program compiled successfully!
Assembling and downloading program ...
> Terminated with exit code 0.
Basically the txt is not imported into the PicKit1 scratchpad. Data is all 3FFF, as is the configuration word. Quitting the PicKit1 gives the terminated code.
Tried with a 16f688 and same results.
Kent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The 3FFF is because the code I posted above doesn't tell the PicKit1 what file to open. If you go to File > Open, and choose "compiled.hex", it should come up.
I've dealt with the LVP bug, so everything should be okay now. I've only ever used PICs that have LVP, so I didn't even consider that bug when I was initially writing the part of GCBASIC responsible for the config!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The PicKit1 experiences some odd behavior in not wanting to alternate flashing the leds. Having one port pin set seems to disable the other port pin altogether. But this is now a hardware and programming excersise for me to experiment with.
Thanks a bunch!
Kent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When I try to compile my program, I get the following error:
Compiling COMPILED.TXT ...
Bad file name in module GCBASIC at address 0DD6:ABF6
I have been a programmer for 35 years so I am not a newbie at programming. In fact, GCBasic if very intuitive. Good job! I installed to the default directories. I wanted to see how GCBasic compares memory wise to the Assembly version of the same program that I wrote.
Thanks for any help you can give
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have fixed up some bugs in #include, and improved its ability to check for errors. There is a new update at http://gcbasic.sourceforge.net/newfiles/update.zip - please download it, extract it to C:\Program Files\GCBASIC, and let me know if it fixes the problem or not.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No problems installing on XP SP2. When attempting to launch GCBasic the Dos screen just flashes on then off really quick. Tried different compatibility modes, screen text size etc. and still no luck. On one odd occaison the Dos editor did stand still and said it did not recoginise .pif file? Any suggestions here, it seems like the editor is being hijacked or performing an illegal operation.
Thanks
Kent
This is actually quite normal - GCBASIC is a command line program, and has no editor.
To use it, drag and drop the file that you want compiled onto "compile.bat".
O.K. thanks. I am probably looking for an IDE type of environment.
A couple of other questions before going to far with this:
1) Is this compiler meant just for the eracer robot? (i.e. does it use an interpreter on the chip?)
2) If no, then how do you find out what chips are supported, speeds, etc.
3) Does the lanquage have a very close relative that will also compile?
4) Is there an example for a bare Pic?
Thanks again,
Kent
If you want an IDE, try Crimson Editor or Notepad ++. I'll gladly add some step-by-step instructions on how to set these up if you'd like.
GCBASIC will work fine with robots other than the eracer - use the #chip directive to select the model and speed. Most 10/12/16 chips are supported. To use say a 20 MHz 16F877A, add this at the start of the program:
#chip 16F877A, 20
Similarly, for a 4 MHz PIC16F628A:
#chip 16F628A, 4
There are a few examples for a bare PIC chip - see the code on the Examples page of the website (http://gcbasic.sourceforge.net/examples.html). There's also some examples for a bare chip in the Demos folder.
There is no real close relative to GCBASIC for PIC chips, unfortunately.
Lots to learn here. Be forewarned I am a Newbie at programming. Have a fair amount of hardware to work with tho, so maybe I can get something simple off the ground.
Have the Notepad 2, and MPASM installed if that helps any. Got a PicKit1, and was hoping to use that as a programmer if possible. Could use a 12f675 or a 16f684 with this programmer.
So if someone could help me get a blinky led or demo program going with above it would be much arppreciated.
Any suggestions for a good Basic language book or online source? Have Googled a lot on this, but looking for an informed opinion.
Regards,
Kent
Having Notepad 2 is a good thing - use File > Launch > Open With, and select compile.bat as the destination. You might need to create a shortcut on your desktop for this to work.
To use PicKit1 with GCBASIC:
-Find the file "PICKit1 Classic.exe" and copy it to the GCBASIC directory
-Rename it to "download.exe"
-Add "download" to the bottom of "makeasm.bat"
Then whenever you compile a program, PicKit will be opened. All you'll need to do is open and download "compiled.hex".
I'd recommend you use the 16F684, as it has more I/O ports and RAM than the 12F629.
Here's an LED winking program which I will include in the demos for the next version (0.9.0.4). You'll need to change the #chip line to suit whatever chip you decide to use:
'A program to flash two LEDs on PORTB, bits 0 and 1
'Chip model
#chip 16F819, 20
'Main routine
Start:
'Turn one LED on, the other off
SET PORTB.0 ON
SET PORTB.1 OFF
wait 1 sec
'Now toggle the LEDs
SET PORTB.0 OFF
SET PORTB.1 ON
wait 1 sec
'Jump back to the start of the program
goto Start
When I started programming, I found "Programming for Dummies" to be very helpful. It has a good QBASIC tutorial, much of which can be applied to GCBASIC. I'll be working on the GCBASIC tutorial a little more myself over the next few weeks.
Had a whirl this morning and making small progress. Decided to use the Crimson editor, because could not follow the Programmers Notepad2 instructions.
The problem now is setting up the tool or shortcut to compile the file. My settings are:
Menu Text: Compile GCBasic Source
Command: C:\Program Files\GCBasic\Compile.bat
Argument: $(FileName)
Initial Dir:$(FileDir)
Hot Key: None
Guess I don't know where the compiled file is even going or how to direct to the PicKit. The PicKit was added to the makeasm.bat file in the GCBasic directory. The PicKit does show up after the dos editor complains that it:
"cannot find the compiled.txt!"
"Could not find C:\Progra~1\GCBASIC\compiled.txt"
The PicKit uses the internal oscillator of the programmed chips so set:
#chip 16F684, 8
#config _INTRC_OSC_NOCLKOUT
Also setup PORTA.1, and PORTA.2 to take advantage of the onboard leds.
Any more suggestins?
Regards,
Kent
These are my Crimson Editor settings:
Menu Text: Compile with GCBASIC
Command: C:\Program Files\GCBASIC\compile.bat
Argument: $(FileDir)\$(FileName)
Initial Dir: C:\Program Files\GCBASIC
I've also ticked "Use short filename (8.3)"
Those messages are appearing because there is no directory specified as part of the filename, and hence GCBASIC cannot find and compile the file.
The compiled file should go to C:\Program Files\GCBASIC\compiled.hex.
Getting closer yet, I feel thick as a brick.
The compiler nows says it is successfully compiled. But, now getting a syntax error. The code is not sticking or being downloaded to the chip. The chip seems to exhibit proper behavior for a flash when trying to verify code.
Here is the code:
'A program to flash two LEDs on PORTB, bits 0 and 1
'Chip model
#chip 16F684,8
#config _CP_OFF, _CPD_OFF,_MCLRE_OFF,_WDT_OFF,_PWRTE_ON, _INTRC_OSC_NOCLKOUT
'Main routine
Start:
'Turn one LED on, the other off
SET PORTA.2 ON
SET PORTA.3 OFF
wait 1 sec
'Now toggle the LEDs
SET PORTA.2 OFF
SET PORTA.3 ON
wait 1 sec
Loop
'Jump back to the start of the program
goto Start
I have a feeling that the internal osc still not configured right, or some other config issue?
Regards,
Kent
I've had a look at the assembly code that is produced by GCBASIC, and there is a bug. GCBASIC isn't setting the config correctly for the 16F684 chip.
I'll deal with this within the next couple of days, but until then you'll need to add this line to the start of your program:
_LVP_OFF equ 0x3FFF
Also, you'll need to add these lines before the main routine:
dir PORTA.2 out
dir PORTA.3 out
These set the ports used to outputs, so that they can be controlled by the PIC. I should have put these in the demo file.
Don't worry about asking questions - I'm sure there's other people who need to know this too!
I found a similar problem, GCBasic adds in __CONFIG line _LVP_OFF, if the micro doesn't have the possibility ol low voltage programming, in the \gputils\header\*.inc (Configuration Bits section) there isn't the definition of _LVP_OFF. In this case the creation of *.hex is stopped.
Regards
stefano
Latest go round is no compile errors and GCBasic says:
---------- Capture Output ----------
> "C:\Program Files\GCBasic\Compile.bat" C:\PROGRA~1\CRIMSO~1\PICKIT~1
Great Cow BASIC (0.9 21/8/2006)
Compiling COMPILED.TXT ...
Program compiled successfully!
Assembling and downloading program ...
> Terminated with exit code 0.
Basically the txt is not imported into the PicKit1 scratchpad. Data is all 3FFF, as is the configuration word. Quitting the PicKit1 gives the terminated code.
Tried with a 16f688 and same results.
Kent
The 3FFF is because the code I posted above doesn't tell the PicKit1 what file to open. If you go to File > Open, and choose "compiled.hex", it should come up.
I've dealt with the LVP bug, so everything should be okay now. I've only ever used PICs that have LVP, so I didn't even consider that bug when I was initially writing the part of GCBASIC responsible for the config!
Doh! Downloaded file and got one LED flahing.
The PicKit1 experiences some odd behavior in not wanting to alternate flashing the leds. Having one port pin set seems to disable the other port pin altogether. But this is now a hardware and programming excersise for me to experiment with.
Thanks a bunch!
Kent
OK found out the problem, needed to initialize the ANSEL and CMCON0 registers per data sheet to ensure digital I/O.
When I try to compile my program, I get the following error:
Compiling COMPILED.TXT ...
Bad file name in module GCBASIC at address 0DD6:ABF6
I have been a programmer for 35 years so I am not a newbie at programming. In fact, GCBasic if very intuitive. Good job! I installed to the default directories. I wanted to see how GCBasic compares memory wise to the Assembly version of the same program that I wrote.
Thanks for any help you can give
Have you used #include at all?
I have fixed up some bugs in #include, and improved its ability to check for errors. There is a new update at http://gcbasic.sourceforge.net/newfiles/update.zip - please download it, extract it to C:\Program Files\GCBASIC, and let me know if it fixes the problem or not.
Yes installing the updates worked. Thank you very much.