Going Public with Your Variables in CRBasic

por Janet Albers | Actualizado: 05/29/2015 | Comentarios: 0

Etiquetas

CRBasic

Temas Blog


Buscar en el Blog


Suscribirse al Blog

Configure sus preferencias para la recepción de notificaciones por email cuando se publiquen nuevos artículos en el blog que coincidan con sus áreas de interés.


Entre su dirección email:



Sugerir un Artículo

¿Hay algún tema sobre el cual desea saber más? Háganoslo saber. Por favor sea lo más específico que pueda.

Leave this field empty

When programming your Campbell Scientific datalogger, have you ever wondered whether you should be using a Dim variable declaration or a Public one? What is the difference between them, and when is it best to use each one?

Dim and Public variables are temporary holding locations for values that normally vary during program execution. These values are typically the result of measurements and processing or calculations.

The main difference between a Dim and a Public variable is that Dim variables do not show up in the Public table. Your program can still write to, read from, and store data from Dim variables.

Dim variables do not show up in the Public table

Tip:  Variable names, both Dim and Public, are not case sensitive.

In general, during program development you can’t go wrong declaring all variables as Public. That way, you can monitor the Public table while testing and see exactly what’s going on. After your program is running as designed, you can clean up the Public table by using the Dim declaration for variables that you don’t need to monitor as closely. Oftentimes I’ll use Dim variables for scratch calculations, loop counters, and when the Public table gets very large.


Compartir este artículo


Acerca del autor

janet albers Janet Albers is a Senior Technical Writer. She'll share tips, simplify concepts, and guide you to a successful project. She's been at Campbell Scientific, Inc. longer than the CR1000, but not quite as long as the CR10X. After work hours, Janet enjoys the outdoors with her boys and dogs.

Ver todos los artículos de este autor.


Comentarios

Please log in or register to comment.