(you are viewing a thread; or go back to
list of threads)
2 analog inputs comparison (by John)
Dear friends,
i would like to implement a 2 analog compare function with ldmicro to control a motor.
Left value reads A0 from arduino
and Right value read A1 from arduino.
If A0>A1 the motor must go Left and if A1>A0 the motor must go Right. If A0=A1 must stop.
The system compares values with a deadband of 10.
I build the system and works good but i like to do it with ldmicro.
Any help will be appreciated.
TIA
(no subject) (by Alex)
interesting, is there an example for 2 analog inputs? i have tried to do my own but... i donīt know, my pic freezes with 2 analog inputs and doesnīt send to my lcd the reading, i have tried to use cycle ON/OFF timer to read each adc input differently time but nothing happens
(no subject) (by Alex)
ladder,
(no subject) (by MGP)
Alex, adc = 0 - 1023 and duty = 0 - 100% think again ;)
(no subject) (by John)
The project i'm referring at is a LDR based solar tracker.
I need to control 2 arduino analog ports and other 2 as outputs for relay control.
I did that correctly with proteus and now i want to do it with ldmicro.
I would leave it there but i need PLC logic and ldmicro is perfect for it.
Also when i try to send the compiled flash .hex to avrdude, i get stk500v2 receive error and no flashing happens.
When i put the .ino file into arduino, it works great.
Any help will be appreciated.
TIA
(no subject) (by MGP)
Here you have a basic comparator program with 2 adc's and hysteresis.
You will also need to add some timing to get a stable state of the motors or calculate the average analog value of a range of ADC values.
Btw. I'm not familiar with Arduino.
(no subject) (by John)
It looks very promising for my project
I will check it very carefully.
Thank you!
(no subject) (by Alex)
i changed, adc = 0 - 1023 and duty = 0 - 1023 , it stills the same
(no subject) (by MGP)
From where do you get the configurationbits (2F8A)?
(no subject) (by Alex)
Configuration bits from Mikro basic pro for pics, it enables lvp icsp programming
(no subject) (by MGP)
You did someting wrong because 2Fxx does not exist!
(no subject) (by Alex)
After all these writing lvp hex it was wrong..., i just took what mikro pic basic showed me by enabling lvp icsp, that's all i want to enabling lvp icsp for pic16f877a
(no subject) (by MGP)
Then Mikro pic basic is wrong but I doubt this...
Try 3FBA which I made with OshonSoft.
(no subject) (by MGP)
Do you have leds connected at the programming pins (portB) ?
(no subject) (by Alex)
no, 2 leds are connected in portC, RC1 and RC2, PWM out pins
(no subject) (by Alex)
sorry i made a video mistake, simulation ldmicro and pick it 2 are right but the board shown is with 2F8A configuration bits
this is what a i get with 3FBA (see image plz):
the "number 16" shown in lcd is from previous hex file, it just keeps like that after writing hex with 2 analog inputs
(no subject) (by Alex)
leds from RC1 and RC2 pins keep turned onafter writing hex, they both donīt do anything when using potentiometer.
(no subject) (by MGP)
I can't follow anymore... and look at rung 5
cls+home takes some time ... and \xFE\x34 at the end what command is this?
(no subject) (by Alex)
Orbital commands pdf says that it is for 16x2 lcd
(no subject) (by MGP)
Do you have an original Orbital LCD display?
(no subject) (by Alex)
Actually i don, t
(no subject) (by MGP)
Sorry but I give it up, it looks more like chatting ...
(no subject) (by Alex)
i think issue is about RC2 pin for pwm out, it tested a ladder program with pwm out pins, RC1 and RC2 (pic16f877a), using RC1 pin works ok , when changing to RC2 it doesnīt work, finally i changed back to RC1, works ok.
https://www.youtube.com/watch?v=r_aYFuKeu_c&feature=youtu.be
Post a reply to this comment:
|