tailieunhanh - Industrial Control Student Guide Version 1.1 phần 8

Thử nghiệm # 7: Kiểm soát thời gian thực và các dữ liệu đăng nhập Lưu ý rằng chương trình sẽ thiết lập lại thời gian đến 05:53 mỗi lần Stamp BASIC là thiết lập lại. Điều này có thể xảy ra từ tải chương trình, thiết lập lại tem hướng dẫn sử dụng, đi xe đạp cung cấp năng lượng, | Experiment 7 Real-time Control and Data Logging 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. Init .alize Sett ings Time 0553 Defi ne initial time Seconds 00 CTimeLow CON 1800 Defi ne time to go low temp. CTimeHigh CON 0600 Defi ne time to go high temp. LowTempSP CON 900 Defi ne low temp. HighTempSP CON 1000 Defi ne high temp. GOSUB SetTime Set RTC Remark out if time ok Note If power is removed from the DS1302Real 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 High byte is hours Minutes VAR 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 starts time 7 minutes before switching to the working-hours temperature. This should provide time for temperature to stabilize at the lower temperature. Figure is a plot of the run. Industrial .

TỪ KHÓA LIÊN QUAN