I'm trying to use the Necto and MikroSDK for a new project, but I have problems even with simple tasks. I'm trying to use port driver but it's not working.
my implementation is looking like this but it always reads 0. However, Writing to port works ok. What could be the problem?
Code: Select all
#include "drv_uart.h"
#include "drv_port.h"
#include "conversions.h"
#include "board.h"
#ifndef PORT_B
#define PORT_B NC
#endif
#ifndef PORT_D
#define PORT_D NC
#endif
// Port driver context structure.
static port_t portb;
static port_t portd;
//Port value
static uint16_t read_value;
void application_init ( void )
{
uint16_t mask = 0xFFFF;
// Initialize PORT_D as output.
port_init( &portd, PORT_D, mask, PIN_DIRECTION_DIGITAL_INPUT );
}
void application_task ( void )
{
// Read port and toggle value.
read_value = port_read( &portd );
}
void main()
{
application_init();
while( 1 )
{
application_task();
}
}