What is ASCII? 

Sometimes new users need an introduction on how to control our products.  The process is very simple.  If you are new to the world of computer control, please read this section.  It will help you understand the overall process.

When an NCD device is first powered up, it is ready to receive commands from your computer or microcontroller telling it what to do.  In your particular application, you may want to use a computer or microcontroller to send commands to an NCD device.  

Commands are sent to NCD devices using an RS-232 cable.  In most cases, this involves connecting a ground wire between the RS-232 port of your computer and the RS-232 ground of the NCD device.  In addition, a data wire must be connected between the RS-232 data output of your computer and the RS-232 data input of the NCD device.  This data wire carries the commands from your computer to our device.  Sometimes data is sent back to the computer from the NCD device, requiring the connection of a 3rd wire.

The data that is sent from a computer to an NCD device is called ASCII.  ASCII has two basic forms, ASCII Characters and ASCII Character Codes, which is where most people get confused.  It is important to understand that the serial port of any computer or microcontroller is a digital device.  As such, it is only able to send the numbers 0 to 255 (ASCII Character Codes).  Many terminal programs and programming languages have made provisions to automatically convert ASCII Character Codes into ASCII Characters (ABCDEFG, 12345, etc).

So if you were to send the ASCII Character Code 65, it would be automatically interpreted as the ASCII Character "A".  Similarly, the ASCII Character Code 66 is interpreted as the ASCII Character "B".

ASCII Characters are very useful, but are difficult to use within a programming environment.  For instance, the only way to send the ASCII Character for a carriage return is to send the ASCII Character code 10 -so you're better off learning how to send ASCII Character Codes anyway.

All programming languages allow you to send ASCII Characters or ASCII Character Codes.  It is your choice.  However, it is MUCH easier to control an NCD device using ASCII Character Codes rather than ASCII Characters.  The following QBasic program opens the COM2 Serial Port at 9600 Baud and sends all 256 ASCII Character Codes 0 to 255 out the serial port.  These ASCII character codes are all that is needed to control ANY NCD device ever created.  

OPEN "COM2:9600,N,8,1,CD0,CS0,DS0,OP0" FOR OUTPUT AS #1

FOR N = 0 TO 255

    PRINT #1, CHR$(N);

NEXT N

The manuals and programming examples for each individual device provide additional information on controlling specific NCD devices using ASCII Character Codes.  Please browse our complete product line, download sample programs and product manuals.

Basic Stamp Users:  Download our guide, "Using NCD Devices with the Basic Stamp" for complete programming examples and connection information.

National Control Devices
Call: (417) 646-5644
www.controlanything.com

Who's Controlling Your World?

www.controleverything.com