TOP Contributors

  1. MIKROE (2656 codes)
  2. Alcides Ramos (353 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (136836 times)
  2. FAT32 Library (69993 times)
  3. Network Ethernet Library (55976 times)
  4. USB Device Library (46290 times)
  5. Network WiFi Library (41895 times)
  6. FT800 Library (41204 times)
  7. GSM click (29011 times)
  8. PID Library (26422 times)
  9. mikroSDK (26391 times)
  10. microSD click (25384 times)
Libstock prefers package manager

Package Manager

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]

< Back
mikroSDK Library

Magnetic rotary click

Rating:

6

Author: MIKROE

Last Updated: 2018-12-21

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Magnetic

Downloaded: 3416 times

Not followed.

License: MIT license  

Magnetic rotary click is a very accurate position sensing Click board which utilizes the HMC1512, a magnetic field displacement sensor IC.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Magnetic rotary click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Magnetic rotary click" changes.

Do you want to report abuse regarding "Magnetic rotary click".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

Magnetic rotary click

Magnetic rotary click

Native view of the Magnetic rotary Click board.

View full image
Magnetic rotary click

Magnetic rotary click

Front and back view of the magnetic rotary Click board.

View full image

Library Description

The library performs a magnetic field angle measurement and calculates angle value to degrees. The library also performs the all necessary settings for the AD conversion, for example channel selection and mode setting. For more details check documentation.

Key functions:

  • uint16_t magnrotary_readADC( uint8_t cmndByte ) - Function returns a 12bit result of AD conversion.
  • uint16_t magnrotary_outVoltADC( uint8_t cmdByte, uint16_t pwrVolt ) - Function returns ADC voltage value calculated to millivolts, depending on the VDD (power) voltage selection.
  • double magnrotary_getFieldAngle( uint8_t cmdByte ) - Function returns a magnetic field angle calculated to degrees, in the range from -90 to 90 degrees.

Examples description

The application is composed of the three sections :

  • System Initialization - Initializes peripherals and pins.
  • Application Initialization - Initializes SPI interface for communication with the device.
  • Application Task - (code snippet) - Reads a magnetic field angle calculated to degrees for channel A in Single-Ended Mode and logs results on uart terminal. Repeats operation every 300 milliseconds. Note : The angle can be measured in the range from -90 to 90 degrees.
void applicationTask()
{
    magnAngle = magnrotary_getFieldAngle( _MAGNROTARY_CHA_POS_GND_NEG | _MAGNROTARY_MSB_ZEROS_ORDER );
    
    FloatToStr( magnAngle, text );
    floatCut();
    mikrobus_logWrite( "Angle is : ", _LOG_TEXT );
    mikrobus_logWrite( text, _LOG_TEXT );
    mikrobus_logWrite( logDeg, _LOG_LINE );
    
    Delay_ms( 300 );

}

Additional Functions :

  • void floatCut()  - - Makes float value to be rounded on two decimal places.
  • void plotAngle()   - Sends results of angle on serial plotter.

 

Other mikroE Libraries used in the example:

  • Conversion
  • SPI
  • UART

Additional notes and information

Depending on the development board you are using, you may need USB UART clickUSB 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.

ALSO FROM THIS AUTHOR

LED Driver 8 click

0

LED Driver 8 Click is a compact add-on board optimized for dimming and blinking 32 mA RGBA LEDs. This board features the PCA9957HNMP, 24-channel SPI-compatible constant current LED driver from NXP Semiconductors.

[Learn More]

Buck 3 Click

5

Buck 3 click is a very advanced synchronous step-down (buck) converter, which is designed to deliver noise and ripple-free voltage to highly sensitive applications, such as FPGA and high-performance DSP platforms.

[Learn More]

HTU21D click

0

The application is composed of two sections.

[Learn More]