Use your forum account to login.

LOGIN

TOP Contributors

  1. MikroElektronika Team (664 codes)
  2. Shawon Shahryiar (258 codes)
  3. Alcides Ramos Zambrano (164 codes)
  4. Dany (66 codes)
  5. S P (63 codes)
  6. MikroBUS.NET Team (35 codes)
  7. NART SCHINACKOW (34 codes)
  8. FOURNET Olivier (25 codes)
  9. Alberto Trasimeni (25 codes)
  10. Roman Toropov (25 codes)

Most Downloaded

  1. Timer Calculator (91134 times)
  2. FAT32 Library (47150 times)
  3. Network Ethernet Library (43470 times)
  4. USB Device Library (33761 times)
  5. Network WiFi Library (31281 times)
  6. FT800 Library (26476 times)
  7. GSM click (21156 times)
  8. PID Library (21049 times)
  9. microSD click - Example (17347 times)
  10. GSM 2 click (14195 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: 1523 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

Charger 2 click

5

Charger 2 click is a LiPo battery charger with the additional monitoring IC onboard. This Click board as a whole, offers unpreceded LiPo battery charging and monitoring solution for 4.2V LiPo batteries, with the capacity up to 7000 mAh.

[Learn More]

HDC1000 click

5

HDC1000 click is a humidity (and temperature) measurement click board carrying the HDC1000 sensor from Texas Instruments. HDC1000 click communicates with the target board microcontroller through mikroBUS I2C lines (SCL, SDA) plus the INT pin, used here for DRDY (Data Ready).

[Learn More]

mikromedia for dsPIC33EP - Examples

0

Set of examples for mikromedia for dsPIC33EP.. Provided examples demonstrate working with mikromedia's various features and modules:

- Accelerometer
- MMC SD card
- MP3
- Serial Flash
- TFT
- Touch Panel
- USB

[Learn More]