| ??? 01/25/03 23:34 Read: times |
#37274 - TIMER 2 Variants. |
I have "almost" completed porting a large subroutine collection of source code that is used to send/receive a 640 bits/second FSK protocol over a half duplex wire between two pieces of equipment. This code is a complex series of activities organized in a pair of state machines that are driven off the occurance of interrupts from TIMER 2 and INT0. INT0 is used to count the output pulses from the T2 output pin when timer 2 is being used to generate the frequency on the signal wire during transmission. The FSK transmission works as a series of bits where "0" bits are four cycles of 2560 Hz. "1" bits are five cycles of 3200 Hz. The receiver section uses the T2EX input pin to run a capture mode from pulse to pulse to time and count input pulses to recover data from the bus wire.
The original implementation of this I ported was not written by myself but was done in C on an Dallas DS80C320 processor running at 7.3728 MHz. I am porting the code to a Cygnal C8051F126 part running at 22.1184 MHz. The original Dallas implementation picked the TMR2 clocks as XTAL/4 which resultes in a rate of 1.8432 MHz. On the Cygnal part I have made it use the available choice of the XTAL/12 which also results in a rate of 1.8432 MHz. When I saw this nicety I thought originally that making the ported code function properly was going to be a piece of cake. However...... ....after several days of extremely hard work with a logic analyzer, a scope, my Cygnal debug platform, and hours pouring over manuals and data sheets I finally have it communicating with the "known good" piece of equipment on the other end of the wire. What this has all led to is that after many hours it is quite obvious that the TIMER2 on a Dallas 'C320 and a Cygnal 'F126 work somewhat the same but not entirely. And I have seen that both these TIMER 2 implementations are rather different in some details from the "Intel 8052 Reference Standard Timer 2". Some of the differences are rather subtle and only discovered by trial and error as some things just are not documented by reading a manufacturers list of SFR descriptions for the TIMER 2. I started this thread becasue I thought readers of this forum would like to know about the fact that not all TIMER2's are created alike. You may also want to share experiences you have had with your work using TIMER2. If we get a good response to this thread I will collect all the items together and create a 8052.COM FAQ on TIMER2 issues. Michael Karas |
| Topic | Author | Date |
| TIMER 2 Variants. | 01/01/70 00:00 | |
| RE: TIMER 2 Variants. | 01/01/70 00:00 | |
RE: TIMER 2 Variants. | 01/01/70 00:00 |



