Beginner
10 min

Switch signals between their pull-up or pull-down states with DTH-08 and PIC18F45K40

Simple yet effective way to manage signal states for electronic projects, enhancing their reliability and performance

EasyPull Click with EasyPIC v8

Published Mar 13, 2024

Click board™

EasyPull Click

Dev Board

EasyPIC v8

Compiler

NECTO Studio

MCU

PIC18F45K40

Configure used mikroBUS™ signals within applications to be either in a pull-up or pull-down state

A

A

Hardware Overview

How does it work?

EasyPull Click is a compact add-on board designed to empower users to easily configure used mikroBUS™ signals within their applications to be either in a pull-up or pull-down state. This board is equipped with two 8-position switches that enable the pull-up or pull-down configuration for mikroBUS™ signals such as AN, RST, PWM, and INT, as well as for communication protocols like SPI, UART, and I2C. All resistors on the EasyPull Click are set to 4.7kΩ, ensuring consistent performance across various signal lines. Whether for prototyping or final product development, EasyPull Click provides developers with a practical tool for enhancing their projects with reliable signal management capabilities. Configuring the signal lines to the desired state is straightforward, thanks to the clear directional arrows on each switch's left

side. These arrows indicate the direction to toggle the switch to achieve either a pull-up (upward direction) or pull-down (downward direction) state. This feature allows for quick and easy adjustments, enhancing the board's usability and flexibility in different project setups. Additionally, the EasyPull Click board™ offers an unpopulated header marked as EXT, which extends four signals from the switches - two from each - labeled as EXTx. This header can be used as a conventional GPIO (General Purpose Input/Output) signal according to the user's requirements. The board also includes two sets of unmarked resistors at the top, connected to the EXT signals, maintaining the 4.7kΩ resistance value consistent with the rest of the board. A unique feature of the EasyPull Click is its low-power mode capability, achieved by cutting

the ID CUT traces on the back of the board. The connection to the lower section of the board, which includes the power (PWR) LED and ID chip, is interrupted by cutting these lines. This action results in significant energy savings, making the EasyPull Click an excellent choice for energy-sensitive applications that require efficient power management. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.

EasyPull Click hardware overview image

Features overview

Development board

EasyPIC v8 is a development board specially designed for the needs of rapid development of embedded applications. It supports many high pin count 8-bit PIC microcontrollers from Microchip, regardless of their number of pins, and a broad set of unique functions, such as the first-ever embedded debugger/programmer. The development board is well organized and designed so that the end-user has all the necessary elements, such as switches, buttons, indicators, connectors, and others, in one place. Thanks to innovative manufacturing technology, EasyPIC v8 provides a fluid and immersive working experience, allowing access anywhere and under any

circumstances at any time. Each part of the EasyPIC v8 development board contains the components necessary for the most efficient operation of the same board. In addition to the advanced integrated CODEGRIP programmer/debugger module, which offers many valuable programming/debugging options and seamless integration with the Mikroe software environment, the board also includes a clean and regulated power supply module for the development board. It can use a wide range of external power sources, including a battery, an external 12V power supply, and a power source via the USB Type-C (USB-C) connector.

Communication options such as USB-UART, USB DEVICE, and CAN are also included, including the well-established mikroBUS™ standard, two display options (graphical and character-based LCD), and several different DIP sockets. These sockets cover a wide range of 8-bit PIC MCUs, from the smallest PIC MCU devices with only eight up to forty pins. EasyPIC v8 is an integral part of the Mikroe ecosystem for rapid development. Natively supported by Mikroe software tools, it covers many aspects of prototyping and development thanks to a considerable number of different Click boards™ (over a thousand boards), the number of which is growing every day.

EasyPIC v8 horizontal image

Microcontroller Overview

MCU Card / MCU

PIC18F45K40

Architecture

PIC

MCU Memory (KB)

32

Silicon Vendor

Microchip

Pin count

40

RAM (Bytes)

2048

Used MCU Pins

mikroBUS™ mapper

Analog Output
RA2
AN
Reset / ID SEL
RE1
RST
SPI Select / ID COMM
RE0
CS
SPI Clock
RC3
SCK
SPI Data OUT
RC4
MISO
SPI Data IN
RC5
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
PWM Signal
RC0
PWM
Interrupt
RB0
INT
UART TX
RC6
TX
UART RX
RC7
RX
I2C Clock
RC3
SCL
I2C Data
RC4
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

EasyPull Click Schematic schematic

Step by step

Project assembly

EasyPIC v8 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the EasyPIC v8 as your development board.

EasyPIC v8 front image hardware assembly
Buck 22 Click front image hardware assembly
MCU DIP 40 hardware assembly
EasyPIC v8 DIP MB 1 - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
NECTO Compiler Selection Step Image hardware assembly
NECTO Output Selection Step Image hardware assembly
Necto image step 6 hardware assembly
Necto DIP image step 7 hardware assembly
Necto image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Necto PreFlash Image hardware assembly

Track your results in real time

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.

Software Support

Library Description

This library contains API for EasyPull Click driver.

Key functions:

  • easypull_get_an_pin - This function reads the state of the AN pin of EasyPull click board

  • easypull_get_rst_pin - This function reads the state of the RST pin of EasyPull click board

  • easypull_get_cs_pin - This function reads the state of the CS pin of EasyPull click board

Open Source

Code example

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.

/*!
 * @file main.c
 * @brief EasyPull Click Example.
 *
 * # Description
 * This example demonstrates the use of PIR 2 Click boards.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and USB UART logger.
 *
 * ## Application Task
 * It checks the state of the pins and displays their state on the USB UART.
 *
 * @author Stefan Ilic
 *
 */

#include "board.h"
#include "log.h"
#include "easypull.h"

static easypull_t easypull;   /**< EasyPull Click driver object. */
static log_t logger;    /**< Logger object. */

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    easypull_cfg_t easypull_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    easypull_cfg_setup( &easypull_cfg );
    EASYPULL_MAP_MIKROBUS( easypull_cfg, MIKROBUS_1 );
    if ( DIGITAL_OUT_UNSUPPORTED_PIN == easypull_init( &easypull, &easypull_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void ) 
{
    if ( EASYPULL_PIN_STATE_HIGH == easypull_get_an_pin( &easypull ) )
    {
        log_printf( &logger, " AN pin state: HIGH \n" );
    }
    else
    {
        log_printf( &logger, " AN pin state: LOW \n" );
    }

    if ( EASYPULL_PIN_STATE_HIGH == easypull_get_rst_pin( &easypull ) )
    {
        log_printf( &logger, " RST pin state: HIGH \n" );
    }
    else
    {
        log_printf( &logger, " RST pin state: LOW \n" );
    }

    if ( EASYPULL_PIN_STATE_HIGH == easypull_get_cs_pin( &easypull ) )
    {
        log_printf( &logger, " CS pin state: HIGH \n" );
    }
    else
    {
        log_printf( &logger, " CS pin state: LOW \n" );
    }

    if ( EASYPULL_PIN_STATE_HIGH == easypull_get_pwm_pin( &easypull ) )
    {
        log_printf( &logger, " PWM pin state: HIGH \n" );
    }
    else
    {
        log_printf( &logger, " PWM pin state: LOW \n" );
    }

    if ( EASYPULL_PIN_STATE_HIGH == easypull_get_int_pin( &easypull ) )
    {
        log_printf( &logger, " INT pin state: HIGH \n" );
    }
    else
    {
        log_printf( &logger, " INT pin state: LOW \n" );
    }
    log_printf( &logger, "- - - - - - - - - - - - - \r\n" );
    Delay_ms( 1000 );

}

int main ( void ) 
{
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.