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

Subversion Repositories 8051

[/] [8051/] [trunk/] [asm/] [sqroot.c] - Blame information for rev 2

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 simont
/*
2
 * Copyright (c) 1999-2001 Tony Givargis.  Permission to copy is granted
3
 * provided that this header remains intact.  This software is provided
4
 * with no warranties.
5
 *
6
 * Version : 2.9
7
 */
8
 
9
/*---------------------------------------------------------------------------*/
10
 
11
#include <reg51.h>
12
#include <math.h>
13
 
14
/*---------------------------------------------------------------------------*/
15
 
16
void main() {
17
 
18
    float x = 3.0;
19
    float y = 4.0;
20
    float xx, yy, xx_yy, sqrt_xx_yy;
21
 
22
    xx = x * x;
23
    P0 = (unsigned char)xx;
24
 
25
    yy = y * y;
26
    P1 = (unsigned char)yy;
27
 
28
    xx_yy = xx + yy;
29
    P2 = (unsigned char)xx_yy;
30
 
31
    sqrt_xx_yy = sqrt(xx_yy);
32
    P0 = (unsigned char)sqrt_xx_yy;
33
 
34
    while(1);
35
}

powered by: WebSVN 2.1.0

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