/*  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;

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

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

	/*Get the bus timing*/
	nRet=mxcan_get_bus_timing(fd);
	if(!nRet){
		printf("mxcan_get_bus_timing dail.\r\n");
		mxcan_close(fd);
		return -1;
	}
	

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

	/*Close can port*/
	mxcan_close(fd);

	return 0;
}

