<?xml version="1.0" encoding="utf-8"?>
				<!-- generator="e107" -->
				<!-- content type="Forum / topic" -->
				<rss  version="2.0">
				<channel>
				<title>8051 Microcontroller Projects AVR PIC Projects Tutorials Ebooks Libraries codes : Forum / topic</title>
				<link>http://www.8051projects.net/</link>
				<description>Learn to make simple microcontroller projects, pic, 8051, avr and arm projects. download 8051 projects, tutorials, libraries, sample codes. join the microcontroller discussion forum and ask doubts regarding electronics. the best source for 8051 over internet.</description>

<language>en-gb</language>
				<copyright>2008 Rickey's World</copyright>
				<managingEditor>contact@nospam.com (Ajay Bhargav)</managingEditor>
				<webMaster>contact@nospam.com (Ajay Bhargav)</webMaster>
				<pubDate>Thu, 08 Jan 2009 21:59:45 -0800</pubDate>
				<lastBuildDate>Thu, 08 Jan 2009 21:59:45 -0800</lastBuildDate>
				<docs>http://backend.userland.com/rss</docs>
				<generator>e107 (http://e107.org)</generator>
				<ttl>60</ttl>
				<textInput>
				<title>Search</title>
				<description>Search 8051 Microcontroller Projects AVR PIC Projects Tutorials Ebooks Libraries codes</description>
				<name>query</name>
				<link>http://www.8051projects.net/search.php</link>
				</textInput>
						<item>
						<title>digital speedometer with  kilometer</title>
<link>http://www.8051projects.net/forum-t10569.html</link>
<description><![CDATA[hi i have an idea to build  digital speedometer with kilometer (Milometre)and distance measurement (resettable) option <br />we can use 16x2 lcd, upper line for speed ,lower line for distance (total as conventional meter have ) and also re-settable to find how much distance today <br />I want to use it in my Bicycle and further in my bike <br />sensor should be easy to install and simple too <br />How to start ?]]></description>
<pubDate>Thu, 03 Jul 2008 11:23:54 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t10569.html</guid>
</item>
						<item>
						<title>Re:  digital speedometer with  kilometer</title>
<link>http://www.8051projects.net/forum-t10569.html</link>
<description><![CDATA[avr? nice <img src='http://www.8051projects.net/e107_images/emotes/yahoo/1.gif' alt='' style='vertical-align:middle; border:0' /> <br /><br />can we have this in AVR projects?]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Thu, 03 Jul 2008 22:48:36 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t10569.html</guid>
</item>
						<item>
						<title>Re:  digital speedometer with  kilometer</title>
<link>http://www.8051projects.net/forum-t10569.html</link>
<description><![CDATA[here i find some link <a class='bbcode' href='http://www.8051projects.net/out.php?link=http://ltc.cit.cornell.edu/courses/ee476/FinalProjects/s2006/jtg28rbc24/jtg28rbc24/goconn.html' rel='external'  target='_blank'>http://ltc.cit.cornell.edu/courses/ee476/FinalProjects/s2006/jtg28rbc24/jtg28rbc24/goconn.html</a>]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Thu, 03 Jul 2008 12:09:58 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t10569.html</guid>
</item>
						<item>
						<title>Re:  digital speedometer with  kilometer</title>
<link>http://www.8051projects.net/forum-t10569.html</link>
<description><![CDATA[<a class='bbcode' href='http://www.8051projects.net/out.php?link=http://www.ednasia.com/article-3159-versatiledigitalspeedometerusesfewcomponents-Asia.html' rel='external'  target='_blank'>http://www.ednasia.com/article-3159-versatiledigitalspeedometerusesfewcomponents-Asia.html</a>]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Thu, 03 Jul 2008 12:30:11 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t10569.html</guid>
</item>
						<item>
						<title>Re:  digital speedometer with  kilometer</title>
<link>http://www.8051projects.net/forum-t10569.html</link>
<description><![CDATA[codes<br /><br /><div class='code_asm'>CODE:</div><div class='code_highlight' style='unicode-bidi: embed; direction: ltr'><div class="asm" style="font-family: monospace;"><span style="color: #adadad; font-style: italic;">;**********************</span><br /><span style="color: #adadad; font-style: italic;">;Including Controller Definetion File</span><br /><span style="color: #adadad; font-style: italic;">;**********************</span><br /><br /><span style="color: #0000ff;">.include</span> <span style="color: #7f007f;">&quot;2313def.inc&quot;</span><br /><br /><span style="color: #adadad; font-style: italic;">;**********************</span><br /><span style="color: #adadad; font-style: italic;">;Description</span><br /><span style="color: #adadad; font-style: italic;">;**********************</span><br /><span style="color: #adadad; font-style: italic;">;The connection details are as given in schematic</span><br /><span style="color: #adadad; font-style: italic;">;LCD is connected to port B and sensor is connected </span><br /><span style="color: #adadad; font-style: italic;">;to INT 0 pin of MCU</span><br /><br /><span style="color: #adadad; font-style: italic;">;**********************</span><br /><span style="color: #adadad; font-style: italic;">;calculation Details (Formulae Used)</span><br /><span style="color: #adadad; font-style: italic;">;**********************</span><br /><br /><span style="color: #adadad; font-style: italic;">;####For speed measurement####</span><br /><span style="color: #adadad; font-style: italic;">;speed = 2*pi*R*3600*clk/time_count*1000*x</span><br /><span style="color: #adadad; font-style: italic;">;R = radius of the wheel in cm (In this design R=25cm)</span><br /><span style="color: #adadad; font-style: italic;">;time_count = value of timer counter in b/w</span><br /><span style="color: #adadad; font-style: italic;">;two successive interrupts</span><br /><span style="color: #adadad; font-style: italic;">;x = clock prescaler used (in this design x=1024)</span><br /><span style="color: #adadad; font-style: italic;">;using this we have calculated the equivalent value of </span><br /><span style="color: #adadad; font-style: italic;">;all the constants (except time_count all other parameters</span><br /><span style="color: #adadad; font-style: italic;">;are constants)</span><br /><span style="color: #adadad; font-style: italic;">;sh and sl are binary equivalent of this constant</span><br /><br />.<span style="color: #0000ff;">equ</span> sh = $<span style="color: #ff0000;">56</span><br />.<span style="color: #0000ff;">equ</span> sl = $<span style="color: #ff0000;">49</span>&nbsp; &nbsp;<br />.<span style="color: #0000ff;">equ</span> sht = $<span style="color: #ff0000;">57</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;sht = sh + 1</span><br /><br /><span style="color: #adadad; font-style: italic;">;####For distance measurement####</span><br /><span style="color: #adadad; font-style: italic;">;After every 100 m the registers holding distance values </span><br /><span style="color: #adadad; font-style: italic;">;are incremented. For this we have used following formulae</span><br /><span style="color: #adadad; font-style: italic;">; 2*pi*R*n/100 = 100</span><br /><span style="color: #adadad; font-style: italic;">;R = radius of the wheel in cm (In this design R=25cm)</span><br /><span style="color: #adadad; font-style: italic;">;n is the count which signifies that 100 m has been completed </span><br /><br />.<span style="color: #0000ff;">equ</span> n = $<span style="color: #ff0000;">40</span><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;To give useful names to Registers </span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><br /><span style="color: #adadad; font-style: italic;">;####temporay registers####</span><br /><span style="color: #0000ff;">.def</span> temp=r16&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<br /><span style="color: #0000ff;">.def</span> temp1=r18&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /><span style="color: #0000ff;">.def</span> c1=r22&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;used for speed calculation and for display purpose</span><br /><span style="color: #0000ff;">.def</span> c2=r4&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;used for speed calculation and for display purpose</span><br /><span style="color: #0000ff;">.def</span> d1=<span style="color: #46aa03; font-weight:bold;">r5</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;used for speed calculation and for display purpose</span><br /><span style="color: #0000ff;">.def</span> d2=<span style="color: #46aa03; font-weight:bold;">r6</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;used for speed calculation and for display purpose</span><br /><span style="color: #0000ff;">.def</span> status=<span style="color: #46aa03; font-weight:bold;">r7</span>&nbsp; <span style="color: #adadad; font-style: italic;">;holds the value of status register in case of interrupt</span><br /><br /><span style="color: #adadad; font-style: italic;">;####Registers used for timing####</span><br /><span style="color: #0000ff;">.def</span> count_1=r17&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;</span><br /><span style="color: #0000ff;">.def</span> time_1=<span style="color: #46aa03; font-weight:bold;">r1</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /><span style="color: #0000ff;">.def</span> time_0=<span style="color: #46aa03; font-weight:bold;">r2</span><br /><br /><span style="color: #adadad; font-style: italic;">;####Registers used for speed measurement####</span><br /><span style="color: #0000ff;">.def</span> sdigit_01=r19<br /><span style="color: #0000ff;">.def</span> sdigit_1=r20&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;holds the binary value of speed</span><br /><br /><span style="color: #adadad; font-style: italic;">;####Registers used for Distance measurement####</span><br /><span style="color: #0000ff;">.def</span> ddigit_01=r8&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;Holds binary value of distance (0.0 to 9.9)</span><br /><span style="color: #0000ff;">.def</span> ddigit_1=r9 &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">;Holds binary value of distance (10.0 to 999.9)</span><br /><span style="color: #0000ff;">.def</span> ddigit_10=r10&nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;Holds binary value of distance (1000.0 to 99999.9)</span><br /><span style="color: #0000ff;">.def</span> dist_count=r13<br /><br /><span style="color: #adadad; font-style: italic;">;####Registers used for LCD display####</span><br /><span style="color: #0000ff;">.def</span> lcd_cmd=r21<br /><span style="color: #0000ff;">.def</span> lcd_dat=r23<br /><span style="color: #0000ff;">.def</span> count=<span style="color: #46aa03; font-weight:bold;">r3</span><br /><br /><span style="color: #adadad; font-style: italic;">;####Registers used for delays####</span><br /><span style="color: #0000ff;">.def</span> low_del=r24<br /><span style="color: #0000ff;">.def</span> hi_del=r25<br /><br /><span style="color: #adadad; font-style: italic;">;####Registers used for EEPROM####</span><br /><span style="color: #0000ff;">.def</span> eep_reg=r11<br /><span style="color: #0000ff;">.def</span> eep_addr=r12<br /><br /><span style="color: #adadad; font-style: italic;">;r14r15</span><br /><br /><span style="color: #adadad; font-style: italic;">;*******************</span><br /><span style="color: #adadad; font-style: italic;">;Code Segment</span><br /><span style="color: #adadad; font-style: italic;">;*******************</span><br /><br />.<span style="color: #0000ff;">cseg</span>&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;<br /><br />.<span style="color: #0000ff;">org</span> <span style="color: #ff0000;">0</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> &nbsp; &nbsp;RESET &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />.<span style="color: #0000ff;">org</span> INT0addr<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> IntV0<br /><br /><span style="color: #00007f; font-weight:bold;">reti</span><br /><span style="color: #00007f; font-weight:bold;">reti</span><br /><span style="color: #00007f; font-weight:bold;">reti</span><br /><span style="color: #00007f; font-weight:bold;">reti</span><br />&nbsp; &nbsp; &nbsp; &nbsp;<br />.<span style="color: #0000ff;">org</span> OVF0addr<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> TimerV0<br />&nbsp; &nbsp; &nbsp; &nbsp;<br /><span style="color: #00007f; font-weight:bold;">reti</span><br /><span style="color: #00007f; font-weight:bold;">reti</span><br /><span style="color: #00007f; font-weight:bold;">reti</span><br /><span style="color: #00007f; font-weight:bold;">reti</span><br /><br />.<span style="color: #0000ff;">org</span> $<span style="color: #ff0000;">000b</span><br /><br /><span style="color: #adadad; font-style: italic;">;*******************</span><br /><span style="color: #adadad; font-style: italic;">;Reset interrupt subroutine</span><br /><span style="color: #adadad; font-style: italic;">;to be executed on Reset interrupt</span><br /><span style="color: #adadad; font-style: italic;">;*******************</span><br />&nbsp; &nbsp; &nbsp; &nbsp;<br />RESET:<br /><br /><span style="color: #adadad; font-style: italic;">;####Initializing Stack Pointer####</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,RAMEND<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">SPL</span>, temp &nbsp; &nbsp; &nbsp; &nbsp;<br /><br /><span style="color: #adadad; font-style: italic;">;####Initializing I/O Ports####</span><br /><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp, <span style="color: #ff0000;">0b</span><span style="color: #ff0000;">11111111</span> &nbsp; <span style="color: #adadad; font-style: italic;">;configure PORT B for all outputs</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">DDRB</span>, temp &nbsp;<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,<span style="color: #ff0000;">0</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">DDRD</span>,temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,$ff<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">PORTD</span>,temp&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;configure PORT D for all inputs &nbsp; &nbsp; &nbsp;</span><br /><br /><span style="color: #adadad; font-style: italic;">;####Initializing INT 0 interrupt####</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,$<span style="color: #ff0000;">40</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;Enabling INT 0 interrupt</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">GIMSK</span>,temp<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,$<span style="color: #ff0000;">03</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;Interrupt on rising edge</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">MCUCR</span>,temp<br /><br /><span style="color: #adadad; font-style: italic;">;####Intializing timing process####</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,$<span style="color: #ff0000;">02</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">TIMSK</span>,temp&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;Enabling timer overflow interrupt</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,$<span style="color: #ff0000;">05</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">TCCR0</span>,temp<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,$<span style="color: #ff0000;">00</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;Initializing Registers</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">TCNT0</span>,temp<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> time_0<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> time_1<br /><br /><span style="color: #adadad; font-style: italic;">;####Initializing registers holding speed####</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> sdigit_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> sdigit_01<br /><br /><span style="color: #adadad; font-style: italic;">;####Initializing registers holding distance####</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> dist_count<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> ddigit_01<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> ddigit_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> ddigit_10<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> eeprom_read<br />&nbsp; &nbsp; &nbsp; &nbsp;<br /><span style="color: #adadad; font-style: italic;">;####Initializing LCD Display####</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> init_lcd<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> init_lcd<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> hi_delay<br /><br /><span style="color: #adadad; font-style: italic;">;####enabling global mask interrupt enable####</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sei</span><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Main Part of the Program</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><br />main_loop:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> dist &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;Subroutine to calculate Distance</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> print_lcd&nbsp;<span style="color: #adadad; font-style: italic;">;Subroutine for LCD Display</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> main_loop &nbsp;<br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;INT 0 ISR </span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><br />IntV0:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">in</span> status,<span style="color: #46aa03; font-weight:bold;">SREG</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">in</span> time_0,<span style="color: #46aa03; font-weight:bold;">TCNT0</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> time_1,count_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> count_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">TCNT0</span>,count_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">inc</span> dist_count<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> speed&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;Subroutine for speed calculation</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">SREG</span>,status<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">reti</span><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Timer overflow ISR</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><br />TimerV0:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">in</span> status,<span style="color: #46aa03; font-weight:bold;">SREG</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">inc</span> count_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cpi</span> count_1,sht<br />&nbsp; &nbsp; &nbsp; &nbsp; brsh timeff<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">SREG</span>,status<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">reti</span><br /><br />timeff:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> count_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> time00<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br />&nbsp; &nbsp; &nbsp; &nbsp;<br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Calculation of speed</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><br />speed:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">push</span> d1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">push</span> d2<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">push</span> c1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">push</span> c2<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp1,$<span style="color: #ff0000;">00</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cp</span> time_1,temp1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">breq</span> time0&nbsp; &nbsp; &nbsp;<br />speedq:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> sdigit_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp1,sh<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> c1,temp1&nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp1,sl<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> c2,temp1&nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> speedcal<br /><br />time0:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cp</span> time_0,temp1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">breq</span> time00<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> speedq<br /><br />time00:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> sdigit_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> sdigit_01<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">pop</span> d1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">pop</span> d2<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">pop</span> c1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">pop</span> c2<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br />&nbsp; &nbsp; &nbsp; &nbsp;<br />speedcal:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cp</span> c1,time_1<br />&nbsp; &nbsp; &nbsp; &nbsp; brsh speed_cal<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> speed0<br />speed_cal:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cp</span> c2,time_0<br />&nbsp; &nbsp; &nbsp; &nbsp; brsh speed_cal1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cp</span> c1,time_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">breq</span> speed0<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> speed_cal2<br />speed_cal1:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">inc</span> sdigit_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sub</span> c1,time_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sub</span> c2,time_0<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> speedcal<br /><br />speed_cal2:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">inc</span> sdigit_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sub</span> c1,time_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sub</span> c2,time_0<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">dec</span> c1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> speedcal<br /><br />speed0:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> scal<br />scal:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> d1,c1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> d2,c2<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp1,<span style="color: #ff0000;">10</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> scal1<br />scal1:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cpi</span> temp1,<span style="color: #ff0000;">1</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">brne</span> scal2<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> scal3<br />scal2:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">dec</span> temp1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">add</span> d2,c2<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">adc</span> d1,c1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> scal1<br />scal3:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cp</span> d1,time_1<br />&nbsp; &nbsp; &nbsp; &nbsp; brsh scal4<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> speed1<br />scal4:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cp</span> d2,time_0<br />&nbsp; &nbsp; &nbsp; &nbsp; brsh scal5<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cp</span> d1,time_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">breq</span> speed1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> scal6<br />scal5:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">inc</span> sdigit_01<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sub</span> d1,time_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sub</span> d2,time_0<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> scal3<br />scal6:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">inc</span> sdigit_01<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sub</span> d1,time_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sub</span> d2,time_0<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">dec</span> d1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> scal3<br />speed1:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">pop</span> d1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">pop</span> d2<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">pop</span> c1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">pop</span> c2<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br />&nbsp; &nbsp; &nbsp; &nbsp;<br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Calculation of distance</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><br />dist:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp1,n&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cp</span> dist_count,temp1<br />&nbsp; &nbsp; &nbsp; &nbsp; brsh dist_cal<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br />dist_cal:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> dist_count<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">inc</span> ddigit_01<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,<span style="color: #ff0000;">1</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> eep_addr,temp<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> eep_reg,ddigit_01<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> eeprom_write<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp1,<span style="color: #ff0000;">100</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cp</span> ddigit_01,temp1<br />&nbsp; &nbsp; &nbsp; &nbsp; brsh dist_cal1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br />dist_cal1:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> ddigit_01<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">inc</span> ddigit_1<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,<span style="color: #ff0000;">1</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> eep_addr,temp<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> eep_reg,ddigit_01<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> eeprom_write<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,<span style="color: #ff0000;">2</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> eep_addr,temp<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> eep_reg,ddigit_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> eeprom_write<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp1,<span style="color: #ff0000;">100</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cp</span> ddigit_1,temp1<br />&nbsp; &nbsp; &nbsp; &nbsp; brsh dist_cal2<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br />dist_cal2:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> ddigit_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">inc</span> ddigit_10<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,<span style="color: #ff0000;">1</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;storing data to EEPROM</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> eep_addr,temp<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> eep_reg,ddigit_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> eeprom_write<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,<span style="color: #ff0000;">2</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> eep_addr,temp<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> eep_reg,ddigit_01<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> eeprom_write<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,<span style="color: #ff0000;">3</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> eep_addr,temp<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> eep_reg,ddigit_10<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> eeprom_write<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp1,<span style="color: #ff0000;">100</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cp</span> ddigit_10,temp1<br />&nbsp; &nbsp; &nbsp; &nbsp; brsh dist_cal3<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br />dist_cal3:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> dist_count<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> ddigit_01<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> ddigit_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> ddigit_10<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br /><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Initializes distance registers values to </span><br /><span style="color: #adadad; font-style: italic;">;previously stored value in EEPROM</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br />eeprom_read:<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cli</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">push</span> temp<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,<span style="color: #ff0000;">1</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> eep_addr, temp<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> eep_nr<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> ddigit_01, eep_reg<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,<span style="color: #ff0000;">2</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> eep_addr, temp<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> eep_nr<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> ddigit_1, eep_reg<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp,<span style="color: #ff0000;">3</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> eep_addr, temp<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> eep_nr<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> ddigit_10, eep_reg<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">pop</span> temp<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sei</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Subroutine to read data from eeprom</span><br /><span style="color: #adadad; font-style: italic;">;eep_addr holds the address of eeprom</span><br /><span style="color: #adadad; font-style: italic;">;eep_reg holds the data read</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br />eep_nr:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sbic</span> <span style="color: #46aa03; font-weight:bold;">EECR</span>,EERE<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> eep_nr<br />read:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> EEAR, eep_addr<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sbi</span> <span style="color: #46aa03; font-weight:bold;">EECR</span>, EERE<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">nop</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">nop</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">in</span> eep_reg, <span style="color: #46aa03; font-weight:bold;">EEDR</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Subroutine to write data to eeprom</span><br /><span style="color: #adadad; font-style: italic;">;eep_addr holds the address of eeprom</span><br /><span style="color: #adadad; font-style: italic;">;eep_reg holds the data to be written</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br />eeprom_write:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sbic</span> <span style="color: #46aa03; font-weight:bold;">EECR</span>, EEWE<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> eeprom_write<br />write:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> EEAR,eep_addr<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">EEDR</span>,eep_reg<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cli</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sbi</span> <span style="color: #46aa03; font-weight:bold;">EECR</span>,EEMWE<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sbi</span> <span style="color: #46aa03; font-weight:bold;">EECR</span>,EEWE<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">sei</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Init_Lcd: Initializes the 16 X 2 LCD module in 4 bit data</span><br /><span style="color: #adadad; font-style: italic;">;transfer mode</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br />init_lcd:<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd, <span style="color: #ff0000;">3</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_low_cmd<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> hi_delay<br /><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd, <span style="color: #ff0000;">3</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_low_cmd<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br /><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd, <span style="color: #ff0000;">3</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_low_cmd<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br />&nbsp;<br /><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd, $<span style="color: #ff0000;">28</span>&nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">; set 4-bit interface</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd, <span style="color: #ff0000;">8</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">; set DDRAM address to 00</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd<br /><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd, $0c&nbsp; &nbsp;<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd<br /><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd, <span style="color: #ff0000;">6</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd&nbsp; &nbsp;<span style="color: #adadad; font-style: italic;">; mode setting</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Print_Lcd: Prints speed and distance on the LCD display module</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><br />print_lcd:<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd, $<span style="color: #ff0000;">80</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp, <span style="color: #ff0000;">16</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> count, temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> <span style="color: #46aa03; font-weight:bold;">ZH</span>, <span style="color: #0000ff;">high</span><span style="color: #66cc66;">&#40;</span>msg1*<span style="color: #ff0000;">2</span><span style="color: #66cc66;">&#41;</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> <span style="color: #46aa03; font-weight:bold;">ZL</span>, <span style="color: #0000ff;">low</span><span style="color: #66cc66;">&#40;</span>msg1*<span style="color: #ff0000;">2</span><span style="color: #66cc66;">&#41;</span><br /><br />more1:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lpm</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> lcd_dat, <span style="color: #46aa03; font-weight:bold;">r0</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_dat<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">adiw</span> <span style="color: #46aa03; font-weight:bold;">ZL</span>, <span style="color: #ff0000;">1</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">dec</span> count<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp, <span style="color: #ff0000;">0</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cp</span> count, temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">brne</span> more1<br /><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp, <span style="color: #ff0000;">16</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> count,temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd, $c0<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd<br />more2: &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lpm</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> lcd_dat, <span style="color: #46aa03; font-weight:bold;">r0</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_dat<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">adiw</span> <span style="color: #46aa03; font-weight:bold;">ZL</span>, <span style="color: #ff0000;">1</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">dec</span> count<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> temp, <span style="color: #ff0000;">0</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cp</span> count, temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">brne</span> more2<br /><br /><span style="color: #adadad; font-style: italic;">;####Binary to BCD conversion####</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> d2<br />speeddigit:&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;hundredth place value of speed</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cpi</span> sdigit_1,<span style="color: #ff0000;">100</span><br />&nbsp; &nbsp; &nbsp; &nbsp; brsh sdigit_cal<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> print1<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />sdigit_cal:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">inc</span> d2&nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">subi</span> sdigit_1,<span style="color: #ff0000;">100</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> speeddigit&nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />print1:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd,$<span style="color: #ff0000;">86</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> lcd_dat,d2<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> lcd_dat,$0f<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ori</span> lcd_dat,$<span style="color: #ff0000;">30</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_dat<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> c1,sdigit_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> bcd<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> sdigit_1,c1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> c2,d1<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd,$<span style="color: #ff0000;">87</span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;tenths place value of speed</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> lcd_dat,c2<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> lcd_dat,$0f<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ori</span> lcd_dat,$<span style="color: #ff0000;">30</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_dat<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd,$<span style="color: #ff0000;">88</span>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;units place value of speed</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> sdigit_1,$0f<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> lcd_dat,sdigit_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ori</span> lcd_dat,$<span style="color: #ff0000;">30</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_dat<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd,$8a&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;decimal place value of speed</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> sdigit_01,$0f<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> lcd_dat,sdigit_01<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ori</span> lcd_dat,$<span style="color: #ff0000;">30</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_dat<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br /><br /><span style="color: #adadad; font-style: italic;">;####prints distance####</span><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> c1,ddigit_10<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> bcd<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd,$c5&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;ten thousandth place of distance</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> lcd_dat,d1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> lcd_dat,$0f<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ori</span> lcd_dat,$<span style="color: #ff0000;">30</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_dat<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br /><br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd,$c6&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;thousandth place of distance</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> lcd_dat,c1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> lcd_dat,$0f<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ori</span> lcd_dat,$<span style="color: #ff0000;">30</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_dat<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> c1,ddigit_1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> bcd<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd,$c7&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;hundredth place value of distance</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> lcd_dat,d1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> lcd_dat,$0f<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ori</span> lcd_dat,$<span style="color: #ff0000;">30</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_dat<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br /><br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd,$c8&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;Tenth place value of distance</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> lcd_dat,c1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> lcd_dat,$0f<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ori</span> lcd_dat,$<span style="color: #ff0000;">30</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_dat<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> c1,ddigit_01<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> bcd<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd,$c9&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;Units place value of distance</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> lcd_dat,d1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> lcd_dat,$0f<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ori</span> lcd_dat,$<span style="color: #ff0000;">30</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_dat<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> lcd_cmd,$cb&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #adadad; font-style: italic;">;decimal place of distance</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_cmd&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> lcd_dat,c1<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> lcd_dat,$0f<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ori</span> lcd_dat,$<span style="color: #ff0000;">30</span><br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_all_dat<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br />&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Binary to BCD conversion</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br />bcd:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">clr</span> d1<br />bcddigit:&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cpi</span> c1,<span style="color: #ff0000;">10</span><br />&nbsp; &nbsp; &nbsp; &nbsp; brsh bcd_cal<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br />&nbsp; &nbsp; &nbsp; &nbsp;<br />bcd_cal:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">inc</span> d1&nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">subi</span> c1,<span style="color: #ff0000;">10</span>&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rjmp</span> bcddigit<br /><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Low_Delay: A 250 us delay</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br />low_delay:<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">push</span> low_del<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">push</span> hi_del<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> low_del, <span style="color: #ff0000;">20</span><br />ld_hi: &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> hi_del, <span style="color: #ff0000;">10</span><br />loop_in:<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">dec</span> hi_del<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cpi</span> hi_del, <span style="color: #ff0000;">0</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">brne</span> loop_in<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">dec</span> low_del<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cpi</span> low_del, <span style="color: #ff0000;">0</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">brne</span> ld_hi<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">pop</span> hi_del<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">pop</span> low_del<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Hi_Delay: A 5 ms delay</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br />hi_delay:<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ldi</span> low_del, <span style="color: #ff0000;">25</span><br />more_call:<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">dec</span> low_del<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">cpi</span> low_del, <span style="color: #ff0000;">0</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">brne</span> more_call<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Lcd_Low_Cmd: Sends a command to higher 4 bits of the LCD.</span><br /><span style="color: #adadad; font-style: italic;">;The command nibble must be in the lower nibble of the</span><br /><span style="color: #adadad; font-style: italic;">;variable 'lcd_cmd'</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br />lcd_low_cmd:<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> temp, lcd_cmd<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsl</span> temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsl</span> temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsl</span> temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsl</span> temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> temp, $f0<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">PORTB</span>, temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ori</span> temp, $<span style="color: #ff0000;">08</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">PORTB</span>, temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> temp, $f7<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">PORTB</span>, temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Lcd_All_Cmd: sends an 8 bit command to the LCD</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br />lcd_all_cmd:<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">push</span> lcd_cmd<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsr</span> lcd_cmd<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsr</span> lcd_cmd<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsr</span> lcd_cmd<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsr</span> lcd_cmd<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_low_cmd<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">pop</span> lcd_cmd<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> lcd_cmd, $0f<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcd_low_cmd<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Lcd_All_Dat: Sends a data byte to the LCD. The data byte</span><br /><span style="color: #adadad; font-style: italic;">;is stored in variable 'lcd_dat'</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br />lcd_all_dat:<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">push</span> lcd_dat<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsr</span> lcd_dat<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsr</span> lcd_dat<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsr</span> lcd_dat<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsr</span> lcd_dat<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> lcd_dat, $0f<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcdlowdat<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">pop</span> lcd_dat<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> lcd_dat, $0f<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> lcdlowdat<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">rcall</span> low_delay<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Lcd_Low_Dat: Sends a data nibble to higher 4 bits of the </span><br /><span style="color: #adadad; font-style: italic;">;LCD. The data nibble must be in the lower nibble of the</span><br /><span style="color: #adadad; font-style: italic;">;variable 'lcd_dat'</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br />lcdlowdat:<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">mov</span> temp, lcd_dat<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsl</span> temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsl</span> temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsl</span> temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">lsl</span> temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> temp, $f0<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ori</span> temp, $<span style="color: #ff0000;">04</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">PORTB</span>, temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ori</span> temp, $<span style="color: #ff0000;">08</span><br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">PORTB</span>, temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">andi</span> temp, $f7<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">out</span> <span style="color: #46aa03; font-weight:bold;">PORTB</span>, temp<br />&nbsp; &nbsp; <span style="color: #00007f; font-weight:bold;">ret</span><br /><br /><span style="color: #adadad; font-style: italic;">;********************</span><br /><span style="color: #adadad; font-style: italic;">;Message #1</span><br /><span style="color: #adadad; font-style: italic;">;********************</span><br />msg1: .<span style="color: #0000ff;">db</span> <span style="color: #7f007f;">&quot;SPEED= &nbsp; . Km/hrDIST= &nbsp; &nbsp; . Km &nbsp;&quot;</span><br /><span style="color: #adadad; font-style: italic;">; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;12345678123456781234567812345678 </span><br />&nbsp;</div></div>]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Thu, 03 Jul 2008 12:39:31 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t10569.html</guid>
</item>
						<item>
						<title>Re:  digital speedometer with  kilometer</title>
<link>http://www.8051projects.net/forum-t10569.html</link>
<description><![CDATA[mail me stuff (circuit + code + hex + little discription) along with the bug detail you said..<br />waiting for your mail.]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Thu, 03 Jul 2008 23:04:06 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t10569.html</guid>
</item>
						<item>
						<title>Re:  digital speedometer with  kilometer</title>
<link>http://www.8051projects.net/forum-t10569.html</link>
<description><![CDATA[yes why not  <img src='http://www.8051projects.net/e107_images/emotes/yahoo/1.gif' alt='' style='vertical-align:middle; border:0' />]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Thu, 03 Jul 2008 23:02:00 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t10569.html</guid>
</item>
						<item>
						<title>Re:  digital speedometer with  kilometer</title>
<link>http://www.8051projects.net/forum-t10569.html</link>
<description><![CDATA[When i was young i developped this circuit for my bicycle.<br />Sorry i have not mplab installed on my pc and i can't generate the hex.<br />Anyway must be assembled with the real wheel circumference.<br />N.B. Low battery is not managed<br />Regards<br /><br /><a href='http://www.8051projects.net/e107_files/public/1215201329_6071_FT10569_tacho_asm.zip'><img src='http://www.8051projects.net/e107_images/generic/lite/file.png' alt='' style='border:0; vertical-align:middle' /></a> <a href='http://www.8051projects.net/e107_files/public/1215201329_6071_FT10569_tacho_asm.zip'>tacho_asm.zip</a><br /><a class='bbcode' href='http://www.8051projects.net/e107_files/public/1215201329_6071_FT10569_tacho1.gif' rel='external'  target='_blank'><img src='http://www.8051projects.net/e107_files/public/1215201329_6071_FT10569_tacho1_.gif' class='bbcode' alt='' width='500' height='375'  /></a><br />]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Fri, 04 Jul 2008 12:59:57 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t10569.html</guid>
</item>
						<item>
						<title>Re:  digital speedometer with  kilometer</title>
<link>http://www.8051projects.net/forum-t10569.html</link>
<description><![CDATA[lol young means? how old <img src='http://www.8051projects.net/e107_images/emotes/yahoo/4.gif' alt='' style='vertical-align:middle; border:0' /> <br /><br />Nice we have two tachometer projects lol1 i have MPlab i will compile it for you.]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Mon, 07 Jul 2008 08:20:33 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t10569.html</guid>
</item>
						<item>
						<title>Re:  digital speedometer with  kilometer</title>
<link>http://www.8051projects.net/forum-t10569.html</link>
<description><![CDATA[Thank Ajay ! When you assemble the code do not forget to disable the case sensitive option.<br />Regards]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Mon, 07 Jul 2008 14:01:56 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t10569.html</guid>
</item>
						<item>
						<title>Re:  digital speedometer with  kilometer</title>
<link>http://www.8051projects.net/forum-t10569.html</link>
<description><![CDATA[case sensitive option? where?  <img src='http://www.8051projects.net/e107_images/emotes/yahoo/17.gif' alt='' style='vertical-align:middle; border:0' />]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Tue, 08 Jul 2008 07:57:14 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t10569.html</guid>
</item>
						<item>
						<title>Re:  digital speedometer with  kilometer</title>
<link>http://www.8051projects.net/forum-t10569.html</link>
<description><![CDATA[ajay can u see upper portin of your massage as vel as all over te forum is blank]]></description>
<author>contact@nospam.com (Ajay Bhargav)</author>
<pubDate>Tue, 08 Jul 2008 08:31:56 -0700</pubDate>
<guid isPermaLink="true">http://www.8051projects.net/forum-t10569.html</guid>
</item>
				</channel>
				</rss>