How to write the codes in microcontroller

5 pts.
Tags:
C
Coding
Python
I would like to know about codes written in a microcontroller and how it is written and saved with what extension of all the coding languages used in controller. Please if any one know it send me the answer soon within 2 days, particularly I need to know what is this program name:
($mod51 
org 0000h 
ljmp main 
org 0003h 
lcall back1 
reti 
org 0013h 
lcall back 
reti 
org 0050h 
back1: jb 01,pass 
setb tr0 
setb 00h 
ret 
pass: clr tr0 
clr tf0 
mov a,#00h 
ret 
org 0100h 
back: jb 00,pass1 
setb tr0 
setb 01h 
ret 
pass1: clr tr0 
clr tf0 
mov a,#00h 
ret 
org 01a0h 
main: 
mov r0,#00h 
mov r3,#00h 
mov r4,#00h 
mov r5,#00h 
mov p1,#00h 
mov p0,#00h 
mov p3,#0ffh 
mov p2,#00h 
mov r1,#00h 
mov r2,#00h 
mov r7,#00h 
mov tmod,#01h 
mov th0,#00h 
mov tl0,#00h 
setb tcon.2 
setb tcon.0 
clr tr0 
clr tf0 
clr 00 
clr 01 
clr p3.1 
mov ie,#10000101b 
mov a,#0ffh 
main1: 
cjne a,#00h,ss 
mov ie,#00h 
mov r1,tl0 
mov r2,th0 
;acall dispinit 
;acall deci 
acall scan 
acall deci 
;acall delay 
clr 00h 
clr 01h 
mov th0,#00h 
mov tl0,#00h 
mov a,#0ffh 
mov ie,#10000101 
ss: sjmp main1 
deci: jb 00,laag 
acall lead_ang 
ret 
laag: acall lag_ang 
ret 
lead_ang: mov dptr,#msg12 
mov a,#0c0h 
acall prtcmd 
acall again 
ret 
lag_ang: mov dptr,#msg13 
mov a,#0c0h 
acall prtcmd 
acall again 
ret 
scan: 
cjne r2,#05h,go 
mov a,r1 
subb a,#0ddh ;aah 
jc com1 
mov dptr,#msg1 
acall disp 
ret 
com1: clr c 
mov a,r1 
subb a,#078h 
jc com2 
mov dptr,#msg2 
acall disp 
jb p2.6,bypass3 
setb p2.6;relay4 on 
bypass3: ret 
com2: clr c 
mov a,r1 
subb a,#14h 
jc thu 
mov dptr,#msg3 
acall disp 
ret 
go: cjne r2,#04h,go1 
mov a,r1 
subb a,#0b0h 
jc com3 
thu: clr c 
mov dptr,#msg4 
acall disp 
jb p2.4,bypass2 
setb p2.4;relay3 on 
bypass2: ret 
com3: clr c 
mov a,r1 
subb a,#4ch 
jc wed 
mov dptr,#msg5 
acall disp 
ret 
go1: cjne r2,#03h,go2 
mov a,r1 
subb a,#0e8h 
jc com4 
wed: clr c 
mov dptr,#msg6 
acall disp 
jb p2.2,bypass1 
setb p2.2;relay2 on 
bypass1: ret 
com4: clr c 
mov a,r1 
subb a,#20h 
jc tue 
mov dptr,#msg7 
acall disp 
ret 
go2: cjne r2,#02h,go3 
mov a,r1 
subb a,#0bch 
jc com5 
tue: clr c 
mov dptr,#msg8 
acall disp 
jb p2.0,bypass 
setb p2.0;relay1 on 
bypass: ret 
com5: clr c 
mov a,r1 
subb a,#58h 
jc mon 
mov dptr,#msg9 
acall disp 
ret 
go3: cjne r2,#01h,go4 
mov a,r1 
subb a,#90h 
jc com6 
mon: clr c 
mov dptr,#msg10 
acall disp 
ret 
com6: clr c 
mov dptr,#msg11 
acall disp; acall deci 
acall chk; acall delay 
ret 
go4: cjne r2,#00h,go5 
mov dptr,#msg11 
acall disp 
; acall chk 
; acall delay 
ret 
go5: mov dptr,#msg1 
acall disp 
ret 
dispinit: mov a,#38h 
acall prtcmd 
mov a,#0eh 
acall prtcmd 
mov a,#06h 
acall prtcmd 
mov a,#01h 
acall prtcmd 
ret 
disp: acall dispinit 
again: clr a 
movc a,@a+dptr 
jz next1 
acall prtchr 
inc dptr 
sjmp again 
next1: ret 
prtcmd: ACALL READY ;is LCD ready? 
MOV P1,A ;issue command code 
CLR P3.5 ;RS=0 for command 
CLR P3.6 ;R/W=0 to write to LCD 
SETB P3.7 ;E=1 for H-to-L pulse 
CLR P3.7 ;E=0 ,latch in 
RET 
prtchr: ACALL READY ;is LCD ready? 
MOV P1,A ;issue data 
SETB P3.5 ;RS=1 for data 
CLR P3.6 ;R/W=0 to write to LCD 
SETB P3.7 ;E=1 for H-to-L pulse 
CLR P3.7 ;E=0, latch in 
RET 
READY: 
SETB P1.7 ;make P1.7 input port 
CLR P3.5 ;RS=0 access command reg 
SETB P3.6 ;R/W=1 read commandreg 
;read command reg and check busy flag 
BACK11: 
CLR P3.7 ;E=1 for H-to-L pulse 
SETB P3.7 ;E=0 H-to-L pulse 
JB P1.7,BACK11 ;stay until busy flag=0 
RET 
chk: jnb p2.0,chk1 
clr p2.0 
acall delay 
ret 
chk1: 
jnb p2.2,chk2 
clr p2.2 
acall delay 
ret 
chk2: 
jnb p2.4,chk3 
clr p2.4 
acall delay 
ret 
chk3:jnb p2.6,chk4 
clr p2.6 
acall delay 
ret 
chk4:ret 
delay: 
setb psw.3 
setb psw.4 
mov r3,#200d 
zz: mov r4,#50d 
ww: mov r5,#50d 
qq: djnz r5,qq 
djnz r4,ww 
djnz r3,zz 
clr psw.3 
clr psw.4 
ret 
msg1: 
db ' out of range ' 
db 0 
msg2: 
db ' P.F = 0.91 ' 
db 0 
msg3: 
db ' P.F = 0.92 ' 
db 0 
msg4: 
db ' P.F = 0.93 ' 
db 0 
msg5: 
db ' P.F = 0.94 ' 
db 0 
msg6: 
db ' P.F = 0.95 ' 
db 0 
msg7: 
db ' P.F = 0.96 ' 
db 0 
msg8: 
db ' P.F = 0.97 ' 
db 0 
msg9: 
db ' P.F = 0.98 ' 
db 0 
msg10: 
db ' P.F = 0.99 ' 
db 0 
msg11: 
db ' P.F is unity ' 
db 0 
msg12: 
db ' lead ' 
db 0 
msg13: 
db ' lag ' 
db 0 
end)


Software/Hardware used:
keil is the software used
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • TheRealRaven
    If you're the one using the Keil MDK and you have the program, you're the only one who could know the "name" of the program if it has a "name" at all. Looks like maybe a dynamometer that indicates a power factor, but...?
    33,080 pointsBadges:
    report
  • Subhendu Sen
    Assuming this is an assignment, it is better to ask your faculty/ get help from your study materials.
    132,800 pointsBadges:
    report
  • ToddN2000
    Why in 2 days, what is the rush? If this is an assignment, talk to the instructor. If you have the code, how did you open the file? If you wrote it, you should know the language and what extension was used when it was saved.
    127,920 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: