Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

i need help in ASM coding?

Status
Not open for further replies.

brilliantelc

Junior Member level 1
Junior Member level 1
Joined
Aug 6, 2010
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
malaysia
Activity points
1,475
hi all

can any one help me please in this code:

;SQUARE WAVE GENERATION ROUTINE
TMR0_INIT: MOV TL0,#0F0H
MOV TH0,#0DBH
SETB IE.7 ;iNTRUPPUT ENABLE
SETB IE.1
MOV TMOD,#01H ;
NOP
NOP
SETB TCON.4 ; SET TR1
RET
;*************************
TIMER0: CLR TCON.4 ; CLEAR TR1
CPL P0.7 ; COMPLEMENT P0.7
MOV TL0,#0F0H
MOV TH0,#0D0H
SETB TCON.4
RETI

what does the "SQUARE WAVE GENERATION ROUTINE" means?
can i run the timer of 8051 without any Square Wave?!

thanks
 

if this is representative of your knowledge, it is difficult to help you.
 

Dear millwood

thanks for respond.

i just wanna know how to make the 89c51 run and counting without any Square Wave.
what difficult in that!!!
is it impossible?
cannot run the timer without Square Wave generator?!

can u please take a look on the attachments.

thanks, dude.
 

Attachments

  • timer.txt
    20.4 KB · Views: 101

is it impossible?

not only is it possible, it is routine.

what is impossible is for a person who has great difficulties in understanding what a square wave is to program a mcu to do that, dude.

if you want to run, you better make sure that you can walk. What you have shown convincingly is that you don't know how to walk, yet.

metaphorically speaking.
 

Dear millwood

i'm not looking here for any kind of philosophy. I am a beginner and looking for help from the experts.
it was simple, if you could answer me by defining the "Square Wave" and what it's for?!
This was the first, second, if you do not know how to help people in simple way, so better for you to stay silent.

is there any modest expert here can answer a simple beginner???
 

The comments at the top of the ASM file you attached mention that the program drives an LCD, a keyboard, and outputs a square wave on P0.7. Thus the code you are concerned about is for generating that square wave.

You'll have to talk to the person who wrote that code to find out what the square wave is for.

r.b.
 

at this rate, the best help you can get is to go back to basics.

if you don't understand what a square wave is, it is a waste of everyone's time to tell you anything else.
 

i know it's for generating a digital signal for 8051 timer.
however, just now, i tried to include a design for NE555 to my main timer design (in ISIS). check the attached file please.
(the pin 3 of NE555 connected to P0.7)

but still doesn't works with me!!
thats why i need to neglect it...

so, back to the main point of this post.. can i ignore the Square Wave generation? and do the timing with 8051 only?
or how exactly i need to design and connect the wave generator for the previous attached example?


thanks millwood for your care ;)
 

Attachments

  • 1.gif
    1.gif
    2.7 KB · Views: 236
Last edited:

i know it's for generating a digital signal for 8051 timer.

Not really. Timer0 is used to generate the square wave output. It doesn't use the square wave.

however, just now, i tried to include a design for NE555 to my main timer design (in ISIS). check the attached file please.
(the pin 3 of NE555 connected to P0.7)

but still doesn't works with me!!
thats why i need to neglect it...

Not too surprising there. You're hooking the output of the NE55 to the output of the 8051. What did you expect would happen?

so, back to the main point of this post.. can i ignore the Square Wave generation? and do the timing with 8051 only?
or how exactly i need to design and connect the wave generator for the previous attached example?

You've clearly grabbed this code off the internet because it meets some design need of yours. One of its features is that it outputs a square wave. The 8051 doesn't use the square wave itself. So you have to decide if you still need the square wave or not.

If you still need the square wave, you can continue to generate the square wave with the 8051, or use your NE 555 timer, but not both together. The choice is yours.

r.b.
 
hi rberek

yeah man, i got this example from 8052.com - The Online 8051/8052 Microcontroller Resource - 8052.com and trying to run/test it in ISIS.
then i will develop it to count down too.
this is the whole idea.

i am a telecomm. engineer and i'm working on a project in RF design. anyway, i'm not much familiar with PIC timers prog. & applications.
and i'm trying to add a timer (Up and Down) to attach to my project. thats how i got here and suffering to find a HELP...

anyway, now, i'm facing troubles with square wave generation :(
so, can you please be patient with me and guide me how to overcome this problem?
how should i connect the pic P0.7 based on this program?

i read and saw some examples on how to generate this squarewave, like the circuit attached before. and ooooooopsss i am hooking the output... :D

i do really appreciate you help, rberek
you are nice, simple and helpful.
a rating for you & thanks man.
 

anyway, now, i'm facing troubles with square wave generation :(
so, can you please be patient with me and guide me how to overcome this problem?
how should i connect the pic P0.7 based on this program?

I'm not sure what your problem actually is. As I mentioned in my previous post, this program will generate a square wave output. So what is your issue? I can't tell you what to do with P0.7. It is sent out of the 8051 and the program doesn't state what happens to it. Your best bet is to contact the fellow that put this in the 8052.com code library and get details from him.

In order to accomplish your task, you are going to have to take the time to understand exactly what this program does, and then make the changes you want to make. I'm sorry that I won't be of much help, as I do not usually write in assembler, and I've never written in 8051 assembler. Heck, embedded design is only a sideline for me. Plus, I'm swamped at my own job.

As an engineer, you must be used to teaching yourself new stuff, so here's another chance to do just that.

What I will tell you, based on my cursory reading of the program, is that I think its a good bet that the square wave output is fed back into P2.2 and that is used as the input pulse train which is counted. If you want to do an up/down counter, you will need another input that will control count direction. Then when pulses are received, you will need to check the state of the up/down input and increment or decrement the counter as necessary. Currently the program has a counter that is only incremented.

The pulse train that you count can be the output of P0.7, as it probably is now, it could be the output of the timer you drew, or it could be another push button.

At any rate, contact the guy who wrote the original code, grab a book or webpage on the 8051 instruction set, and figure out what the program does. Then it is much easier to figure out how to change it to make it do what you want it to do. If I were to help you, I'd have to do exactly the same thing.

Good Luck

r.b.
 
hello brilliant, whats ur problem, explain ur question clearly. do u want to learn how to create a square wave or u want to know how that code works. for all those beginners i suggest 8051 micro controller by mazidi it is simplest ever 8051 learning book. it has all the examples.


regards
kj:wink:
 
... So what is your issue? I can't tell you what to do with P0.7. It is sent out of the 8051 and the program doesn't state what happens to it. Your best bet is to contact the fellow that put this in the 8052.com code library and get details from him.

r.b.

guys, thats is exactly my problem..
what to do with pin P0.7 based on this program to make it run???!

i already tried to find and contact the fellow who did this program, but couldn't find his email...

As an engineer, you must be used to teaching yourself new stuff, so here's another chance to do just that.
yeah bro, you r right, i know that very well. i am a PhD candidate in telecomm. eng. and currently getting deep in electronics because of this timer.. :D
i have no problems with reading and learn new staff. it is ALL what i do...

I think its a good bet that the square wave output is fed back into P2.2 and that is used as the input pulse train which is counted.
i have already Start/Stop switch on P2.0
and Reset on P2.1 (couldn't make it work yet)..

dude, i just tried (for testing) to connect it through a switch and the counter on the LCD runs/counts on each press.. :)
P0.7--> switch ->P2.2
how should i connect it exactly???

Dear welove8051
thanks for giving attention to this post.

the P0.7 (the generated square wave) is my problem. how to deal with this pin? where exactly i should to connect it?
this is my big dilemma..but not for you elec. guys ;)


thank you guys for HELP
dear millwood, you are included and thanks ;)
 

your troubles are much deeper than that: you cannot define your problem(s).

I think you can help yourself greatly if you can forget about the code and instead try to articulate, in the most concise language, what you are attempting to do, and then what you have done, so other people may point you in the right direction (not to code it for you).

BTW, it is simply, xxxxxxxxx.....

MODERATOR ACTION: Delete inappropriate words as per reported by the user
 
Last edited by a moderator:

what "square wave" means.
:D no dude, you got it wrong.
i said:
it was simple, if you could answer me by defining the "Square Wave" and what it's for?!
from all your replies, you was thinking that i'm a new lazy fellow/student who looking for the easy way without effort. isn't?
thats why i said that you could answer me by defining the square wave...as a simplest answer that you could replied for such a fellow.

anyways bro, we here for knowledge Sharing not anything else. take example of "rberek" replies, he is a nice and helpful guy ;)
plus, the forums (in general) created mainly to help people not to jugde them with such answers:
if this is representative of your knowledge, it is difficult to help you.

of course, with all my respect
thats all, and we done here.

with best regards, millwood
 
Last edited:

Dear brilliantelc: unfortunately for you, millwood is COMPLETELY right!
At this date you have not explained in simple and detailed words what you really need!
I really do not know the way you were teached on how to tame a problem, but I think you are going in the wrong way!
PLEASE write down in a simple but articulate way what are your requirements and what you want to do and maybe you will get all the help you need.
If you continue to behave in a such unpolite manner, it will be very difficult you will get any help.

P.S. you wrote:
anyways bro, we here for knowledge Sharing not anything else
: at this date you are not sharing with us your knowledge of YOUR problem, so it will be very difficult to help you.
 

hi bepobalote
yeah, maybe you are right!

i already asked and mentioned several times in my replies what i want/ looking for.
anyone of you guys (the experts in this issue), read the program code and tell me what to do with P0.7???
is that not simple or clear question!!!

check the fellow "rberek" reply.
thanks to him, he read the code and directly notice the P0.7 and P2.2 which related to the square wave generation..
"I think its a good bet that the square wave output is fed back into P2.2 and that is used as the input pulse train which is counted."
so, how i should connect it?

is there still any confusions?!

and i'm sorry for disturbance, guys.
 

i already asked and mentioned several times in my replies what i want/ looking for.
anyone of you guys (the experts in this issue), read the program code and tell me what to do with P0.7???
is that not simple or clear question!!!
NO, your question is not clear because you didn't told us what you really want to do!!!

is there still any confusions?!
Yes, the problem is that YOU are confused: please relax yourself and explain in a DETAILED way WHAT YOU WANT TO DO with this piece of code!!!!

By the way, your unpoliteness [= following the netiquette rules] is so big that you even forgot to put DETAILED links to the place where you got this snippet of code and the reasons why you choose such code!!!
 

Please apologize my limited interest for "if"/"how" to connect P0.7 to P2.2. ....

To give a short summary in my own view:

You have some 8051 assembly code, downloaded from 8052.com and are trying to understand what it's good for.

You're playing around with 8051 and 555 to learn about timer circuits. Now you're stuck with the simulation of the 8051 code.

I also understand, that you're final target is to utilize PIC processors for your project rather than learning 8051 programming.

I wonder, if you shouldn't go more straight for it? The 8051 example represents the way people used to write microprocessor code 25 or 30 years ago. Assembly level programming is still useful today, but it's not the stuff to start with. And it's not needed at all for many projects.
 

i already posted the link to 8052.com - The Online 8051/8052 Microcontroller Resource - 8052.com website.
and here it is:
**broken link removed**
the "16*2 LCD display based Pulse Counter" for contributor "Gagan Goswami".


NO, your question is not clear because you didn't told us what you really want to do!!!
i think you didn't read all of my post's!


Yes, the problem is that YOU are confused: please relax yourself and explain in a DETAILED way WHAT YOU WANT TO DO with this piece of code!!!!
and yes, you arre completely right in this :D


By the way, your unpoliteness [= following the netiquette rules]
your are completely wrong in this.
i didn't used rude words or meant anything bad for anyone!!!
how you could say that?! STRANGE how you judge!!!

anyway, thank you for your opinion.

---------- Post added at 10:26 PM ---------- Previous post was at 10:19 PM ----------

hi FvM
To give a short summary in my own view:

You have some 8051 assembly code, downloaded from 8052.com and are trying to understand what it's good for.

You're playing around with 8051 and 555 to learn about timer circuits. Now you're stuck with the simulation of the 8051 code.

I also understand, that you're final target is to utilize PIC processors for your project rather than learning 8051 programming.

I wonder, if you shouldn't go more straight for it? The 8051 example represents the way people used to write microprocessor code 25 or 30 years ago. Assembly level programming is still useful today, but it's not the stuff to start with. And it's not needed at all for many projects.
yes Sir, you are completely right.

Please apologize my limited interest for "if"/"how" to connect P0.7 to P2.2. ....
guys, you are the experts not me :(
and thats why i posted here asking for some help...

but it seems useless post...
is there any Administrator monitoring this forum? can you please delete this post.

guys, all of you, i'm really so sorry for inconvenience you in this post.
i'm out of here
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top