Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Industrial Control Student Guide Version 1.1 phần 8 ppsx
MIỄN PHÍ
Số trang
24
Kích thước
572.0 KB
Định dạng
PDF
Lượt xem
1069

Industrial Control Student Guide Version 1.1 phần 8 ppsx

Nội dung xem thử

Mô tả chi tiết

Experiment #7: Real-time Control and Data Logging

Industrial Control Version 1.1 • Page 197

Note that the program will reset the time to 05:53 every time the BASIC Stamp is reset. This can occur from

program loading, manual Stamp reset, power supply cycling, and sometimes the COM port or computer

cycling. The start time is appropriate for what we are discussing in this section, but in later sections you may

want to set the values of the start-time to actual values.

'***** Initialize Settings *******

Time = $0553 ' Define initial time

Seconds = $00

CTimeLow CON $1800 ' Define time to go low temp.

CTimeHigh CON $0600 ' Define time to go high temp.

LowTempSP CON 900 ' Define low temp.

HighTempSP CON 1000 ' Define high temp.

'*********************************

GOSUB SetTime ' Set RTC (Remark out if time ok)

Note: If power is removed from the DS1302 Real Time Clock it will power-up with unpredictable values in the

time registers with Gosub SetTime remarked out.

The times for changing temperature and their new values are also set here. GOSUB SetTime sets the real

time clock to the specified time. Once the proper time is set, this line may be remarked out and downloaded

again to prevent the time from being reset to 05:53 if the BASIC Stamp is reset.

The program uses two sets of variables for time, one to set/hold the current time, and another to hold the

time we wish to change the thermostat. Note that the word variable of Time and CTime are further broken

down into Hours and Minutes:

Time VAR WORD ' Word to hold full time

Hours VAR TIME.HIGHBYTE ' High byte is hours

Minutes VAR TIME.LOWBYTE ' Low byte is hours

The variable Hours is assigned to be the high byte of the word variable Time, or those two BCD positions

representing the hour. The same is true for minutes and the lower 2 positions. This is a very powerful tool

when parts of a single variable need to be addressed individually.

Program 7.1 starts time 7 minutes before switching to the working-hours temperature. This should provide

time for temperature to stabilize at the lower temperature. Figure 7.4 is a plot of the run.

Experiment #7: Real-time Control and Data Logging

Page 198 • Industrial Control Version 1.1

Figure 7.4: Time-Controlled 'Building Heating’

The StampPlot Lite user status box displays the current time and the time that the next change is set to occur.

The time in the status box may appear to be changing at irregular intervals, but that is a result of timing of the

BS2 in displaying the data and not the time kept by the RTC. The message area displays both the time a change

occurred and the new setpoint.

The plot illustrates On/Off control at the 90 F setpoint, and the switch to the 100 F setpoint at 06:00. Using

the RTC, adding more output devices, and expanding the control section of the code, we could add numerous

time-based events to occur over the course of a day.

Download and run program 7.1. Monitor with StampPlot Lite through at least the 06:00 change. You will need

to wait another 12 hours to see if it switches back to the low setpoint at 18:00... Have time to wait?

Tải ngay đi em, còn do dự, trời tối mất!