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

Thread Starter

sabareeshchambayil

Joined Jul 17, 2015
28
It's a programm for automatic water pump controller cum motor Protector and need to change the 10 minute dry running condition to 5 minute.I made it and its working now.i don't know I can post external link here.
 

shteii01

Joined Feb 19, 2010
4,647
Is the chip soldered to the board or sitting in a chip holder on the board?

If it is in the holder, the easiest thing to do is to get the second chip, program it using whatever programming device you have/can buy/can build, then pull old chip out, insert new chip in.
 

Thread Starter

sabareeshchambayil

Joined Jul 17, 2015
28
Sorry for my mistake.I forgot to mention.

I know how to programm a microcontroller.(My friend has programmer)

I need to edit the programm thats I am asking.

And I have 3 files of the programm(.LST , .asm , .hex).

I know hex is for burning to microcontroller
 

absf

Joined Dec 29, 2010
1,942
Sorry for my mistake.I forgot to mention.

I know how to programm a microcontroller.(My friend has programmer)

I need to edit the programm thats I am asking.

And I have 3 files of the programm(.LST , .asm , .hex).

I know hex is for burning to microcontroller
OK, then show us the asm file. Maybe someone here can help.

Allen
 

ScottWang

Joined Aug 23, 2012
6,843
The below is what I compiled and the errors.
I'm not sure which compiler you like to use?
Code:
8051 Macro Assembler  Copyright (C) 1990 by 2500AD Software Inc. Version 5.00b
DOS/16M Run-Time  Copyright (C) 1987-89 by Rational Systems, Inc. Version 3.88



                         ***** Active Commands *****

                           Ctrl S = Stop Output
                           Ctrl Q = Start Output
                           Esc  C = Stop Assembly
                           Esc  T = Terminal Output
                           Esc  P = Printer Output
                           Esc  D = Disk Output
                           Esc  M = Multiple Output
                           Esc  N = No Output

    2   0000                                            $MOD51
        ***** Waternew.asm : Line 2 *****
        ***** ILLEGAL MNEMONIC *****



               2500 A.D. 8051 Macro Assembler  -  Version 5.00b
               ------------------------------------------------

                       Input  Filename : Waternew.asm
                       Output Filename : Waternew.obj


    2   0000                                            $MOD51
        ***** Waternew.asm : Line 2 *****
        ***** ILLEGAL MNEMONIC *****
  451   0773   30 A4 88                         JNB P2.4, 0788H         ;STILL H/V THEN GOTO 0788 H
        ***** Waternew.asm : Line 451 *****
        ***** RELATIVE JUMP TOO LARGE *****
  454   077B   30 A3 8B                         JNB P2.3, 078BH         ;STILL L/V THEN GOTO 078B H
        ***** Waternew.asm : Line 454 *****
        ***** RELATIVE JUMP TOO LARGE *****
  457   0783   30 A1 8E                         JNB P2.1, 078EH         ;STILL NOT DRY SUMP THEN GOTO 078E H 
        ***** Waternew.asm : Line 457 *****
        ***** RELATIVE JUMP TOO LARGE *****



           Lines Assembled :  465             Assembly Errors :  4
 

absf

Joined Dec 29, 2010
1,942
The below is what I compiled and the errors.
I'm not sure which compiler you like to use?
Code:
8051 Macro Assembler  Copyright (C) 1990 by 2500AD Software Inc. Version 5.00b
DOS/16M Run-Time  Copyright (C) 1987-89 by Rational Systems, Inc. Version 3.88



                         ***** Active Commands *****

                           Ctrl S = Stop Output
                           Ctrl Q = Start Output
                           Esc  C = Stop Assembly
                           Esc  T = Terminal Output
                           Esc  P = Printer Output
                           Esc  D = Disk Output
                           Esc  M = Multiple Output
                           Esc  N = No Output

    2   0000                                            $MOD51
        ***** Waternew.asm : Line 2 *****
        ***** ILLEGAL MNEMONIC *****



               2500 A.D. 8051 Macro Assembler  -  Version 5.00b
               ------------------------------------------------

                       Input  Filename : Waternew.asm
                       Output Filename : Waternew.obj


    2   0000                                            $MOD51
        ***** Waternew.asm : Line 2 *****
        ***** ILLEGAL MNEMONIC *****
  451   0773   30 A4 88                         JNB P2.4, 0788H         ;STILL H/V THEN GOTO 0788 H
        ***** Waternew.asm : Line 451 *****
        ***** RELATIVE JUMP TOO LARGE *****
  454   077B   30 A3 8B                         JNB P2.3, 078BH         ;STILL L/V THEN GOTO 078B H
        ***** Waternew.asm : Line 454 *****
        ***** RELATIVE JUMP TOO LARGE *****
  457   0783   30 A1 8E                         JNB P2.1, 078EH         ;STILL NOT DRY SUMP THEN GOTO 078E H
        ***** Waternew.asm : Line 457 *****
        ***** RELATIVE JUMP TOO LARGE *****



           Lines Assembled :  465             Assembly Errors :  4
The 3 errors are due to 0788H, 078BH & 078EH have no corresponding labels. But that's easy to fix.

Code:
L770:   LCALL DLY_2SEC        ;WAIT FOR 2 SECONDS
        JNB P2.4, L0788H        ;STILL H/V THEN GOTO 0788 H   <-(1)
        SJMP      L764        ; NOT H/V THEN GOTO 0764 H
L778:   LCALL DLY_2SEC        ;WAIT FOR 2 SECONDS
        JNB P2.3, L078BH        ;STILL L/V THEN GOTO 078B H    <-(2)
        SJMP      L767        ;NOT L/V THEN GOTO 0767 H
L780:   LCALL DLY_2SEC        ;WAIT FOR 2 SECONDS
        JNB    P2.1, L078EH        ;STILL NOT DRY SUMP THEN GOTO 078E H <-(3)
        SJMP      L76A        ;OTHERWISE GOTO 076A
L0788H:   CLR 77H        ;CLEAR FLAG 77H FOR H/V   <-(4)
        RET         
L078BH:  CLR 78H        ;CLEAR FLAG 78H FOR L/V  <-(5)
        RET         
L078EH:   CLR 76H        ;CLEAR FLAG 76H FOR DRY SUMP CHECK  <-(6)
        RET
The schematic is attached here...
7D5_01_Water-Level-Controller-Fig-1.jpg

Allen
 
Last edited:

Thread Starter

sabareeshchambayil

Joined Jul 17, 2015
28
Yes this is it.In this water pump stops when water level is not reached the 2nd float switch or sensor with in 10 minutes the controller go to dry sump1 and then rest for 5 minutes.
I want to change that 10 minute to 5 minutes.
 

ScottWang

Joined Aug 23, 2012
6,843
Your first posted -- I made it and its working now.
Did you modify the errors that I posted in #7?

You have two subroutine -- TMR_5MIN, TMR_10MIN.
And in your program have three addresses to call TMR_10MIN, you may modify them to LCALL TMR_5MIN
 

Thread Starter

sabareeshchambayil

Joined Jul 17, 2015
28
Sorry for late reply.The hex file from the EFY website is what I burned to At89s51.I have made no modification, And I need to know what are the softwares and how I can study coding for microcontroller.Before that can anybody attach the new hex file and asm file created without errors and timer to 5 minutes.
 

shteii01

Joined Feb 19, 2010
4,647
There is a hacked version of Keil uVision 4 floating around, use it to simulate and write code, it comes with compiler and stuff so in the end you will have a .hex file to load into your micro.
 

Thread Starter

sabareeshchambayil

Joined Jul 17, 2015
28
You want to create the *.hex by yourself?
I already attached the waternew.hex in the zip file.
Hi Scottwang i am now using the hex file you generated and my friend requested me to make the same water pump controller for him, but he needs the timer value to 1 minute .
I tried changing the programm from orginal source by placing 1 minute instead of 10 minutes in Lines
77
332
389
And i got undeclared error in keil uvision5 and i again checked the program and found one more 10 min timer in Line 431 and changed that to 1minute and there's no error and generated hex file and burned to At89S51 but its still 10 minutes timer working
What's the mistake i am making?
Please help
 

dannyf

Joined Sep 13, 2015
2,197
don't know how to do it and I am a total noob to microcontrollers
The answer to those types of questions should always be the same: then become more experienced.

anyone providing you with a finished product is impeding your learning and not doing you any favor over the long run.

Moderators note : reduced font size and bold, as large bold fonts look like shouting
 
Last edited by a moderator:

ScottWang

Joined Aug 23, 2012
6,843
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
 

Attachments

Top