MikroElektronika white logo
  • Products
    • Click Boards
      • Wireless Connectivity
        • GPS/GNSS
        • GSM/LTE
        • LTE IoT
        • BT/BLE
        • WiFi
        • RFID/NFC
        • GSM+GPS
        • 6LoWPAN
        • ZigBee
        • UWB
        • SigFox
        • Sub-1 GHz Transceievers
        • 2.4 GHz Trancevers
        • LoRa
        • WiFi+BLE
      • Sensors
        • Biometrics
        • Gas
        • Magnetic
        • Motion
        • Optical
        • Pressure
        • Proximity
        • Temperature & humidity
        • Current sensor
        • Miscellaneous
        • Environmental
        • Force
        • Inductance
        • RF meter
        • Click Shields
        • Click Bundles
      • Interface
        • Adapter
        • CAN
        • Port expander
        • RS485
        • USB
        • 1-Wire
        • RS232
        • Ethernet
        • LIN
        • PWM
        • Current
        • DALI
        • I2C
        • Fiber optics
        • SPI
        • DMX
        • CXPI
        • Click Shields
        • Click Bundles
      • Display & LED
        • LED Drivers
        • LED Matrix
        • LED Segment
        • OLED
        • LCD
        • TFT
        • Click Shields
        • Click Bundles
      • Miscellaneous
        • Relay
        • Optocoupler
        • ID
        • Proto
        • Encryption
        • Click Shields
        • Click Bundles
      • Mixed Signal
        • ADC
        • Measurements
        • DAC
        • Digital potentiometer
        • ADC-DAC
        • Click Shields
        • Click Bundles
      • Storage
        • EEPROM
        • FLASH
        • FRAM
        • microSD
        • MRAM
        • SRAM
        • EERAM
        • ReRAM
        • DRAM
        • Click Shields
        • Click Bundles
      • Motor Control
        • Brushed
        • Brushless
        • Servo
        • Stepper
        • Click Shields
        • Click Bundles
      • Audio & Voice
        • Amplifier
        • Microphone
        • Speakers
        • Signal Processing
        • Speech recognition
        • FM
        • MP3
        • Click Shields
        • Click Bundles
      • HMI
        • Capacitive
        • Pushbutton/Switches
        • Potentiometers
        • Rotary encoder
        • Haptic
        • Fingerprint
        • Click Shields
        • Click Bundles
      • Clock & Timing
        • RTC
        • Clock generator
        • Click Shields
        • Click Bundles
      • Power Management
        • Battery charger
        • Boost
        • Buck
        • Linear
        • Buck-Boost
        • Wireless Charging
        • Power Switch
        • USB-C PD
        • Click Shields
        • Click Bundles
      • Click Bundles
      • Click Shields
    • NECTO
      • NECTO Studio
    • Compilers
      • PIC
        • C
          • NECTO Studio
          • mikroC PRO for PIC
        • Basic
          • mikroBasic PRO for PIC
        • Pascal
          • mikroPascal PRO for PIC
        • Additional Software
          • CODEGRIP WiFi license
          • CODEGRIP SSL license
          • Visual TFT
          • Visual TFT AI
          • Visual GLCD
          • Package Manager
          • mikroBootloader
          • CAN calculator
          • GLCD Font Creator
          • Timer Calculator
          • MikroPlot
      • dsPIC/PIC24
        • C
          • NECTO Studio
          • mikroC PRO for dsPIC
        • Basic
          • mikroBasic PRO for dsPIC
        • Pascal
          • mikroPascal PRO for dsPIC
        • Additional Software
          • CODEGRIP WiFi license
          • CODEGRIP SSL license
          • Visual TFT
          • Visual GLCD
          • Package Manager
          • mikroBootloader
          • CAN calculator
          • GLCD Font Creator
          • Timer Calculator
          • MikroPlot
      • PIC32
        • C
          • NECTO Studio
          • mikroC PRO for PIC32
        • Basic
          • mikroBasic PRO for PIC32
        • Pascal
          • mikroPascal PRO for PIC32
        • Additional Software
          • CODEGRIP WiFi license
          • CODEGRIP SSL license
          • Visual TFT
          • Visual GLCD
          • Package Manager
          • mikroBootloader
          • CAN calculator
          • GLCD Font Creator
          • Timer Calculator
          • MikroPlot
      • ARM
        • C
          • NECTO Studio
          • mikroC PRO for ARM
        • Basic
          • mikroBasic PRO for ARM
        • Pascal
          • mikroPascal PRO for ARM
        • Additional Software
          • CODEGRIP WiFi license
          • CODEGRIP SSL license
          • Visual TFT
          • Visual TFT AI
          • Visual GLCD
          • Package Manager
          • mikroBootloader
          • CAN calculator
          • GLCD Font Creator
          • Timer Calculator
          • MikroPlot
      • AVR
        • C
          • NECTO Studio
          • mikroC PRO for AVR
        • Basic
          • mikroBasic PRO for AVR
        • Pascal
          • mikroPascal PRO for AVR
        • Additional Software
          • CODEGRIP WiFi license
          • CODEGRIP SSL license
          • Visual TFT
          • Visual GLCD
          • Package Manager
          • mikroBootloader
          • CAN calculator
          • GLCD Font Creator
          • Timer Calculator
          • MikroPlot
      • FT90x
        • C
          • mikroC PRO for FT90x
        • Basic
          • mikroBasic PRO for FT90x
        • Pascal
          • mikroPascal PRO for FT90x
        • Additional Software
          • CODEGRIP WiFi license
          • CODEGRIP SSL license
          • Visual TFT
          • Visual GLCD
          • Package Manager
          • mikroBootloader
          • CAN calculator
          • GLCD Font Creator
          • Timer Calculator
          • MikroPlot
      • 8051
        • C
          • mikroC PRO for 8051
        • Basic
          • mikroBasic PRO for 8051
        • Pascal
          • mikroPascal PRO for 8051
        • Additional Software
          • CODEGRIP WiFi license
          • CODEGRIP SSL license
          • Visual TFT
          • Visual GLCD
          • Package Manager
          • mikroBootloader
          • CAN calculator
          • GLCD Font Creator
          • Timer Calculator
          • MikroPlot
    • Dev Boards
      • PIC (8-bit)
        • 8th Generation
          • Fusion for PIC v8
          • EasyPIC PRO v8
          • EasyPIC PRO v8 over USB-C
          • EasyPIC v8
          • EasyPIC v8 over USB-C
          • UNI-DS v8
          • UNI-DS v8 over USB-C
        • 7th Generation
          • EasyPIC PRO v7a
          • PICPLC16 v7a
          • EasyPIC v7a
          • EasyPIC PRO v7
          • EasyPIC v7
        • 6th Generation
          • PICPLC16 v6
      • dsPIC/PIC24 (16-bit)
        • 8th Generation
          • EasyPIC v8 PIC24/dsPIC33
          • EasyPIC v8 for dsPIC30
          • EasyPIC v8 for dsPIC30 over USB-C
          • Fusion for PIC v8
          • UNI-DS v8
          • UNI-DS v8 over USB-C
        • 7th Generation
          • EasyPIC Fusion v7
          • EasyPIC v7 for dsPIC30
        • 6th Generation
          • Easy24-33 v6
      • PIC32 (32-bit)
        • 8th Generation
          • Fusion for PIC32
          • Fusion for PIC32 over USB-C
          • Fusion for PIC v8
          • UNI-DS v8
          • UNI-DS v8 over USB-C
        • 7th Generation
          • EasyPIC Fusion v7
      • ARM (32-bit)
        • 8th Generation
          • Fusion for ARM v8
          • Fusion for ARM v8 over USB-C
          • Fusion for STM32 v8
          • Fusion for STM32 over USB-C
          • Fusion for KINETIS v8
          • Fusion for Kinetis v8 over USB-C
          • Fusion for TIVA v8
          • Fusion for TIVA v8 over USB-C
          • UNI-DS v8
          • UNI-DS v8 over USB-C
        • 7th Generation
          • EasyMx PRO v7a STM32
          • EasyMx PRO v7 STM32
          • EasyMx PRO v7 Tiva
      • AVR (8-bit)
        • 8th Generation
          • EasyAVR v8
          • EasyAVR PRO v8
          • EasyAVR PRO v8 over USB-C
          • UNI-DS v8
          • UNI-DS v8 over USB-C
        • 7th Generation
          • EasyAVR v7
        • 6th Generation
          • AVRPLC16 v6
      • 8051 (8-bit)
        • 7th generation
          • BIG8051
        • 6th Generation
          • Easy8051 v6
      • PSoC (8-bit)
        • 6th Generation
          • UNI-DS6 Development System
      • RISC-V (32bit)
        • 8th Generation
          • UNI-DS v8
          • UNI-DS v8 over USB-C
      • Universal Boards
        • 8th Generation
          • UNI-DS v8
          • UNI-DS v8 over USB-C
          • Fusion for PIC v8
          • Fusion for ARM v8
        • 7th Generation
          • EasyPIC Fusion v7
        • 6th Generation
          • UNI-DS6
          • mikroBoard for PIC 80-pin
          • mikroBoard for AVR
          • mikroBoard for dsPIC
          • mikroBoard for PSoC
          • mikroBoard for 8051
          • mikroBoard for PIC 40-pin
          • mikroBoard for ARM
          • mikroBoard for ARM 144-pin
      • IoT - Wearable
        • Hexiwear
          • Hexiwear
          • Hexiwear Power User Pack
          • Hexiwear Docking Station
          • Hexiwear Battery Pack
          • Hexiwear Color Pack
          • Hexiwear Workstation
      • Analog Boards
        • 7th Generation
          • Analog System Lab Kit PRO
    • Starter Boards
      • PIC (8-bit)
        • Clicker
          • PIC clicker
        • Clicker 2
          • Clicker 2 for PIC18FJ
          • Clicker 2 for PIC18FK
        • Clicker 4
          • Clicker 4 for PIC18F
          • UNI Clicker
        • Ready
          • Ready for PIC Board
          • Ready for PIC (DIP28)
          • PIC-Ready2 Board
          • MMC Ready Board
        • StartUSB
          • StartUSB for PIC
      • dsPIC/PIC24 (16-bit)
        • Clicker 2
          • Clicker 2 for PIC24
          • Clicker 2 for dsPIC33
        • Clicker 4
          • UNI Clicker
        • Ready
          • dsPIC-Ready1 Board
          • dsPIC-Ready2 Board
          • DsPIC-Ready3 Board
          • dsPIC-Ready4 Board
      • PIC32 (32-bit)
        • Clicker
          • PIC32MX clicker
          • 6LoWPAN Clicker
          • PIC32MZ clicker
        • Clicker 2
          • Clicker 2 for PIC32MX
          • Clicker 2 for PIC32MZ
        • Clicker 4
          • UNI Clicker
        • MINI
          • MINI-32 Board
          • MINI-32 for PIC32MZ
        • Flip&Click
          • Flip&Click PIC32MZ
      • ARM (32-bit)
        • Clicker
          • RA4M1 Clicker
          • Kinetis Clicker
          • MSP432 Clicker
          • CEC1702 clicker
          • CEC1302 Clicker
          • STM32 M4 clicker
        • Clicker 2
          • Clicker 2 for STM32
          • Clicker 2 for Kinetis
          • Clicker 2 for CEC1702
          • Clicker 2 for MSP432
          • Clicker 2 for CEC1302
          • Clicker 2 for PSoC 6
        • Clicker 4
          • Clicker 4 for STM32F745VG
          • Clicker 4 for STM32F4
          • Clicker 4 for TMPM3H
          • Clicker 4 for TMPM4K
          • Clicker 4 for STM32
          • UNI Clicker
        • MINI
          • MINI-M4 for STM32
          • MINI-M4 For Kinetis
          • MINI-M4 for Tiva
          • MINI-M4 for Stellaris
          • MINI-M4 for MSP432
          • MINI-M0 for STM32
        • Flip&Click
          • Flip&Click SAM3X
      • AVR (8-bit)
        • Clicker 4
          • UNI Clicker
        • MINI
          • MINI-AT Board - 3.3V
          • MINI-AT Board - 5V
        • Ready
          • Ready for AVR Board
          • Ready For XMEGA
          • mikroXMEGA Board
          • AVR-Ready2 Board
        • StartUSB
          • StartUSB for AVR
      • 8051 (8-bit)
        • Ready
          • 8051-Ready Board
      • FT90x (32-bit)
        • Clicker 2
          • Clicker 2 for FT90x
      • Miscellaneous
        • USB
          • USB Wizard
          • Quail
          • FlowPaw Kit
      • Universal Boards
        • Clicker 4
          • UNI Clicker
    • Prog-Debug
      • PIC (8-bit)
        • CODEGRIP
          • UNI CODEGRIP
          • UNI CODEGRIP - USB-C
          • CODEGRIP for PIC
          • CODEGRIP for PIC USB-C
        • mikroProg
          • mikroProg for PIC
      • dsPIC/PIC24 (16-bit)
        • CODEGRIP
          • UNI CODEGRIP
          • UNI CODEGRIP - USB-C
          • CODEGRIP for PIC
        • mikroProg
          • mikroProg for dsPIC
      • PIC32 (32-bit)
        • CODEGRIP
          • UNI CODEGRIP
          • UNI CODEGRIP - USB-C
          • CODEGRIP for PIC
          • CODEGRIP for PIC USB-C
        • mikroProg
          • mikroProg for PIC32
      • ARM (32-bit)
        • CODEGRIP
          • UNI CODEGRIP
          • UNI CODEGRIP USB-C
          • CODEGRIP for ARM
          • CODEGRIP for ARM USB-C
          • CODEGRIP for STM32
          • CODEGRIP for KINETIS
          • CODEGRIP for Tiva
          • CODEGRIP for Tiva USB-C
        • mikroProg
          • mikroProg for STM32
          • mikroProg for Tiva
          • mikroProg for Kinetis
          • mikroProg for CEC
          • mikroProg for MSP432
          • mikroProg for PSoC 5LP
      • AVR (8-bit)
        • CODEGRIP
          • CODEGRIP for AVR
          • CODEGRIP for AVR - USB-C
          • UNI CODEGRIP
          • UNI CODEGRIP - USB-C
        • mikroProg
          • mikroProg for AVR
      • 8051 (8-bit)
        • mikroProg
          • mikroProg for 8051
      • FT90x (32-bit)
        • mikroProg
          • mikroProg for FT90x
    • Smart Displays
      • 2.8"
        • ARM (32-bit)
        • AVR (8-bit)
        • dsPIC/PIC24 (16-bit)
        • PIC (8-bit)
        • PIC32 (32-bit)
      • 3.5"
        • ARM (32-bit)
        • FT90x (32-bit)
        • PIC (8-bit)
        • PIC32 (32-bit)
      • 4.3"
        • ARM (32-bit)
        • FT90x (32-bit)
        • PIC (8-bit)
        • PIC32 (32-bit)
      • 5"
        • ARM (32-bit)
        • FT90x (32-bit)
        • PIC32 (32-bit)
      • 7"
        • ARM (32-bit)
        • FT90x (32-bit)
    • MCU Cards
      • PIC (8-bit)
        • 8th Generation
        • 7th Generation
        • 6th Generation
      • dsPIC/PIC24 (16-bit)
        • 8th Generation
        • 7th Generation
        • 6th Generation
      • PIC32 (32-bit)
        • 8th Generation
        • 7th Generation
      • ARM (32-bit)
        • 8th Generation
        • 7th Generation
      • AVR (8-bit)
        • 8th Generation
      • RISC-V (32bit)
        • 8th Generation
    • Accessories
      • TFT Displays
      • LCD Displays
      • LED Displays
      • E-Paper Displays
      • Sensors
      • Headers and Connectors
      • Wire Jumpers and Cables
      • Antennas
      • Batteries
      • RFID/NFC
      • Proto
      • Motors
      • Storage
      • Power
      • Adapters
      • Interface
      • Input/Output
      • Miscellaneous
      • FANware
      • MCUs
      • Books
    • Kits
      • PIC Kits
      • dsPIC/PIC24 Kits
      • PIC32 Kits
      • ARM Kits
      • AVR Kits
      • FT90x Kits
      • 8051 Kits
  • Shop
  • EmbeddedWiki
  • Support
    • Helpdesk
    • Contact us
    • Forum
    • LibStock
    • Learn
    • Let's make
    • Books
  • Services
    • Planet Debug
    • Design Service
    • Product Customization
    • Contract Manufacturing
    • Premium Technical Support
  • News
  • My profile
  • Privacy settings
  • Activity
  • Sign out

Your shoppingcart is empty.
Continue shopping.

MikroElektronika white logo
  • Products
    • click boards icon Click Boards
      • Wireless Connectivity
        • GPS/GNSS
        • GSM/LTE
        • LTE IoT
        • BT/BLE
        • WiFi
        • RFID/NFC
        • GSM+GPS
        • 6LoWPAN
        • ZigBee
        • UWB
        • SigFox
        • Sub-1 GHz Transceievers
        • 2.4 GHz Trancevers
        • LoRa
        • WiFi+BLE
      • Sensors
        • Biometrics
        • Gas
        • Magnetic
        • Motion
        • Optical
        • Pressure
        • Proximity
        • Temperature & humidity
        • Current sensor
        • Miscellaneous
        • Environmental
        • Force
        • Inductance
        • RF meter
        • Click Shields
        • Click Bundles
      • Interface
        • Adapter
        • CAN
        • Port expander
        • RS485
        • USB
        • 1-Wire
        • RS232
        • Ethernet
        • LIN
        • PWM
        • Current
        • DALI
        • I2C
        • Fiber optics
        • SPI
        • DMX
        • CXPI
        • Click Shields
        • Click Bundles
      • Display & LED
        • LED Drivers
        • LED Matrix
        • LED Segment
        • OLED
        • LCD
        • TFT
        • Click Shields
        • Click Bundles
      • Miscellaneous
        • Relay
        • Optocoupler
        • ID
        • Proto
        • Encryption
        • Click Shields
        • Click Bundles
      • Mixed Signal
        • ADC
        • Measurements
        • DAC
        • Digital potentiometer
        • ADC-DAC
        • Click Shields
        • Click Bundles
      • Storage
        • EEPROM
        • FLASH
        • FRAM
        • microSD
        • MRAM
        • SRAM
        • EERAM
        • ReRAM
        • DRAM
        • Click Shields
        • Click Bundles
      • Motor Control
        • Brushed
        • Brushless
        • Servo
        • Stepper
        • Click Shields
        • Click Bundles
      • Audio & Voice
        • Amplifier
        • Microphone
        • Speakers
        • Signal Processing
        • Speech recognition
        • FM
        • MP3
        • Click Shields
        • Click Bundles
      • HMI
        • Capacitive
        • Pushbutton/Switches
        • Potentiometers
        • Rotary encoder
        • Haptic
        • Fingerprint
        • Click Shields
        • Click Bundles
      • Clock & Timing
        • RTC
        • Clock generator
        • Click Shields
        • Click Bundles
      • Power Management
        • Battery charger
        • Boost
        • Buck
        • Linear
        • Buck-Boost
        • Wireless Charging
        • Power Switch
        • USB-C PD
        • Click Shields
        • Click Bundles
      • Click Bundles
      • Click Shields
    • necto icon NECTO
      • NECTO Studio
    • compilers icon Compilers
      • PIC
        • C
          • NECTO Studio
          • mikroC PRO for PIC
        • Basic
          • mikroBasic PRO for PIC
        • Pascal
          • mikroPascal PRO for PIC
        • Additional Software
          • CODEGRIP WiFi license
          • CODEGRIP SSL license
          • Visual TFT
          • Visual TFT AI
          • Visual GLCD
          • Package Manager
          • mikroBootloader
          • CAN calculator
          • GLCD Font Creator
          • Timer Calculator
          • MikroPlot
      • dsPIC/PIC24
        • C
          • NECTO Studio
          • mikroC PRO for dsPIC
        • Basic
          • mikroBasic PRO for dsPIC
        • Pascal
          • mikroPascal PRO for dsPIC
        • Additional Software
          • CODEGRIP WiFi license
          • CODEGRIP SSL license
          • Visual TFT
          • Visual GLCD
          • Package Manager
          • mikroBootloader
          • CAN calculator
          • GLCD Font Creator
          • Timer Calculator
          • MikroPlot
      • PIC32
        • C
          • NECTO Studio
          • mikroC PRO for PIC32
        • Basic
          • mikroBasic PRO for PIC32
        • Pascal
          • mikroPascal PRO for PIC32
        • Additional Software
          • CODEGRIP WiFi license
          • CODEGRIP SSL license
          • Visual TFT
          • Visual GLCD
          • Package Manager
          • mikroBootloader
          • CAN calculator
          • GLCD Font Creator
          • Timer Calculator
          • MikroPlot
      • ARM
        • C
          • NECTO Studio
          • mikroC PRO for ARM
        • Basic
          • mikroBasic PRO for ARM
        • Pascal
          • mikroPascal PRO for ARM
        • Additional Software
          • CODEGRIP WiFi license
          • CODEGRIP SSL license
          • Visual TFT
          • Visual TFT AI
          • Visual GLCD
          • Package Manager
          • mikroBootloader
          • CAN calculator
          • GLCD Font Creator
          • Timer Calculator
          • MikroPlot
      • AVR
        • C
          • NECTO Studio
          • mikroC PRO for AVR
        • Basic
          • mikroBasic PRO for AVR
        • Pascal
          • mikroPascal PRO for AVR
        • Additional Software
          • CODEGRIP WiFi license
          • CODEGRIP SSL license
          • Visual TFT
          • Visual GLCD
          • Package Manager
          • mikroBootloader
          • CAN calculator
          • GLCD Font Creator
          • Timer Calculator
          • MikroPlot
      • FT90x
        • C
          • mikroC PRO for FT90x
        • Basic
          • mikroBasic PRO for FT90x
        • Pascal
          • mikroPascal PRO for FT90x
        • Additional Software
          • CODEGRIP WiFi license
          • CODEGRIP SSL license
          • Visual TFT
          • Visual GLCD
          • Package Manager
          • mikroBootloader
          • CAN calculator
          • GLCD Font Creator
          • Timer Calculator
          • MikroPlot
      • 8051
        • C
          • mikroC PRO for 8051
        • Basic
          • mikroBasic PRO for 8051
        • Pascal
          • mikroPascal PRO for 8051
        • Additional Software
          • CODEGRIP WiFi license
          • CODEGRIP SSL license
          • Visual TFT
          • Visual GLCD
          • Package Manager
          • mikroBootloader
          • CAN calculator
          • GLCD Font Creator
          • Timer Calculator
          • MikroPlot
    • dev boards icon Dev Boards
      • PIC (8-bit)
        • 8th Generation
          • Fusion for PIC v8
          • EasyPIC PRO v8
          • EasyPIC PRO v8 over USB-C
          • EasyPIC v8
          • EasyPIC v8 over USB-C
          • UNI-DS v8
          • UNI-DS v8 over USB-C
        • 7th Generation
          • EasyPIC PRO v7a
          • PICPLC16 v7a
          • EasyPIC v7a
          • EasyPIC PRO v7
          • EasyPIC v7
        • 6th Generation
          • PICPLC16 v6
      • dsPIC/PIC24 (16-bit)
        • 8th Generation
          • EasyPIC v8 PIC24/dsPIC33
          • EasyPIC v8 for dsPIC30
          • EasyPIC v8 for dsPIC30 over USB-C
          • Fusion for PIC v8
          • UNI-DS v8
          • UNI-DS v8 over USB-C
        • 7th Generation
          • EasyPIC Fusion v7
          • EasyPIC v7 for dsPIC30
        • 6th Generation
          • Easy24-33 v6
      • PIC32 (32-bit)
        • 8th Generation
          • Fusion for PIC32
          • Fusion for PIC32 over USB-C
          • Fusion for PIC v8
          • UNI-DS v8
          • UNI-DS v8 over USB-C
        • 7th Generation
          • EasyPIC Fusion v7
      • ARM (32-bit)
        • 8th Generation
          • Fusion for ARM v8
          • Fusion for ARM v8 over USB-C
          • Fusion for STM32 v8
          • Fusion for STM32 over USB-C
          • Fusion for KINETIS v8
          • Fusion for Kinetis v8 over USB-C
          • Fusion for TIVA v8
          • Fusion for TIVA v8 over USB-C
          • UNI-DS v8
          • UNI-DS v8 over USB-C
        • 7th Generation
          • EasyMx PRO v7a STM32
          • EasyMx PRO v7 STM32
          • EasyMx PRO v7 Tiva
      • AVR (8-bit)
        • 8th Generation
          • EasyAVR v8
          • EasyAVR PRO v8
          • EasyAVR PRO v8 over USB-C
          • UNI-DS v8
          • UNI-DS v8 over USB-C
        • 7th Generation
          • EasyAVR v7
        • 6th Generation
          • AVRPLC16 v6
      • 8051 (8-bit)
        • 7th generation
          • BIG8051
        • 6th Generation
          • Easy8051 v6
      • PSoC (8-bit)
        • 6th Generation
          • UNI-DS6 Development System
      • RISC-V (32bit)
        • 8th Generation
          • UNI-DS v8
          • UNI-DS v8 over USB-C
      • Universal Boards
        • 8th Generation
          • UNI-DS v8
          • UNI-DS v8 over USB-C
          • Fusion for PIC v8
          • Fusion for ARM v8
        • 7th Generation
          • EasyPIC Fusion v7
        • 6th Generation
          • UNI-DS6
          • mikroBoard for PIC 80-pin
          • mikroBoard for AVR
          • mikroBoard for dsPIC
          • mikroBoard for PSoC
          • mikroBoard for 8051
          • mikroBoard for PIC 40-pin
          • mikroBoard for ARM
          • mikroBoard for ARM 144-pin
      • IoT - Wearable
        • Hexiwear
          • Hexiwear
          • Hexiwear Power User Pack
          • Hexiwear Docking Station
          • Hexiwear Battery Pack
          • Hexiwear Color Pack
          • Hexiwear Workstation
      • Analog Boards
        • 7th Generation
          • Analog System Lab Kit PRO
    • starter boards icon Starter Boards
      • PIC (8-bit)
        • Clicker
          • PIC clicker
        • Clicker 2
          • Clicker 2 for PIC18FJ
          • Clicker 2 for PIC18FK
        • Clicker 4
          • Clicker 4 for PIC18F
          • UNI Clicker
        • Ready
          • Ready for PIC Board
          • Ready for PIC (DIP28)
          • PIC-Ready2 Board
          • MMC Ready Board
        • StartUSB
          • StartUSB for PIC
      • dsPIC/PIC24 (16-bit)
        • Clicker 2
          • Clicker 2 for PIC24
          • Clicker 2 for dsPIC33
        • Clicker 4
          • UNI Clicker
        • Ready
          • dsPIC-Ready1 Board
          • dsPIC-Ready2 Board
          • DsPIC-Ready3 Board
          • dsPIC-Ready4 Board
      • PIC32 (32-bit)
        • Clicker
          • PIC32MX clicker
          • 6LoWPAN Clicker
          • PIC32MZ clicker
        • Clicker 2
          • Clicker 2 for PIC32MX
          • Clicker 2 for PIC32MZ
        • Clicker 4
          • UNI Clicker
        • MINI
          • MINI-32 Board
          • MINI-32 for PIC32MZ
        • Flip&Click
          • Flip&Click PIC32MZ
      • ARM (32-bit)
        • Clicker
          • RA4M1 Clicker
          • Kinetis Clicker
          • MSP432 Clicker
          • CEC1702 clicker
          • CEC1302 Clicker
          • STM32 M4 clicker
        • Clicker 2
          • Clicker 2 for STM32
          • Clicker 2 for Kinetis
          • Clicker 2 for CEC1702
          • Clicker 2 for MSP432
          • Clicker 2 for CEC1302
          • Clicker 2 for PSoC 6
        • Clicker 4
          • Clicker 4 for STM32F745VG
          • Clicker 4 for STM32F4
          • Clicker 4 for TMPM3H
          • Clicker 4 for TMPM4K
          • Clicker 4 for STM32
          • UNI Clicker
        • MINI
          • MINI-M4 for STM32
          • MINI-M4 For Kinetis
          • MINI-M4 for Tiva
          • MINI-M4 for Stellaris
          • MINI-M4 for MSP432
          • MINI-M0 for STM32
        • Flip&Click
          • Flip&Click SAM3X
      • AVR (8-bit)
        • Clicker 4
          • UNI Clicker
        • MINI
          • MINI-AT Board - 3.3V
          • MINI-AT Board - 5V
        • Ready
          • Ready for AVR Board
          • Ready For XMEGA
          • mikroXMEGA Board
          • AVR-Ready2 Board
        • StartUSB
          • StartUSB for AVR
      • 8051 (8-bit)
        • Ready
          • 8051-Ready Board
      • FT90x (32-bit)
        • Clicker 2
          • Clicker 2 for FT90x
      • Miscellaneous
        • USB
          • USB Wizard
          • Quail
          • FlowPaw Kit
      • Universal Boards
        • Clicker 4
          • UNI Clicker
    • prog-debug icon Prog-Debug
      • PIC (8-bit)
        • CODEGRIP
          • UNI CODEGRIP
          • UNI CODEGRIP - USB-C
          • CODEGRIP for PIC
          • CODEGRIP for PIC USB-C
        • mikroProg
          • mikroProg for PIC
      • dsPIC/PIC24 (16-bit)
        • CODEGRIP
          • UNI CODEGRIP
          • UNI CODEGRIP - USB-C
          • CODEGRIP for PIC
        • mikroProg
          • mikroProg for dsPIC
      • PIC32 (32-bit)
        • CODEGRIP
          • UNI CODEGRIP
          • UNI CODEGRIP - USB-C
          • CODEGRIP for PIC
          • CODEGRIP for PIC USB-C
        • mikroProg
          • mikroProg for PIC32
      • ARM (32-bit)
        • CODEGRIP
          • UNI CODEGRIP
          • UNI CODEGRIP USB-C
          • CODEGRIP for ARM
          • CODEGRIP for ARM USB-C
          • CODEGRIP for STM32
          • CODEGRIP for KINETIS
          • CODEGRIP for Tiva
          • CODEGRIP for Tiva USB-C
        • mikroProg
          • mikroProg for STM32
          • mikroProg for Tiva
          • mikroProg for Kinetis
          • mikroProg for CEC
          • mikroProg for MSP432
          • mikroProg for PSoC 5LP
      • AVR (8-bit)
        • CODEGRIP
          • CODEGRIP for AVR
          • CODEGRIP for AVR - USB-C
          • UNI CODEGRIP
          • UNI CODEGRIP - USB-C
        • mikroProg
          • mikroProg for AVR
      • 8051 (8-bit)
        • mikroProg
          • mikroProg for 8051
      • FT90x (32-bit)
        • mikroProg
          • mikroProg for FT90x
    • smart displays icon Smart Displays
      • 2.8"
        • ARM (32-bit)
        • AVR (8-bit)
        • dsPIC/PIC24 (16-bit)
        • PIC (8-bit)
        • PIC32 (32-bit)
      • 3.5"
        • ARM (32-bit)
        • FT90x (32-bit)
        • PIC (8-bit)
        • PIC32 (32-bit)
      • 4.3"
        • ARM (32-bit)
        • FT90x (32-bit)
        • PIC (8-bit)
        • PIC32 (32-bit)
      • 5"
        • ARM (32-bit)
        • FT90x (32-bit)
        • PIC32 (32-bit)
      • 7"
        • ARM (32-bit)
        • FT90x (32-bit)
    • mcu cards icon MCU Cards
      • PIC (8-bit)
        • 8th Generation
        • 7th Generation
        • 6th Generation
      • dsPIC/PIC24 (16-bit)
        • 8th Generation
        • 7th Generation
        • 6th Generation
      • PIC32 (32-bit)
        • 8th Generation
        • 7th Generation
      • ARM (32-bit)
        • 8th Generation
        • 7th Generation
      • AVR (8-bit)
        • 8th Generation
      • RISC-V (32bit)
        • 8th Generation
    • accessories icon Accessories
      • TFT Displays
      • LCD Displays
      • LED Displays
      • E-Paper Displays
      • Sensors
      • Headers and Connectors
      • Wire Jumpers and Cables
      • Antennas
      • Batteries
      • RFID/NFC
      • Proto
      • Motors
      • Storage
      • Power
      • Adapters
      • Interface
      • Input/Output
      • Miscellaneous
      • FANware
      • MCUs
      • Books
    • kits icon Kits
      • PIC Kits
      • dsPIC/PIC24 Kits
      • PIC32 Kits
      • ARM Kits
      • AVR Kits
      • FT90x Kits
      • 8051 Kits
  • Shop
  • EmbeddedWiki
  • Support
    • Helpdesk
    • Contact us
    • Forum
    • LibStock
    • Learn
    • Let's make
    • Books
  • Services
    • Planet Debug
    • Design Service
    • Product Customization
    • Contract Manufacturing
    • Premium Technical Support
  • News
  • Price :

    More info
Reset filter
  • 0
Authentication
Account

Create account

Forgot your password?

Your cart is empty !
View cart ( )
  1. Home
  2. ebooks
  3. PIC Microcontrollers - Programming in Basic
  4. analog-modules
MikroElektronika books

3.9 Analog Modules

 

In addition to a large number of digital I/O pins used for communication with peripheral modules, the PIC16F887 also has 14 analog inputs. They enable the microcontroller to recognize not only whether a pin is driven low or high (0 or +5V), but to precisely measure its voltage and convert it into numerical value, i.e. digital format.

One of the most important analog modules within the microcontroller is an A/D converter which has the following features:
  • Conversion is performed by applying the method of successive approximation;
  • There are 14 separate analog inputs connected to the microcontroller port pins;
  • The A/D converter converts an analog input signal into a 10-bit binary number;
  • The resolution, i.e. the quality of conversion may be adjusted to various needs by selecting voltage references Vref- and Vref+.
pic-microcontrollers-programming-in-basic-chapter-03-image-130

A/D CONVERTER

Even though the use of A/D converter seems to be very complicated, it is basically very simple, simpler than the use of timers and serial communication modules, anyway.
pic-microcontrollers-programming-in-basic-chapter-03-image-131
The operation of A/D converter is in control of the bits of four registers:
  • ADRESH Contains high byte of conversion result;
  • ADRESL Contains low byte of conversion result;
  • ADCON0 Control register 0; and
  • ADCON1 Control register 1.

ADRESH and ADRESL Registers

The process of converting an analog value into digital has as a result a 10-bit number to be stored in the ADRESH and ADRESL registers. There are two ways of handling this number - left and right justification which simplifies its use to a great extent. The format of conversion result depends on the ADFM bit of the ADCON1 register. In case the A/D converter is not used, ADRESH and ADRESL registers may be used as general-purpose registers.
pic-microcontrollers-programming-in-basic-chapter-03-image-132

A/D ACQUISITION REQUIREMENTS

For the voltage to be accurately measured by means of the A/D converter, it is necessary to provide a certain time delay between the selection of an analog input and measurement itself. Such time delay is called ‘acquisition time’ and mainly depends on the source impedance. There is an equation used to calculate this time delay accurately, which in the worst case amounts to approximately 20uS. So, if you want the A/D conversion to be accurate, don’t forget this small detail.

ADC CLOCK PERIOD

The time needed to complete a single-bit conversion is referred to as TAD. It is required to be at least 1,6 uS. One full 10-bit A/D conversion is a little bit longer than expected and amounts to 11 TAD periods. Since both device clock frequency and A/D conversion clock source are specified by software, it is necessary to select one of the available combinations of bits ADCS1 and ADCS0 before the voltage measurement on some of the analog inputs starts. These bits are stored in the ADCON0 register.
ADC CLOCK SOURCE ADCS1 ADCS0 DEVICE FREQUENCY (FOSC)
20 Mhz 8 Mhz 4 Mhz 1 Mhz
Fosc/2 0 0 100 nS 250 nS 500 nS 2 uS
Fosc/8 0 1 400 nS 1 uS 2 uS 8 uS
Fosc/32 1 0 1.6 uS 4 uS 8 uS 32 uS
Frc 1 1 2 - 6 uS 2 - 6 uS 2 - 6 uS 2 - 6 uS
Any change of the microcontroller clock frequency will affect the A/D conversion speed, which may adversely affect the ADC result. The table abowe shows some of the possible device clock frequencies as well as how they affect the speed of A/D conversion. The values in the shaded cells are outside of the recommended range.
pic-microcontrollers-programming-in-basic-chapter-03-image-133

HOW TO USE THE A/D CONVERTER?

In order to enable the A/D converter to run properly as well as to avoid unexpected results, it is necessary to consider the following:
  • The A/D converter does not differ between digital and analog signals. In order to avoid errors in measurement or to prevent the chip from being damaged, all A/D input pins should be configured as analog inputs before the process of conversion starts. The appropriate bits are stored in the TRIS and ANSEL (ANSELH) registers;
  • When reading the port with analog inputs marked as CH0-CH13, the state of the corresponding bits, i.e. their digital value will be read as a logic zero (0); and
  • Roughly speaking, the process of measuring voltage by the converter is based on comparing input voltage to an immaginary scale with 1024 grades (210 = 1024). The lowest mark is referred to as the Vref- voltage, while the highest one is referred to as the Vref+ voltage. Figure below shows selectable voltage references and their cutoff values, as well.
pic-microcontrollers-programming-in-basic-chapter-03-image-134

ADCON0 Register

pic-microcontrollers-programming-in-basic-chapter-03-image-135
ADCS1, ADCS0 - A/D Conversion Clock Select bits select clock frequency used for internal synchronization of A/D converter. It also affects the speed of A/D conversion.
ADCS1 ADCS2 CLOCK
0 0 Fosc/2
0 1 Fosc/8
1 0 Fosc/32
1 1 RC *
* Clock is generated by the internal oscillator built into the A/D converter. CHS3-CHS0 - Analog Channel Select bits select a pin (an analog input) for A/D conversion, i.e. voltage measurement:
CHS3 CHS2 CHS1 CHS0 CHANNEL PIN
0 0 0 0 0 RA0/AN0
0 0 0 1 1 RA1/AN1
0 0 1 0 2 RA2/AN2
0 0 1 1 3 RA3/AN3
0 1 0 0 4 RA5/AN4
0 1 0 1 5 RE0/AN5
0 1 1 0 6 RE1/AN6
0 1 1 1 7 RE2/AN7
1 0 0 0 8 RB2/AN8
1 0 0 1 9 RB3/AN9
1 0 1 0 10 RB1/AN10
1 0 1 1 11 RB4/AN11
1 1 0 0 12 RB0/AN12
1 1 0 1 13 RB5/AN13
1 1 1 0 CVref
1 1 1 1 Vref = 0.6V
GO/DONE - A/D Conversion Status bit determines current status of conversion:
  • 1 - A/D conversion is in progress.
  • 0 - A/D conversion is complete. This bit is automatically cleared after completing A/D conversion.
ADON - A/D On bit enables A/D converter.
  • 1 - A/D converter is enabled.
  • 0 - A/D converter is disabled.
Let's do it in mikroBasic...
'This example code reads analog value from channel 2 and displays it on PORTB and PORTC
'as a 10-bit binary number.

dim adc_rd as word
main:
ANSEL = 0x04 ' Configure AN2 as an analog pin
TRISA = 0xFF ' PORTA is configured as an input
ANSELH = 0 ' Configure all other AN pins as digital I/O
TRISC = 0x3F ' Pins RC7 and RC6 are configured as outputs
TRISB = 0 ' PORTB is configured as an output
while 1
temp_res = ADC_Read(2) ' Get a 10-bit result of AD conversion
PORTB = temp_res ' Send lower 8 bits to PORTB
PORTC = temp_res >> 2 ' Send 2 most significant bits to RC7 and RC6
wend ' Remain in the loop
end.

ADCON1 Register

pic-microcontrollers-programming-in-basic-chapter-03-image-136
ADFM - A/D Result Format Select bit
  • 1 - Conversion result is right justified. Six most significant bits of the ADRESH register are not used.
  • 0 - Conversion result is left justified. Six least significant bits of the ADRESL register are not used.
VCFG1 - Voltage Reference bit selects the negative voltage reference source for the operation of A/D converter.
  • 1 - The Vref- pin is fed with negative voltage reference.
  • 0 - Power supply voltage Vss is used as a negative voltage reference source.
VCFG0 - Voltage Reference bit selects the positive voltage reference source for the operation of A/D converter.
  • 1 - The Vref+ pin is fed with positive voltage reference.
  • 0 - Power supply voltage Vdd is used as a positive voltage reference source.

In Short

Using A/D converter

In order to measure voltage on an input pin by means of the A/D converter, the following should be done: Step 1 - Port configuration:
  • Write a logic one (1) to a bit of the TRIS register to configure the appropriate pin as an input.
  • Write a logic one (1) to a bit of the ANSEL register to configure the appropriate pin as an analog input.
Step 2 - ADC module configuration:
  • Configure voltage reference in the ADCON1 register.
  • Select A/D conversion clock in the ADCON0 register.
  • Select one of input channels CH0-CH13 of the ADCON0 register.
  • Select data format using the ADFM bit of the ADCON1 register.
  • Enable the A/D converter by setting the ADON bit of the ADCON0 register.
Step 3 - ADC interrupt configuration (optionally):
  • Clear the ADIF bit.
  • Set bits ADIE, PEIE and GIE.
Step 4 - Wait for the required acquisition time to pass (approximately 20uS). Step 5 - Start conversion by setting the GO/DONE bit of the ADCON0 register. Step 6 - Wait for the A/D conversion to be completed.
  • Check in the program whether the GO/DONE bit is cleared or wait for an A/D interrupt to occur (must be previously enabled).
Step 7 - Read conversion results:
  • Read registers ADRESH and ADRESL.
 

ANALOG COMPARATOR

In addition to the A/D converter, there is another module, which until quite recently was only built into integrated circuits belonging to the so called analog electronics. Owing to the fact that it is hardly possible to find any more complex device in automatics which in some way does not use these modules, two high quality analog comparators are integrated into the microcontroller and connected to its pins. How does an analog comparator operate? Basically, the analog comparator is an amplifier provided with two inputs and one output. It compares the magnitude of voltages at two inputs. Depending on which input has a higher voltage (an analog value), a logic zero (0) or a logic one (1) (digital values) will appear on its output:
pic-microcontrollers-programming-in-basic-chapter-03-image-137
  • When the analog voltage at Vin- is higher than that at Vin+, the output of the comparator is a digital low level (0).
  • When the analog voltage at Vin+ is higher than that at Vin-, the output of the comparator is a digital high level (1).
The PIC16F887 microcontroller is provided with two such analog comparators the inputs of which are connected to I/O pins RA0-RA3, while their outputs are connected to the RA4 and RA5 pins. There is also an adjustable voltage reference internal source within the microcontroller itself, which will be discussed later. These two analog modules are under control of the bits of the following registers:
  • CM1CON0 is in control of comparator C1;
  • CM2CON0 is in control of comparator C2;
  • CM2CON1 is in control of comparator C2;

VOLTAGE REFERENCE INTERNAL SOURCE

One of two analog voltages provided on the analog comparator inputs is fixed and constant. This voltage is known as a ‘voltage reference’ (Vref) and can be generated either by external or internal voltage source. The voltage source is selectable via both ends of a ladder network consisting of 16 resistors which together form a voltage divider. The VRSS bit of the VRCON register is used for selecting the source of reference voltage. The comparator voltage reference module provides an internally generated voltage reference for the comparators (CVref). The CVref voltage reference has 2 ranges each containing 16 voltage levels. Range selection is controlled by the VRR bit of the VRCON register. The selected voltage range may be output to the RA2/AN2 pin using the VROE bit. Furthermore, bits VR0-VR3 are used to select appropriate voltage levels. See figure below.
pic-microcontrollers-programming-in-basic-chapter-03-image-138
Although the main idea with the voltage reference module was to provide analog modules with varying voltage reference, it is now used as a D/A converter as well. As such, it proved to be very useful in some applications. Its operation is under control of the VRCON register.

COMPARATORS AND INTERRUPT

Every change of the logic state of any comparator’s output causes the CMIF flag bit of the PIR register to be set. Such changes will also generate an interrupt if the following bits are set:
  • The CMIE bit of the PIE register = 1;
  • The PEIE bit of the INTCON register = 1; and
  • The GIE bit of the INTCON register = 1.
If an interrupt is enabled when the microcontroller is in Sleep mode, any change on the comparator’s output will cause the microcontroller to exit this mode and proceed with the normal operation.

OPERATION OF COMPARATOR IN SLEEP MODE

The comparator, if enabled before the microcontroller enters Sleep mode, remains active. In case the comparator is not used to wake up the microcontroller, it can be turned off to minimize power consumption. It is done by clearing the CxON bit of the CMxCON0 register. To enable the comparator to wake up the microcontroller from sleep, the CxIE bit of the IE2 register and the PEIE bit of the INTCON register must be set. The first instruction to be executed after the microcontroller exits the sleep mode is the one following the sleep instruction. If the GIE bit of the INTCON register is set, the microcontroller will execute the Interrupt Service Routine first.

CM1CON0 Register

pic-microcontrollers-programming-in-basic-chapter-03-image-139
Bits of the CM1CON0 register are in control of the comparator C1. It mainly refers to the connection of its inputs. Figure below shows a part of the module directly affected by the bits of this register.
pic-microcontrollers-programming-in-basic-chapter-03-image-140
C1ON - Comparator C1 Enable bit enables comparator C1.
  • 1 - Comparator C1 is enabled.
  • 0 - Comparator C1 is disabled.
C1OUT - Comparator C1 Output bit is the output of the comparator C1. If C1POL = 1 (comparator output is inverted)
  • 1 - Analog voltage at C1Vin+ is lower than analog voltage at C1Vin-.
  • 0 - Analog voltage at C1Vin+ is higher than analog voltage at C1Vin-.
If C1POL = 0 (comparator output is non-inverted)
  • 1 - Analog voltage at C1Vin+ is higher than analog voltage at C1Vin-.
  • 0 - Analog voltage at C1Vin+ is lower than analog voltage at C1Vin-.
C1OE Comparator C1 Output Enable bit.
  • 1 - Comparator C1OUT output is connected to the C1OUT pin.*
  • 0 - Comparator output is only used internally.

* In order to enable the state of the C1OUT bit to be present on the pin, two conditions must be met: C1ON = 1 (comparator must be enabled) and the corresponding pin must be configured as an output (TRIS bit = 0).

C1POL - Comparator C1 Output Polarity Select bit enables the state of the comparator C1 output to be inverted.
  • 1 - Comparator C1 output is inverted.
  • 0 - Comparator C1 output is non-inverted.
C1R - Comparator C1 Reference Select bit
  • 1 - Non-inverting input C1Vin+ is connected to the voltage reference C1Vref.
  • 0 - Non-inverting input C1Vin+ is connected to the C1IN+ pin.
C1CH1, C1CH0 - Comparator C1 Channel Select bit
C1CH1 C1CH0 COMPARATOR C1VIN- INPUT
0 0 Input C1Vin- is connected to the C12IN0- pin
0 1 Input C1Vin- is connected to the C12IN1- pin
1 0 Input C1Vin- is connected to the C12IN2- pin
1 1 Input C1Vin- is connected to the C12IN3- pin

CM2CON0 Register

pic-microcontrollers-programming-in-basic-chapter-03-image-141
Bits of the CM2CON0 register are in control of the comparator C2. Similar to the previous case, figure below shows a simplified schematic of the circuit affected by the bits of this register.
pic-microcontrollers-programming-in-basic-chapter-03-image-142
C2ON - Comparator C2 Enable bit enables comparator C2.
  • 1 - Comparator C2 is enabled; and
  • 0 - Comparator C2 is disabled.
C2OUT - Comparator C2 Output bit is the output of the comparator C2. If C2POL = 1 (comparator output inverted)
  • 1 - Analog voltage at C2Vin+ is lower than analog voltage at C2Vin-.
  • 0 - Analog voltage at C2Vin+ is higher than analog voltage at C2Vin-.
If C2POL = 0 (comparator output is non-inverted)
  • 1 - Analog voltage at C2Vin+ is higher than analog voltage at C2Vin-.
  • 0 - Analog voltage at C2Vin+ is lower than analog voltage at C2Vin-.
C2OE - Comparator C2Output Enable bit
  • 1 - Comparator C2OUT output is connected to the C2OUT pin.*
  • 0 - Comparator output is internal only.

* In order to enable the state of the C2OUT bit to be present on the pin, two conditions must be met: C2ON = 1 (comparator must be enabled) and the corresponding pin must be configured as an output (TRIS bit = 0).

C2POL - Comparator C2 Output Polarity Select bit enables the state of the comparator C2 output to be inverted.
  • 1 - Comparator C2 output is inverted.
  • 0 - Comparator C2 output is non-inverted.
C2R - Comparator C2 Reference Select bit
  • 1 - Non-inverting input C2Vin+ is connected to the reference voltage C2Vref.
  • 0 - Non-inverting input C2Vin+ is connected to the C2IN+ pin.
C2CH1, C2CH0 Comparator C2 Channel Select bit
C2CH1 C2CH0 COMPARATOR C2VIN- INPUT
0 0 Input C2Vin- is connected to the C12IN0- pin
0 1 Input C2Vin- is connected to the C12IN1- pin
1 0 Input C2Vin- is connected to the C12IN2- pin
1 1 Input C2Vin- is connected to the C12IN3- pin

CM2CON1 Register

pic-microcontrollers-programming-in-basic-chapter-03-image-143
Mirror Copy of the C1OUT bit Mirror Copy of the C2OUT bit C1RSEL Comparator C1 Reference Select bit
  • 1 - Varying voltage CVref is used in the voltage reference C1Vref source.
  • 0 - Fixed voltage reference 0.6V is used in the voltage reference C1Vref source.
C2RSEL - Comparator C2 Reference Select bit
  • 1 - Varying voltage CVref is used as a voltage reference C2Vref source.
  • 0 - Fixed voltage reference 0.6V is used as a voltage reference C2Vref source.
T1GSS - Timer1 Gate Source Select bit
  • 1 - Timer1 gate uses the T1G pin signal as a clock source.
  • 0 - Timer1 gate uses the SYNCC2OUT comparator output as a clock source.
C2SYNC - Comparator C2 Output Synchronization bit
  • 1 - Comparator C2 output is synchronized with the Timer1 clock.
  • 0 - Comparator C2 output is asynchronous signal.
VRCON Register
pic-microcontrollers-programming-in-basic-chapter-03-image-144
VREN Comparator C1 Voltage Reference Enable bit
  • 1 - Voltage reference source CVref enabled.
  • 0 - Voltage reference source CVref disabled.
VROE Comparator C2 Voltage Reference Enable bit
  • 1 - The CVref pin is fed with voltage reference source CVref.
  • 0 - The CVref pin is disconnected from reference source CVref.
VRR - CVref Range Selection bit
  • 1 - Voltage reference source is set to low range.
  • 0 - Voltage reference source is set to high range.
VRSS - Comparator Vref Range selection bit
  • 1 - Voltage reference source is in the range between Vref+ and Vref-.
  • 0 - Voltage reference source is in the range between Vdd and Vss (power supply voltage).
VR3 - VR0 CVref Value Selection If VRR = 1 (low range) Voltage reference is calculated by means of the formula: CVref = ([VR3:VR0]/24)Vdd If VRR = 0 (high range) Voltage reference is calculated by means of the formula: CVref=Vdd/4+([VR3:VR0]/32)Vdd

In Short

In order to properly use built-in comparators, it is necessary to do the following: Step 1 - Module Configuration:
  • In order to select the appropriate mode, bits of the CM1CON0 and CM2CON0 registers should be configured. Interrupt on mode change should be disabled.
Step 2 - Internal voltage reference source configuration (when used). In the VRCON register it is necessary to:
  • Select one of two voltage ranges using the VRR bit.
  • Configure necessary Vref using bits VR3 - VR0.
  • Set the VROE bit if needed.
  • Enable voltage reference Vref source by setting the VREN bit.
Formula used to calculate voltage reference: VRR = 1 (low range) CVref = ([VR3:VR0]/24)VLADDER VRR = 0 (high range) CVref = (VLADDER/4) + ([VR3:VR0]VLADDER/32) Vladder = Vdd or ([Vref+] - [Vref-]) or Vref+ Step 3 - Start of operation:
  • Enable an interrupt by setting bits CMIE (PIE register), PEIE and GIE (INTCON register).
  • Read the C1OUT and C2OUT bits of the CMCON register.
  • Read the CMIF flag bit of the PIR register. When set, this bit must be cleared from within the software.
 

MIKROE

MIKROE is a development tools company dedicated to standardization and time-saving in the embedded industry.

  • About us
  • Success story
  • Contact
  • PressKit
  • Timeline
  • Partners
  • Legal
  • Distributors
  • Legacy Products

SOLUTIONS

  • Click boards™
  • Development boards
  • Mikromedia
  • CODEGRIP
  • NECTO Studio
  • Planet Debug
  • ClickID
  • Click Snap
  • EmbeddedWiki

SUPPORT

  • Helpdesk
  • Forum
  • Libstock
  • Learn
  • Let's Make
  • eBooks
  • Premium TS
  • Design service
  • Product Customization
  • Contract Manufacturing

STANDARD

  • mikroBUS™
  • mikroSDK
  • SiBRAIN
  • DISCON

Prodavnica za inostrano tržište

Nalazite se na prodavnici za inostrano tržište. Da li želite da Vas odvedemo na prodavnicu koja je namenjena za Srbiju?

Prodavnica za inostrano tržište

Nalazite se na prodavnici za inostrano tržište. Da li želite da Vas odvedemo na prodavnicu koja je namenjena za Srbiju?

Daily product releases, special offers, and more

  • FOLLOW US:

  • instagram
  • linkedin
  • facebook
  • github
  • newsletter
  • youtube
  • twitter twitter

Join us

Pridruži nam se

Careers
Internship
Posao
Napravi Click
Praksa
Copyright© 2025 MikroElektronika d.o.o.

Privacy