I want to edit a at89c51 program and I am a total noob to microcontrollers.

Thread Starter

sabareeshchambayil

Joined Jul 17, 2015
28
If you don't know about the uC, you better not to do anything for your friend, because the uC is a hard work, it needs hardware and software conceptions and knowledges, the best way is that you go to study the uC and when you have any problems then you can ask for help.

I was copied DLY_2MIN to DLY_1MIN and modified the values of R2, and R3.
you can try it, probably it needs to modify the R4 a little, I also modified the first line of the LOOP program from LCALL TMR_5MIN to LCALL DLY_1MIN.

Code:
    ;-----------------------------------------------
LOOP:
     LCALL DLY_1MIN     ;CALL 1 MIN. TIMER
     JNB 78H,L3     ;L/V THEN GOTO 018B H
     JNB 77H,L2      ;H/V THEN GOTO 0136 H
     JB 76H,L5      ;DRY SUMP THEN GOTO 0188 H
     JB P2.2,$      ;WAIT UNTIL TANK FULL
LOOP1:
     LJMP TANK_FULL     ;GOTO TANK FULL DISPLAY
==========================================
Code:
;------------------------- ORG  05xxH ---------------------------------
     ORG  05xxH
DLY_1MIN:
     MOV R2,#07FH
L502:
     MOV R3,#07FH
L504:
     MOV R4,#0FFH
L506:
     NOP  
     NOP  
     NOP  
     NOP  
     DJNZ R4, L506
     DJNZ R3, L504
     DJNZ R2, L502
     RET       ;BACK TO MAIN PROGRAMME



Can you tell me where can i learn 8051 programming ,tried many websites that made me more confused.
and i attatch the file i changed.

can you please tell me whats the mistake i have done
[ I tried changing the programm from orginal source by placing 1 minute instead of 10 minutes in Lines
77
332
389
431 ]
 

Attachments

Thread Starter

sabareeshchambayil

Joined Jul 17, 2015
28
If you don't know about the uC, you better not to do anything for your friend, because the uC is a hard work, it needs hardware and software conceptions and knowledges, the best way is that you go to study the uC and when you have any problems then you can ask for help.

I was copied DLY_2MIN to DLY_1MIN and modified the values of R2, and R3.
you can try it, probably it needs to modify the R4 a little, I also modified the first line of the LOOP program from LCALL TMR_5MIN to LCALL DLY_1MIN.

Code:
    ;-----------------------------------------------
LOOP:
     LCALL DLY_1MIN     ;CALL 1 MIN. TIMER
     JNB 78H,L3     ;L/V THEN GOTO 018B H
     JNB 77H,L2      ;H/V THEN GOTO 0136 H
     JB 76H,L5      ;DRY SUMP THEN GOTO 0188 H
     JB P2.2,$      ;WAIT UNTIL TANK FULL
LOOP1:
     LJMP TANK_FULL     ;GOTO TANK FULL DISPLAY
==========================================
Code:
;------------------------- ORG  05xxH ---------------------------------
     ORG  05xxH
DLY_1MIN:
     MOV R2,#07FH 
L502: 
     MOV R3,#07FH 
L504: 
     MOV R4,#0FFH 
L506:
     NOP     
     NOP     
     NOP     
     NOP     
     DJNZ R4, L506 
     DJNZ R3, L504   
     DJNZ R2, L502 
     RET       ;BACK TO MAIN PROGRAMME


This is not working , there's only " S " showing in LCD.
burned the hex file in http://forum.allaboutcircuits.com/attachments/water2-zip.116712/
 

ScottWang

Joined Aug 23, 2012
7,398
Can you tell me where can i learn 8051 programming ,tried many websites that made me more confused.
and i attach the file i changed.

can you please tell me whats the mistake i have done
[ I tried changing the programm from orginal source by placing 1 minute instead of 10 minutes in Lines
77
332
389
431 ]
So the display of this program is ok, but the number is still counting as 10 minutes?
 

ScottWang

Joined Aug 23, 2012
7,398
I'm sorry, I forgot why it had errors but I didn't correct it, the new attached files didn't show any errors.

The DLY_1MIN was copied from DLY_2MIN, but I didn't modify the ORG address (ORG 0500H) and 3 labels as L502, L504, L506, and the new ORG address is ORG 0520H and 3 labels as L501, L503, L505, they didn't duplicated the name of labels now.

I didn't try it in the real circuit, so I didn't know how precisely is it of the original delay 2 minutes, I just modified the value from 0FFH(255 D) to 7FH(127 D), so it could be has a time less than 0.468 Sec that it compared with the original 0FFH(255 D) and the T= 60S*(1/128) = 60S*0.0078 = 0.468 Sec when it counting as 1 minutes.

∇ - 2 minutes delay :
Code:
;------------------------- ORG  0500H ---------------------------------
     ORG  0500H
DLY_2MIN:
     MOV R2, #0FFH 
L502: 
     MOV R3,#0FFH 
L504: 
     MOV R4,#0FFH 
L506:
     NOP     
     NOP     
     NOP     
     NOP     
     DJNZ R4, L506 
     DJNZ R3, L504   
     DJNZ R2, L502 
     RET       ;BACK TO MAIN PROGRAMME
∇ - 1 minute delay :
Code:
;------------------------- ORG  0520H ---------------------------------
     ORG  0520H
DLY_1MIN:
     MOV R2,#07FH 
L501: 
     MOV R3,#0FFH 
L503: 
     MOV R4,#0FFH 
L505:
     NOP     
     NOP     
     NOP     
     NOP     
     DJNZ R4, L505 
     DJNZ R3, L503   
     DJNZ R2, L501 
     RET
 

Attachments

Thread Starter

sabareeshchambayil

Joined Jul 17, 2015
28
I'm sorry, I forgot why it had errors but I didn't correct it, the new attached files didn't show any errors.

The DLY_1MIN was copied from DLY_2MIN, but I didn't modify the ORG address (ORG 0500H) and 3 labels as L502, L504, L506, and the new ORG address is ORG 0520H and 3 labels as L501, L503, L505, they didn't duplicated the name of labels now.

I didn't try it in the real circuit, so I didn't know how precisely is it of the original delay 2 minutes, I just modified the value from 0FFH(255 D) to 7FH(127 D), so it could be has a time less than 0.468 Sec that it compared with the original 0FFH(255 D) and the T= 60S*(1/128) = 60S*0.0078 = 0.468 Sec when it counting as 1 minutes.

∇ - 2 minutes delay :
Code:
;------------------------- ORG  0500H ---------------------------------
     ORG  0500H
DLY_2MIN:
     MOV R2, #0FFH
L502:
     MOV R3,#0FFH
L504:
     MOV R4,#0FFH
L506:
     NOP    
     NOP    
     NOP    
     NOP    
     DJNZ R4, L506
     DJNZ R3, L504  
     DJNZ R2, L502
     RET       ;BACK TO MAIN PROGRAMME
∇ - 1 minute delay :
Code:
;------------------------- ORG  0520H ---------------------------------
     ORG  0520H
DLY_1MIN:
     MOV R2,#07FH
L501:
     MOV R3,#0FFH
L503:
     MOV R4,#0FFH
L505:
     NOP    
     NOP    
     NOP    
     NOP    
     DJNZ R4, L505
     DJNZ R3, L503  
     DJNZ R2, L501
     RET

The hex provided was burned and checked.
The dry sump timer now 26 seconds, and motor is not turning off while tank is full.
Motor is running continuously.
 
Top