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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Jai Nair
01/17/13 11:56
Read: 955 times


 
#189227 - LED currents
Responding to: David Prentice's previous message
DEAR DAVID SIR,

I KNOW 89S52 CAN'T DRIVE LED,I WILL USE DREIVER LIKE BC547 OR SOMETHING ELSE.

I HAVE POSTED SECOND CODE WHICH IS--(CAN IT BE HELPFUL FOR ME TO ADD POT METERE.IF YES THEN WHAT WOULD BE CODE)-

ORG 0000H
LJMP MAIN

;Delay function.Put 16-bit delay in milli seconds.R1-higher byte and R0-lower byte.
DELAY:
MOV TL0,#0FFH
MOV TH0,#0E0H
SETB TR0
CONTINUE:JNB TF0,CONTINUE ;Delay for 1ms
CLR TF0
CLR TR0
DJNZ R0,DELAY ;Lower
CJNE R1,#00H,LABEL ;Higher
RET
LABEL:
DEC R1
SJMP DELAY

;**************Main***************
MAIN:

;call subroutine FORWARD for 10 times
MOV R2,#0aH
LABEL_0:
LCALL FORWARD
DJNZ R2,LABEL_0

;call subroutine REVERSE for 10 times
MOV R2,#0aH
LABEL_1:
LCALL REVERSE
DJNZ R2,LABEL_1

;call subroutine DESIGN1 for 10 times
MOV R2,#0aH
LABEL_2:
LCALL DESIGN1
DJNZ R2,LABEL_2

LJMP MAIN

;DESIGN1 subroutine
DESIGN1:
MOV P1,#0ffH
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#0bfH
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#0dfH
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#0efH
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#0f7H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#0fbH
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#0fdH
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#0feH
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#0ffH
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
RET

;FORWARD subroutine
FORWARD:
MOV P1,#080H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#040H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#020H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#010H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#08H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#04H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#02H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#01H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
RET

;REVERSE subroutine
REVERSE:
MOV P1,#01H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#02H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#04H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#08H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#010H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#020H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#040H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
MOV P1,#080H
MOV R1,#00H
MOV R0,#032H
LCALL DELAY
RET

END

List of 36 messages in thread
TopicAuthorDate
LED CHASER      Jai Nair      01/12/13 13:41      
   To avoid problems      Hal Albach      01/12/13 15:10      
      RMW uses latch      Maarten Brock      01/13/13 06:37      
      LED CHASER      Jai Nair      01/14/13 01:19      
         very possible        Erik Malund      01/14/13 07:27      
            LED CHASER      Jai Nair      01/14/13 08:59      
               Do you know what comments are?        Richard Erlacher      01/14/13 11:20      
                  oddly enough      Erik Malund      01/14/13 11:33      
                     Very true      Kalpak Dabir      01/14/13 20:07      
                     Design your project in the first place        David Prentice      01/15/13 09:14      
               yes, when      Erik Malund      01/14/13 11:30      
                  led chaser_comment      Jai Nair      01/16/13 09:13      
                     it would be helpful      Erik Malund      01/16/13 09:42      
                        chip       Jai Nair      01/16/13 10:11      
                           read the datasheet      Erik Malund      01/16/13 11:51      
                              potentiometer      Jai Nair      01/16/13 23:27      
                                 Erik's typing      Andy Neil      01/17/13 02:13      
                                 RE: potentiometer      Andy Neil      01/17/13 02:28      
                              Not entirely true      Andy Neil      01/17/13 02:17      
                                 The AT89C2051 has analog comparator      David Prentice      01/17/13 02:32      
                                    LED currents      Jai Nair      01/17/13 11:56      
                                       no, you have not      Erik Malund      01/17/13 13:01      
                                          comment      Jai Nair      01/17/13 13:33      
                                             which is also uncommented scribbles      Erik Malund      01/17/13 13:46      
                                                comment      Jai Nair      01/18/13 09:42      
                                                   He wants you to put descriptive, detailed comments      Andy Neil      01/18/13 09:58      
                                                      thanks       Jai Nair      01/18/13 10:01      
                                                         Will you do it?      Andy Neil      01/18/13 13:02      
                                                            comment      Jai Nair      01/18/13 13:12      
                                                               A method I have used for LED signs        Erik Malund      01/18/13 13:46      
                                                                  OMG      Michael Karas      01/18/13 18:47      
                                                                     one example, please      Erik Malund      01/18/13 20:25      
                                                               bear in mind that not everyone will recognize "LED Chaser"      Richard Erlacher      01/22/13 09:27      
                                                   apparently you still don't know what comments are      Richard Erlacher      01/22/13 09:17      
   no, you don't      Erik Malund      01/12/13 19:41      
   ADC with 89C2051 comparator      Hal Albach      01/25/13 18:25      

Back to Subject List