Use your forum account to login.

LOGIN

TOP Contributors

  1. MikroElektronika Team (758 codes)
  2. Shawon Shahryiar (263 codes)
  3. Alcides Ramos Zambrano (170 codes)
  4. S P (67 codes)
  5. Dany (66 codes)
  6. MikroBUS.NET Team (35 codes)
  7. NART SCHINACKOW (34 codes)
  8. Armstrong Subero (26 codes)
  9. Roman Toropov (26 codes)
  10. FOURNET Olivier (25 codes)

Most Downloaded

  1. Timer Calculator (95916 times)
  2. FAT32 Library (50398 times)
  3. Network Ethernet Library (45106 times)
  4. USB Device Library (35203 times)
  5. Network WiFi Library (32318 times)
  6. FT800 Library (28232 times)
  7. GSM click (21840 times)
  8. PID Library (21670 times)
  9. microSD click (17937 times)
  10. GSM 2 click (14856 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

Cap Extend 4 click

Rating:

5

Author: MikroElektronika Team

Last Updated: 2018-01-17

Category: Measurement

Downloaded: 1879 times

Not followed.

License: MIT license  

Cap Extend 4 click adds touch/proximity detection feature to any application, providing an easy and intuitive framework for building a human-machine interface.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Cap Extend 4 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Cap Extend 4 click" changes.

Do you want to report abuse regarding "Cap Extend 4 click".

  • Information
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal 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
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal 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
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

Cap Extend 4 Click

Cap Extend 4 Click

Native view of the Cap Extend 4 Click board.

View full image
Cap Extend 4 Click

Cap Extend 4 Click

Front and back view of the Cap Extend 4 Click board.

View full image

Library description

Library declares register address as global variables, sets configuration registers and mikroBUS output pins on expected values, and defines functions to writing in registers and reading from registers.

Key functions:

void capext4_writeReg(uint8_t device_address, uint8_t register_address, uint8_t transfer_data);- This function writes in register 8-bit data

uint8_t capext4_readReg(uint8_t device_address, uint8_t register_address); - This function reads from a register and returns 8-bit value as result.

Example description

  • System Initialization - Initializes pins, SPI peripheral and logger.
  • Application Initialization - Initializes click driver.
  • Application Task - Detects presence on all the sensors, and outputs data when change is detected.
void applicationTask()
{
    uint8_t intcap;
    
    if(_CAPEXT4_CONTROL == 0x00)
    {

//Compares all input pins with default value (DEFAULT_VALUE = 0x00)
        capext4_writeReg(_CAPEXT4_ADDRESS_DEVICE, _CAPEXT4_INTERRUPT_CONTROL, 0xFF);

//Enables interrupt-on-change
        capext4_writeReg(_CAPEXT4_ADDRESS_DEVICE, _CAPEXT4_INTERRUPT_ENABLE, 0xFF);

//Checks is interrupt happening
        if(capext4_readReg(_CAPEXT4_ADDRESS_DEVICE, _CAPEXT4_INTERRUPT_FLAG) == 0x00)
        {
		
//Reads value on input, it causes that interrupt will stop
            intcap = capext4_readReg(_CAPEXT4_ADDRESS_DEVICE, _CAPEXT4_INTERRUPT_CAPTURE);
			
//Writes on UART if interrupt is not happening, all input pins are 0
            mikrobus_logWrite("No presence detected.", _LOG_LINE);
        }
        
//Disables interrupt-on-change
        capext4_writeReg(_CAPEXT4_ADDRESS_DEVICE, _CAPEXT4_INTERRUPT_ENABLE, 0x00);
        _CAPEXT4_CONTROL = 0x01;
    }
    
//Compares all input pins with previous value
    capext4_writeReg(_CAPEXT4_ADDRESS_DEVICE, _CAPEXT4_INTERRUPT_CONTROL, 0x00);

//Enables interrupt-on-change
    capext4_writeReg(_CAPEXT4_ADDRESS_DEVICE, _CAPEXT4_INTERRUPT_ENABLE, 0xFF);
    
//Checks is interrupt happening
    if(capext4_readReg(_CAPEXT4_ADDRESS_DEVICE, _CAPEXT4_INTERRUPT_FLAG))
    {
        
//Eeads value on input when interrupt is happening
        intcap = capext4_readReg(_CAPEXT4_ADDRESS_DEVICE, _CAPEXT4_INTERRUPT_CAPTURE);
        writeResult(intcap);
        _CAPEXT4_CONTROL = 0x00;
    }
//Disables interrupt-on-change
    capext4_writeReg(_CAPEXT4_ADDRESS_DEVICE, _CAPEXT4_INTERRUPT_ENABLE, 0x00);
    
    Delay_ms(1000);
}


Other MikroElektronika Libraries used in the example:

  • UART
  • Conversions
  • C_String

Additional notes and information

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

FTDI click - Example

0

This is demonstration project how FTDI click can be used to control slave microcontroller via I2C. Lower nibble of slave address is masked which enables the master to address slave using eight different addresses. Currently four addresses are implemented for different functionality.

[Learn More]

VREG 2 click

5

VREG 2 click is a voltage regulator click, with outstanding performances. It has a steady output voltage with the ripple lower than 5mV, short circuit protection with the LED indicator, and high efficiency with minimal power dissipation.

[Learn More]

BIGdsPIC6

0

Examples for BIGdsPIC6 development system

[Learn More]