Automotive and Embedded Networks

cancel
Showing results for 
Search instead for 
Did you mean: 

ADCS+CVI on RT does not work

I started to use the "NI Automotive Diagnostic Command Set"
With NI-CVI 2012 & NI-PXI System- running on NI-RealTime OS.

but It seems like to does not work.
It is working like a system that have no (ADCS) library in it.

and I'm trying to get Status String with "ndStatusToString" function
but that does not return any Messages.

How can I do ADCS to be worked on RT System with CVI.

I'm please asking for any advice.

thank you.

Environments :
Device :
NI PXI-8513

Software On NI RT System
Automotive Diagnostic Command Set 1.1.1
LabVIEW Real-TIme 12.0
LabWindows/CVI Run-Time Engine for RT 12.0.0
LabWindows/CVI Network variable for RT 12.0.0
NI-CAN 2.7.4
NI-XNET 1.7.0

Build System
LAB Windows/CVI 2012

Test Code:
//==========================Test Code Start ===================================
#include <windows.h>
#include <ansi_c.h>       
#include <cvirte.h>
#include <rtutils.h>
#include "NIDiagCS.h"

#define RT_DEBUG

void TestCode(void)
{
    char cs_messages[1024];
    printf("test\n");     
    char ErrText[1024] = "";
    long ErrTextLen = 1024;
    int transport_protocol = 0;
    
    TD1 diag = {0,0,0,0,0,0};
    TD3 DTCDescriptor = {2,1,0,0};
    
    unsigned short tx_id = 200;
    unsigned short rx_id = 201;
    unsigned long baudrate = 500000;
    
    char CanPort[25] = "CAN1@ni_genie_nixnet";
    
    long status = 0;
    status =
        ndOpenDiagnostic(CanPort, baudrate, transport_protocol, tx_id, rx_id, &diag);
        // on RT_SYSTEM status return "-8299"
    
    
    if(status != 0)
    {
        ndStatusToString(status, ErrText, &ErrTextLen);
        printf("status code :%d,\nError Text : %s\n", status, ErrText);
        // on RT System can not get any messages with any status code
    }
    printf("test done \n");     
    
    // on RT_SYSTEM Output is :
    // status code :-8299
    // Error Text :
    // test done
    
    ///////////////////////////////////////////////////////////////////////////////////
    // "ndStatusToString" Test Code
    printf("ndStatusToString Function Test \n");     
    status = -8256;
    ndStatusToString(status, ErrText, &ErrTextLen);
    printf("status code :%d,\nError Text : %s\n", status, ErrText);
    printf("test done \n");     
    // on RT_SYSTEM Output is :
    // status code :-8256
    // Error Text :
    // test done
}

#ifndef RT_DEBUG
int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                       LPSTR lpszCmdLine, int nCmdShow)
{
    if (InitCVIRTE (hInstance, 0, 0) == 0)
        return -1;    /* out of memory */
    
    TestCode();
    return 0;
}
#endif
#ifdef RT_DEBUG
void CVIFUNC_C RTmain (void)
{
    if (InitCVIRTE (0, 0, 0) == 0)
        return;    /* out of memory */

    TestCode();

    CloseCVIRTE ();
}
#endif
//==========================Test Code end===================================

0 Kudos
Message 1 of 1
(6,187 Views)