Hi, I´m working in a project, i´m using AT89S52 with a xtal at 22.1184MHz, I need to generate a binary coded sine wave with 20KHz at P1 with max and min amplitude using the 8bits of P1, 0000 0000 for min and 1111 1111 for max . It will be applied to a hi speed DAC
For a good reproduction of the wave I should amostrate with like 400KHz, this mean that the P1 get 400.000 values per second
The question is, can the 89S52 deal with that speed?
22.118.400 / 12 = 1.843.200 operation cycle per second
if you want to generate 400KHz,
1.843.200 / 400.000 = 4,608 cycle per wave form.
I think its difficult to use this microcontroller for your requirement even if you have very efficient code.
my suggestion is to use RISC microcontroller such as Atmel AVR, with one clock per most one operation cycle.
This MCU is not good choice for your app. Use RISC. Memember that everything must be generated by FW. FW obviously contains much more codes than one signe line.