doubt in using c compiler?????

Status
Not open for further replies.

n_vikranth

New Member
I planned to interface ADXL345 with ATmega16A using SPI bus... iam using mikro c pro compiler and I have one doubt in compiler that to write and read from ADXL345 I used predefined library from compiler.
But to write data and address towards adxl345 we have only same command that
SPI1_Write(data); how to write data and address…
If u know kindly tell me how to send address and data towards ADXL345 using 3-wire SPI bus
And using the library files from mikro c pro compiler….
 
I dont know the lib you want to use. But the read and write command is possibly enough.
Switch CE down and send the Address including steering bits. Then send the according values you want to send.
After that you have to switch the CE to up.
Reading should work the same way. It could be, that you have to write a command into the Chip, before reading out the Data with the read command, without switching up the CE signal.
But without knowledge of the include file I couldn't be shure.
Some read values are 16Bit. In this case i guess you have to read out 2 Bytes.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…