Basic Programming Functions


Displaying text is the most basic part of a program.  The ClrHome function isn't needed, but it makes the program look much more streamlined and well-done.  The Pause function is necessary in all but the most basic and short programs.

Topics Covered

Displaying Text

ClrHome, Pause Functions

Links

Home

Programming Main Page

 

 

Displaying Text

You have three options for displaying text: Disp, Output, and Text.  Display is the most commonly used for general text output (SP 1).  You will have 16 characters from left to right.  You will need to repeat the Disp marker for each line of text (SP 2).

The Output function allows you to more accurately position text.  You can pick the column and row the text starts (SP 3).  It is in the format of

Output(x,y,"Text")

 where x is the row and y is the column of the text starting position.  Text is obviously the text that you are displaying.

Text is a more advanced function and will be covered later.

ClrHome Function

The ClrHome function clears the main screen of all text, and is used many times in an average program.  I recommend using it at the beginning of each program and of each section.  I use the tag in each sample program below.

Pause Function

The pause function stops the program (SP 4).  This allows a user to read a section in a long amount of text, or see the result of a calculation, among other things.  Once the user presses the "Enter" key, the program will continue.

Sample Program 1

This sample program displays the text "Hello World."

----------------

ClrHome

Disp "Hello World"

----------------

Sample Program 2

This program displays three lines of text.

----------------

ClrHome

Disp "Hello. I am"

Disp "here. How are"

Disp "you?"

----------------

Sample Program 3

Displays two lines of text using the Output Function.  The text will appear on lines 2 and 4.

----------------

ClrHome

Output(2,1,"Hello")

Output(4,1,"World")

Pause

ClrHome

----------------

Sample Program 4

This program displays a line of text, pauses, then displays another line of text after the user presses the enter key.

----------------

ClrHome

Disp "Hello"

Pause

Disp "World"

----------------