??? 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 |