Skip to main content
Visitor II
December 25, 2004
Question

Sin calculation

  • December 25, 2004
  • 11 replies
  • 2588 views
Posted on December 25, 2004 at 08:22

Sin calculation

    This topic has been closed for replies.

    11 replies

    saladinoAuthor
    Visitor II
    October 9, 2003
    Posted on October 09, 2003 at 15:06

    Dear all,

    I use the ST72F521R9 microprocessor. I need to calculate the trigonometrical formula x=sin(y) using the assembly code of the ST7. Is there anyone who has such routine either in souce code or as object file?

    Thank you for the help.

    Visitor II
    October 13, 2003
    Posted on October 13, 2003 at 05:28

    Can you use a tabel to calculate it?

    saladinoAuthor
    Visitor II
    October 13, 2003
    Posted on October 13, 2003 at 06:47

    Dear Moppie,

    which kind of table you mean?
    Visitor II
    October 13, 2003
    Posted on October 13, 2003 at 09:02

    You want to calculate X=sin(Y).

    If the Y = 0 to 255 (or higher) you can made a table.

    Y is the pointer of the table

    In the table are the calculated values of sin(Y), thus X

    You spend a lot of time in the programming.

    saladinoAuthor
    Visitor II
    October 13, 2003
    Posted on October 13, 2003 at 10:10

    I cannot use a table because I need to calculare the sin formula for sine wave generation and to calculare a cripto code. So the value of Y could be any.

    Visitor II
    October 13, 2003
    Posted on October 13, 2003 at 10:34

    If you want to made a sine wave generator, you could be use a table!

    You made a table like my last message.

    The frequency of the sinewave can be varieted by the sample time of reading the table.

    The amplitude can be varieted by the multiply factor by reading the value of the table.

    saladinoAuthor
    Visitor II
    October 13, 2003
    Posted on October 13, 2003 at 12:03

    you're full right about. The problem come up when I need the calculation of the sin to create a cripto code. Actually in this case I need to calculate the sin and cosin. Do you have any suggestion?

    Visitor II
    October 13, 2003
    Posted on October 13, 2003 at 12:12

    I don't understand the words cripto code?

    For sin and cosin you can use 2 pointers for the same table with 90 degrees phaseshift

    [ This message was edited by: Moppie on 13-10-2003 15:44 ]

    [ This message was edited by: Moppie on 13-10-2003 15:45 ]
    saladinoAuthor
    Visitor II
    October 13, 2003
    Posted on October 13, 2003 at 13:51

    The crypto code means generating stream of data encoded with a certain kind of calculation so then the real data coming out from a microprocessor are unreadable. This kind of encoding is done with a public key and private key criteria to generate protected trasmission. To do that the two main formula used are sin and cosin. It is true that the cosin is the 90° phaseshift respect the sin but in this case I need a precise calculation otherwise the data decoder will re-generate a wrong message.

    Visitor II
    October 14, 2003
    Posted on October 14, 2003 at 19:53

    This might be a ''long shot'', but do a search on CORDIC for trig calculations.

    Good luck