We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2018-11-06
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Magnetic
Downloaded: 5718 times
Not followed.
License: MIT license
GeoMagnetic click is a digital magnetometric click board which can measure the geomagnetic field in three perpendicular axes.
Do you want to subscribe in order to receive notifications regarding "GeoMagnetic click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "GeoMagnetic click" changes.
Do you want to report abuse regarding "GeoMagnetic click".
Library Description
Initializes and defines the SPI and I2C bus driver and driver functions, witch have ability to writting on registers and reading from registers. The functions also offer a choice to reading x, y and z axis data and hall resistance data when data is ready for reading. For more details check the documentation.
Key functions:
GEOMAG_RETVAL_T geomag_writeReg( uint8_t dataIn, const uint8_t registerAddress ) - Function writes one byte data in register.
GEOMAG_RETVAL_T geomag_readReg( uint8_t *dataOut, const uint8_t registerAddress, const uint8_t nBytes ) - Function reads determined number of bytes from registers.
void geomag_readData( uint16_t *dataX, uint16_t *dataY, uint16_t *dataZ, uint16_t *resHall ) - Function reads 13-bit x and y axis data, 15-bit z axis data and 14-bit hall resistance data from data registers.
Examples Description
Application Task - (code snippet) - Reads axis data after each 500ms and logs results on USB UART.
void applicationTask() { geomag_readData( &axisX, &axisY, &axisZ, &RHall ); WordToStr( axisX, text ); mikrobus_logWrite( "X axis: ", _LOG_TEXT ); mikrobus_logWrite( text, _LOG_LINE ); WordToStr( axisY, text ); mikrobus_logWrite( "Y axis: ", _LOG_TEXT ); mikrobus_logWrite( text, _LOG_LINE ); WordToStr( axisZ, text ); mikrobus_logWrite( "Z axis: ", _LOG_TEXT ); mikrobus_logWrite( text, _LOG_LINE ); mikrobus_logWrite( "", _LOG_LINE ); Delay_ms( 500 ); }
Other mikroE Libraries used in the example:
Additional notes and information
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.