Going Public with Your Variables in CRBasic

byJanet Albers| Updated: 05/29/2015 | Comments: 0

Tags

CRBasic

Search the Blog


Subscribe to the Blog

Set up your preferences for receiving email notifications when new blog articles are posted that match your areas of interest.


Area / Application

Product Category

Activity

Corporate / News

Enter your email address:



Suggest an Article

Is there a topic you would like to learn more about? Let us know. Please be as specific as possible.

Leave this field empty

When programming your Campbell Scientific data logger, have you ever wondered whether you should be using aDimvariable declaration or aPublicone? What is the difference between them, and when is it best to use each one?

DimandPublicvariables 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 aDimand aPublicvariable is thatDimvariables do not show up in thePublictable. Your program can still write to, read from, and store data fromDimvariables.

Dim variables do not show up in the Public table

Tip:Variable names, bothDimandPublic, are not case sensitive.

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


Share This Article


About the Author

janet albersJanet Albers holds the title of Technical Communications Manager; the sign above her office door says, "Coach." 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.

View all articles by this author.


Comments

Pleaselog in or registerto comment.

We're active on social media!
Stay informed with our latest updates by following us on these platforms:

Baidu