Discussion forum for the BasicX family of microcontroller chips.
ADC Help - paul...@yahoo.com - Nov 18 18:20:53 2008
I am new to the bx 24 and for a starter project I have designed a tracking solar panel
system. I have two small panels that i would like to compare voltages to in order to tell
if the panels are in the optimal position. I have used a non-inverting op-amp
configuration so that my voltages range from 0 to 5V. I am using a small stepper motor
with a driver that i had lying around. I have been able to properly step the motor and do
whatever i want with it however i have not been able to to compare the input voltages.
Option Explicit
Public Sub Main()
Dim VWest As Single 'Voltage
Dim VEast As Single
Const SPWest as Byte = 13
Const SPEast as Byte = 14
Dim steps As integer 'Count for max range of rotation
Call PutPin(7,1) 'Enable for Driver to stepper motor
steps = 0
Do Until steps = 255
Call GetADC(SPWest, VWest) 'pin 13
Call GetADC(SPEast, VEast) 'pin 14
If VWest < VEast Then
Call PutPin(5,1)
Delay(0.01)
Call PutPin(6,1)
Delay(0.01)
else
Delay(60.0)
Call PutPin(6,0)
steps = steps + 1
End if
Loop
End Sub
------------------------------------

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
Re: ADC Help - rosa...@aol.com - Nov 18 20:50:33 2008
Hi,
Did you check the voltages at the pin 13 and 14. Make sure that you have voltage. It is
possible that your op amps are not working right. Also you can tried it using a voltage at
each input and see if you can read it right.
Regards,
rosarite
-----Original Message-----
From: p...@yahoo.com
To: b...@yahoogroups.com
Sent: Tue, 18 Nov 2008 1:43 pm
Subject: [BasicX] ADC Help
I am new to the bx 24 and for a starter project I have designed a tracking solar panel
system. I have two small panels that i would like to compare voltages to in order to tell
if the panels are in the optimal position. I have used a non-inverting op-amp
configuration so that my voltages range from 0 to 5V. I am using a small stepper motor
with a driver that i had lying around. I have been able to properly step the motor and do
whatever i want with it however i have not been able to to compare the input voltages.
Option Explicit
Public Sub Main()
Dim VWest As Single 'Voltage
Dim VEast As Single
Const SPWest as Byte = 13
Const SPEast as Byte = 14
Dim steps As integer 'Count for max range of rotation
Call PutPin(7,1) 'Enable for Driver to stepper motor
steps = 0
Do Until steps = 255
Call GetADC(SPWest, VWest) 'pin 13
Call GetADC(SPEast, VEast) 'pin 14
If VWest < VEast Then
Call PutPin(5,1)
Delay(0.01)
Call PutPin(6,1)
Delay(0.01)
else
Delay(60.0)
Call PutPin(6,0)
steps = steps + 1
End if
Loop
End Sub
[Non-text portions of this message have been removed]
------------------------------------
______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.
(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
Re: ADC Help - "nje...@ihug.co.nz" - Nov 18 22:11:17 2008
Paul
Without looking carefully at your logic, I would put the two
getADC steps oustside the loop for a start so that you are sure they
will run. Looks to me as though the l;oop will never start if steps =
255, and if Vwest >Vest, then steps would not be incremented. Where do
you reset steps?
p...@yahoo.com wrote:
> I am new to the bx 24 and for a starter project I have designed a
> tracking solar panel system. I have two small panels that i would like
> to compare voltages to in order to tell if the panels are in the
> optimal position. I have used a non-inverting op-amp configuration so
> that my voltages range from 0 to 5V. I am using a small stepper motor
> with a driver that i had lying around. I have been able to properly
> step the motor and do whatever i want with it however i have not been
> able to to compare the input voltages.
>
> Option Explicit
>
> Public Sub Main()
>
> Dim VWest As Single 'Voltage
> Dim VEast As Single
>
> Const SPWest as Byte = 13
> Const SPEast as Byte = 14
>
> Dim steps As integer 'Count for max range of rotation
>
> Call PutPin(7,1) 'Enable for Driver to stepper motor
>
> steps = 0
>
> Do Until steps = 255
> Call GetADC(SPWest, VWest) 'pin 13
> Call GetADC(SPEast, VEast) 'pin 14
>
> If VWest < VEast Then
> Call PutPin(5,1)
> Delay(0.01)
> Call PutPin(6,1)
> Delay(0.01)
> else
> Delay(60.0)
> Call PutPin(6,0)
> steps = steps + 1
> End if
> Loop
> End Sub
>
>------------------------------------------------------------------------
>
>No virus found in this incoming message.
>Checked by AVG.
>Version: 7.5.549 / Virus Database: 270.9.6/1797 - Release Date: 18/11/2008 11:23 a.m.
>
>
--
*******************************************
Neil Jepsen. B.Sc. M.Sc(Hons). CPL. MNZAS
Acoustic Consultant.
Jepsen Acoustics & Electronics Ltd
PO Box 1904.
Palmerston North.
New Zealand.
Ph +64 6 357 7539
FAX +64 6 357 7217
Mobile 0274 428 094
------------------------------------

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
Re: ADC Help - reza arezoumand - Nov 26 11:26:21 2008
you have tow way for slove this problem
1 use adc ic for adapt analog signal to digital
2- use microcontroller with adc devise so avr atmega32
=A0
__________________________________________________
=20
[Non-text portions of this message have been removed]
------------------------------------

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )