Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

coding with using 8051

Status
Not open for further replies.

ripingz

New Member
can anyone help me to program in assembly source code....this is an a dc digital multimeter.....it will measure from 0v to 12v....and it will display on lcd...please help me...and this is the circuit ...i don't have anymore time....my lecturer give me 1 week only to do this project as an assignment...plus i got 1 more project to settle up View attachment 62886

i do not know if the source code provided by anyone here....it will be a big thanks if i got the flowchart of the program....to make me understand...what is in the program about
 
Last edited:
The circuit came from 8052.com... there is an accompanying C program... You can use the LST file to see whats happening.

Remember.. We are not here to do your homework..... This is NOT a 1 week assignment...

If you browse THIS section of the forum, there is plenty of people doing the same assignment.

Sorry "Rickey world" not 8052.com

I see you've already asked for the assembly code!!!
 
Last edited:
The circuit came from 8052.com... there is an accompanying C program... You can use the LST file to see whats happening.

Remember.. We are not here to do your homework..... This is NOT a 1 week assignment...

If you browse THIS section of the forum, there is plenty of people doing the same assignment.

Sorry "Rickey world" not 8052.com

I see you've already asked for the assembly code!!!

im not lying...seriously i got 2 project i have to do in this semester. one of the project is im doing right now.. my lecturer give me 5 months to make it works. and this semester...which about 2 weeks ago....which another modul...that is computer system .... i had to do a mini project...i'll be given 1 week to make it works in simulation. so totally i got 2 project i had to do....i'm not an expertist..that why. i ask for help. rickey world doesnt help at all. he does not reply what im asking.... i had tried to convert the hex file to source code...but it doesnt work...that why i'm asking..and all of the project..im doing it alone !!!! one of my group project 1 is been expelled....and another project i had no group....
 
I never called you a liar.. I said that you would need more than 1 week to do this if you have no or little experience.

I noticed that several people have asked the same question on that site.. Some have been successful..

Why can't you use C? or does it have to be in asm?

If you download mcu 8051 ide.... SDCC compiler.... compile the code.. It produces an ASM file..... You just need to edit it.
 
I never called you a liar.. I said that you would need more than 1 week to do this if you have no or little experience.

I noticed that several people have asked the same question on that site.. Some have been successful..

Why can't you use C? or does it have to be in asm?

If you download mcu 8051 ide.... SDCC compiler.... compile the code.. It produces an ASM file..... You just need to edit it.

yes....i must provide a source code in assembly..not in c++...what software i have to use to convert the c++ program...to the assembly source code?
 
To change the code from C to ASM is VERY tedious you'll need to write ALL the low level routine.. ie Multiply / divide / add / subtract for you calculations

You need a BIN to Ascii routine, all the low level LCD routines all the ADC routines.

I am proficient in ASM and C, and it will take me a couple of day's with debugging.

You need a basic skeleton code that you can modify.... Try and find a 8051 code snippet of a LCD read/write and add the ADC part.

You can change the inner loop to 8 instead of 10.. This will make it easier to divide as you can shiftright by 3.
 
To change the code from C to ASM is VERY tedious you'll need to write ALL the low level routine.. ie Multiply / divide / add / subtract for you calculations

You need a BIN to Ascii routine, all the low level LCD routines all the ADC routines.

I am proficient in ASM and C, and it will take me a couple of day's with debugging.

You need a basic skeleton code that you can modify.... Try and find a 8051 code snippet of a LCD read/write and add the ADC part.

You can change the inner loop to 8 instead of 10.. This will make it easier to divide as you can shiftright by 3.

what is skeleton code...and snippet????
 
what is skeleton code...and snippet????

A small piece of code to get you started.. something like this

Code:
;--------------------------------------------------------------
;---------------------------------------------------------------
;------------------------------------------------------ 
;Author: Ashwin.V 
;Country:India 
;Code:LCD interface in 8bit mode 
;CPU:At89c51@11.0592Mhz 
;Tips:All you need to do is call the line where you want to display the message, 
;mov the charecter to lcd_data and call datw. 
;If you want to display a string, move the address of the hardcodded string into dptr and call datw. 
;---------------------------------------------------------------------------
;--------------------------------------------------------------------------- 
RS 		EQU 	P3.0 
EN 		EQU 	P3.1 
lcd_data	DATA	30h 

		org 	0000h 
		ljmp 	lcd8_main 
		org 	0030h 
;___________________________________________________________________________ 
;------------------------------delay subroutines---------------------------- 
;___________________________________________________________________________ 
;------------------------------100us delay---------------------------------- 

delay_100us: 
		push	00h 
		mov	r0,#46 
delay_100us_loop: 
		djnz 	r1,delay_100us_loop 
		pop 	00h 
		ret 

;------------------------------16ms delay---------------------------------- 
delay_16ms: 
		push 	00h 
		push 	01h 
		mov 	r0,#30 
delay_16ms_loop1: 
		mov 	r1,#255 
delay_16ms_loop2: 
		djnz 	r1,delay_16ms_loop2 
		djnz 	r0,delay_16ms_loop1 
		pop 	01h 
		pop 	00h 
		ret 
	
;--------------------------half second delay------------------------------- 
delay_half_second:	
		push 	00h 
		push 	01h 
		push 	02h 
		mov 	r2,#0ah 
delay_half_second1: 
		mov 	r1,#64h 
delay_half_second2:	
		mov 	r0,#0ffh 
back:	 
		djnz 	r0,back 
		djnz 	r1, delay_half_second2 
		djnz 	r2,delay_half_second1 
		pop 	02h 
		pop 	01h 
		pop 	00h 
		ret 
;_________________________________________________________________ 
;----------------message definition and display------------------- 
;_________________________________________________________________ 

disp_message: 
		push 	acc 
		push 	00h 
		mov 	r0,#17 		; maximum of 16charecters on lcd display 

disp_message_loop1: 
		mov 	a,#00h		; reset accumulator 
		movc 	a,@a+dptr 
		djnz 	r0,disp_message_loop2 
		pop 	00h 
		pop 	acc 
		ret 

disp_message_loop2: 
		mov 	lcd_data,a 
		acall 	datw 
		acall 	delay_100us 
		inc 	dptr 
		sjmp 	disp_message_loop1 
disp_ashwin:	
		DB	" Hello ashwin " 
disp_testing:
		DB	"Testing 4bit LCD" 
disp_initialising:
		DB	"Initialising...." 
disp_ready:
		DB	" 4bit LCD ready " 
disp_clear:
		DB	" " 
;___________________________________________________________________________ 
;--------------------command and data write subroutines--------------------- 
;___________________________________________________________________________ 

cmdw: 
		push 	acc 
		mov 	a,lcd_data 
		mov 	p0,a 
		clr 	rs 
		setb 	en 
		clr 	en 
		pop 	acc 
		ret 

datw: 
		push 	acc 
		mov 	a,lcd_data 
		mov 	p0,a 
		setb 	rs 
		setb 	en 
		clr 	en 
		pop 	acc 
		ret 

;___________________________________________________________________________ 
;--------------------------line select subroutines-------------------------- 
;___________________________________________________________________________ 

line1: 
		mov 	lcd_data,#80h	 	;initial position of cursor 
		acall 	cmdw 
		acall 	delay_100us 
		ret 

line2: 
		mov 	lcd_data,#0c0h	 	;initial position of cursor 
		acall 	cmdw 
		acall 	delay_100us 
		ret 

;___________________________________________________________________________ 
;----------------------lcd initialisation subroutine------------------------ 
;___________________________________________________________________________ 

lcd8_initialise: 
		acall 	delay_16ms 		;wait more than 15ms after vdd reaches 4.5v 
		mov 	lcd_data,#38h 		;2line 5x7 matrix 
		acall 	cmdw 
		acall 	delay_100us 
		mov 	lcd_data,#0fh	 	;display on, cursor on, cursor blinking 
		acall 	cmdw 
		acall 	delay_100us 
		mov 	lcd_data,#01h	 	;clear screen 
		acall 	cmdw 
		acall 	delay_100us 
		mov 	lcd_data,#06h		;cursor and display shifts(right/left) 
		acall 	cmdw 
		acall 	delay_100us 
		ret 

;___________________________________________________________________________ 
;-------------------------------lcd main code------------------------------- 
;___________________________________________________________________________ 

lcd8_main: 
		mov 	p0,#00h 
		clr 	RS 			;make out pins 
		clr 	EN 			;make out pins 
		mov 	IE,#00h 
		acall 	lcd8_initialise 

;--------------------------------------------------------------------------- 

		acall 	line1 
		mov 	dptr,#disp_initialising 
		acall 	disp_message 
		acall 	delay_half_second 
		acall 	delay_half_second 
		acall 	delay_half_second 
		acall 	delay_half_second 
		lcall 	line2 #
		mov 	dptr,#disp_ready 
		acall 	disp_message 
		acall 	delay_half_second 
		acall 	delay_half_second 
		acall 	delay_half_second 
		acall 	delay_half_second 
		lcall 	line1 
		mov 	dptr,#disp_testing 
		acall 	disp_message 
		acall 	delay_half_second 
		acall 	delay_half_second 
lcd8_loop: 
		acall 	line2 
		mov 	dptr,#disp_clear 
		acall 	disp_message 
		acall 	line2 
		mov	lcd_data,#'a' 
		acall 	datw 
		acall 	delay_half_second 
		mov 	lcd_data,#'b' 
		acall 	datw 
		acall 	delay_half_second 
		mov 	lcd_data,#'c' 
		lcall 	datw 
		acall 	delay_half_second 
		mov 	lcd_data,#'d' 
		lcall 	datw 
		acall 	delay_half_second 
		acall 	line2 
		mov 	dptr,#disp_ashwin 
		lcall 	disp_message 
		acall 	delay_half_second 
		acall 	delay_half_second 
		sjmp 	lcd8_loop 
		
		end

This has LCD routines AND delay routines....
 
can i know something???? why do we need the lcd rountines and delay rountines??? what is that things??? why do we need it???
 
can i know something???? why do we need the lcd rountines and delay rountines??? what is that things??? why do we need it???

For the same reason a PC needs driver software to run external peripherals. The code posted above is the "driver firmware" needed by the 8051 so that it can talk to the LCD display.
 
I changed my mind... You'll need MUCH more than a week...

If you browse the code library **broken link removed** you can find ALL the code you need to do this project (some of the code is in C, but a lot is assembler)

You'll need to get a grasp of how this all works together.

Take a look at PG1995's posts.... This is how we start... Not diving in with full applications.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top