How to Prevent a Program Update from Causing a Loss of Communication

经过Robert Hyatt|Updated: 11/10/2016 | Comments: 5

搜索the Blog


Subscribe to the Blog

在将新的博客文章发布符合您感兴趣的领域时,请设置您的首选项以接收电子邮件通知。


Area / Application

Product Category

活动

公司/新闻

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

Communication failure between weather station and computer

想象一下,您有三个小时的数据记录台,距离测量数据有三个小时。为了物理到达你的车站,你不仅要开三个小时,而且你必须徒步旅行一座冰雪覆盖的山。

A couple of days ago, you made a change to your CRBasic data logger program and were unsure of the effects of the update. But you needed to make the change and proceeded to send the updated program to the data logger. Unfortunately, that was the last you heard from your station.

虽然您发现了您的数据记录器程序中的错误导致您导致通信,但您现在必须等待晴朗的一天,以便您可以让山上沿着山上纠正程序。如果您可以在不必去网站旅行的情况下再次运行,那么如果您可以再次运行,那就不容易得多?

The good news is that there is a simple solution that can prevent your program update from causing a loss of communication with your station. Within your CRBasic program, use therunprogram()指令,并引用新程序将更换的程序名称。在下面的例子中,runprogram()指令是引用以前的程序名为prognawerev1.cr6.。Notice that therunprogram()instruction is placed within a conditional如果然后/结束instruction—just below a timer.

为你推荐:有关指令如何工作的其他帮助和信息,请参阅CRBasic编辑器帮助runprogram()instruction. To access the file, highlightRunProgramin the instruction list, and click theHelp列表上方的按钮。



'prognawerev2'主程序beginprog扫描(1,sec,0,0)Public ChangeBackTimer ‘Declaration of variable ChangeBackTimer = Timer (10,Min,0 ) ‘Result of timer is assigned to variable If ChangeBackTimer >= 10 Then ‘Conditional statement evaluates variable RunProgram ("CPU:ProgNameRev1.cr6",4) ‘Points to another program on CPU, Set to run now. EndIfNextscan.EndProg

此代码允许您的新上传程序运行10分钟(足够的时间来测试您的通信是否受到影响)。然后它自动恢复到上一个​​程序。

If you send the new program, your data logger seems to be operating as planned, and communication is operating normally, you can proceed to comment out or delete the “ChangeBack” portions of your code. Then send the program again. Congratulations! Your station is now up and running, your data logger has resumed logging data, and you didn’t have to spend hours traveling back and forth to your station site to do it. Although therunprogram()指令在此应用程序中有许多其他用途,它可能只是从意外行程保存。

笔记:As fantastic as this application may sound, therunprogram()教学不是一个故障安全指令。Possible complications can arise when combiningrunprogram()与其他指示如SetSetting()。如果您使用的是,请联系Campbell ScientificSetSetting()instruction in your program(s).

Tip:It is always a good practice to download your data frequently and keep a current backup of your data logger program and configuration file.

如果你认为的话runprogram()instruction can help you in your application, I invite you to try it out a few times with your unique programs in your office.If you have any questions or comments about using the instruction, post them below.


分享这篇文章


关于the Author

robert hyattRobert L. Hyatt是Campbell Scientific,Inc。的支持和实施工程师,他于2007年加入Ca万博matex网页登录mpbell Scientific之前,他获得了犹他州州立大学工程技术和环境科学的科学学士学位。罗伯特有两个激情:农业和太阳能。他喜欢在他周围的全部录制数据 - 从太阳能收集和在现场的温度下,到房子的能源用途。无论项目,Robert都喜欢包括坎贝尔科学数据记录器来监控和控制它。

View all articles by this author.


Comments

kcopeland|2016/10/2016在02:32 PM

这是一个很好的功能!如果我理解正确,如果您的程序有编译错误,这无帮助。我们最近遇到了一个特定于OS29的函数的问题,正在向远程记录器发送与OS27.04,Onboard Compiler失败,我们的端口控制调制解调器不会重新打开。我们需要一种方法在编译失败时运行程序。

sonoautomated|11/11/2016 at 03:49 PM

宾夕法尼亚州先生,这确实是另一个例外,谢谢你的意见。我会将其提交给工程,看看可以做些什么。如果发生了一些事情,您可以确定它将在您需要上传的新操作系统上。:) - Cheers我的朋友。

thinkitcodeit|11/17/2016 at 02:30 AM

您可以实现默认的default.Cr1(或Cr#,具体取决于记录器类型),其恢复通信。如果程序无法编译或运行并且在电源周期之后没有运行程序,则数据记录器将自动运行此默认程序。这是一个很好的方法来放置一些基本的Comms启动代码,试图并测试,以确保您获得返回。

luisfgranada|06/07/2018在06:56 AM

您好,我在使用此指令时出现问题。该计划如下:

公共numfiles.
公共文件(10)作为字符串

const measurementprogram =“cpu:template.cr1”
Dim i

BeginProg
Scan (1,Sec,3,0)
NumFiles = FileList("CPU",Files())
For i = 1 To NumFiles
如果strcomp(文件(i),meforialprogram)= 0则为0
RunProgram (MeasurementProgram,4)
万一
接下来我
Nextscan.
EndProg

What I do is to look in the memory "CPU" for a particular program. In the example (CPU:Template.CR1). If it founds it, then try to run it. The problem is that if the program is not in the memory the instruction RunProgram should not run (beacause is in the IF loop) but it does. I have tested the loop and is fine. Could you help?

Thanks

sonoautomated|06/07/2018 at 08:45 AM

Dear Luisfgranada,

On a logger I just wiped clean with the latest OS, I was not able to replicate your problem with my Test.CR1 program.

但是,我决定上传一个名为“template.cr1”的程序,我的test.cr1程序中的runprogram指令会寻找它,并且正如所预期的那样,它找到它。所以而不是删除模板.Cr1,我决定使用FileManage指令隐藏它。所以此时,文件控制对话框不再有一个名为template.cr1的文件,但是当我运行我的test.cr1时,程序仍然找到了一个名为template.cr1的文件并开始运行它。应该有。

Is it possible that you have a hidden program that you can’t see? This may be the reason the RunProgram instruction is finding this file you think does not exist. If this is the case, you have at least two options. 1- You may use the FileManage instruction to delete that hidden file. 2- You may upload the lasted OS to the logger. Before updating your logger with the latest OS, please remember to download any data and programs you might need, and maybe do a full logger backup. Backing up your logger is always a clever idea and can be done from Device Configuration Utility.

I hope this has been helpful. Please let me know if you have any more questions.

登录或注册to comment.

We're active on social media!
通过以下平台跟踪我们的最新更新,随时了解我们的最新更新:

Baidu