TOP Contributors

  1. MIKROE (2659 codes)
  2. Alcides Ramos (356 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 (136984 times)
  2. FAT32 Library (70095 times)
  3. Network Ethernet Library (56023 times)
  4. USB Device Library (46344 times)
  5. Network WiFi Library (41961 times)
  6. FT800 Library (41274 times)
  7. GSM click (29051 times)
  8. mikroSDK (26488 times)
  9. PID Library (26447 times)
  10. microSD click (25411 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: 3419 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

Angle 6 click

0

Angle 6 Click is a compact add-on board that detects the absolute angular position of a permanent magnet, typically a diametrically magnetized cylinder on a rotating shaft. This board features the MAQ470GQE, a 12-bit contactless angle sensor with PWM output from Monolithic Power Systems. It supports a wide range of magnetic field strengths and spatial configurations, with both end-of-shaft and off-axis (side-shaft mounting), supported configurations. Fast data acquisition and processing provides accurate angle measurement at speeds from 0 to 60,000 rpm, alongside magnetic field strength detection with programmable thresholds.

[Learn More]

MIC23099 click

5

MIC23099 click carries the MIC23099, a single AA/AAA cell step-down/step-up regulator with battery monitoring. The click is designed to run on a 3.3V power supply. It communicates with the target microcontroller over the following pins on the mikroBUSâ„¢ line: CS, INT.

[Learn More]

Flash 4 click

0

Flash 4 click is a perfect solution for the mass storage option in various embedded applications. With fast performance being one of its key features, Flash 4 click can also be used for the code shadowing, execute-in-place (XIP), and data storage.

[Learn More]