URGENT!....how do i write a program for timing??


anyone out there..pls help me out!..

im having problems writing a program using uVision2 for a 8052 developement kit.

problem no.1: I have a Waveform of unknown freq from a swipe card which has TTL voltage of 0 and 5v. we need to design a program using C to count the time between the very 1st 2 high voltage
(1st 2 high V)

problem no.2: Next we hav to decode the waveform using a table. Basically its a Magnetic Swipecard we hav to decode, track 2 (eg 411557, 5bits per character)

half the program has been written so far but we can;t seem to output it to the LCD display...


HELP ME ANYONE PLEASE!!!...
Desperate.
ps: any qns, pls feel free to email me
arelius@visto.com

Parents
  • You should make use of the features of the Timer 2. You can feed the T2 input (Port 1) with a clock signal of a certain frequency... (maybe 100kHz) and use the T2EX input for the signal to be meassured. A 0->1 transition of it will cause an interrupt and the counter content will be captured in a certain 16-bit register. This way, you can meassure the period of the signal with the accuracy of your 100kHz clock. The Timer 2 has to be configured in capture mode. The operation of it is described pretty well in the datasheet of your processor.

    Take care
    Sven

Reply
  • You should make use of the features of the Timer 2. You can feed the T2 input (Port 1) with a clock signal of a certain frequency... (maybe 100kHz) and use the T2EX input for the signal to be meassured. A 0->1 transition of it will cause an interrupt and the counter content will be captured in a certain 16-bit register. This way, you can meassure the period of the signal with the accuracy of your 100kHz clock. The Timer 2 has to be configured in capture mode. The operation of it is described pretty well in the datasheet of your processor.

    Take care
    Sven

Children
More questions in this forum