temperature logging system
Sat Sep 15 2007, 03:45 am
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
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
Sat Sep 15 2007, 01:08 pm
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
so at the end of every subroutine you must put the instruction RET.
I am attaching the code.. check it carefully
Sat Sep 15 2007, 01:09 pm
i donno not able to attach file.. so just copying and pasting it here..
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
abbas1707 like this.
Sat Sep 15 2007, 02:48 pm
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
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
Sat Sep 15 2007, 03:27 pm
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.
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.
Sat Sep 15 2007, 06:39 pm
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.......... :mad :mad :mad
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 :mad
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.......... :mad :mad :mad
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 :mad
Sat Sep 15 2007, 06:41 pm
i think i shud quit programming now and work wid my frends program :mad :-s
i hav done every effort i can
i hav done every effort i can
[ Edited Sat Sep 15 2007, 06:42 pm ]
Sat Sep 15 2007, 07:32 pm
there must be something you are missing.. well.. i donno what to say.. don't loose hope
Sun Sep 16 2007, 05:15 pm
hi
anyone knows how to generate crystal reports and how to attach them with vb??
anyone knows how to generate crystal reports and how to attach them with vb??
Powered by e107 Forum System