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 - The program for Atmega 16 after compilation does not work correctly, although it works perfectly in the simulator

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

The program for Atmega 16 after compilation does not work correctly, although it works perfectly in the simulator (by Daniel R)
Greetings to all of you!
Please help me with a solution to fix the problem described in the title. The program is for the automatic start of two electrical generators when the supply voltage from the network is interrupted, so none of the input ports is active and it starts with the activation of the port (Ygenerator1) for 1.5 seconds 5 times. If the input port is not Xgen1 is not activated, it will try to start the second generator. Finally... the software is quite complex and has many conditions. Maybe that's why it's not compiled correctly? I inserted the last line in the program to check the project and it is the only port of the processor that works according to the program loaded in the processor.
I have attached the program! Thank you in advance and I wish you all the best.
Kind regards,
Daniel
Mon Mar 11 2024, 12:34:17, download attachment Generator IPS-Automat-Manual-Final.ld
(no subject) (by MGP)
You cannot put more than 8 instructions in parallel and series, use an internal relay after 8 instructions.

I did not look for errors in the program itself, first change the program as suggested.
Tue Mar 12 2024, 02:10:55
(no subject) (by Daniel R)
Thanks a lot for the suggestion. I will try.

Kind regards,
Daniel
Tue Mar 12 2024, 12:44:45
(no subject) (by Daniel R)
Unfortunately, even this doesn't work correctly.
However, I've noticed that the logic of the input contacts is inverted. That's why when they are connected in series and parallel, the entire logic becomes anarchic.
It's a pity that this software, which I consider well-made at least as a simulator, cannot be used for Atmega 16. I've tried an older version, but it seems that the bugs have been carried over from there.
Wed Mar 13 2024, 15:37:54
(no subject) (by MGP)
Show me how you did that, although it looks like a simple program to me, I have made much more complicated programs before.
Thu Mar 14 2024, 04:17:04
(no subject) (by Daniel R)
I've implemented the program from the attachment and then I noticed that the logic of the inputs is inverted.
If you'd like, when I will have more time, I'll add a few more internal relays and I'll make a video showing the behavior of the Atmega 16 microprocessor's input/output pins.

Thank you for your support, and I wish you a beautiful day!

Kind regards,
Daniel
Thu Mar 14 2024, 14:39:37, download attachment test-logical input.ld
(no subject) (by Daniel R)
The simplest method is a test in Proteus.

I've done that, and the result was similar to the test on the processor.

Thank you for your support, and I wish you a beautiful day!

Kind regards,
Daniel
Thu Mar 14 2024, 15:08:03
(no subject) (by MGP)
I don't know what you mean by inverted inputs, the buttons need to go to +5v and a 1k resistor to the GND.
Maybe upload a circuit showing how the buttons are connected.

Here you also have the revised program, I have programmed 2 internal relays (temp1 and temp2), which prevent you from having more than 8 contacts in series in row3 and row6.
Thu Mar 14 2024, 15:27:45, download attachment GeneratorIPS-Automat-Manual-Final_NEW.ld
(no subject) (by Daniel R)
I wish to thank you for the time and guidance you provided. I was almost about to give up on this project and even bought an Arduino Mega board...

My mistake was not correctly polarizing all the input pins because those resistors didn't seem very important to me for a microprocessor.

In fact, this is the first time I'm working with programmable microprocessors and with your help, the project finally worked out as I intended.

Thank you again for everything, and I wish you a beautiful day.

With respect,
Daniel
Sun Mar 17 2024, 05:31:49
(no subject) (by Daniel R)
Thanks also to the programmers of this fantastic and very useful software

I wish you all the best in the world!

Kind regards,
Daniel
Sun Mar 17 2024, 05:34:39
(no subject) (by MGP)
Glad I could help and thanks for the feedback.
Sun Mar 17 2024, 15:10:58
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):