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 ... 26 27 28
Moderators: Ajay, Junied , abbas1707, Arun Kumar V, pdi33, Shailesh NAYAK, ۞ TPS ۞, shyam, sashijoseph
Author Post
Arun Kumar V
Wed Sep 24 2008, 06:25AM

 User Offline
Registered Member #426
Joined: Sun Jan 28 2007, 11:50PM

Posts: 522
Thanked 219 times in 186 posts
Hello sahooji,


Good to see that you are putting efforts in writing your own code !

the above code has many errors, i think you are trying two or three things at a time, if you want to display count in hex then you can display it on only one port but you are thinking of displaying the count like on two 7-seg displays.

you can display upto 255 (FFh) on one 8 bit port.

if it is a up counter then you should increment the register/variable, but you are incrementing r1 and decrementing r2.

CODE:

ajmp end
tc_end:
ret
end:
end


the above, is a common newbie mistake. instruction "end" does not belong to 8051's
instruction set but it is an assembler directive, it tells/indicates the assembler the "finish" of code. its the job of the programmer to " loop back " other wise the micro fetches and executes the code till the end of ROM memory and resets it self .

in my earlier post i had suggested you to go thru a good micro book (kenneth ayala) but seems that you have not spend enough time with the book.

i / we can understand your enthusiasm to learn micros but keep in mind "good foundation is a must for becoming successful designer"

you can read the topic "PAL" (Practice Assemble Language ) in ayala's book.


Arun



[ Edited Wed Sep 24 2008, 06:26AM ]
Back to top



This post has been thanked 1 time
 sks 
Ajay
Wed Sep 24 2008, 06:35AM
Rickey's World Admin

 User Offline

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

Posts: 4042
Thanked 753 times in 712 posts
end is a keyword in keil (if you are using keil) so replace it with any other label say "routine_end" or something.

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
 sks 
sks
Wed Sep 24 2008, 09:32AM
 User Offline
Registered Member #9477
Joined: Thu Jul 31 2008, 07:51AM

Posts: 160
Thanked 0 times in 0 posts
hello Mr Arun,
thank u for ur comments and advice. as per ur advice believe me i m reading the said book. as mr pdi33 had suggested to read from the numeric system, i m following his advice. i know there must be errors in my code as i hv told b4 i m new to ur world of uc. so pl bear with me, i promise u i will try to obey ur advice and follow ur said path. pl try to point out the errors. i wrote the code for two 7seg displays, it will count 0 to 99 and stop when counter reaches 99. of course i hv not written delay for above code.
thanks again
sks

Back to top


sks
Wed Sep 24 2008, 09:34AM
 User Offline
Registered Member #9477
Joined: Thu Jul 31 2008, 07:51AM

Posts: 160
Thanked 0 times in 0 posts
hello Mr Ajay,
thanks for ur suggestion, i am using 8051 IDE not KEIL. pl suggest
sks

Back to top


sks
Wed Sep 24 2008, 10:49PM
 User Offline
Registered Member #9477
Joined: Thu Jul 31 2008, 07:51AM

Posts: 160
Thanked 0 times in 0 posts
hello Mr Arun,
first allow me to call/address at least u as "SIR" among all of ur Moderators.
last night i hv gone through the chapter PAL of the book, and felt sorry for my mistakes. it was not a structured one, no algorithm has been followed etc.
ok i will try to improve myself. pl reply. thanks again
sks


Back to top


Arun Kumar V
Thu Sep 25 2008, 07:45PM

 User Offline
Registered Member #426
Joined: Sun Jan 28 2007, 11:50PM

Posts: 522
Thanked 219 times in 186 posts

Hello sahooji,

you don't have to call me or our friends as SIR, on the contrary we have to call you as SIR, because of your age, we are like your kids - so no formalities !

regarding PAL, pl. go thru that chapter carefully, the author has explained the concept very beautifully and this is the first step to be learned before actual 8051 assembly.

did you know that 8051 which is a 8 bit micro, actually has a instruction set of 255 instructions/commands (FFh) - thats how amazing our 8051 is !


Arun
Back to top



This post has been thanked 1 time
 sks 
sks
Fri Sep 26 2008, 08:34AM
 User Offline
Registered Member #9477
Joined: Thu Jul 31 2008, 07:51AM

Posts: 160
Thanked 0 times in 0 posts
Hello Mr Arun,
Thank u all, i extremely happy after reading ur reply. god bless u all. i didn't know there is 255 instructions before, i didn't notice that op code part of instructions in the book. right now i noticed it , it is 255 (ffh) nos. thanks for teaching me. i have followed some of ur replies in other threads, it is amazing. i mean ur teaching style. thank u all again
sks


Back to top


sks
Fri Sep 26 2008, 11:14PM
 User Offline
Registered Member #9477
Joined: Thu Jul 31 2008, 07:51AM

Posts: 160
Thanked 0 times in 0 posts
Hello Mr Arun,
i hv some doubts in PAL Practice Chapter. It has been written PAL has only NINE Instructions where as we hv 255 instructions to use. pl clear my doubt.
one more question, i have notice in Instruction set there r 8 AJMPs 7 ACALLs having different OP CODES, why it is like that. pl clarify my doubts.
thanking u
sks


Back to top


Arun Kumar V
Sat Sep 27 2008, 12:31AM

 User Offline
Registered Member #426
Joined: Sun Jan 28 2007, 11:50PM

Posts: 522
Thanked 219 times in 186 posts

hello Sahooji,

please don't get confused with the PAL instruction set and 8051 instruction set, the author introduces the concept of Assembly language by taking example of a "similar" micro controller like 8051 and names it as PAL micro controller just like we have 8051 Micro.

now PAL micro has RAM, Registers, ROM, PC etc just like any 8 bit micro, it also has separate instruction set, opcodes ( just like 8051).

now this typical PAL micro has only 9 instructions or opcodes,and the author wants us to understand the concept with the help of a small micro rather than straight away starting with bigger 8051.

regarding the different no:of opcodes for AJMP and ACALL, each opcode is a result of possible short address 3 bit combination(upper bits).

at this stage you don't have to worry about this.



Arun

Back to top



This post has been thanked 1 time
 sks 
sks
Sat Sep 27 2008, 08:21AM
 User Offline
Registered Member #9477
Joined: Thu Jul 31 2008, 07:51AM

Posts: 160
Thanked 0 times in 0 posts
Hello Mr Arun,
i hv written two simple up counter code, one can count up to 255 and another can count up to 1000. the later one was little difficult to write. is this one of the ways to count up to 1000 or more. i am pasting the codes here. pl comment, how can i know my faults, unless i see the correct one.
thanks all
sks

; 0 TO 255 DEC COUNTER

ORG 00H
MOV A,#0

MAIN:
INC A
CJNE A,#255,MAIN
END

; 0 TO 1000 DEC COUNTER

ORG 00H
MOV A,#0
MOV R0,#0
MOV R6,#0

MAIN:

INC DPTR
MOV A,DPL

CJNE A,#250,MAIN

MAIN_1:
INC R6
MOV DPTR,#0000H
INC DPTR
MOV A,#DPL
MOV R0,A
CJNE R0,#4,MAIN

END

Back to top


Go to page  1 2 [3] 4 ... 26 27 28  

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