⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demo.c

📁 CNC.rar
💻 C
📖 第 1 页 / 共 3 页
字号:
//*****************************************************************************
void
Demo3(void)
{
    unsigned long ulX, ulY, ulZ, ulDepth, ulIterations;

    //
    // Setup the tool for this demo.
    //
    DemoSetupTool(&ulX, &ulY, &ulZ, &ulDepth, &ulIterations);

    //
    // Indicate that a drawing sequence is starting.
    //
    DrawStart();

    //
    // Start the tool if required.
    //
    if(g_ulTool != 0x00)
    {
        //
        // Turn on the tool.
        //
        ToolOn();

        //
        // Delay for two seconds while the tool gets up to speed.
        //
        DemoDelay(2000);
    }

    //
    // Loop over the requested number of iterations.
    //
    while(ulIterations--)
    {
        //
        // Draw the steer image.
        //
        DrawImage(ulX + INCHES(0, 500), ulY + INCHES(1, 625), ulZ, g_pusSteer,
                  INCHES(2, 000), ulDepth);

        //
        // Do no draw any further iterations if the drawing was aborted.
        //
        if(!DrawIsDrawing())
        {
            break;
        }

        //
        // Increase the depth of the next iteration.
        //
        ulDepth += ROUTER_DEPTH_INCREMENT;
    }

    //
    // Stop the tool if required.
    //
    if(g_ulTool != 0x00)
    {
        ToolOff();
    }

    //
    // Move the home position.
    //
    TableHome();

    //
    // Indicate that the drawing is complete.
    //
    DrawStop();
}

//*****************************************************************************
//
//! Performs the fourth CNC demonstration.
//!
//! This demonostration of the CNC machine draws a printed circuit board one
//! inch (2.54 cm) tall.  It is intended to be used with a pen and a piece of
//! paper approximately five inches (12.7 cm) square.
//!
//! \return None.
//
//*****************************************************************************
void
Demo4(void)
{
    unsigned long ulX, ulY, ulZ, ulDepth, ulIterations;

    //
    // Setup the tool for this demo.
    //
    DemoSetupTool(&ulX, &ulY, &ulZ, &ulDepth, &ulIterations);

    //
    // Indicate that a drawing sequence is starting.
    //
    DrawStart();

    //
    // Start the tool if required.
    //
    if(g_ulTool != 0x00)
    {
        //
        // Turn on the tool.
        //
        ToolOn();

        //
        // Delay for two seconds while the tool gets up to speed.
        //
        DemoDelay(2000);
    }

    //
    // Loop over the requested number of iterations.
    //
    while(ulIterations--)
    {
        //
        // Draw the printed circuit board image.
        //
        DrawImage(ulX + INCHES(1, 625), ulY + INCHES(2, 250), ulZ, g_pusPCB,
                  INCHES(1, 000), ulDepth);

        //
        // Do no draw any further iterations if the drawing was aborted.
        //
        if(!DrawIsDrawing())
        {
            break;
        }

        //
        // Increase the depth of the next iteration.
        //
        ulDepth += ROUTER_DEPTH_INCREMENT;
    }

    //
    // Stop the tool if required.
    //
    if(g_ulTool != 0x00)
    {
        ToolOff();
    }

    //
    // Move the home position.
    //
    TableHome();

    //
    // Indicate that the drawing is complete.
    //
    DrawStop();
}

//*****************************************************************************
//
//! Performs the fifth CNC demonstration.
//!
//! This demonstration of the CNC machine draws a football (soccer) pitch four
//! inches tall.  It is inteded to be used with a pen and a piece of paper
//! approximately five inches (12.7 cm) square.
//!
//! \return None.
//
//*****************************************************************************
void
Demo5(void)
{
    unsigned long ulX, ulY, ulZ, ulDepth, ulIterations;

    //
    // Setup the tool for this demo.
    //
    DemoSetupTool(&ulX, &ulY, &ulZ, &ulDepth, &ulIterations);

    //
    // Indicate that a drawing sequence is starting.
    //
    DrawStart();

    //
    // Start the tool if required.
    //
    if(g_ulTool != 0x00)
    {
        //
        // Turn on the tool.
        //
        ToolOn();

        //
        // Delay for two seconds while the tool gets up to speed.
        //
        DemoDelay(2000);
    }

    //
    // Loop over the requested number of iterations.
    //
    while(ulIterations--)
    {
        //
        // Draw a football pitch.
        //
        DrawImage(ulX + INCHES(1, 375), ulY + INCHES(0, 625), ulZ, g_pusPitch,
                  INCHES(4, 000), ulDepth);

        //
        // Do no draw any further iterations if the drawing was aborted.
        //
        if(!DrawIsDrawing())
        {
            break;
        }

        //
        // Increase the depth of the next iteration.
        //
        ulDepth += ROUTER_DEPTH_INCREMENT;
    }

    //
    // Stop the tool if required.
    //
    if(g_ulTool != 0x00)
    {
        ToolOff();
    }

    //
    // Move the home position.
    //
    TableHome();

    //
    // Indicate that the drawing is complete.
    //
    DrawStop();
}

//*****************************************************************************
//
//! Performs the sixth CNC demonatration.
//!
//! This demonstration of the CNC machine draws a map of the world two and a
//! half inches (6.35 cm) tall.  It is intended to be used with a pen and a
//! piece of paper approximately five inches (12.7 cm) square.
//!
//! \return None.
//
//*****************************************************************************
void
Demo6(void)
{
    unsigned long ulX, ulY, ulZ, ulDepth, ulIterations;

    //
    // Setup the tool for this demo.
    //
    DemoSetupTool(&ulX, &ulY, &ulZ, &ulDepth, &ulIterations);

    //
    // Indicate that a drawing sequence is starting.
    //
    DrawStart();

    //
    // Start the tool if required.
    //
    if(g_ulTool != 0x00)
    {
        //
        // Turn on the tool.
        //
        ToolOn();

        //
        // Delay for two seconds while the tool gets up to speed.
        //
        DemoDelay(2000);
    }

    //
    // Loop over the requested number of iterations.
    //
    while(ulIterations--)
    {
        //
        // Draw the world map.
        //
        DrawImage(ulX + INCHES(0, 500), ulY + INCHES(1, 375), ulZ, g_pusMap,
                  INCHES(2, 500), ulDepth);

        //
        // Do no draw any further iterations if the drawing was aborted.
        //
        if(!DrawIsDrawing())
        {
            break;
        }

        //
        // Increase the depth of the next iteration.
        //
        ulDepth += ROUTER_DEPTH_INCREMENT;
    }

    //
    // Stop the tool if required.
    //
    if(g_ulTool != 0x00)
    {
        ToolOff();
    }

    //
    // Move the home position.
    //
    TableHome();

    //
    // Indicate that the drawing is complete.
    //
    DrawStop();
}

//*****************************************************************************
//
//! Moves the gantry to the shipping position.
//!
//! This function will prepare the CNC machine for shipping.  Each axis is
//! moved to a known location that will allow it to fit into the cavity in the
//! shipping crate for safe shipping.
//!
//! \return None.
//
//*****************************************************************************
void
DemoShip(void)
{
    long lX, lY, lZ;

    //
    // Get the current position of the table.
    //
    TableGetPosition(&lX, &lY, &lZ);

    //
    // Indicate that a drawing sequence is starting.
    //
    DrawStart();

    //
    // Move the Z axis to the home position.
    //
    TableMoveLine(lX, lY, 0, 1200, 30000);

    //
    // Wait until the movement has completed.
    //
    while(TableIsMoving())
    {
    }

    //
    // Return if the "drawing" sequence has been aborted.
    //
    if(!DrawIsDrawing())
    {
        return;
    }

    //
    // Move the X and Y axes to the shipping position.
    //
    TableMoveLine(0, INCHES(8, 500), 0, 2400, 30000);

    //
    // Wait until the movement has completed.
    //
    while(TableIsMoving())
    {
    }

    //
    // Indicate that the drawing is complete.
    //
    DrawStop();
}

//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -