Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I2c communication with sht21

Status
Not open for further replies.

vinay shabad

Junior Member level 3
Joined
Dec 13, 2010
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,769
hiii i am writing program for communication betwwen i2C and SHT21 sensor i have found some example code with the help of that i wrote mine but it is having some errors





void I2c_init ()
//Ready
I2C> W //<<< Set 3.3v power supply on
Power supplies ON
I2C> (1) // <<< Search device on I2C bus//Searching I2C address space. Found devices at:
0x80(0x40 W) //<<< SHT21 is found
I2C> [0x80 0xE3][0x81 %:1000 r:3] // <<< start measure temperature and read value
I2C START BIT
WRITE: 0x80 ACK
WRITE: 0xE3 ACK
I2C STOP BIT
I2C START BIT
WRITE: 0x81 ACK
DELAY 1000ms
READ: 0x59 ACK 0x4C ACK 0x64
NACK
I2C STOP BIT
I2C> [0x80 0xE5][0x81 [%:1000] r:3] //<<< start measure humidity and read value
I2C START BIT
WRITE: 0x80 ACK
WRITE: 0xE5 ACK
I2C STOP BIT
I2C START BIT
WRITE: 0x81 ACK
DELAY 1000ms
READ: 0x8B ACK 0x22 ACK 0xDD
NACK
I2C STOP BIT
I2C>










errors :program Files\Microchip\mplabc30\v3.25\support\peripheral_24F\i.c:10: error: syntax error before 'I2C'
C:\Program Files\Microchip\mplabc30\v3.25\support\peripheral_24F\i.c:14: error: stray '%:' in program
C:\Program Files\Microchip\mplabc30\v3.25\support\peripheral_24F\i.c:21:7: error: invalid suffix "ms" on integer constant
C:\Program Files\Microchip\mplabc30\v3.25\support\peripheral_24F\i.c:25: error: stray '%:' in program
C:\Program Files\Microchip\mplabc30\v3.25\support\peripheral_24F\i.c:32:7: error: invalid suffix "ms" on integer constant
C:\Program Files\Microchip\mplabc30\v3.25\support\peripheral_24F\i.c:36:5: warning: no newline at end of file
----------------------------------------------------------------------



can any one please help me i am not C language expert it would be appriciable if some one help.Thankyou in advance
 

i am really sorry i found this example in net i too dn't understand in which language it is, but i am trying this programm in to C language but i am not expert in C language so can any one can change same programme to c language please.

Thankyou in advance
 

PIC24F16KA102 microcontroller
MPLAB ,C30 compiler

---------- Post added at 14:29 ---------- Previous post was at 14:27 ----------

the value in above programme are based on SHT21 datasheet which is excatly right i verified it
 

It's no programming language at all. Either a kind of debug output or the log output of an interactive tool operating the SHT21. Maybe it has been shown to give some hints what a C programm should do. You can hardly avoid to do some C coding on your own. Or find real C code for the device.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top