Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 26th May 2007, 06:27 PM   (permalink)
New Member
sara_6252 is on a distinguished road
Default calculator

please i need a source code in assembley langauge for a calculator that displayed at screen (lcd) which does the four function (*,/,+,-) using 8051 for two digit
thanks
pleaaaaaaaaaaaase
sara_6252 is offline   Reply With Quote
Old 26th May 2007, 06:44 PM   (permalink)
Experienced Member
 
amindzo is on a distinguished road
Default

Hi, i can help you with that code but in diferent way. i have a code for calculator but in picbasic(for pic micocontrollers).if you want ask me again.
amindzo is offline   Reply With Quote
Old 26th May 2007, 09:09 PM   (permalink)
Experienced Member
 
Hero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to beholdHero999 is a splendid one to behold
Default

Whilst we enjoy helping people; in order to help you we need to know how far you've progressed. Please post what you've already done, including any ideas you've had. If you need help that your lecturer should have provided, please tell us (and your lecturer) what you found was lacking. It is not right if you manage to attain a high grade from the help we have provided if your lecturer is negligent; it will make them appear to be better than they really are and put you at an unfair advantage to your classmates.

It also would help us to know more about your education, geographical location and experience with the English language.
__________________
What's so bad about Microsoft?

Get Opera it's simply a superb browser.
Hero999 is offline   Reply With Quote
Old 26th May 2007, 10:53 PM   (permalink)
Experienced Member
upand_at_them is on a distinguished road
Default

Have you tried doing your school assignment by yourself first?

Mike
upand_at_them is offline   Reply With Quote
Old 27th May 2007, 04:36 AM   (permalink)
Experienced Member
 
Blog Entries: 2
gramo is just really nicegramo is just really nicegramo is just really nicegramo is just really nice
Default

I've seen plenty of these examples in other threads on the forum, just do a quick search for "assembly calculator"

__________________
Spency.

PIC Micro's - Your mind is the limit

PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net
gramo is offline   Reply With Quote
Old 29th May 2007, 06:40 AM   (permalink)
New Member
sara_6252 is on a distinguished road
Default

my code:
please help


Code:
RS EQU P3.4
RW EQU P3.5
EN EQU P3.6
DATA EQU P1
 DB4     EQU   P3.4
 DB5     EQU   P3.5
 DB6     EQU   P3.6
 DB7     EQU   P3.7
 EN      EQU   P3.3
 RS      EQU   P3.2
 

mov r7,#3
lcall operand
cjne r7,#2,error
mov r0,a
lcall operator
cjne r7,#1,error
mov r1,a
lcall operand
cjne r7,#0,error
mov r2,a
lcall equal
LCALL INIT_LCD
MOV A, #'0'

error:
jmp $

operand:
LCALL WRITE_TEXT
lCALL INIT_LCD
MOV P2, #11110000B
JNB P2.0, ROW1
JNB P2.1, ROW2
JNB P2.2, ROW3
JNB P2.3, ROW4
;JMP LOOP

ROW1:
MOV P2, #00001111B
JNB P2.4, SHOW7
JNB P2.5, SHOW8
JNB P2.6, SHOW9
;JNB P2.7, SHOW_ADD
JMP $

ROW2:
MOV P2, #00001111B
JNB P2.4, SHOW4
JNB P2.5, SHOW5
JNB P2.6, SHOW6
;JNB P2.7,SHOW_sub
JMP $

ROW3:
MOV P2, #00001111B
JNB P2.4, SHOW1
JNB P2.5, SHOW2
JNB P2.6, SHOW3
;JNB P2.7, SHOW_MUL
JMP $

ROW4:
MOV P2, #00001111B
JNB P2.4, SHOW_ON
JNB P2.5, SHOW0
;JNB P2.6, SHOW_equal
;JNB P2.7, SHOW_div
JMP $

SHOW0:
MOV A, #'0'
lCALL WRITE_TEXT
lCALL DELAY
dec r7

SHOW1:
MOV A, #'1'
lCALL WRITE_TEXT
lCALL DELAY
dec r7
;JMP LOOP

SHOW2:
MOV A, #'2'
lCALL WRITE_TEXT
lCALL DELAY
;JMP LOOP

SHOW3:
MOV A, #'3'
lCALL WRITE_TEXT
;CALL DELAY
dec r7
;JMP LOOP

SHOW4:
MOV A, #'4'
lCALL WRITE_TEXT
lCALL DELAY
dec r7
;JMP LOOP

SHOW5:
MOV A, #'5'
lCALL WRITE_TEXT
lCALL DELAY
dec r7
;JMP LOOP

SHOW6:
MOV A, #'6'
lCALL WRITE_TEXT
lCALL DELAY
dec r7
;JMP LOOP

SHOW7:
MOV A, #'7'
lCALL WRITE_TEXT
lCALL DELAY
dec r7
;JMP LOOP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SHOW8:
MOV A, #'8'
lCALL WRITE_TEXT
lCALL DELAY
dec r7
;JMP LOOP

SHOW9:
MOV A, #'9'
lCALL WRITE_TEXT
lCALL DELAY
dec r7
;JMP LOOP



ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
SHOW_ON:
MOV A, #'ON'
lCALL WRITE_TEXT
lCALL DELAY
;JMP LOOP

operator:

LCALL WRITE_TEXT

lCALL INIT_LCD
MOV P2, #11110000B
JNB P2.0, ROW11
JNB P2.1, ROW22
JNB P2.2, ROW33
JNB P2.3, ROW44
;JMP LOOP

ROW11:
MOV P2, #00001111B
;JNB P2.4, SHOW7
;JNB P2.5, SHOW8
;JNB P2.6, SHOW9
JNB P2.7, SHOW_ADD
JMP $

ROW22:
MOV P2, #00001111B
;JNB P2.4, SHOW4
;JNB P2.5, SHOW5
;JNB P2.6, SHOW6
JNB P2.7,SHOW_sub
JMP $

ROW33:
MOV P2, #00001111B
;JNB P2.4, SHOW1
;JNB P2.5, SHOW2
;JNB P2.6, SHOW3
JNB P2.7, SHOW_MUL
JMP $

ROW44:
MOV P2, #00001111B
;JNB P2.4, SHOW_ON
;JNB P2.5, SHOW0
JNB P2.6, SHOW_equal
JNB P2.7, SHOW_div
JMP $



SHOW_ADD:
MOV A, #'+'
lCALL WRITE_TEXT
lCALL DELAY
dec r7
;JMP LOOP


SHOW_sub:
MOV A, #'-'
lCALL WRITE_TEXT
lCALL DELAY
dec r7
;JMP LOOP


SHOW_mul:
MOV A, #'*'
lCALL WRITE_TEXT
lCALL DELAY
dec r7
;JMP LOOP


SHOW_div:
MOV A, #'/'
lCALL WRITE_TEXT
lCALL DELAY
dec r7
;JMP LOOP

ret

equal:
LCALL WRITE_TEXT

lCALL INIT_LCD
MOV P2, #11110000B
JNB P2.2, ROW444
ROW444:
JNB P2.6, SHOW_equal
SHOW_EQUAL: MOV A, #'='
lCALL WRITE_TEXT
lCALL DELAY
dec r7
;JMP LOOP
ret



INIT_LCD:
CLR RS
CLR RW
CLR EN
MOV DATA, #38H
SETB EN
CLR EN
lCALL WAIT_LCD
CLR RS
CLR RW
MOV DATA, #0EH
SETB EN
CLR EN
lCALL WAIT_LCD
CLR RS
CLR RW
MOV DATA, #06H
SETB EN
CLR EN
lCALL WAIT_LCD
RET

WAIT_LCD:
MOV R1, #50
LOOP2:
MOV R2, #50
LOOP1:
DJNZ R2, LOOP1
DJNZ R1, LOOP2
RET

WRITE_TEXT:
SETB RS
CLR RW
CLR EN
MOV DATA, A
SETB EN
NOP
NOP
CLR EN
lCALL WAIT_LCD
RET

DELAY:
MOV R1, #50
LOOP4:
MOV R2, #50
LOOP3:
MOV R3, #300
LOOP5:
DJNZ R3, LOOP5
DJNZ R2, LOOP3
DJNZ R1, LOOP4
RET


;mov r0,p3
;mov r1,p3
;mov r2,p3
;mov r3,p3

cjne r1,#'+',sub
mov a,r0
add a,r1
jmp equ

equ:
cjne r3,#'=',error2
lcall WRITE_TEXT
;JMP LOOP
error2:nop

sub: 
cjne r1,#'-',mul
mov a,r0
subb a,r2

mul:
cjne r1,#'*',div
mov a,r0
mov b,r2
mul ab

div:
cjne r1,#'/',error1
mov b,r2
mov a,r0
div ab
error1:
jmp $

Last edited by sara_6252; 29th May 2007 at 02:45 PM.
sara_6252 is offline   Reply With Quote
Old 29th May 2007, 02:49 PM   (permalink)
New Member
sara_6252 is on a distinguished road
Default

please
hellllllllllllllllllllllp
sara_6252 is offline   Reply With Quote
Old 29th May 2007, 03:29 PM   (permalink)
Experienced Member
 
justDIY is a jewel in the roughjustDIY is a jewel in the rough
Default

you need to have your keyboard cleaned, it seems some of your llllllllllllletters are sticking!
__________________
If you don't have a planet, what good are gold bars?

want to contact me directly? gmail gordonthree
check out my project website: http://projects.dimension-x.net
Favorite numbers:
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
justDIY is offline   Reply With Quote
Old 1st June 2007, 02:28 AM   (permalink)
Experienced Member
 
ikalogic is just really niceikalogic is just really niceikalogic is just really nice
Send a message via MSN to ikalogic Send a message via Skype™ to ikalogic
Default

Quote:
Originally Posted by justDIY
you need to have your keyboard cleaned, it seems some of your llllllllllllletters are sticking!
it's not the keyboard, as sometimes the letter 'a' also freezes....

And sara, you would have much more chances to acheive your project by communicating your problem with us in detail, explaining where is the problem in the code, instead of begging for help.
__________________
Ibrahim Kamal
check my electronics and robotics page: http://www.ikalogic.com/
ikalogic is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
Calculator!!! Gaurav Varshney Micro Controllers 1 6th May 2007 06:15 AM
Calculator battery pack. on1aag Electronic Projects Design/Ideas/Reviews 3 18th April 2007 12:07 AM
help with Calculator LCD aryyy Micro Controllers 4 17th July 2006 10:24 AM
Talking Calculator using 16F877A Imprezzive Micro Controllers 1 5th May 2004 10:48 PM
CMOS 7555 Calculator ? DaleHall General Electronics Chat 11 15th February 2004 12:51 AM



All times are GMT. The time now is 03:54 AM.


Electronic Circuits  |  Radio Controlled
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.