free 8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems

 
8051 microcontroller 8051 microcontroller
Forums

Go to page  1 2 3 [4] 5
Moderators: Ajay, Junied , abbas1707, Arun Kumar V, pdi33, Shailesh NAYAK, ۞ TPS ۞, shyam, sashijoseph
Author Post
abbas1707
Fri Sep 14 2007, 03:15PM

 User Offline
Registered Member #383
Joined: Thu Jan 25 2007, 08:07AM

Posts: 414
Thanked 67 times in 52 posts
hi ajay!
here is my first program in assembly:) for this project
i just now tested it on proteus but it gets stuck after 30 seconds on proteus.i have not tested it at board yet.
since im a newbie to assembly so plz can u have a look at it if u have time!!!
circuit is same as i posted before

1189808107_383_FT1501_assembly1.zip



A Thousand Miles Journey Starts With a Single Step.
Back to top


Ajay
Sat Sep 15 2007, 12:38AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 3752
Thanked 695 times in 654 posts
well of course it will get stuck. the reason is.. you are calling the subroutines and you are not using the instruction "RET".
so at the end of every subroutine you must put the instruction RET.
I am attaching the code.. check it carefully

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top


Ajay
Sat Sep 15 2007, 12:39AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 3752
Thanked 695 times in 654 posts
i donno not able to attach file.. so just copying and pasting it here..

CODE:
org 0
ljmp main

org 0bh
cpl clock
reti

org 23h
ljmp serial

org 30h
main:
        clock bit P3.2
        sc bit P3.3
        eoc bit P3.4
        oe bit P3.5
        ale bit P3.7

        mov dptr,#aray
        mov TMOD,#22h
        mov TH1,#0FDh
        mov SCON,#50h
        mov TH0,#0a3h
        mov IE,#10010010B
        setb TR1
        setb TR0
        mov P2,#0ffh
        setb eoc
        clr ale
        clr oe
        clr sc
while1:
        clr P1.0
        clr P1.1
        clr P1.2
        acall msdelay
        setb ale
        acall msdelay
        setb sc
        acall msdelay
        clr ale
        clr sc
wait:
        jb eoc,wait
wait1:
        jnb eoc,wait1
        setb oe
        acall msdelay
        mov r2,P2
        clr oe
        acall convert
        sjmp while1

convert:
        mov a,r2
        mov b,#10
        div ab
        mov r7,b;lower
        mov b,#10
        div ab
        mov r6,b ;mid
        mov r5,a ;high
        acall sendString
        ret

sendString:
        mov a,r5
        movc a,@a+dptr
        mov SBUF,a
fis:
        JNB TI,fis
        acall msdelay
        mov a,r6
        movc a,@a+dptr
        mov SBUF,a
sec:
        JNB TI,sec
        acall msdelay
        mov a,r7
        movc a,@a+dptr
        mov SBUF,a
thd:
        JNB TI,thd
        acall msdelay
        mov SBUF,#","
com:
        JNB TI,com
        acall msdelay
        ret

msdelay:
        mov r2,#50
he:
        mov r3,#250
she:
        nop
        nop
        djnz r3,she
        djnz r2,he
        ret

aray: db "0123456789"

serial:
        JB TI,trans
        reti
trans:
        clr TI
        reti
        end


www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top



This post has been thanked 1 time
 abbas1707 
abbas1707
Sat Sep 15 2007, 02:18AM

 User Offline
Registered Member #383
Joined: Thu Jan 25 2007, 08:07AM

Posts: 414
Thanked 67 times in 52 posts
yeah now it works
u put ret at end of subroutine sendString.but y it was not working wid ljmp while1?????
plz clarify becoz i have only 1 day knowledge of assembly so i cant understand this

A Thousand Miles Journey Starts With a Single Step.
Back to top


Ajay
Sat Sep 15 2007, 02:57AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 3752
Thanked 695 times in 654 posts
you know why your controller stops working after 30sec?
because of stack overflow..
you are using acall.. that means call to a subroutine.. and in the subroutine you are not returning.. so.. when you do this all in loop.. the stack stores the address from where call is made.. and when stack overflow.. on next call the address will not be stored anywhere.. and when executing routine like msdelay and when it reach to RET instruction it will jump to some unknown location because the actual address couldn't be stored coz of stack overflow.

Now.. if you want to use ur program.. with LJMP while1
then.. remove the calls to sendstring and convert in your program.. because they all comes in order.. no address will be stored in stack. except for routines with RET statement.

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top


abbas1707
Sat Sep 15 2007, 06:09AM

 User Offline
Registered Member #383
Joined: Thu Jan 25 2007, 08:07AM

Posts: 414
Thanked 67 times in 52 posts
now some different problem
program tested on microcontroller board instead of proteus this time.
but...
i get reading to hyper terminal only if i press reset button on board.
i.e press reset get one reading then press reset and get other reading..........
however my frend program working on board
no problem in harware no problem in software(as it was fine on proteus)
i m just going mad

A Thousand Miles Journey Starts With a Single Step.
Back to top


abbas1707
Sat Sep 15 2007, 06:11AM

 User Offline
Registered Member #383
Joined: Thu Jan 25 2007, 08:07AM

Posts: 414
Thanked 67 times in 52 posts
i think i shud quit programming now and work wid my frends program
i hav done every effort i can

[ Edited Sat Sep 15 2007, 06:12AM ]

A Thousand Miles Journey Starts With a Single Step.
Back to top


Ajay
Sat Sep 15 2007, 07:02AM
Rickey's World Admin

 User Offline

Registered Member #1
Joined: Fri Feb 24 2006, 04:56AM

Posts: 3752
Thanked 695 times in 654 posts
there must be something you are missing.. well.. i donno what to say.. don't loose hope

www.rickeyworld.info
If you feel satisfied with the user's forum reply please click on the thank button.

Obey forum rules!
Respect others!
Back to top


abbas1707
Sun Sep 16 2007, 04:45AM

 User Offline
Registered Member #383
Joined: Thu Jan 25 2007, 08:07AM

Posts: 414
Thanked 67 times in 52 posts
hi
anyone knows how to generate crystal reports and how to attach them with vb??





A Thousand Miles Journey Starts With a Single Step.
Back to top


۞ TPS ۞
Sun Sep 16 2007, 05:29AM

 User Offline
Registered Member #2712
Joined: Tue Jul 31 2007, 12:06AM

Posts: 469
Thanked 66 times in 56 posts
abbas it looks interesting

Online Component Shoppe
http://www.onlinetps.com/
Components at cheap rates in India
Back to top


Go to page  1 2 3 [4] 5  

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System

8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems