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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/08/09 20:35
Read: times


 
#162189 - Help Needed in P89V51RD2 (to acheive PWM)
Hi all,

I've been working only with AT89S52 for about two months.

I'm almost a newbie. Tried to flash simple programs in P89V51RD2 using FlashMagic and it worked fine.

The main purpose of choosing this MCU was to get continuous PWM output without disturbing the normal program.

But I tried the following code in Keil and flashed the hex file using ISP:


ORG 000H

sfr CCAP0H 	= 0xFA
sfr CCAP0L 	= 0xEA
sfr CCAPM0 	= 0xDA
sfr CCON   	= 0xD8
sfr CMOD	= 0xD9

sbit CR		= 0xDE

MAIN:
MOV SP, #02FH

MOV CCAP0H, #128
MOV CCAP0L, #000

MOV CCAPM0, #066

MOV CMOD, #128
MOV CCON, #001

AGAIN:
	  	SETB CR
		LCALL DELAY		
		CLR CR
		MOV CCAP0H, #245		
		SETB CR		
		LCALL DELAY		
		CLR CR		
		MOV CCAP0H, #128		
		SJMP AGAIN

//Using 11.0592MHz Crystal
DELAY:
		MOV R0, #007
L1:		MOV R1, #255
L2:		MOV R2, #255
		DJNZ R2, $
		DJNZ R1, L2
		DJNZ R0, L1
		RET

END

 




I expected PWM output from P1.3 (Pin 4 of IC). I don't get PWM output :(

I connected P1.3, to base of BC547, emitter to gnd, From Vcc to LED, to 100ohm resistor then to collector.

I don't see any change in its brightness.

Somebody pleeeze help me. Plz give me a sample code of how to do PWM with this MCU. I've been breaking my head for two hours ( I know that might sound funny) :(

List of 7 messages in thread
TopicAuthorDate
Help Needed in P89V51RD2 (to acheive PWM)            01/01/70 00:00      
   Its working..!            01/01/70 00:00      
   one step back            01/01/70 00:00      
   for any PCA question, the best reference is            01/01/70 00:00      
      Thanks all :)            01/01/70 00:00      
      To Erik: copying & posting links            01/01/70 00:00      
         sorry            01/01/70 00:00      

Back to Subject List