Want to edit a at89c51 program but don't know how to do it and I am a total noob to microcontrollers

Discussion in 'Embedded Systems and Microcontrollers' started by sabareeshchambayil, Jan 16, 2016.

  1. sabareeshchambayil

    Thread Starter New Member

    Jul 17, 2015
    10
    0
    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.
     
  2. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,398
    497
    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.
     
  3. sabareeshchambayil

    Thread Starter New Member

    Jul 17, 2015
    10
    0
    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
     
  4. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    The programmer can write the .hex into the 8051, the other as .tsk.
    If you have x8051.exe and link.exe files then do these in the Dos prompt.
    1. x8051 spk.asm -d
    2. link -c spk.obj -x

    TS Controls Emulator 8051.
     
  5. absf

    Senior Member

    Dec 29, 2010
    1,493
    372
    OK, then show us the asm file. Maybe someone here can help.

    Allen
     
  6. sabareeshchambayil

    Thread Starter New Member

    Jul 17, 2015
    10
    0
    Asm file attached
     
  7. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    The below is what I compiled and the errors.
    I'm not sure which compiler you like to use?
    Code (Text):
    1.  
    2.  
    3. 8051 Macro Assembler  Copyright (C) 1990 by 2500AD Software Inc. Version 5.00b
    4. DOS/16M Run-Time  Copyright (C) 1987-89 by Rational Systems, Inc. Version 3.88
    5.  
    6.  
    7.  
    8.                          ***** Active Commands *****
    9.  
    10.                            Ctrl S = Stop Output
    11.                            Ctrl Q = Start Output
    12.                            Esc  C = Stop Assembly
    13.                            Esc  T = Terminal Output
    14.                            Esc  P = Printer Output
    15.                            Esc  D = Disk Output
    16.                            Esc  M = Multiple Output
    17.                            Esc  N = No Output
    18.  
    19.     2   0000                                            $MOD51
    20.         ***** Waternew.asm : Line 2 *****
    21.         ***** ILLEGAL MNEMONIC *****
    22.  
    23.  
    24.  
    25.                2500 A.D. 8051 Macro Assembler  -  Version 5.00b
    26.                ------------------------------------------------
    27.  
    28.                        Input  Filename : Waternew.asm
    29.                        Output Filename : Waternew.obj
    30.  
    31.  
    32.     2   0000                                            $MOD51
    33.         ***** Waternew.asm : Line 2 *****
    34.         ***** ILLEGAL MNEMONIC *****
    35.   451   0773   30 A4 88                         JNB P2.4, 0788H         ;STILL H/V THEN GOTO 0788 H
    36.         ***** Waternew.asm : Line 451 *****
    37.         ***** RELATIVE JUMP TOO LARGE *****
    38.   454   077B   30 A3 8B                         JNB P2.3, 078BH         ;STILL L/V THEN GOTO 078B H
    39.         ***** Waternew.asm : Line 454 *****
    40.         ***** RELATIVE JUMP TOO LARGE *****
    41.   457   0783   30 A1 8E                         JNB P2.1, 078EH         ;STILL NOT DRY SUMP THEN GOTO 078E H
    42.         ***** Waternew.asm : Line 457 *****
    43.         ***** RELATIVE JUMP TOO LARGE *****
    44.  
    45.  
    46.  
    47.            Lines Assembled :  465             Assembly Errors :  4
    48.  
    49.  
    50.  
    51.  
    52.  
     
    sabareeshchambayil likes this.
  8. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    I adjust the position and then only three errors.

    8051-3errors.gif
     
    sabareeshchambayil likes this.
  9. sabareeshchambayil

    Thread Starter New Member

    Jul 17, 2015
    10
    0
    I can't under stand anything.This project is in EFY in the name "Water level controller cum Motor Protector"
     
  10. absf

    Senior Member

    Dec 29, 2010
    1,493
    372
    The 3 errors are due to 0788H, 078BH & 078EH have no corresponding labels. But that's easy to fix.

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

    Allen
     
    Last edited: Jan 19, 2016
    sabareeshchambayil likes this.
  11. sabareeshchambayil

    Thread Starter New Member

    Jul 17, 2015
    10
    0
    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.
     
  12. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    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
     
  13. sabareeshchambayil

    Thread Starter New Member

    Jul 17, 2015
    10
    0
    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.
     
  14. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    There are 4 files including in the zip file, I haven't trace all the program, I just modified those three instructions from LCALL TMR_10MIN to LCALL TMR_5MIN and three error messages.

    waternew.hex
    waternew.lst
    waternew.obj
    waternew.asm
     
    sabareeshchambayil likes this.
  15. sabareeshchambayil

    Thread Starter New Member

    Jul 17, 2015
    10
    0
    What are the softwares you have used.I need to try it to create hex.
     
  16. ScottWang

    Moderator

    Aug 23, 2012
    4,855
    767
    You want to create the *.hex by yourself?
    I already attached the waternew.hex in the zip file.
     
  17. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,398
    497
    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.
     
  18. sabareeshchambayil

    Thread Starter New Member

    Jul 17, 2015
    10
    0
    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
     
Loading...