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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/21/05 08:23
Read: times


 
#97713 - Help with Assembly Code
Hello guys

I am working on a project that involves using atmel microcontroller, i would say that i have fairly decent knowledge of using MCS-51 family but i am stuck on this one.at the moment i am just trying to configure hardware of micro, i am using AT89S8252(first time ever), in my program i send #00 data to all ports but for some reason it does not seem to be working as i supply power to micro, the LEDs connected at the port lit up and pins are giving high signal on all ports except port 0. i have tried everything possible but nothing seems to be working, even the more annoying fact is that last night when i left my workshop the ciruit was working and as i have popped in this morning and switched on power supply it is not looking good. i am also pasting the code below which i am using. any tips, comments, help would be much appreciated. (I have also tried the same code with AT89C2051 and it works perfectly fine, do i have to do extra coding for AT89S8252).

/////////////////BELOW IS THE CODE///////////////////

ORG 0000H

BUTTON EQU 1.7
DOWN EQU 1.6
SHAKE EQU 1.5
UP EQU 1.4

JMP MAIN

MAIN:

MOV P0,#00H
MOV P1,#00H
MOV P2,#00H
MOV P3,#00H

HERE: JNB P1.7, HERE
CALL DEBOUNCE
SETB P1.6
CALL DELAY
CLR P1.6
CALL SDELAY
SETB P1.5
CALL DELAY
CLR P1.5
CALL SDELAY
SETB P1.4
CALL DELAY
CLR P1.4
JMP HERE

DEBOUNCE:

MOV R2, #0AH

LOOP4: MOV R3, #09H

LOOP3: MOV R4, #09H

LOOP2: MOV R5, #09H

LOOP1: DJNZ R5, LOOP1

DJNZ R4, LOOP2

DJNZ R3, LOOP3

DJNZ R2, LOOP4
RET


DELAY:


MOV R2, #0FFH

LOOPA4: MOV R3, #08H

LOOPA3: MOV R4, #090H

LOOPA2: MOV R5, #09H

LOOPA1: DJNZ R5, LOOPA1

DJNZ R4, LOOPA2

DJNZ R3, LOOPA3

DJNZ R2, LOOPA4
RET


SDELAY:

MOV R2, #07H

LOOPAB4: MOV R3, #09H

LOOPAB3: MOV R4, #090H

LOOPAB2: MOV R5, #090H

LOOPAB1: DJNZ R5, LOOPAB1

DJNZ R4, LOOPAB2

DJNZ R3, LOOPAB3

DJNZ R2, LOOPAB4
RET
END



List of 31 messages in thread
TopicAuthorDate
Help with Assembly Code            01/01/70 00:00      
   Just one question            01/01/70 00:00      
   REPLY            01/01/70 00:00      
      74HC244            01/01/70 00:00      
   Some Possibilities:            01/01/70 00:00      
   Don't be surprised ...            01/01/70 00:00      
      Do not use TABs!            01/01/70 00:00      
         Right, but I meant            01/01/70 00:00      
            in case of Keil            01/01/70 00:00      
               Sharp eye !            01/01/70 00:00      
   re:mehdi & don't be surprised            01/01/70 00:00      
      RC Reset!!!            01/01/70 00:00      
   could you explain            01/01/70 00:00      
   Port 1 output/input conflict.            01/01/70 00:00      
      port 0 assigned as output            01/01/70 00:00      
         hiding the point            01/01/70 00:00      
   RE: Input/Output port            01/01/70 00:00      
      infinite loop            01/01/70 00:00      
      port            01/01/70 00:00      
         terminology            01/01/70 00:00      
         re: Erik Malund            01/01/70 00:00      
            killing your '51            01/01/70 00:00      
               re: killing your '51            01/01/70 00:00      
                  Negative logic            01/01/70 00:00      
                  0 and 1            01/01/70 00:00      
            I know it is not "in" to read before act            01/01/70 00:00      
   Pullups?            01/01/70 00:00      
      Well ... maybe not with TTL ...            01/01/70 00:00      
         strictly speaking,for 74LS...            01/01/70 00:00      
         oh yes?            01/01/70 00:00      
   re: re: got it            01/01/70 00:00      

Back to Subject List