Saturday, January 20, 2007

Characterizing the timing in the 8052.

My father is building a fly-back style switching power supply to power the post-ultor on our scope tube project. In order to characterize the magnetics he wants to have the switching controlled by a PWM at first.

The specs he gave me to produce are “a fixed on time at 10 uSeconds on, minimally 10 uS off, up to 1mS or more” so that he can start doing first order testing his protection diodes, etc.

In order to do this I have to characterize the timing of my 8051 boards timing. Aside from the LCD interfacing (which will be uploading soon) this is the first programming project I have done for “real time.” In order to do this, I will want to create delay routines, so I need to characterize my fundamental delay command: NOP.

Using my scope and frequency counter I wrote three assembly programs that flip P0 back and forth. While I could find out the length of a NOP with two cases I could not be sure that my counter wasn’t being fooled in the noisy digital environment.


LOOP:
SETB P0
NOP
CLR P0
SJMP LOOP
END




Measured period: 2.5 microseconds


LOOP:
SETB P0
NOP
CLR P0
NOP
SJMP LOOP
END





Measured period: 3 microseconds



LOOP:
SETB P0
NOP
NOP
CLR P0
NOP
NOP
SJMP LOOP
END




Measured period: 4 microseconds


Conclusion:
NOP takes 0.5 microseconds

No comments: