Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/05/03 05:49
Read: times


 
#38294 - RE: Help, saving square waves
Responding to: ???'s previous message
You could setup to have the signal be wired to the T2EX pin of an 8052 clone with a TIMER 2. It would be necessary to wire the square wave through one exclusive or (XOR) gate (i.e. one section of a 74HC86 chip). The opposite input of the XOR gate would be connected to another output port pin.

You would be using the TIME2 in an input capture mode so that at each time there is a negative transition on the T2EX pin then the timer would capture the count in the RCAP2H and RCAP2L registers. Also arrange the timer to generate an interrupt at this time. In the interrupt routine you would read the captured count and use it to determine how long it has been since the previous interrupt. Also in the interrupt you will toggle the level on the port pin that controls the exclusive or gate. This will have the effect of fixing it so that the next trigger of the T2EX pin will occur on the next opposite edge of the square wave input.

Using this system you can attain an accurate measure of the period of each half cycle of the square wave signal. These can then be logged in to a large memory such as an external RAM.

You can replay the waveform simply by reprogramming the TIMER2 in the high speed output mode where it can toggle the T2 output pin. You would reload the TIMER 2 reload registers from the previously stored data table to reproduce the equivalent half cycle time periods.

It should not take long to realize however that with 16 bit counts for the logged periods that one cannot save too long of waveform period with this scheme if the input frequency is very high. For example, if the frequency was roughly 3 KHz, then a 32K external memory could store about 8K half period samples in the data table. This would result in a few seconds of playback capability.

To over come this delemma please note that it is unlikely that the signal frequency can change very fast as compared to its actual frequency. Thus one can create a simple form of data compression by not storing every 1/2 cycle period value in the log list. Instead you store the count period once and then keep a counter value in the table that specifies how many times to use the same half cycle period.

I hope this gives a general outline of one approach to your problem.
Michael Karas


List of 8 messages in thread
TopicAuthorDate
Help, saving square waves            01/01/70 00:00      
   RE: Help, saving square waves            01/01/70 00:00      
      RE: Help, saving square waves            01/01/70 00:00      
      RE: Help, saving square waves            01/01/70 00:00      
   RE: Help, saving square waves            01/01/70 00:00      
      RE: Help, saving square waves            01/01/70 00:00      
         RE: Help, saving square waves            01/01/70 00:00      
            RE: Help, saving square waves            01/01/70 00:00      

Back to Subject List