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 - Compiling for atmega168 PLC logic backwards

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

Compiling for atmega168 PLC logic backwards (by Carlos Ruiz)
Hi

On the simulator or even on proteus simple two contact coil and an output works, either coils programmed as series or in paralell, but once programmes on ATMEGA168 parallel contacts act as serial and serial contacts act as paralell, and not just for contacts all logic acts the same way including internal coils, timers etc.

Any help is appreciated.

Carlos.
Sun Jun 23 2019, 20:24:51
(no subject) (by Alex)
attach ladder please
Sun Jun 23 2019, 21:14:13
(por Carlos Ruiz) (by paulino)
Hello (by Carlos Ruiz) Look at this link, I do not know if that's what happens to you. since you do not clarify very well or I do not understand you since you do not attach your LD test.

Hola (por Carlos Ruiz) Mírate este enlace, no se síes lo que te sucede. ya que no aclaras muí bien o no te entiendo ya que no adjuntas tu prueba de LD.

http://cq.cx/ladder-forum.pl?a...;parent=8665&tt=1560172899
Mon Jun 24 2019, 09:05:07
Timer (0) o Timer (1) (by paulino)
Take into account in the configuration of the Timer (0) - (1), by logic is selected in Timer 1 canviar to the timer (0)
Tue Jun 25 2019, 09:44:50
(no subject) (by Carlos Ruiz)
it is juat anti tie-down circuit contacts in series act as contacts in paralell and vice-versa once programmed into an atmega168, simulated on proteus or in ldmicro works like a charm.

-[]-[]----()- does not work as "AND" but as "OR".

-[]-|-----()- does not work as "OR" but "AND".
-[]-|


Single line contact coils work just fine:


-[]--------()-

This is my test program, does not work at all:

b1 b2 tmr1 Y1
-[]--[]--[/]----()-

b1 Y1
-[]-|--[/]--(tmr1)-
b2 |
-[]-|

works on simulation but not in real-life.

Good Day!

Carlos
Thu Jun 27 2019, 02:56:23
adjunta programa Carlos (by paulino)

attach your program and looked at it

adjunta tu programa y lo miro
Thu Jun 27 2019, 03:49:57
Inverted Logic functions (by Ruiz Carlos)
Como puedes ver es un programa basico de ladder con una funcion AND que una vez programada en el AVR ATMEGA168 responde como un a funcion OR. Y si escribo una funcion OR acturara como una funcion AND en el ATMEGA168.

Lo mismo que postee anteriormente.

Carlos
Thu Jun 27 2019, 19:53:32, download attachment PLCTest.ld
para Ruiz Carlos (by paulino)
para Ruiz Carlos, Hola Carlos, una pregunta estas usando el Atmega 168 de 28 pines, o el de 32 Pines.
yo no puedo probarlo ya que no tengo ninguno de este modelo, pero lo pruebo con el Atmega 328 y funciona correcto.

Supongo que le pones resistencias a las entradas de PD0 y PD1,

for Ruiz Carlos, Hi Carlos, a question you are using the 28-pin Atmega 168, or the 32-pin Atmega 168.
I can not prove it since I do not have any of this model, but I try it with the Atmega 328 and it works correctly.


I guess they put resistors to the inputs of PD0 and PD1,
Fri Jun 28 2019, 05:04:21
(no subject) (by Ihor Nehrutsa)
to Carlos Ruiz
I insist on publishing the ld file.
Fri Jun 28 2019, 16:05:31
(no subject) (by Alex)
Ihor Carlos Ruiz posted his ladder as Ruiz Carlos, named PLCtest.ld
Fri Jun 28 2019, 22:07:26
(no subject) (by Carlos Ruiz)
Paulino, it is the 28 pin Atmega 168 type mounted on a STK200 development board with LEDs and Switches already tested with other programs thus working ok but not the ladder logic program already posted. I'll give it a try with a Atmega 328 at first chance.

Good Day.
Mon Jul 1 2019, 01:43:21
(no subject) (by Ziggy)
If STK200 is anything like STK500 then the button polarity as well as LED polarity need to be taken in consideration.
What I mean is it could be something like the DeMorgan law catching You out because what you think you are doing is not correct and what the outcome is also not what You are expecting.

And it sounds like You are experiencing just that.
Mon Jul 1 2019, 04:53:47
(no subject) (by Ihor Nehrutsa)
to Carlos Ruiz
Please see part 2 of
https://github.com/LDmicro/LDmicro/wiki/Pull-down-resistors

You must detect what type of pull-up or pull-down resistors are used on your development board at the PD0 and PD 1 inputs.
If they are has pull-up resistors, then you should use negated contact element in LDmicro.
Mon Jul 1 2019, 04:54:46
(pora Carlos Ruiz) (by paulino)
(pora Carlos Ruiz), Hola gracias por su respuesta,cuando me comentas que ya has cargado otros programas te refieres a LDMicro o a otros C++,Ensamblador,etc.

como debes hacer para que te funcione el software.

Monta la escalera en LDMicro una vez hecha la compilas en HEX-ASM. con tu archivo en .hex, lo grabas al micro por Uart, ICSP o un grabador que admita este tipo de micro-procesador.
yo lo hago con este grabador con zócalo de 40P o ICSP Para.
cuando lo hagas dime si te funciono (te deberia funcionar ya que yo lo hago como te comento y funcionan todos los micro-procesadores que he probado.

(for Carlos Ruiz), Hi, thank you for your reply, when you mention that you have already loaded other programs, you are referring to LDMicro or other C ++, Assembler, etc.

How should you do to make the software work for you?

Ride the ladder in LDMicro once compiled in HEX-ASM. with your file in .hex, you record it to the micro by Uart, ICSP or a recorder that supports this type of micro-processor.
I do it with this recorder with 40P socket or ICSP Para.

Enlace:

http://www.autoelectric.cn/en/TL866_main.html
Mon Jul 1 2019, 05:07:21
(no subject) (by paulino)
Ya se que me dices que has grabado antes, pero esto que me dices no funciona con 64bit win,7,xp,10 64bit.

https://www.kanda.com/avr-isp-software.html

Kanda LPT programmer software will NOT work in 64-bit Windows OS, even in XP 32-bit mode under 64-bit Windows7. For Windows 64-bit support, you will need our low cost USB programmer.
Mon Jul 1 2019, 05:15:54
(no subject) (by Ziggy)
Google DeMorgan's law.
Mon Jul 1 2019, 06:50:22
Compiling for atmega168 PLC logic backwards (by Carlos Ruiz)
Modded STK200 to work as arduino but works as negative logic for both inputs and outputs, just find out, herein the inverse logic, problem solved.

Thanks for your help.

Carlos.
Sun Jul 14 2019, 12:21:36
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):