| ??? 12/15/03 07:51 Read: times |
#60606 - RE: Call C Func. from Asm program? Responding to: ???'s previous message |
Andy said it all really. In reality, why call a 'c' function from assembler? The main reason to use assembler is for speed and calling a 'c' function especially sin() is not fast on a 8051 anyway. One of the tricks in embedded systems is to pre-calculate equations you know the range of inputs. You can also tailor the amount of precision you need. In your instance to generate a sine wave for an 8 bit DAC you know that the result has to be an integer between 0 and 255. So as Andy says, use excel or qbasic whatever to generate your solution as a table. To change the frequency of the output sinewave you can alter the sample rate you're reading the table at and/or skip samples. Also Andy mentions using PWM rather than a separate DAC - this can simplify things a bit. Most 8051 devices can generate PWM fairly easily and a resistor and capacitor on the output to smooth the signal and you have yourself a sinewave. Don't expect a good quality sinewave with only 8 bits - there'll be a bit of distortion. If you want more information, tell us more about your application. |
| Topic | Author | Date |
| Call C Func. from Asm program? | 01/01/70 00:00 | |
| RE: Call C Func. from Asm program? | 01/01/70 00:00 | |
| Sledgehammer to crack nut? | 01/01/70 00:00 | |
| RE: Call C Func. from Asm program? | 01/01/70 00:00 | |
| RE: Excel | 01/01/70 00:00 | |
RE: 8-Bit Sin Lookup Table !! | 01/01/70 00:00 |



