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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/26/06 09:01
Read: times


 
#117131 - code finished, but small error
Responding to: ???'s previous message
hello!

first i want to thank all of you who posted me and helped me reaching my goal.
i've written my source code now but i have a small problem with the output.

i built the difference between the oldest and the old capture when a new capture happens.
the difference should be the period T of my signal as i am always triggering on the falling edge of my square signal.

here is my code:
as we are programming in 3 independent files(ASM;DEF;INT) i have to send all 3 files:
firstly the Assembler file:

IMPORTANT NOTICE: OLD=ALT
NEW=NEU

$ INCLUDE (80C552.DEF) ;Definitionen 8052
$ INCLUDE (WORK.DEF) ;Definitionen des Projektes

ORG 8000h ;Beginn bei 08000h (für den Kit)
_RESET:
LJMP START

$ INCLUDE (WORK.INT)

ORG 8400h

START:
mov sp,#stack-001h
;--------------------------------------------------------------------
INIT: ;timer 2 initialisierungen
mov TM2CON,#00000001b

mov CTCON,#00000010b

mov TM2IR,#00000001b
mov IEN1,#00000001b
mov r2,#3
clr f0
setb ea

;-------------------------------------------------------------
main:

jnb f0,main
clr ea

;_______________________________________________________________
;(AUSGABEPROGRAMM ZUM TESTEN DES ERGEBNISSES)
mov dptr,#zeichen0 ;___
lcall string_out ;|
mov a,cth0neu ;|
lcall hex_byte_out ;cth0neu out |
lcall cr_lf_out ; |new
; |capture
mov dptr,#zeichen1 ; |values
lcall string_out ; |
mov a,ctl0neu ; |
lcall hex_byte_out ;ctl0neu out |
lcall cr_lf_out ;""""
;............................................................
mov dptr,#zeichen2 ;___
lcall string_out ; |
mov a,cth0alt ;cth0alt out |
lcall hex_byte_out ; |
lcall cr_lf_out ; old
mov dptr,#zeichen3 ; |capture
lcall string_out ; |values
mov a,ctl0alt ;ctl0alt out ; |
lcall hex_byte_out ; |
lcall cr_lf_out ;"""

;.............(subtraction: ).................

clr cy
mov a,ctl0alt ;+
subb a,ctl0neu ;|
mov erg_lo,a ;+


mov a,cth0alt ;+
subb a,cth0neu ;|
mov erg_hi,a ;+


mov dptr,#zeichen6
lcall string_out

lcall cr_lf_out


mov dptr,#zeichen4
lcall string_out
;.......................
mov a,erg_lo ;+
lcall hex_byte_out ;+

lcall cr_lf_out

mov dptr,#zeichen5
lcall string_out

mov a,erg_hi ;+
lcall hex_byte_out ;+


lcall cr_lf_out

lcall char_in
;...................
lcall cr_lf_out
lcall cr_lf_out



mov r2,#03
clr f0
setb ea


ljmp main

zeichen0:
DB 'Value High NEU ist: ',80h
zeichen1:
DB 'Value Low NEU ist: ',80h
zeichen2:
DB 'Value High ALT ist: ',80h
zeichen3:
DB 'Value Low ALT ist:',80h
zeichen4:
DB 'Ergebnis1 (=ergebnis low) ist: ',80h
zeichen5:
DB 'Ergebnis2 (=ergebnis high) ist: ',80h
zeichen6:
DB '_____________________________________'
end


--------------------------------------------------
ORG 08033h
_TF2_EXF2:
LJMP JR1_T1

ORG 08073h

ljmp JIE0


JR1_T1:

mov cth0alt,cth0neu
mov ctl0alt,ctl0neu
mov cth0neu,cth0
mov ctl0neu,ctl0

djnz r2,aus
setb f0

aus:
reti
-------------------------------------------------------------
ctl0alt data 3Ah
ctl0neu data 3Bh
cth0alt data 3Ch
cth0neu data 3Dh

erg_lo data 30h
erg_hi data 31h





List of 51 messages in thread
TopicAuthorDate
measuring illumination by tsl220            01/01/70 00:00      
   sh.. project            01/01/70 00:00      
   PROCESSOR !            01/01/70 00:00      
      processor 80c552            01/01/70 00:00      
         why CCU? KISS            01/01/70 00:00      
            ccu is necessary            01/01/70 00:00      
               who is making it?            01/01/70 00:00      
                  well, thats true but....            01/01/70 00:00      
         Look at this            01/01/70 00:00      
   any programmes?            01/01/70 00:00      
      why not source code 1??            01/01/70 00:00      
         programmes=source codes;)            01/01/70 00:00      
            I agree            01/01/70 00:00      
               ok            01/01/70 00:00      
                  You are a lazy bone!!            01/01/70 00:00      
               source code 1            01/01/70 00:00      
                  you have still not explained ...            01/01/70 00:00      
   You need frequency counter. Look here.            01/01/70 00:00      
   elaborationg on simple solution            01/01/70 00:00      
      relax            01/01/70 00:00      
         blatantly untrue            01/01/70 00:00      
            please apologize            01/01/70 00:00      
               Timer2-what for?            01/01/70 00:00      
                  here's the exact definition of the prblm            01/01/70 00:00      
                     how do i attach files in the postings?            01/01/70 00:00      
                        Posting file listings            01/01/70 00:00      
                     Have a look again...            01/01/70 00:00      
                        ok, i'll do this immediately.            01/01/70 00:00      
                     Capture registers            01/01/70 00:00      
                     E-mail address            01/01/70 00:00      
                        mail adress            01/01/70 00:00      
   next problem            01/01/70 00:00      
      not spilling the beans            01/01/70 00:00      
   link forgotten sorry            01/01/70 00:00      
      In english...            01/01/70 00:00      
      CPT registers            01/01/70 00:00      
         maybe at this time he is in his little            01/01/70 00:00      
            happy about all postings            01/01/70 00:00      
               re flag            01/01/70 00:00      
                  re:re:flags            01/01/70 00:00      
                     You have to set the flag!            01/01/70 00:00      
         Do you have a simulator?            01/01/70 00:00      
            re:simulator            01/01/70 00:00      
               Single Stepping            01/01/70 00:00      
   save capture before next capture            01/01/70 00:00      
      Capture registers            01/01/70 00:00      
   The cookbook            01/01/70 00:00      
   code finished, but small error            01/01/70 00:00      
      atomicity            01/01/70 00:00      
      Who is Hans Meiser???            01/01/70 00:00      
         hans meiser!            01/01/70 00:00      

Back to Subject List