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 - DIY Barrier controller with PIC16F628 MCU

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

DIY Barrier controller with PIC16F628 MCU (by M. Javed)
Hi Friends,

I have been using LDmicro since last two years, it works great with simple Ladder logic programs. I do appreciate the hard work from the software developers.

Recently, I have assemble a simple Car parking Barrier controller based on PIC16F628 MCU with OPEN, CLOSE, STOP push switches as Xopen, Xclose, Xstop interlocked with Limit switches Xopen_lmt, Xclose_lmt and a small IR cut beam sensor Xsensor.


The ladder program with the name "Barrier628.ld" works great with 6 inputs & 3 relays control as Yopen_rly, Yclose_rly, Ysig_rly and do as directed with the shown hardware.

But, since the requirement changed, I have added one more relay for sequential control of the associated pump motor.

Thus, I modified the same program with the name "Barrier628_new.ld" with the added timers and relay Ypmp_rly, but it didn't worked as expected.

Perhaps, all the other functions works normally in the simulation, but, it didn't worked in the same hardware as the last program works.

The problem is that, the added relay Ypmp_rly is not energized at X0 input function, but works with some noise at X1 input.

The related X0 & X1 function for Yopen_rly & Yclose_rly & Ysig_rly works well.

Please suggest any changes to make it work.

I hope that some of experts here could solve the mystery for this simple ladder logic sequence.

Both of the programs are attached with my PIC MCU base DIY mini PLC.

I do appreciate your help and suggestions.

Regards,
Wed May 22 2019, 07:15:54, download attachment Barrier_628.ld
(no subject) (by MGP)
Do you have a schematic of your PCB because I suspect the inputcircuits (opto's I think).
Wed May 22 2019, 11:18:44
(no subject) (by MGP)
Btw you have a bad programming habit, what I mean by that is that you have a relay in different places.. for example 4x R_OPEN_SET.
That is very confusing to follow and is normally not done.
Wed May 22 2019, 11:42:05
(no subject) (by MGP)
Here you have an example how to do it.

The use of Set/Reset relay's is not always the best method and sometimes dangerous.
Wed May 22 2019, 12:36:42, download attachment Barrier_628_example.ld
(no subject) (by M. Javed)
Hi MGP,

I have tested the entire board for loose connection as well as short circuits, but all OK.

The program named "Barrier628.ld" works perfectly on the same board, but the new program "Barrier628_new.ld" with added relay & timers works also but with the exception of no YO_PMP_rly function properly for the associated inputs at X0_open_sw & X1_close_sw.

I guess that there is a bug in my program and I am missing the actual location of this bug.


Otherwise, the program has to be simulated in the LDmicro application itself and shown no malfunction & energize the related Y0_pmp_rly as programed.

I have cheked the PIC16F628 pin logic voltages as well to confirm the Y0_pmp_rly output, but it doesn't activate as it has to be, upon being energized by program, but the related Y2_open_rly with the same function activates anomaly.

I will share the schematic of my DIY PLC in my next post.

Thanks.
Thu May 23 2019, 04:39:21
(no subject) (by MGP)
The problem is that if you use so many set / reset relays it is almost impossible for an outsider to follow.

It is also possible that you set and reset this S / R relay in the same cycle time, and that causes some kind of noise on the output, very difficult to find.

It could also be the pull-up resistors, for that I should see the diagram.
Thu May 23 2019, 06:42:03
Para barreras (by Calubert)
Hola te adjunto programa con las seguridades que se necesitan y con presiones de anti golpes y ziza-llamiento. con tiempos de trabaja, Funciones de automática hombre presente, se mi automática, ya que el software que has hecho si falla un final de carrera quemaras el motor ya que no parara de dar potencia.

en mi experiencia con LDmiicro, si hace tiempo que lo hiciste en otra versión dan herreros en el micro-procesador, debes usar la misma versión para hacer modificaciones, es curioso pero pasa y sobretodo con la pic.

debes escribir toda la escalera en la versión mas moderna, como si la hiciste, ejemplo en XP debes seguirla en XP, hablo siempre de versiones mas antiguas.
aun que la escalera la habras con versiones mas modernas lo veras todo bien y en el simulador es correcto pero en la vida real no funciona bien (compilación).
Thu May 23 2019, 08:16:12, download attachment puerta trasera con pic 16f887 22.ld
(por M. Javed) (by Calubert)
"Barrier628_new.ld" No esta esta esta escalera, para verificar, mandar para la aguda.
Thu May 23 2019, 08:30:46
Controlador de barrera DIY con PIC16F628 MCU (por M. Javed) (by Calubert)
No te funciona porque las salidas (Y ) solo se pueden activarlas una sola función (No repetir los reles de salida (Y0_PMP_Rly) solo una vez),

Solución: Cambia los Y0_PMP_Rly de salida Pr R0_PMP_Rly (Reles Internos y los repites tantas veces como necesites) y luego el R0_PMP_Rly activa la salida Y0_PMP_Rly.

esto es un error por no leer el manual ya que lo indica que esto que has hecho no se puede hacer, en la simulación te funciona bien pero en la compilación con el PICf16fxx no te dará nunca la señal ya que le dices que la señal la variable hace lo mismo y esto en programación si funciona pero no funciona ya que los bit son repetidos y se que da congelado esa salida del micro-procesador.
Thu May 23 2019, 08:48:49
Controlador de barrera DIY con PIC16F628 MCU (por M. Javed) (by Calubert)
Ya modificado, tu programa.
dime si te funciona.
Thu May 23 2019, 09:31:01, download attachment Barrier__new.ld
Controlador de barrera DIY con PIC16F628 MCU (por M. Javed) (by Calubert)
perdona el sotfware anterior no me guardo bien.
te paso el correcto
Thu May 23 2019, 10:45:01, download attachment Barrier__new (1).ld
(no subject) (by Ihor Nehrutsa)
Coil side effect you can see at page
https://github.com/LDmicro/LDmicro/wiki/COIL
Thu May 23 2019, 12:32:05
por Ihor Nehrutsa (by Calubert)
(por Ihor Nehrutsa) Si es correcto como indicas en el linz,Es un contacto cerrado y otro abierto esto si es correcto.
Pero no podemos crear en PLC, 2 contactos abiertos o Cerrados en la misma salida llamadas Y, en las simulaciones funciona pero hay que darse cuenta que la simulación da la linea y encenderá todas las lineas que llamen el mismo nombre,


pero el problema que tienen la mayoría que no están relacionados con los sistemas PLC, creen que pueden activar varias veces (Directa) la salida y.

Mi conclusión es que no leen el manual de LDMicro como los manuales de los procesadores y lo dan como hecho.

mi profesión es programador de PLC, y se programar la mayoría de los PLC que están en el mercado. por ello intento aguda y veo algunos fallos de programación que suelen ser de Humanos.

y tienes todo el apoyo que pueda darte para el gran trabajo que has hecho con LDMicro, y por ello aprovecho para felicitarte.
Paulino Cano (Calubert).
Thu May 23 2019, 13:04:37
Como hacer la salida (Y) correcta para la compilación (by Calubert)
Las 2 primeras lineas son incorrectas.

las lineas de mas abajo son correctas ya que se hacen con Reles Internos.
Thu May 23 2019, 13:26:22, download attachment Como hacer la salida para los microcontroladores.ld
(no subject) (by Ihor Nehrutsa)
to Calubert
You can take part in improving the LDmicro documentation and describe difficult cases on the wiki page.

to all
Please use English as much as possible. Google translator is not entirely correct and your thoughts are not fully clear after translation.

Try to translate your native text to English and back and compare two variants of the text in native.
Thu May 23 2019, 13:32:45
Para MGP (by Calubert)
(por MGP), mira los (Y) solo se activan una sola vez, no pueden haber mas de una salida (Y), si se necesitan mas (Y) se devén hacer con (R) i todas devén (R) devén dirigir a (Y).

re comunico esto ya que veo que culpas el PCB y es para que no te vuelvas loco mirando las PCB.
Ya que veo que haces un buen trabajo.
Saludos Paulino Cano (Calubert)
Thu May 23 2019, 13:38:39
(por Ihor Nehrutsa (by Calubert)
Lo se ya lo has comentado varias veces, pero pido perdón ya que mi ingles es técnico y no se escribirlo solo leo el ingles Técnico. pido 1000 disculpas.

I know you have already mentioned it several times, but I apologize because my English is technical and I do not write it, I only read Technical English. I ask 1000 apologies
Thu May 23 2019, 13:44:21
Traducir Google (by Calubert)
For translations to be more real you have to be registered in Google.
since it keeps the improvements of our translations.
this happens in all languages.

For translations to be more real you have to be registered in Google.
since it keeps the improvements of our translations
Thu May 23 2019, 13:50:46
(no subject) (by Alex)
aveces no entiendo lo que posteas en español Calubert
Thu May 23 2019, 14:21:00
(no subject) (by Ihor Nehrutsa)
In any case, I would like to know your expert opinion about LDmicro in comparison with other PLCs. What is lacking and what can be implemented?
Thu May 23 2019, 15:17:09
Comandos PLC (by Calubert)
pora Ihor Nehrutsa.

Hola Nehrutsa, te adjunto Comando PLC, mirarlo por encima y si necesitas los Software me das un E-mail donde pueda cargarlos por el peso del Programa.

no te asustes por estar en Español también te e puesto los comando en ingles técnico ya que creo que los entenderás.

la verdad que tu LDMicro esta muy bien.
mi E-mail [email protected]
una curiosidad de que país eres.

Hello Nehrutsa, I attached PLC Command, look over it and if you need the Software you give me an E-mail where I can load them by the weight of the Program.

do not be scared for being in Spanish I also put you in command in technical English since I think you will understand them.

the truth that your LDMicro is very good.
my E-mail [email protected]
A curiosity of what country you are.
Fri May 24 2019, 08:05:44, download attachment Comandos.doc
(no subject) (by Calubert)
Tu problema es que repites la salida Y0_PMP_Rly, y no se pueden repetir solo una vez, cambiar por R interno y a ambos reles le cambias el nombre de variable, te adjunto escalera para que veas como hacer tu fallo.

Your problem is that you repeat the output Y0_PMP_Rly, and can not be repeated only once, change by internal R and both relays you change the variable name, you attached ladder so you see how to make your failure.
Mon Jun 10 2019, 09:20:05, download attachment saverprogramar.ld
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):