Search the Community

Showing results for tags 'C++'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • News
    • New Users Introduction
    • Announcements
  • Digilent Technical Forums
    • FPGA
    • Digilent Microcontroller Boards
    • Non-Digilent Microcontrollers
    • Add-on Boards
    • Scopes & Instruments and the WaveForms software
    • LabVIEW
    • FRC
    • Other
  • General Discussion
    • Project Vault
    • Learn
    • Suggestions & Feedback
    • Buy, Sell, Trade
    • Sales Questions
    • Off Topic
    • Educators
    • Technical Based Off-Topic Discussions

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 14 results

  1. Hi, I am trying to synchronize two sine waves referring to the sample file "analogout_sync.cpp" using the master and slave technique, but I feel like there is too much of a delay before the second wave is generated still. When I use an external oscilloscope, it shows that the sine waves are not in sync and the phases change for the waves every time the program is rerun, so I can't hardcode a phase to fix it. Is there any way to make sure I can sync the two waves using C++ code? Thanks
  2. I tried the new Instant SoC from FPGA Cores on my Nexys 4 DDR (Nexys A7) board. Instant SoC is a C++ compiler that compiles C++ directly to a RISC-V processor and peripherals. The result is one vhdl file that I synthesized with Vivado. The only file I needed to add was the constraints file to map the signals to pins. The code implements a simple inclinometer. This is a description of what the code does: Sleeps 100 ms Read accelerations from the on board accelerometer using SPI Calculates angles using floating point math (atan, sqrt) Removes the zero offset that is reset using the center button. Print angles with one decimal point on UART Set the angles on 7 segment display Calculates an effect on the 16-leds. A led is “rolling” to the direction the board is leaning. Repeat A lot of the code was taken from Instant SoC class lib doc. The "hardware section", first in the main file defines the IO etc. In this case I created the following objects: ... int main(void) { //% hw_begin FC_IO_Clk Clk(100); FC_IO_Out LED(16); FC_IO_SPI accel(1000000,0,8); FC_IO_UART_TX uart_tx(115200,32); FC_IO_SegmentDisplay s7(8,8,0); FC_IO_In button_center; FC_System_Timer timer; //% hw_end uart_tx << "\r\nInclinometer demo using Nexys\r\n"; ... When compiling this it resulted in a VHDL file with the following port signals: ... entity nexys is port( Clk : in std_logic; LED : out std_logic_vector(15 downto 0); accel_SCLK : out std_logic; accel_MOSI : out std_logic; accel_MISO : in std_logic; accel_SSn : out std_logic; uart_tx : out std_logic; s7_seg : out std_logic_vector(7 downto 0); s7_sel : out std_logic_vector(7 downto 0); button_center : in std_logic ); end entity; architecture IMPL of nexys is ... And if you prefer Verilog there is also a Verilog header file generated: ... module nexys( input Clk, output [15:0] LED, output accel_SCLK, output accel_MOSI, input accel_MISO, output accel_SSn, output uart_tx, output [7:0] s7_seg, output [7:0] s7_sel, input button_center ); endmodule ... The system is free to download. I have attached the bit file (zipped) so it is possible to see what the C++ does. nexys.cpp nexys.xdc
  3. Hello Everyone, I am a new one in this forum and want to know Is C or C++ faster. Which is easy to understand and goes with the scope in the present scenario.
  4. Dear Diligent AD2 team Please can you update your companies notes supporting Microsoft .net drivers which work with C# and and F# for the Analog Discovery 2 tool. It is a an excellent tool , but be even more excellent if could work and be used in the microsoft .net environment. This is a link to a previous forum post on the subject which used visual basic 6 from a while back. The original visual basic 6 example . From the time before .net happened >> I have taken this worked example and updated to get it to run with in visual studio 2017 .See enclosed attachment- It is failing to work properly due a. dll memory project fault in the .dll driver. The C++ source code for the .dll driver is also included in the attachment. My request is can Digilent fix the driver so that is usable in .net assemblies and is Memory safe . This is the reported run time fault when trying to access FDwfDeviceOpen in line of code : nRet = FDwfDeviceOpen(-1, hdwf) Fault report : System.AccessViolationException HResult=0x80004003 Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Source=<Cannot evaluate the exception source> StackTrace: <Cannot evaluate the exception stack trace> Thank you for considering this request
  5. Hi, I've created a custom software program in C++ that uses analog discovery 2 and I have two questions. 1. I want to read some data using I2C interface, but I'm having trouble on the idea of how should I set up a "typical I2C" interface in C++. Is there an example anywhere on how exactly can this be accomplished in C++? 2. When reading the on-board temperature value in C++ I keep receiving a constant value if I'm doing multiple reads in a row. How can I fix it so that every time I read the AD2 on-board temp value I would get an updated temp value not the initial value? Thank you!
  6. the error are : note: candidate function template not viable: requires 3 arguments, but 5 were provided void dut_mmult_accel_core ( sorce/main.cpp:645:2: error: no matching function for call to 'dut_mmult_accel_core' dut_mmult_accel_core <float, 60, 1*60, 4, 5, 5>(in_stream, out_stream, predict_label1_hw_trig,precision1_hw_trig,prob_estimates_t1_hw_trig); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ `dut_mmult_accel_core <float, 60, 1*60, 4, 5, 5>(in_stream, out_stream, predict_label1_hw_trig,precision1_hw_trig,prob_estimates_t1_hw_trig);` where (predict_label1_hw_trig,precision1_hw_trig,prob_estimates_t1_hw_trig):output ``` template <typename T, int DIM1,int DIM2,int DIMa,int DIMb,int DIMc,int DIMd,int DIMe,int DIMf, int SIZE, int U, int TI, int TD> void dut_mmult_accel_core ( AXI_VAL in_stream[SIZE], AXI_VAL out_stream[3*SIZE], //volatile ap_uint<1> *hw_trig) volatile ap_uint<1> *predict_label1_hw_trig; volatile ap_uint<1> *precision1_hw_trig; volatile ap_uint<1> *prob_estimates_t1_hw; { // Map ports to Vivado HLS interfaces #pragma HLS INTERFACE ap_fifo port=in_stream #pragma HLS INTERFACE ap_fifo port=out_stream // Map HLS ports to AXI interfaces #pragma HLS RESOURCE variable=in_stream core=AXIS metadata="-bus_bundle INPUT_STREAM" #pragma HLS RESOURCE variable=out_stream core=AXIS metadata="-bus_bundle OUTPUT_STREAM" #pragma HLS RESOURCE variable=return core=AXI4LiteS metadata="-bus_bundle CONTROL_BUS" ap_uint<1> logic_zero = 0; ap_uint<1> logic_one = 1; T LabelS [DIM1][DIM2]; T out predict_label1[DIMa][DIMb]; T out precision1[DIMc][DIMd]; T out prob_estimates_t1[DIMe][DIMf]; *predict_label1_trig = logic_zero; *precision1_trig = logic_zero; *prob_estimates_t1_trig = logic_zero; assert(sizeof(T)*8 == 32); *predict_label1_trig = logic_one; *precision1_trig = logic_one; *prob_estimates_t1_trig = logic_one; ```
  7. Hi Digilent Im currently working on my finals in electronics development, including a hardware setup and a custom-made C++ application for my Analog Discovery 2. However it seems that the calibration data made with WaveForms does not apply to the hardware when using custom C++ applications. I've been looking through the manual and haven't encountered any examples of how it is done. I hope you can help me Kind regards Rasmus Pforr-Weiss, Brüel & Kjær SV
  8. Hello everybody, My name is Simon, I'm currently working in an R and T department, trying to design a prototype using the MyRIO motoradapter. My background is mechanical engineering and I already have made simple prototypes using python and a Phidgets motor adapter. But I have to use a MyRIO for this project and I have to code in C++ (no labview for me ) and here, the problem begins.... Have any of you ever seen such projects ? I can't find any example on the net and to be honest, the small exemple by NI on the C++ for MyRIO aren't clear for a newbie like me. Any help will be much appreciated, I can't find anything on the forum... The motor is not even started yet ! Have a nice day Simon
  9. I would like to utilize the SDK to develop a C++ application for the Analog Discovery 2 within Visual Studio 2015. I am trying to get one of the C++ sample applications provided to work but I am not having much luck. I tried adding a reference to dwf.dll but that failed. There is a lib file - do I use that and how? I am not sure what type of application I should start with (Forms, Console) and how do I bring in the sample app. Has anyone this? Can you provide step by step instructions with the expected result?
  10. I found the dwfcmd in /usr/share/digilent/waveforms/samples/dwfcmd/dwfcmd.cpp. How do I compile this file? g++ throws many errors starting with "ISO C++ forbids forward references to 'enum' types" and "use of undeclared identifier".
  11. Hello all tech-lovers; Do any of you guys have experience using Eigen library ( in bared metal OS ? When I try to define a matrix like : xil_printf(" TP CC 0 \r\n "); MatrixXd m1(6,6); MatrixXd m1_inv(6,6); xil_printf(" TP CC 1 \r\n "); the program is compiled and built, but when running it on the board, it HALT happens! I saw the assembly code of the line that exception happens, it is 0010da80: ldr r0, [r0] in which r0= 3758100524 I think the halt is because of referring to the address( decimal: 3758100524, Hex: E000102C )which is out of range of the address bus of Zybo! However this code works fine on PC ( X86) But I don’t know why my c codes convert to this assembly code. I would appreciate if any of you guys have any hint or experience on that.
  12. I want to build the DaciDemo project in Visual Studio 2010. Following the recipes given in "Building and Adept SDK Project in Visual Studio.pdf" one has to add all required paths and the additional dependencies (of course at different locations due to the fact that I am using 2010 and the reference doc is 2008), all libraries and other files get nicely attached. Nevertheless, the project won't build. There are 10 Error messages , all of the type: Error 1 error LNK2019: unresolved external symbol __imp__## referenced in function _main c:\....\visual studio 2010\Projects\dacidemo\dacidemo\DaciDemo.obj dacidemo where ## stands for {DmgrClose, DaciDisable, DaciGetBuf, DaciPutBuf, ...} - shortly said: all references to the attached libararies occuring in the project. In the meantime I found out that changing the library path (in Project Property sheet | Linker | C++Directories|) from "lib64 " to "lib" will eliminate 8 of the above 10 errors (even though my platform is Win64 :-) ). Now all external names from "Daci" are resolved but the "Dmgr" references are still left: {DmgrClose,DmgrOpen} The problem is solved: There is an error in the documentation file that comes with the SDK! It is NOT enough to include only depp.h and daci.h in the "additional dependencies" as stated in the documentation but one has to include dmgr.h as well. Obviously, depp.h and daci.h do not include any external symbol to open and close depp resources.
  13. Hi all, I've recently bought an Arty board (Microblaze processor) and some Pmods (PmodDPOT, PmodDAs, PmodADs), which use SPI protocol. I've looked everywhere for an example on how to access the Pmod headers or just how to use Pmods with the Arty but I couldn't find anything (even on the reference wiki page for the Arty). I found a library for SPI on Xilinx SDK which is called Xspi but I also am not sure how to use it. Can anybody perhaps help me by giving me the basic steps on how to do this? I'm very new to FPGA, so any feedback or suggestions are welcome! Thanks Viv
  14. Hello guys, I have a problem to configure the digital output of my Analog Discovery with a custom designed/programmed signal. I can handle the fundtions given in Waveforms and watched the tutorials. The plan is to generate a PWM with the device in C++. As compiler I am using CodeBlocks. I tried to generate a sine, which is given in the samples of waveforms, but right there I am stuck. I included the samples.h and managed, that the dwf.h is included. In Waveforms itself I only can import .txt files. Because of that I think I have to connect with the Analog Discovery with the commands out of the "WaveForms SDK Reference Manual". After building the sample sine signal, my compiler gives me the error, that something in the dwf.h is noch correct. The compiler is confused by the expression "DWFAPI" in every line in dwf.h. The error message is: "expected identifier or '(' before string constant". I could not find a tutorial fiiting my problem, so I hope to find some answers or solutions right here Thanks for help!