Bascom-avr program that can display temperature and time (and set alarm time)

Publisher:HarmoniousSoulLatest update time:2020-09-17 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

$regfile = "m16def.dat"
$crystal = 8000000

Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , E = Portc.2 , Rs = Portc.0
Config Lcd = 16 * 2
Config 1wire = Porta.0
'*************************************************
Dim Id(8) As Byte
Dim I As Byte
Dim C(2) As Byte
Dim T As Word                                             
'*****************************************************
Deflcdchar 0 , 14 , 10 , 14 , 32 , 32 , 32 , 32 , 32 ' Define the display characters of degree
Deflcdchar 1 , 4 , 10 , 17 , 4 , 31 , 2 , 4 , 8 'Define the display characters of the Chinese character "今"
Deflcdchar 2 , 31 , 4 , 31 , 4 , 12 , 10 , 18 , 17 'Define the display characters of the Chinese character "天"
'****************************************************

Dim Shi As Byte , Fen As Byte , Miao As Byte               
Dim S As String * 2 , F As String * 2 , M As String * 2   

Dim N_shi As Byte , N_fen As Byte , Zt As Bit              
Dim N_s As String * 2 , N_f As String * 2                  

Dim Key_in As Byte                                          
Dim Beep_times As Byte

Config Portb = Input                                    
Portb = &HFF                                             


Initlcd                                                     
Cls

Shi = 12
Fen = 0
Miao = 0
N_shi = 12
N_fen = 0
Zt = 0


Cursor Off                                             

Main:
   Cls                                                   
   Gosub Disp                                             
   Gosub Ds18b20csh                                      
   Gosub 18b20js
   Gosub Key_scan                                         
   Gosub Naoshi
   Gosub Jishi

Goto Main

End
............
............
..............
The program is correct, the experiment is successful, the temperature can be displayed, the time is very accurate.
Minor problems also exist, but they can be basically solved. It can be used as it is.

Reference address:Bascom-avr program that can display temperature and time (and set alarm time)

Previous article:AVR MCU fuse settings and rescue methods
Next article:Mixed programming of basic language and assembly language --- electronic watch

Popular Resources
Popular amplifiers
Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号