# measurement of speed with atmega

Status
Not open for further replies.

#### iulian2010

##### Newbie level 3
bascom lcd speed problem

I am new on this forum and say "Hello everyone!"

I want to measure and read in real time the speed in mm/sec.
I use a linear transducer (it work between 0-10 V dc.), Atmega 8, lcd 16x4 and to compile i use Bascom-AVR.
I tried several times to write the code , but without results.
Can you help me with code in Bascom-AVR (if it is possible) for this problem?
I use until now:

$regfile "m8def.dat" Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.1 , Rs = Portd.0 Config Lcd = 20 * 4 Config Adc = Single , Prescaler = Auto , Reference = Avcc 'config ADC Start Adc Dim W As Word.. Do W = Getadc(0) ....speed = ?...... Lcd "speed" ; speed ; "mm/sec" Loop End Thanks [/quote] #### ashad ##### Full Member level 6 config adc why not u use C language ... i think it is easy to debug in C language #### iulian2010 ##### Newbie level 3 code lcd20*4 adc Thanks for your advice Say that C is easier? Think you can help me in C language with my problem? or anyone? I chose Bascom because it can compile and simulate. I am beginner in programming languages. In C language don't know anything. For me will be difficult to learn C language. Thanks in advance #### doraemon ##### Super Moderator Staff member Re: measurement speed Hello! Your question is to vague to be answered. Even with the code. 1. Can you read something from your transducer? (do you have any menans of tracing whet the GetADC reads?) 2. Does the value you read seem to be correct? Try to move something for instance by 100 mm / second, try to make a measure 3. Does your LCD work? Is there something displayed? Can you write "hello"? Can you write an integer / float / whatever? Dora iulian2010 said: I am new on this forum and say "Hello everyone!" I want to measure and read in real time the speed in mm/sec. I use a linear transducer (it work between 0-10 V dc.), Atmega 8, lcd 16x4 and to compile i use Bascom-AVR. I tried several times to write the code , but without results. Can you help me with code in Bascom-AVR (if it is possible) for this problem? I use until now:$regfile "m8def.dat"
Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.1 , Rs = Portd.0
Config Lcd = 20 * 4
Config Adc = Single , Prescaler = Auto , Reference = Avcc 'config ADC
Dim W As Word..
Do

....speed = ?......

Lcd "speed" ; speed ; "mm/sec"
Loop
End

Thanks

#### iulian2010

##### Newbie level 3
Re: measurement speed

Hello
Thanks a lot for your help doraemon.

For the first step I configured the adc converter and I could read on lcd from the transducer the value which I needed.
The length of transuder is 1000mm and his output voltage is between 0-10V dc.
I solved the problem with the code, with the help of a friend.
If is need I'll post the code here for those who need help.

Status
Not open for further replies.