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 - Uart behaviour on AVR & Simulator

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

Uart behaviour on AVR & Simulator (by José GILLES)
Hi

I'm not an expert in ladder, but I tried the attached ladder to make a simple Uart echo on a true Atmega16.

As you may see on screenshots, this ladder works perfectly (as expected) in simulation with ldmicro 4.4.3.0, but when compiled directly in hex or via C compiling, it makes infinite echo of the last char sent (via hyperterminal).

It rises 2 questions:

1) Isn't it abnormal to have a different behaviour between simulator and true life ?

2) Ain't there a pb with UART in C or Hex/Asm ?

To finish, may someone explain me how to use "Uart Sedn variable" function ? Even with the source code, I don't understand what it is made for ?

Thanks for your answers
JG
Tue Dec 18 2018, 02:59:57, download attachment uart-echo.zip
(no subject) (by MGP)
I think you made an error.

Pay attention that when receiving a char via UART that the rung is true only for 1 cycletime.
You don't need a SetReset instuction.

Attached a new version of your program.
Tue Dec 18 2018, 07:10:13, download attachment uart-echo_V2.ld
(no subject) (by José GILLES)
Thanks for your answer !

Your ladder works fine in 3 modes.

Nevertheless, there remains a problem somewhere since simulation and compiling don't give the same result with mine.
Which is the right behaviour according to ladder logic ?

You seem to know perfectly ldmicro : so, could you please help me in understanding the famous "Uart Sendn variable" contact ???

Best regards
JG
Tue Dec 18 2018, 12:54:14
(no subject) (by MGP)
I never have used the instruction Uart Sendn, but I think it does not work because the outcome should be as sending \x01 .. \xFF with the instruction "Formated string over UART"

I'm working with pic's and have no problems with the Uart instructions and I use them alot.
I only compile my programs to hex never to C or ....

Sorry but I can only help you with ladder programs.
Tue Dec 18 2018, 17:43:52
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):