Click here to Skip to main content
Click here to Skip to main content
Go to top

Allow for easy control of Univelop CNC 4\5 Axis board in user mode

, 12 Jun 2009
Rate this:
Please Sign up or sign in to vote.
A C++ class to control Univelop CNC 4\5 Axis controller board in usermode on Linux.

Introduction

Recently, I got my hands on a Univelop CNC 4\5 Axis controller board and wanted to write Linux user mode code to interface with the board. The board has the ability to control up to 5 steppers and 6 switches (4 axis limiters \ 1 Stop \ 1 Aux). The code also uses virtual positioning to allow the implementer to move the stepper to virtual positions, say -50 to +50. The class allows for per axis stepper pulse delays since the implementer may have different speed steppers for each axis. It may be necessary to increase the delay for slower steppers. A too fast delay leads to the stepper buzzing and not rotating. The switch state functions return true if the switch is closed, and false if open. The Univelop5Axis class functions are well commented, and the Univelop user manual is attached to the top of this page. The manual shows all the pin out information needed to understand the inner workings of the code.

The attached project was done with CodeBlocks, but will also compile from command line using GCC.

Using the Code

Below is a list of the core functions of the class. The following can be in your main function:

#define BASEPORT 0x378

Univelop5Axis r( BASEPORT );

// To display the states of the 6 switch's which
// can be used as limiters, emergency stop, or aux
printf( "AuxState: %d\n" , r.IsSetAux() );
printf( "StopState: %d\n" ,r.IsSetStop() );
printf( "XlimState: %d\n" ,r.IsSetXLimit() );
printf( "YlimState: %d\n" ,r.IsSetYLimit() );
printf( "ZlimState: %d\n" ,r.IsSetZLimit() );
printf( "AlimState: %d\n" ,r.IsSetALimit() );

// Moving individual steppers Clockwise (CW) or Counter Clock Wise (CCW)
printf( "Testing stepper X movement\n");
r.StepX( 500 , Univelop5Axis::CW);
r.StepX( 500 , Univelop5Axis::CCW);
printf( "Testing stepper Y movement\n");
r.StepY( 500 , Univelop5Axis::CW);
r.StepY( 500 , Univelop5Axis::CCW);
printf( "Testing stepper Z movement\n");
r.StepZ( 500 , Univelop5Axis::CW);
r.StepZ( 500 , Univelop5Axis::CCW);
printf( "Testing stepper A movement\n");
r.StepA( 500 , Univelop5Axis::CW);
r.StepA( 500 , Univelop5Axis::CCW);
printf( "Testing stepper C movement\n");
r.StepC( 500 , Univelop5Axis::CW);
r.StepC( 500 , Univelop5Axis::CCW);
 
// To move directly to a virtual position
// you can use the following functions
// The each of the sets of three will step the motors 800 times.
// (0 to 200 = 200(CW) , 200 to -200 = 400(CCW) , -200 to 0 = 200(CW)) 
r.MoveXTo( 200 ); // +200
r.MoveXTo( -200 ); // -200
r.MoveXTo( 0 ); // Goto the origin

r.MoveYTo( 200 );
r.MoveYTo( -200 );
r.MoveYTo( 0 );

r.MoveZTo( 200 );
r.MoveZTo( -200 );
r.MoveZTo( 0 );

r.MoveATo( 200 );
r.MoveATo( -200 );
r.MoveATo( 0 );

r.MoveCTo( 200 );
r.MoveCTo( -200 );
r.MoveCTo( 0 );

Univelop Board Images

This is the main board which plugs into the parallel port:

mainboard.jpg

This is the main board with Axis controllers attached:

total.jpg

History

  • June 12th 2009 - Initial release.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Ludvik Jerabek
Software Developer
United States United States
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web04 | 2.8.140916.1 | Last Updated 13 Jun 2009
Article Copyright 2009 by Ludvik Jerabek
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid