I am using NHS3152ADK, LPC-link2 and LPCXpresso IDE.
I am trying to run example adcdac_nss_example_1.
When i debug, i get the following message:
After i click proceed:
How do i fix this?
This is the code:
#include "board.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#pragma GCC diagnostic ignored "-Wunused-variable"
void adcdac_nss_example_1(void)
{
//! [adcdac_nss_example_1]
Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_ANA0_0, IOCON_FUNC_1);
Chip_ADCDAC_Init(NSS_ADCDAC0);
Chip_ADCDAC_SetMuxDAC(NSS_ADCDAC0, ADCDAC_IO_ANA0_0);
Chip_ADCDAC_SetModeDAC(NSS_ADCDAC0, ADCDAC_CONTINUOUS);
Chip_ADCDAC_WriteOutputDAC(NSS_ADCDAC0, 3000);
//! [adcdac_nss_example_1]
}
#pragma GCC diagnostic pop
已解决! 转到解答。
Hi,
The problems screenshot you posted shows a linker error: it cannot find an implementation of the main function.
The example_snippets folder does not contain complete projects, it only contains code snippets surrounded with some C sugar to enable compilation checks and test runs by the development team (include, pragma's, function prototype). The code snippet shows code that is functional and as minimal as possible, to get you started faster. Every code snippet is included in the firmware documentation at <SDK>/docs/firmware.html.
The example you refer to is also listed there: navigate to Documentation of the low-level HW block drivers > adcdac: Analog-to-Digital / Digital-to-Analog converter driver > Example 1 - Continuous Digital-to-Analog conversion with polling.
To use the code snippet, just copy what is listed in that documentation to your own project - which should already be in good shape (have a main, compiling and linking, etc.) - inside whatever function.
KR,
Dries.
Hi,
It seems your project does not compile or link. Did you paste the full contents? I don't see main, for example. Can you have a look at the errors - if you inadvertently closed them, navigate to Window > Show view > Other... > General > Problems and/or Console.
The examples are used in the firmware documentation <SDK>/tools/firmware.html. To use them in your project, copy and paste the code in e.g. the blinky demo project, after the call to Board_Init.
Kind regards,
Dries.
Hello Dries,
Below is the full code that i find in adcdac_nss_example_1.
If i run the blinky demo it works!, perhaps i need to modify adcdac_nss_example_1 to include a main?
I tried running i2d_nss_example_1, this also works.
I have placed, adcdac_nss_example_1 in blinky demo folder, and when i debug i get these problems::
This is the code copied:
/*
* Copyright 2020 NXP.
* This software is owned or controlled by NXP and may only be used
* strictly in accordance with the applicable license terms. By expressly
* accepting such terms or by downloading, installing, activating and/or
* otherwise using the software, you are agreeing that you have read, and
* that you agree to comply with and are bound by, such license terms. If
* you do not agree to be bound by the applicable license terms, then you
* may not retain, install, activate or otherwise use the software.
*/
#include "board.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#pragma GCC diagnostic ignored "-Wunused-variable"
void adcdac_nss_example_1(void)
{
//! [adcdac_nss_example_1]
Chip_IOCON_SetPinConfig(NSS_IOCON, IOCON_ANA0_0, IOCON_FUNC_1);
Chip_ADCDAC_Init(NSS_ADCDAC0);
Chip_ADCDAC_SetMuxDAC(NSS_ADCDAC0, ADCDAC_IO_ANA0_0);
Chip_ADCDAC_SetModeDAC(NSS_ADCDAC0, ADCDAC_CONTINUOUS);
Chip_ADCDAC_WriteOutputDAC(NSS_ADCDAC0, 3000);
//! [adcdac_nss_example_1]
}
#pragma GCC diagnostic pop
Hi,
The problems screenshot you posted shows a linker error: it cannot find an implementation of the main function.
The example_snippets folder does not contain complete projects, it only contains code snippets surrounded with some C sugar to enable compilation checks and test runs by the development team (include, pragma's, function prototype). The code snippet shows code that is functional and as minimal as possible, to get you started faster. Every code snippet is included in the firmware documentation at <SDK>/docs/firmware.html.
The example you refer to is also listed there: navigate to Documentation of the low-level HW block drivers > adcdac: Analog-to-Digital / Digital-to-Analog converter driver > Example 1 - Continuous Digital-to-Analog conversion with polling.
To use the code snippet, just copy what is listed in that documentation to your own project - which should already be in good shape (have a main, compiling and linking, etc.) - inside whatever function.
KR,
Dries.