Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - pwm analog input

(you are viewing a thread; or go back to list of threads)

pwm analog input (by john devito)
need some help with a project what im trying to do is vary the brightness of a led im using a light to voltage converter 0-5volt an a led driver that uses pwm input im trying to make led dim in dark condition a bright in sunny condition


light to voltage is a TSL261RD-TR
led driver is a CAT4104V-GT3
and a PIC 16F886

the example works but backwards!in the dark led is bright in sun led is dim LOL help with rewrite please thanx
Sat Feb 17 2018, 23:36:52, download attachment pwmexmpl.ld
(no subject) (by MGP)
Maybe if you work like this:

AALS
Value = 1023 - AALS

And then the rest of your program.

BTW you have forgotten a rung in your program, reading the analog input AALS
Sun Feb 18 2018, 03:47:32
(no subject) (by john devito)
like this ?
Sun Feb 18 2018, 12:29:33, download attachment pwmexmpl.ld
(no subject) (by MGP)
Is this good for the job?

I think you are using an older version of LDmicro because I get a warning when saving the program.
But it should work.
Mon Feb 19 2018, 06:13:59, download attachment pwmexmpl_V2.ld
(no subject) (by john devito)
THANX MGP seems to be working i dont understand all this math part
Fri Feb 23 2018, 18:28:36
(no subject) (by MGP)
Here you have your program with more explanation about mathematics.
Sat Feb 24 2018, 06:56:03, download attachment pwmexmpl_V2_with comment.ld
(no subject) (by MGP)
Here a shorter program that does the same with the use of the 10 bits PWM from LDmicro 4.3.8
Sat Feb 24 2018, 07:04:13, download attachment pwmexmpl_PWM1023.ld
(no subject) (by Teresa)
Hello friends pwmexmpl_PWM1023 does not work sketch arduino which can be the problem.

Thank you.
Sun Feb 25 2018, 03:05:35, download attachment pwmexmpl_PWM1023.zip
(no subject) (by MGP)
Teresa, I just simulated it as an example.

I see that you want to PWM at 61Hz and I think that does not work, because the crystal frequency of the controller is too high and that's why you have to choose a higher frequency.
But I dont work with Arduino...
Sun Feb 25 2018, 03:48:23
(no subject) (by Teresa)
With this program the hex file if it works pwm.
But it does not work with sketch arduino.

Thank you.
Sun Feb 25 2018, 04:08:07, download attachment PWM_POT.zip
(no subject) (by MGP)
Ok, then it's for IHOR ;)
Sun Feb 25 2018, 04:54:03
(no subject) (by Teresa)
Many thanks MGP.
Sun Feb 25 2018, 08:09:04
(no subject) (by john devito)
thanx again MGP i like the simple one but i have encountered a problem as the output of the als gets low the led turns of like it should but i would like to keep it on dim even in no light condition i tried to put a voltage divider circuit in parallel with the out put of the als but it still dims untill it goes out
Thu Mar 1 2018, 19:41:14
bidirctional dc motor (by smei)
how to dc motor speed control with techo forward &reverse..
0 to 10v analog input and. 0.24v techo...and closed loop control..any example program
Mon Mar 5 2018, 13:16:33, download attachment picpwm_03.jpg
(no subject) (by MGP)
@John Devito, is this better?

@SMEI, use an other H-bridge, you can only use it with 5V motors
Tue Mar 6 2018, 03:11:58, download attachment pwmexmpl_PWM1023 _minimum.ld
por smei (by Calubert)
El puente en H usa solo 2 salidas No hace falta usar 4 salidas,
si usas 4 salidas veras que la velocidades de ejecutante no serán = por ello usa 2 salidas y tendrás mas memoria sin desperdiciar y sera mas efectivo el puente H.
Tue Mar 13 2018, 08:06:13
ADC range (by Dacman)
Hi,

in your example pwmexmpl_v2_with comment.ld,
would it be possible to modify to obtain a 0-100% PWM with an ADC value between 0.2V and 4.9V ?

Thank you,

Jose
Fri Jul 7 2023, 12:23:15
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):