Use your forum account to login.

LOGIN

TOP Contributors

  1. MikroElektronika Team (709 codes)
  2. Shawon Shahryiar (258 codes)
  3. Alcides Ramos Zambrano (169 codes)
  4. Dany (66 codes)
  5. S P (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 (93244 times)
  2. FAT32 Library (48734 times)
  3. Network Ethernet Library (44250 times)
  4. USB Device Library (34432 times)
  5. Network WiFi Library (31748 times)
  6. FT800 Library (27417 times)
  7. GSM click (21483 times)
  8. PID Library (21333 times)
  9. microSD click - Example (17578 times)
  10. GSM 2 click (14510 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: 1711 times

Not followed.

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

GSM Booster Board Example

0

This is a sample program which demonstrates the usage of GSM Booster Board, a replacement board for Telit GM862 module used on various MikroElektronika development systems. This example covers PICPLC4 v6 and PICPLC16 v6 development systems, it receives the SMS message in specific format and toggles the relay specified in the message.

[Learn More]

Noise click

1

Noise click is a mikroBUS add-on board with noise detecting circuitry. It enables you to set a noise detection threshold for alarm systems, environmental monitoring or data logging. When the volume of ambient sound reaches the set threshold, an interrupt is triggered.

[Learn More]

USB I2C click

5

This example code demonstrates how USB I2C click can be used to control slave microcontroller via I2C. USB I2C click carries Microchip's MCP2221 chip. Click is designed to be supplied with 3.3V or 5V.

[Learn More]