Kripton2035
Advanced Member level 4
- Joined
- Jul 19, 2001
- Messages
- 1,184
- Helped
- 212
- Reputation
- 428
- Reaction score
- 194
- Trophy points
- 1,353
- Location
- Western Europe
- Activity points
- 8,210
I tried to interface Sht11 sensor to zigbee development kit (smartRF04EB) with CC2430EM and tried to change the code from sensirion but it don't really work. I don't understand what's wrong with my code (I am new in this zigbee Dev.Kit). Any one help me please the right code to interface sht11 sensor to cc2430?
I really need this code!
Thanks before...
---------- Post added at 10:39 PM ---------- Previous post was at 10:13 PM ----------
Do you have coding for interface sht11 to zigbee cc2430 in c language?
I really need that code!
regard, amh16
For those whose preferred choice of MCU is MCS51,
Here is (K*E*I*L) c-code for interfacing the SHT11 temp-humid sensor to the MCS51 (in this case the 89C51RD2 + 11.0592 MHz (Speed x2)). The detail how to connect the SHT11 to the 89C51RD2 is explained in the source code.
hello
anyone can help me with a schematic for connecting sht11 with an AVR Atmega8 and seding results to a PC using USB. I would appreciate some links or advices. I have to do a project with this subject and I can't find anything with usb,atmel and sht11 together.
Thank you in advance
'//////////////////////////////////////////////////////////////
'/// FastAVR Basic Compiler for AVR by MICRODESIGN ///
'/// SHT11/15 Temperature and Humidity measurement ///
'/// 14/12 bit ///
'//////////////////////////////////////////////////////////////
$Device= 8515
$Stack = 32 ' stack size
$Clock = 7.3728
$Baud=115200
$ShiftOut Data=PORTD.2, Clk=PORTD.3, 1
$LeadChar=" ", Format(2,3)
$Def dDta=DDRD.2
$Def inDta=PIND.2
$Def Dta=PORTD.2
$Def Sck=PORTD.3
Declare Sub Init()
Declare Sub StartTX()
Declare Sub CommReset()
Declare Function WriteByte(db As Byte) As Byte
Declare Function ReadByte(ack As Byte) As Byte
Declare Function Measure(what As Byte) As Word
Dim tmp As Integer, ftmp As Float
Dim n As Byte
Dim Cta As Byte, Ctb As Integer
Const True=1, False=0
Const ACK=1, NAK=0
Const TmpSHT=&h03
Const HumSHT=&h05
Const ResSHT=&h1e
Const Rstat =&h07
Const Wstat =&h06
Const c1=-4, c2=0.0405, c3=-2.8E-06
Init()
Do
tmp=Measure(TmpSHT) ' measure Temperature
ftmp=tmp/100-40
Print "Temp:"; ftmp
tmp=Measure(HumSHT) ' measure Humidity
ftmp=c1+tmp*c2+Sqr(tmp)*c3
Print "Humy:"; ftmp
Print
Wait 1
Loop
'//////////////////////////////////////////////////////////////
Sub Init()
WaitMs 20
CommReset()
WriteByte(Wstat) ' write to Status
Set dDta
WriteByte(0) ' 14bit for T, 12 bit for RH
End Sub
'//////////////////////////////////////////////////////////////
Function Measure(what As Byte) As Word
Local tmp As Word
CommReset()
If WriteByte(what)=0 Then ' isue Cmd
BitWait inDta, 0 ' wait for data ready
tmp=ReadByte(ACK) ' read first byte
Shift(Left, 8, tmp) ' make it MSB
tmp=tmp Or ReadByte(NAK) ' read second byte and combine
'n=ReadByte(NAK) ' no CRC for now
Else
Print "No sensor!"
tmp=0
End If
Return tmp
End Function
'//////////////////////////////////////////////////////////////
Sub StartTX()
Set dDta
Set Sck
Reset Dta
Reset Sck
Set Sck
Set Dta
Reset Sck
End Sub
'//////////////////////////////////////////////////////////////
Sub CommReset()
Local i As Byte
Set Dta
For i=0 To 8
Set Sck: Reset Sck
Next
StartTX()
End Sub
'//////////////////////////////////////////////////////////////
Function WriteByte(db As Byte) As Byte
Local mask As Byte
ShiftOut db ' send data
Reset dDta ' back to input
Set Sck:Reset Sck ' clock ACK
Return inDta ' return ACK (0=SHT present)
End Function
'//////////////////////////////////////////////////////////////
Function ReadByte(ack As Byte) As Byte
Local i As Byte, db As Byte
db=ShiftIn
Set dDta
Dta=Not ack
Set Sck
Reset Sck
Reset dDta
Return db
End Function
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?