What Software Use For This Coding?

Thread Starter

Muhamad

Joined Mar 31, 2015
14
I want to ask, what software used for this coding? I found it and want to do it for my project.
This coding use At89C51.
This is the coding.

Code:
equ com,0fch  ;defining com and giving initial value 0fcH

equ dat,0fdh  ;defining dat and giving initial value 0fdH

equ eot,0feh  ;defining eot and giving initial value 0feH

equ frqflg,0fh  ;defining frqflg and giving initial value 0fH

org 0000h

mov sp,#30h  ;moving 30H to stack pointer

sjmp over  ;simple jump to over

org 001bh

setb psw.3  ;set bit psw.3,register bank selector 0

inc r0  ;increment r0

cjne r0,#00h  ;checktime

;compare r0 and 00H and jump to checktime if  not equal

inc r1    ;increment r1

cjne r1,#00h  ;checktime

;compare r0 and 00H and jump to checktime if  not equal

inc r2  ;increment r2

checktime:  ;defining checktime

cjne r2,#11h,goback  ; repeatit 11h times

cjne r1,#27h,goback  ;repet it 27h times

cjne r0,#0c0h,goback  ;repeat it c0h times

clr tr0  ;clear tr0,timer 0 run control bit (OFF)

clr tr1  ;clear tr1,timer 1 run control bit (OFF)

setb frqflg  ;setbit frqflg

goback:  ;defining goback

clr psw.3  ;clear psw.3

reti  ;return interupt

over:

mov p1,#00h

mov dptr,#msg1  ;move msg1 to data pointer

lcall message   ;long call message

mov r0,#00h  ;move 00H to r0

over1:  ;defining over1

mov r1,#00h  ;move 00H to r1

mov r2,#00h  ;move 00H to r2

  mov r3,#00h  ;move 00H to r3

  mov r4,#00h

  mov r5,#00h

  mov r6,#00h

  mov r7,#00h

  mov tcon,#00h  ;move 00H to TCON (clear TCON)

  setb psw.3

  mov r0,#00h  ;move 00H to r0

  mov r1,#00h  ;move 00H to r1

  mov r2,#00h  ;move 00H to r2

  clr psw.3  ;clear psw.3

mov tmod,#25h  ;timer 0 16 bit counter, timer 1 mode 2 auto reload timer

  mov tl1,#4eh  ;tl1=4eh,the low byte

  mov th1,#0ceh  ;th1=ceh, the high byte

  mov tl0,#00h  ;move 00H to tl1

  mov th0,#00h  ;move 00H to th1

  clr frqflg  ;clear frqflg

  mov tcon,#50h  ;tr1 and tr0 are set to start timer1

   and timer0

mov ie,#88h  ;move 88H to IE, enabling the interrupts

simulate:

  jbc frqflg,getfrq  ;stay until bit is set

  sjmp simulate  ;repeat for reloadin counters

getfrq:

mov ie,#00h  ;move 00H to IE,disabling all interrupts

  mov r1,tl0  ;move value in tl0 to r1

  mov a,r1  ;move value in r1 to accumulator,a

  mov b,#0ah  ;move 0aH to b

div ab  ;div a by 10 and store quotient in a and reminder in b

  mov r4,b  ;move the least significan bit t to r4

  mov b,#0ah  ;move 0aH to b

div ab  ;divide a by 10, store quotient in a and remainder in b

  mov r3,b  ;move value in b to r3

  mov r2,a  ;move value in a to r2

  lcall display  ;long call display 

cjne r1,#80D,l1  ;compare r1 and 80D and jmp to l1 if not equal

l1:  jc l8  ;jump if carry to l8

  lcall send1  ;long call send1

l8:  sub r0,60D  ;defining l8

  jc send1

ljmp over1  ;long jump to over1

display  ;defining display

:mov dptr,#msg0  ;move msg0 to data pointer

  lcall message   ;long call message

  mov a,r2  ;move r2 to accumulator

add a,#30h  ;add 30H to a, ASCII conversion

  lcall ready  ;long call ready

  lcall sendit1  ;long call sendit1

mov a,r3   ;move content in r3 to accumator

add a,#30h  ;adding 30H to accumulator, ASCII conversion

  lcall ready  ;long call ready

  lcall sendit1  ;long call sendit1

mov a,r4  ;move content of r4 to accumulator

  add a,#30h  ;adding 30H to accumulator, ASCII conversion

  lcall ready  ;long call ready

  lcall sendit1  ;long call sendit1

  ret  ;return

message:  ;defining message

acall ready  ;absolute call to ready

  clr a  ;clear accumulator

movc a,@a+dptr  ;move code byte relative to data pointer to accumulator

  inc dptr  ;increment data pointer

cjne a,#eot,comd  ;compare a and eot and jump to comd if not equal

  ret  ;return

comd:  ;defining comd

cjne a,#com,data  ;compare Acc content and com and jump to data if not equal

  clr p0.0  ;compliment p0.0

  sjmp message  ;simple jump to message


data:  ;defining data

cjne a,#dat,sendit  ;compare Acc contents to dat and jump to send it if not equal

  setb p0.0  ;set bit p0.0

  sjmp message  ;simple jump message

sendit:  ;define sendit

mov p2,a  ;move Acc contents to port 2

  clr p0.1    ;clear p0.1

  setb p0.2  ;set bit p0.2

  clr p0.2  ;clear p0.2

  sjmp message  ;simple jump message

ready:  ;defining ready

mov r7,p0  ;move p0 to r7

  clr p0.2  ;clear p0.2

mov p2,#0ffh  ;move 0ffH to port2 for transmission

clr p0.0  ;clear p0.0,RS=0,select command register

  setb p0.1  ;set bit p0.1, R/W=1 for read

wait:  ;defining wait

  clr p0.2  ;clear p0.2

  setb p0.2  ;set bit p0.2

  jb p2.7,wait  ;jump to wait if bit in p2.7

  clr p0.2  ;clear p0.2

  mov p0,r7  ;move content in r7 to p0

  ret  ;return

msg1:  ;defining msg1

.db com,3ch,06h,0eh,01h,81h,dat,"000",com,0c0h,dat,"heart beat",eot

;data heart beat and 000 defined to display at specific location on lcd

msg0:  ;defining msg0

.db com,3ch,06h,0eh,01h,81h,eot



delay2:    ;defining delay2

  setb p1.0  ;set bit p1.0

  mov r6,#01h  ;move 01H to r6

cont2:  ;define cont2

  mov r2,#0ffh  ;move 0ffH to r2

s2:  ;define s2

mov r3,#0ffh  ;move 0ffH to r3

s1:  ;define s1

djnz r3,s1     ;decrement r3 and jump to s1 if r3 is non-zero

djnz r2,s2  ;decrement r2 and jump to s2 if r2 non zero

djnz r6,cont2  ;decrement r6 and jump to cont2 if r6 non zero

  cpl p1.0  ;compliment p1.0

  ret  ;return

sendit1:  ;defining sendit1

setb p0.0  ;set bit p0.0

mov p2,a     ;move accumulator contents to p2

  clr p0.1  ;clear p0.1

  setb p0.2  ;set bit p0.2

  clr p0.2  ;clear bit p0.2

  ret    ;return

delay:  ;dfining delay

  setb p1.0  ;set bit p1.0

  mov r6,#50h  ;move 50H to r6

c2:  ;defining c2

  mov r2,#61h  ;move 61H to r2

s20:  ;defining s20

mov r3,#0ffh  ;move offH to r3

s10:    ;defining s10

djnz r3,s10    ;decrement r3 and jump to s10 if r3 non zero

djnz r2,s20     ;decrement r2 and jump to s20 if r2 non zero

djnz r6,c2  ;decrement r6 and jump to c2if r6 non zero

  cpl p1.0  ;compliment p1.0

  ret  ;return

send1:    ;defining send1

  mov dptr,#msg2  ;move msg2 to data pointer

  lcall out  ;long call out

  mov dptr,#msg9  ;move msg9 to data pointer

  lcall out  ;long call out

  mov dptr,#msg10  ;move msg10 to data pointer

  lcall out  ;long call out

  mov a,r2  ;move content of r2 to a

  add a,#30h  ;add 30H to accumulator

  lcall out1  ;long call out1

  mov a,r3  ;move content of r3 to Acc

  add a,#30h    ;add 30H to aontent of Acc

  lcall out1    ;long call out1

  mov a,r4    ;move r4 contents to Acc

  add a,#30h  ;add 30H to Acc contents

  lcall out    ;long call out1

  mov dptr,#msg13  ;move msg13 to data pointer

  lcall out    ;long call out

  mov dptr,#msg14  ;move msg14 to data pointerr

  lcall out    ;long call out

  ret      ;return

out:    ;defining out

lcall delay1  ;long call delay1

trans:  ;defining trans

  mov pcon,#00h    ;move 00H to PCON

  mov tmod,#20h    ;move 20H to TMOD

  mov th1,#0fDh  ;move 0fdH to th1

  setb tr1        ;set bit tr1,T1 run control bit

  mov scon,#40h  ;move 40H to SCON

  clr a    ;clear accmulator

movc a,@a+dptr   ;move code byte relative to data pointer to accumulator

inc dptr    ;increment data pointer

cjne a,#eot,comd1   ;compare accumulator and eot and jump to comd1 if not equal

  ret  ;return

comd1:    ;defining comd1

mov sbuf,a  ;move accumulator contents to SBUF

wait1:    ;defining mait1

jbc ti,fin  ;jump bit carry ti to fin

  ljmp wait1    ;long jmp to wait1

fin:    ;defining fin

ljmp trans    ;long jump to trans

out1:    ;defining out1

  lcall delay1  ;jong call delay1

trans1:  ;defining trans1

mov pcon,#00h  ;move 00H to PCON

  mov tmod,#20h  ;move 20H to TMOD

  mov th1,#0fDh  ;move 0fdH to th1

  setb tr1  set bit tr1,T1 run control bit

  mov scon,#40h  ;move 40H to SCON

mov sbuf,a  ;move accumulator contents to SBUF

wait2:    ;define wait2

  jbc ti,fin1  ;jump bit carry ti to fin1

  sjmp wait2  ;simple jump wait2


fin1:  ;defining fin1

ret  ;return

delay1:   ;defining delay1

setb psw.3  ;set bit psw.3

  mov r7,#08h  ;move 08H to r7

d3:  ;defining d3

mov r6,#0ffh  ;move 0ffH to r6

d2:  ;defining d2

mov r5,#0ffh  ;move 0ffH to r5

d1:  ;defining d1

djnz r5,d1  ;decrement r5 and jump to d1 if r5 non zero

djnz r6,d2  ;decrement r6 and jump to d2 if r6 non zero

djnz r7,d  ;decrement r7 and jump to d3 if r7 non zero

  clr psw.3  ;clear psw.3

  ret  ;returnJ

msg2:  .db "AT+CMGF=1",0dh,eot

msg9:  .db "AT+CMGS=",22h,"9633444713",22h,0dh,22h,”ATA9447700861”,22h,0dh,eot

msg10: .db "heart beat is "

msg13: .db 0dh,eot

msg14: .db 1Ah,eot
Moderators note : please use code tags for pieces of code
 
Last edited by a moderator:

atferrari

Joined Jan 6, 2004
4,769
Not an answer to your question but, have you found it like that? Has it any format?

If so, for future postings of code, please use the "code" option from the toolbar.

Just an example of how it could look:

Code:
;DIG_BCD_4:0 are trashed out upon completion.

    MOVF  DIG_BCD_1,W       ;(DIG_BCD_1 + DIG_BCD_3) *2
    ADDWF DIG_BCD_3,W
    MOVWF NROBIN_L
    RLCF NROBIN_L,F

    SWAPF DIG_BCD_2,W       ;+DIG_BCD_2*16 + DIG_BCD_2
    ADDWF DIG_BCD_2,W
    ADDWF NROBIN_L,F

    RLCF DIG_BCD_4,W        ;+(DIG_BCD_4 *2 + DIG_BCD_3) *256
    ADDWF DIG_BCD_3,W
    MOVWF NROBIN_H

    RLCF NROBIN_L,F         ;*2
    RLCF NROBIN_H,F

    SWAPF DIG_BCD_3,W       ;-DIG_BCD_3 *16
    SUBWF NROBIN_L,F
    BTFSS STATUS,C
Easier for everybody, including you.
 
Last edited:

jpanhalt

Joined Jan 18, 2008
11,087
It is indeed Assembly language, but it is for the AVR/Atmel chips. The instructions are a bit different, so I would suggest looking for a tutorial for that type of MCU.

John
 

JWHassler

Joined Sep 25, 2013
306
Those are 8051 mnemonics. In fact, the OP stated that.
It looks like the output of a disassembler: all the comments are pointless re-iterations of the menmonics
 
Top