ADC Help

Started by paul...@yahoo.com November 18, 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
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...
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


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
>
>
>
> 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 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



__________________________________________________