problēma ar ADC

K

Kaleborg

Guest
Sveiki!

Es mēģinu izveidot vienkāršu saules tracker bet nevaru saprast, kāpēc tas isnt working.

Kods:# include <pic.h>

# include "My include.h"

# include "MyADC.h"

# include "delay.h"

# include "motor_control.h"

/ / # define _XTAL_FREQ 4000000

__CONFIG (XT & WDTDIS & PWRTDIS & BORDIS & Unprotect);

anulēts main (spēkā neesošs) (neparakstīts garš left_ldr_val, right_ldr_val, i;TRISA | = 0x0f;

ANSEL0 = 0x3;

ANSEL1 = 0;

/ / ADCON0 = 0;

CM2CON0 = 0;

OPA1CON = 0;

INIT_MOTO ();

MOTO_PWM ();

ADC_INIT ();while (true) (left_ldr_val = READ_ADC (0) &0x03FF;

/ / DelayUs (10);left_ldr_val = 1024-left_ldr_val;

DelayUs (10);right_ldr_val = READ_ADC (1) &0x03FF;

/ / DelayUs (10);

right_ldr_val = 1024-right_ldr_val;

DelayUs (10);/ / for (i = 0; i <0x0200, i )while (left_ldr_val> right_ldr_val) (GO_LEFT ();

)

while (left_ldr_val <right_ldr_val) (GO_RIGHT ();

)

DelayUs (10);

))

 

Welcome to EDABoard.com

Sponsor

Back
Top