FAQs - THe common questions and answers 

Want to go directly to Windows specific FAQ, Apple FAQ   or  Linux specific FAQ, select the links.

 

We are always wanting to improve the FAQ.   If you feel you want a question answered and it should be shared.   Please tell us here current FAQ Thread

 

And.... It is always a good idea to consult the Help System first.     Many questions are answered in the Help.

 

 

 


 

1. Installing GCBASIC

crying Can I use GCBASIC on a Mac / Windows / Linux?

enlightenedYes, see the specific FAQ, links at Top of this Page.

2. Configuration

crying What configuration is there?

enlightenedThe software needs very little configuration.   You need to link your programmer to the IDE or to Great Cow Graphical BASIC - this is detailed in the Help and discussed in this page.

3. Compiling, Running

crying Oh dear...Error!    foobar. GCBASIC (nn): Error: Invalid variable name: 0THEN:

enlightenedCarefully search downwards for missing end if, the Error line nn is not  the real Reason!

crying A program compiles and downloads fine, but will not run

enlightenedAre you using external or internal Oscillator? select which suits your situation.    See here : http://GCBASICasic.sourceforge.net/help/_configuration.html

crying I an trying to use "On Interrupt PortBChange Call My_Interrupt_Handler" but, the Interrupt Routine (My_Interrupt_Handler) is not triggered, Why?

enlightenedLook at the datasheet for the specific microcontroller, i. e. a PIC18F25K22, look for the 'Interrupt-On-Change' (IOC) specification.   The PIC18F25K22 shows PortB.4 to PortB.7 are useable for IOC.   Therefore, you must use  PortB.4 to PortB.7 for IOC all the other ports will never trigger the interrupt.
So, in your user code you must set the Interrupt with IOCB4 to IOCB7, as shows below:

Set IOCB4 On

crying Why does my #IfDef Define not work?

enlightened When an '#IfDef' statement is set, it is important that the 'Then' word is not included as part of the statement or the Define will not be correctly interpreted.

This should work:

#Define MyDefinition 
#IfDef MyDefinition 
Do 
'MyStuff here 
Loop 
#EndIf 

This won't work:

#Define MyDefinition 
#IfDef MyDefinition 
Then Do
 'MyStuff here 
Loop 
#EndIf 

[The #Define is misinterpreted as: #IfDef MyDefinitionthen]

A2. It seems not to be possible to encase an entire SubRoutine (or SubRoutines) within an '#IfDef' statement.

This should work:

#Define MyDefinition 
Sub MySub 
#IfDef MyDefinition 
Do
 'MyStuff here 
Loop 
#EndIf End Sub 

This won't work:

#Define MyDefinition 
#IfDef MyDefinition 
Sub MySub 
 Do 'MyStuff here
 Loop 
End Sub
#EndIf 

[The SubRoutine seems never to compile]

cryingI am still having problems programming my microcontroller!!!

enlightenedIn most cases, this is not a problem of the programmer software, but, a problem of the programmer hardware or the connection to the microcontroller.
Some hints, tips and tricks which can be used for troubleshooting such problems.
• Check all Vdd (supply voltage) and Vss (0v) pins of the microcontroller have to be connected to the corresponding power supply pins.
• Each Vdd pin should be connected to a decoupling capacitor, i.e. a capacitor between Vdd and VSS. The capacitor shall be placed as close as possible to the Vdd pin. A typical value for a decoupling capacitor is 100nF.
• For Low-Voltage programmers, make sure that the PGM pin of the microcontroller is tied to ground via a pull-down resistor (~10k).
• For High-Voltage programming, it also might be necessary to connect the PGM pin to GND. So if programming fails, try to connect the PGM pin to ground via a 10k resistor.
• Microcontrollers that can be programmed either in High-Voltage or Low-Voltage mode may make problems during programming in High-Voltage mode if the LVP bit (Low Voltage ICSP Enable bit) in the configuration memory is enabled. Also, if you program a microcontroller the first time, the LVP bit (Low Voltage ICSP Enable bit) in configuration memory is set, i.e. LVP enabled. Issues also happen when using the MCLR pin is used as Input I/O pin. 
If the LVP configuration fuse is enabled, PGM should be held low to prevent inadvertent entry into LVP mode.
• If you are using a High-Voltage programmer, make sure that the programming voltage on MCLR pin is within the voltage thresholds specified in the programming specification of the microcontroller to be programmed.

crying Where can I see how big my Program is, how much memory/eeprom/ RAM it uses etc.

enlightened Look at the Compilation Report in your current project folder. The File with the html extension has a vast amount of information.

4. other Questions

crying What is the Difference between  GLCDPrint and GLCDDrawString?

enlightened GlcdPrint can print Variables, GLCDDrawString can print only Strings.   You can minimize program  a bit if you are only use one kind.

crying How do i find examples of GCBASIC code and commands? 

enlightened Try searching for text using this URL. https://github.com/Anobium/Great-Cow-BASIC-Demonstration-Sources At the top is a search dialog.  Try typing a search there.  The results are the same as in your local installation. If you search for 'Stan' you will see "Stan's" contributions, if you search for ‘ds18b20' you will see all the demos with ’ds18b20’.

crying Why are my ports floating at start up, neither inputs or outputs? I've set the direction in my header file, but this doesn't seem to work. Why?

enlightenedIf the port direction is attempted to be set from within a header file, it may not be set correctly leaving the port in an ambiguous state. If the port direction is set from within a SubRoutine then called with the 'StartUp' directive within the header file, this will work.

This won't work:

[Header file saved as MyHeaderFile.h]
#Define MyPort  PortA.0

Dir MyPort Out

[End Header file]

[Program file]
#Include MyHeaderFile.h

Let MyPort = 1
[End program file]

This will work:

[Header file saved as MyHeaderFile.h]
#Define MyPort  PortA.0

#StartUp SetPortDir

Sub SetPortDir
    Dir MyPort Out
End Sub

[End Header file]

[Program file]
#Include MyHeaderFile.h

Let MyPort = 1
[End program file]

crying Any support for 16bit PIC24 family support in the near future?

enlightened Short Answer: No. Long Answer: Discussion in Forum

crying Does GCBASIC support Graphic Display XY, Sensor foobar?

enlightened Please look here for an answer:  hardware. For Graphic Displays is here an actual Table: glcd_overview. Always a good Idea is to go on Discovery Tour in our Help system, searching for Overview will reveal interesting Things, we promise!

crying Where comes the name  GCBASIC  come from?

enlightened Now the history of the Name is simple.  No-one else had that name, it had no meanings that could offend, and it was something odd enough to be memorable, so GCBASIC it was.

crying What is ICSP?

enlightened ICSP means In-system programming (ISP), also called in-circuit serial programming (ICSP), is the ability of some programmable logic devices, microcontrollers, and other embedded devices to be programmed while installed in a complete system, rather than requiring the chip to be programmed prior to installing it into the system. (description copied from Wikipedia, see here or more Info

crying How can I store very much Data in a Table?

enlightened Look at this snippet: 

It is possible to have your program report the size of the table for you. That way you wouldn't need to use a fixed value in your For...Next loop.

Table Valori as Byte
117
127
127
23
87
3
.......
End Table


dim k as word
Dim TableLen As Word
ReadTable Valori, 0, TableLen 'Get the length of the table
for k=1 to TableLen
  ReadTable Valori, k, Letto
  portb=Letto
  wait 167 us
next k

If you added or removed items in the table, your code will automatically adjust to the new length of the table.