这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » DIY与开源设计 » 电子DIY » chenhaixin “51 DIY” 进程贴

共16条 2/2 1 2 跳转至
助工
2014-05-09 17:23:47     打赏
11楼
STC下载冷启动确实不方便,这个不错!

高工
2014-05-11 11:21:56     打赏
12楼

顶一个~


菜鸟
2014-05-11 22:39:30     打赏
13楼

液晶12864

画画以及任意位置打点必备图表.

(成功)12864液晶ST7920控制--画温度曲线.zip





12864也就这样了,过几天写一个VB的上位机把18B20也结了


助工
2014-05-15 01:07:58     打赏
14楼
楼主多照顾我们这些菜鸟哈哈、多多发一些教程给我们学学吧、多谢了哈哈

菜鸟
2014-05-18 23:15:28     打赏
15楼
我这块板子一直有各种格样的问题,一直就不好好工作,想法也发不了呀

菜鸟
2014-06-05 23:33:47     打赏
16楼

传一个用VB写的关于温度计的上位机,配合单片机串口程序在电脑端实时显示温度曲线


Public sina As Variant
Public sinb As Variant
Public sinc As Variant
Public sind As Variant
Public sine As Variant
Public i As Variant
Private Sub Command1_Click()
If Command1.Caption = "关闭串口" Then
        MSComm1.PortOpen = False
        Command1.Caption = "打开串口"
        Timer1.Enabled = False
    Else
        Command1.Caption = "关闭串口"
        MSComm1.CommPort = Combo1.Text
        MSComm1.Settings = "" '"Combo2.text"'","'" combo3.text  "'", "'"  combo4.text   "'" , "'"combo5.text "'""
        MSComm1.InputMode = 0
       MSComm1.PortOpen = True
       Timer1.Enabled = True
    End If
End Sub

Private Sub Form_Load()
Dim i As Integer '生成串口号
For i = 1 To 20
With Combo1
  .AddItem i
End With
Next
Combo2.AddItem "600"
Combo2.AddItem "1200"
Combo2.AddItem "2400"
Combo2.AddItem "4800"
Combo2.AddItem "9600"
Combo2.AddItem "57600"
Combo2.AddItem "115200"
Combo3.AddItem "n"
Combo3.AddItem "e"
Combo3.AddItem "o"
Combo3.AddItem "s"
Combo3.AddItem "m"
Combo4.AddItem "8"
Combo4.AddItem "9"
Combo5.AddItem "1"
Combo5.AddItem "1.5"
Combo5.AddItem "2"
i = 100
sina = 0
sind = 1400
sinc = 0
End Sub
Private Sub Timer1_Timer()
Dim buf$
Dim v As Double
buf = Trim(MSComm1.Input)
If Len(buf) <> 0 Then
    sina = sinc
    sinb = sind
    v = Asc(buf) + 256  '只传了低八位,所以直接加256,相当于把接受的数据& 0001 0000 0000  
    v = v / 10
    Text1.Text = Text1.Text + Str(v) + Chr(13) + Chr(10)
    sinc = (sina + 100)
    sind = (Asc(buf) * 20)
    sine = Val(2000)
    Form1.Picture1.Line (sina, 5000 - sinb)-(sinc, 5000 - sind), sine
    If sinc = 10000 Then
    Picture1.Cls
    sina = 0
    sinc = 0
    End If
    End If
End Sub
Private Sub cmdquite_chick()
MSComm1.PortOpen = False
Unload Me
End Sub


等一会再传一个EXE可执行文件

com.zip

程序数据处理比较特殊

uint tmp()               //get the temperature
{
  float tt;
  uchar a,b;
  dsreset();
  delay(1);
  tmpwritebyte(0xcc);
  tmpwritebyte(0xbe);
  a=tmpread();
  b=tmpread();
  temp=b;
  temp<<=8;             //two byte  compose a int variable
  temp=temp|a;
  tt=temp*0.0625;
  temp=tt*10+0.5;
  return temp;
}

 这个是单片机读18B20,传感器是12数据,但是我们只传送了低八位,因为常温状态下第九位为1,所以加256

   	ii =tmp();
	
//   SBUF=ii>>8;
//   while(TI==0);//????????
//	TI=0;//??????
//	
   SBUF=ii;
   while(TI==0);//????????
	TI=0;//??????

 




共16条 2/2 1 2 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]