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 - can i use printf and scanf command's?

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

can i use printf and scanf command's? (by Carlos )
Good evening, can I use the console command execution ?, because I 'm trying in ansi.cpp use printf and scanf commands for receive a user command and print the file. But when run the program ldmicro.exe just open the console window displays the message doesnt place and then this close... is there any way to receive a user information from the cmd?
Tue Nov 17 2015, 22:10:40
(no subject) (by Jonathan Westhues)
What are you trying to do?

LDmicro itself isn't a console application; it has a WinMain() function, not main(). So printf() or scanf() won't work.

ANSI C code generated by LDmicro might be compiled into any kind of program, including Windows console apps. That's a different program from LDmicro itself, though.
Tue Nov 17 2015, 22:15:54
(no subject) (by Carlos)
I understand what you just explain to me, and I've been modifying the ansi.cpp to add the main routine of my PIC and also am generating a second file (ejm: ladder.h) where restrain pic setings, and there are my read and write functions. This is ok, but i want from the programm ask the user what port wants for the X or Y variables. And then this information put in my ladder.h example:
//other settings
#define Ent1 PORTBbits.RB0
.
.
.
.
//other settings
Inline BOOL Read_u_i_Xon(void){
//here i put the user information :return Ent1
}
Tue Nov 17 2015, 23:08:20
(no subject) (by Jonathan Westhues)
I don't understand why you're modifying LDmicro. My intent when I wrote the ANSI C back end was that:

(1) Any micro-specific code (like your PIC's main routine) goes in a separate file compiled with LDmicro's output, not in ansi.cpp.

(2) The special register set that you expose is fixed; so instead of exposing a special variable named X that might correspond to many different hardware ports, you'd expose registers corresponding directly to the hardware ports, and let the user's program assign an alias if they want it.

LDmicro could be recompiled as a console app, and then you could use printf() and scanf() within ldmicro.exe. That would be a strange user interface, with your additions working through the console and everything else working through the GUI windows as usual.
Tue Nov 17 2015, 23:53:05
(no subject) (by Alex)
Hello, I made program for arduino uno using ansi c (ldmicro 4.0.10 pre-release) and ladder gen in which it contains a counter "U_i_C1" and greater than or equal "I_i_scratch2 " comparator i want to print "U_i_C1" or "I_i_scratch2 " value to a lcd 16x2 (parallel), i donīt know if it is possible, if it is so, how can i do it, please some help.
i attach ladder, arduino hex and program and proteus simulation.
Sun Nov 20 2016, 13:30:10, download attachment Arduino print ansi c.rar
(no subject) (by Alex)
here is an image of the simulation, where it says "HELLO WORLD" instead i want to add the counter or comparator, thanks again.
Sun Nov 20 2016, 13:32:36, download attachment multitask_lcd.jpg
(no subject) (by Alex)
i finally did it, but i had to add library and modify the ansi c code, my intention is to do it without touching anything the ansi c code, connecting the .cpp (ansi c) and main.c with #include <LiquidCrystal.h>
Sun Nov 20 2016, 20:55:35
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):