/*  Copyright (C) MOXA Inc. All rights reserved.

    This software is distributed under the terms of the
    MOXA License.  See the file COPYING-MOXA for details.
*/
/*
    mxcan_read.cpp

    This is for the read of canbus data.

    2010-10-31	Epson Chiang
		new release
*/

#include "stdafx.h"
#include "stdafx.h"
#include <windows.h>
#include "..\SDK\mxcanbus.h"


int _tmain(int argc, _TCHAR* argv[])
{
	int nRet;
	int fd;
	int port = 0;
	int busTiming = 1000;

	printf("Enter can port number:");
	scanf("%d",&port);

	printf("Enter bus timing:");
	scanf("%d",&busTiming);

	/*Open can port*/
	fd = mxcan_open(port);

	/*Set the bus timing*/
	nRet = mxcan_set_bus_timing(fd, busTiming);
	printf("nRet of mxcan_set_bus_timing= %d\n", nRet);

	/*Get the bus timing*/
	nRet = mxcan_get_bus_timing(fd);
	printf("nRet of mxcan_get_bus_timing = %d\n", nRet);

	printf("bus timing=%d\r\n",nRet);

	/*Close can port*/
	mxcan_close(fd);
	return 0;
}

