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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/12/03 08:14
Read: times


 
#58364 - RE: AC linearization -Cant compare TH0 & TL0
Responding to: ???'s previous message

you're doing the dimmer the hard way....

try this:

mov dptr,#table_low
mov a,level
movc a,@a+dptr
mov r1,a ;low compare into r1
inc dptr
mov a,level
movc a,@a+dptr
mov r3,r1 ;hi compare into r3

; r3:r1 has the dimmer compare value

clr tr0
clr c
mov a,TL0
subb a,r1
mov r1,a
mov a,TH0
subb a,r3
mov r3,a
setb tr0 ;note the timer has lost about 18 cycles each time we do this...not good

;use carry to see if we've matched


I would suggest you use the capture/compare of timer2 or use a device with a PCA timer. I could also suggest using a faster cpu such as a AVR as I have implemented a 4 channel dimmer which tracks the mains frequency,does fades in 24bits and does dmx in an atmel at90s2313 at 8mhz - a normal 8051 has trouble doing this without going to a high clock speed.



List of 7 messages in thread
TopicAuthorDate
AC linearization -Cant compare TH0 & TL0            01/01/70 00:00      
   RE: AC linearization -Cant compare TH0 & TL0            01/01/70 00:00      
      RE: AC linearization -Cant compare TH0 & TL0            01/01/70 00:00      
         RE: AC linearization -Cant compare TH0 &            01/01/70 00:00      
            RE: AC linearization -Cant compare TH0 &            01/01/70 00:00      
   RE: AC linearization -Cant compare TH0 & TL0            01/01/70 00:00      
      RE: AC linearization -Cant compare TH0 & TL0            01/01/70 00:00      

Back to Subject List