OpenCores
URL https://opencores.org/ocsvn/8051/8051/trunk

Subversion Repositories 8051

[/] [8051/] [trunk/] [asm/] [sqroot.c] - Diff between revs 185 and 186

Only display areas with differences | Details | Blame | View Log

Rev 185 Rev 186
/*
/*
 * Copyright (c) 1999-2001 Tony Givargis.  Permission to copy is granted
 * Copyright (c) 1999-2001 Tony Givargis.  Permission to copy is granted
 * provided that this header remains intact.  This software is provided
 * provided that this header remains intact.  This software is provided
 * with no warranties.
 * with no warranties.
 *
 *
 * Version : 2.9
 * Version : 2.9
 */
 */
 
 
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
 
 
#include <reg51.h>
#include <reg51.h>
#include <math.h>
#include <math.h>
 
 
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
 
 
void main() {
void main() {
 
 
    float x = 3.0;
    float x = 3.0;
    float y = 4.0;
    float y = 4.0;
    float xx, yy, xx_yy, sqrt_xx_yy;
    float xx, yy, xx_yy, sqrt_xx_yy;
 
 
    xx = x * x;
    xx = x * x;
    P0 = (unsigned char)xx;
    P0 = (unsigned char)xx;
 
 
    yy = y * y;
    yy = y * y;
    P1 = (unsigned char)yy;
    P1 = (unsigned char)yy;
 
 
    xx_yy = xx + yy;
    xx_yy = xx + yy;
    P2 = (unsigned char)xx_yy;
    P2 = (unsigned char)xx_yy;
 
 
    sqrt_xx_yy = sqrt(xx_yy);
    sqrt_xx_yy = sqrt(xx_yy);
    P0 = (unsigned char)sqrt_xx_yy;
    P0 = (unsigned char)sqrt_xx_yy;
 
 
    while(1);
    while(1);
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.