??? 06/11/05 10:05 Read: times |
#94675 - This is the code for timer n counter Responding to: ???'s previous message |
HI Frandz,
Thanks for the reply I have written a code for the frequency counter,it is like this the P3.3(t0) is kept for the counting purpose of frequncy and it is in the 16 bit mode mode1 the timmer t1 is kept for the delay purose. whne the counting is completed an intrept is genearated, This will maek the counting stop and the 16 bit data is stored in the TL0 and TH0 and it wil be hex value of the unknown frequency which is devided by 10. now i wil write the lookup table but i am in little bit confusion to write the lookup table, just c the code does it ok, or not pls correct it if it have nay mistake ************** progrm starts here freq.asm********* frqflag equ 0Fh freq: org 0000h mov sp,#30h sjmp over org 001bh setb psw.3 inc r0 cjne r0,#00h,checktime inc r1 checktime: cjne r1,#03h,goback cjne r0,#0e8h,goback clr tr0 clr tr1 setb frqflag goback: clr psw.3 reti ;;; main progrmme starts here over: mov Tcon,#00h ;clear all timers stopped - flag reset setb psw.3 ;select reg,bank 1 and reset r0, and r1 mov r0,#00h mov r1,#00h clr psw.3 ;return to bank 0 mov tmod,#25h ; t1 a mode2 counter as timer, and t0 a mode 1 -16 bit counter mov tl1,#9ch ; tl1 strts countdown from 9c=156 mov th1,#9ch ; th1 will overload 156= 9c mov tl0,#00h mov th0,#00h clr frqflg mov Tcon,#50h mov ie,#88h sim: jbc frqflag,getfrq sjmp sim getfrq: mov R6,tl0 ; show freq. count in hex on p1 & p2,whichis p1, p2 == unknonfreq/10 mov R7,th0 ; P1 ->LSB and P2-> MSB ; look up table lowbyte equ 0200h highbyte equ 0300h mov dptr,#lowbyte mov a,@a+dptr ////***** here what vlues i wan 2 give***//// sjmp over end |
Topic | Author | Date |
A doubt in making timmer and a counter | 01/01/70 00:00 | |
Intel Application Note | 01/01/70 00:00 | |
Re | 01/01/70 00:00 | |
If you could | 01/01/70 00:00 | |
This is the code for timer n counter | 01/01/70 00:00 | |
Error message? | 01/01/70 00:00 | |
Kai dont u refer the code it is incompl | 01/01/70 00:00 | |
'org' and 'db'... | 01/01/70 00:00 | |
Look Up Table: | 01/01/70 00:00 | |
Oh | 01/01/70 00:00 | |
A probable solution... | 01/01/70 00:00 | |
HI Can I use the lookup table for Fract | 01/01/70 00:00 | |
Convert it !![]() | 01/01/70 00:00 |