Electronics Projects: How to Create Names in PBASIC Code - dummies

Electronics Projects: How to Create Names in PBASIC Code

By Doug Lowe

When your electronics projects take you into the realm of programmable circuits, you may find yourself writing some PBASIC code. In PBASIC, you can create names to use as program labels. You can also create names for constants and variables. You can also assign a name of your own to I/O pins, which makes it easier to remember what kind of input or output is expected from each pin.

You must follow a few simple rules when you create names in PBASIC:

  • Names can consist of a combination of upper- and lowercase letters, numbers, and underscore characters (_). Other special characters, such as dollar signs or exclamation marks, aren’t allowed. Thus, Timer_Routine and Relay7 are valid names, but LED$ or Bang! aren’t.

  • Names must begin with a letter or an underscore but can’t begin with a number. Thus, Timer1 and _Timer1 are both valid names, 1Timer isn’t.

  • Names may be as long as 32 characters.

  • Names aren’t case-sensitive, which is to say that PBASIC doesn’t distinguish between upper- and lowercase letters. Thus, PBASIC considers all of the following names to be identical: TimerCheck, timercheck, TIMERCHECK, and TiMeRcHeCk.

  • Actually, nothing in PBASIC is case sensitive, so anything can be written in upper- or lowercase. However, it is a common PBASIC programming convention that keywords such as HIGH and GOTO are written in all caps, while names are written with just the first letter capitalized.