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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/17/04 04:21
Read: times


 
#68662 - RE: Decelaration of a short int
Responding to: ???'s previous message
i been working on it and made some improvements here is what i have now. I am getting operation invalid in this segment errors.

/* used to time a one minute interval */


/* want timer 1 in 8 bit auto reload */
/* need 2 unsigned char counter1 and counter2 to cout 1000 overflows of timer1, inital values for counter1 and counter2 are 0 */

counter SEGMENT DATA
RSEG counter
counter1: DS 1
counter2: DS 1


start: mov TMOD, #40h ; counting machine cycles
mov TH1, #38h ; counts 200 clock pulse = 200 * .5us = 1 ms for 24MHz crystal
mov counter1, #00h ;
mov counter2, #00h ;
setb TR1 ; start timer
stay: JNB TF1, stay ; stay here until timer 1 overflows
inc counter1 ; counter = counter + 1
mov R0, counter1 ;
cjne R0, #00h, clear ; if counter 1 didn't overflow jump to clear
inc counter2 ; counter1 over flowed inc counter2
mov R0, counter2 ;
cjne R0, #03h, clear ; counter2 not 03 so jump to clear
mov R0, counter1 ;
cjne R0, #0E8h, clear ; counter1 not E8 so jump to clear
mov counter1, #00h ; counter = 1000 so reload
mov counter2, #00h ; counter is reloaded
lcall inc_min () ; counter = 1000 so inc the min
clear: clr TF1 ; clear the overflow flag for next time
ajmp check_set () ; check the clock_set button every ms
; insert a check for trigger
ajmp stay ; jump back to stay
END




List of 5 messages in thread
TopicAuthorDate
Decelaration of a short int            01/01/70 00:00      
   RE: Decelaration of a short int            01/01/70 00:00      
   I almost have it            01/01/70 00:00      
   RE: Decelaration of a short int            01/01/70 00:00      
   To the poster or imposter:            01/01/70 00:00      

Back to Subject List