Prox / RFID
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Resume / Consulting
Contact Me

LDmicro Forum - LDmicro.GitHub news v5.3.1.0

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

LDmicro.GitHub news v5.3.1.0 (by Ihor Nehrutsa)

== Release

* Fixed flashMcu.bat and LIBRARIES_FOR ARM,AVR, PIC by Jose GILLES

* Modified "St ARM STM32F40X 144-LQFP" by Jose GILLES

* Added "St ARM STM32F10X 48-LQFP / Bluepill" by Jose GILLES

* Fixed OSR, OSF, OSL, OSC show error.

* Fixed AVR compilation stack overflow error.

* Fixed flashMcu.bat for AVR

* Fixed LUT index range in simulation.

* Fixed PIC UART baud rate calculation.

* Fixed PICs PORTA outputs still stay in analog mode in generated C source code.
Added setPortDigitalIO()

* Fixed When compiling Hex/Asm with PIC target and then calling FlashMcu, the window still closes
immediately without a word...

Thu May 30 2019, 12:40:28
(no subject) (by Alex)
great work, thanks both of you, Ihor and José
Thu May 30 2019, 15:24:10
(no subject) (by José GILLES)
To Alex:

16x2 Lcd displays driven by I2c are now fully operationnal under all targets (PIC16, ATMega, ARM), as you can see in attached zipped examples (PIC16F877 and ATMega328).


A new special command allows users to activate /deactivate backlight from ldmicro ; see doc in LIBRARIES_FOR and attached ld file.
Don't forget to modify I2c address in I2cLib.c for AVRs and in I2cLib.h for PICs (Only one address to modify !!!) to match the one in ld file and in hardware module (generaly 0x27 by default).

Fri May 31 2019, 03:22:05, download attachment I2cLcd16x2.zip
(no subject) (by Alex)
thanks for the information José GUILLES i will test :)
Sat Jun 1 2019, 23:23:35
(no subject) (by Ihor Nehrutsa)
Are there any bug reports?
Tue Jun 4 2019, 16:21:47
(no subject) (by Alex)
lcd backlight is on :), i just set path for hi tech in flashMcu,that´s all i had to do, it seems easy, now i want to try words.

btw, is it possible to do like video link, i am using a serial lcd there or is i2c function in early development yet?

Tue Jun 4 2019, 22:05:44, download attachment lcd i2c test.jpg
(no subject) (by José GILLES)
Hi Alex

Normaly you should be able to do the same as on your video with your I2C lcd.

Available commands for lcd 16x2 displays are explained in LcdI2cLib.txt in LIBRARIES_FOR:

- values between 0 and 0x10 are commands :
0x00= Erase display
0x01= Cursor home
0x02= Blinking display
0x03= Normal display

0x0F= Backlight off (if available)
0x10= Backlight on (if available)

Other values / functions can be added in libraries

- values above 0x80 are move commands to move cursor to line y, col x:
bit 7= 1
bits 6-5= y-1 allows 4 lines 1->4
bits 4-0= x-1 allows 32 columns 1->32

Example: 0xA5 = 1 01 00101 will move cursor to line 2, column 6

- other values between 0x11 and 0x7F are standard chars to display at cursor position

Examples (if I2C address is 0x27):

I2C_WR (0x27 255 'X') displays an X at current cursor position
I2C_WR (0x27 255 chr) displays chr at current cursor position if chr is a regular character (alphanumeric or puntuation for instance)

I2C_WR (0x27 255 0x00) erases display
I2C_WR (0x27 255 0x01) moves cursor home (line 1 col 1)
I2C_WR (0x27 255 0x10) sets backlight on

I2C_WR (0x27 255 0x83) moves cursor at line 1 (8) col 4 (3+1)
I2C_WR (0x27 255 0x87) moves cursor at line 1 (8) col 8 (7+1)
I2C_WR (0x27 255 0xA0) moves cursor at line 2 (A) col 1 (0+1)
I2C_WR (0x27 255 0xA5) moves cursor at line 2 (A) col 6 (5+1)

You can use a LUT to display strings char by char as in this example (replace 0x20 by 0x27).

Let me know if you need help.

Wed Jun 5 2019, 04:18:24, download attachment i2c_lcd16x2.ld
(no subject) (by Alex)
thanks for your reply,first i wanted to try the hello world with backlight on, i think i did well:


1)btw everytime i use i2c function there is a ldmicro error window that shows up only if it is named "I2C1" , watch video please, everything is ok, there is no problem just the window error it is a little annoying but it is ok

2) i have to always name ladder with no spacebar, no problem with that, what about if i don´t use lcd but in my librarie it is set 0x27, does is uses more memory?, i first tried using main library with address 0 i thought it would be generated with 0x27 as set in ladder, i had to set in main library 0x27, i think main library could be default 0 in address for lcd as it is now and then if i set in ladder 0x27 generated lib file that contains lcd library should be the 0x27 because i use lcd, it is only an idea.

My question is if i use backlight command for example how should i set it in ladder?, with an OSR for been used once or without osr?
Wed Jun 5 2019, 20:11:24
(no subject) (by Alex)
thanks for your work, we have i2c in ldmicro :)
Wed Jun 5 2019, 20:12:51
(no subject) (by José GILLES)
To Alex:

- Your hello is OK

- Ldmicro can manage several I2C busses on ARMs (ICD1, 2 or 3). On other targets its only I2C. If you modify ALL I2C names to be correct and SAVE the ladder you shouldn't be anoyed again.

- there musn't be spaces or minus (-) and generally no special symbols in folder / file names for compiling reasons

- to save compiling time, you can remove in each lib subfolder the libraries that you don't use in a ladder, EXCEPT UsrLib. c and .h

- to know if it saves memory, it may depend on the compiler efficency ; try and have a look at hex size ?

- if you never intend to user some libraries, you can remove them from LIBRARIES_FOR folder, EXCEPT Usrlib too

- it's difficult to set I2cLcd address in files from ladder because some displays have different addresses and another I2C peripheral can also have an address at 0x27 !
You're the only one to know that you're using this special I2C peripheral..

- to switch on / off backlight, it is sufficient to send the command once, but if you send the same command several times it shouldn't (doesn't) matter

Thu Jun 6 2019, 06:46:11
(no subject) (by Alex)
Thank for your reply i will try
Thu Jun 6 2019, 13:50:38
(no subject) (by Ahmad sakr)
To Alex
I want to try 16x2 Lcd displays driven by I2c with Atmega, could you please give us the wiring diagram and the steps for making Hello program and the program.
Best regards
Thu Jun 6 2019, 16:22:26
(no subject) (by José GILLES)
To Ahmad:

To try I2cLcd 16x2, you must download the last version of ldmicro ( and ARMGCC compiler from this site for instance:


Then connect your display to I2C bus (4 wires VCC,GND,SDA,SCL)
and follow explainations in:

- HowTo-Avr.txt in LIBRARIES_FOR directory
- LcdI2cLib.txt in LIBRARIES_FOR\AVR directory

Here's attached a working ld example for ATmega328.

Fri Jun 7 2019, 03:04:22, download attachment i2c_lcd16x2bis.ld
(no subject) (by suat)
great work, thanks both of you, Ihor and José
Sat Jun 8 2019, 12:30:28
Como reparar errores de programación. How to fix programming errors. (by Calubert)
Adjunto archivo de como hacer la programación correcta, de las entradas y salidas de LDMicro, de errores de programadores y no es un error de LDMicro (Programa).
Esto sucede porque los Bit de salida son 0 o 1, si en la salida le decimos que tenga el bit 0, nunca se activara en el bit 1 (en otras lineas), por eso tenemos que usar los (R) reles internos y sobre todo con nombres de variables diferentes.
Para mas detalles pueden contactar con migo por este mismo foro y daré las explicacion necesaria. no soy partidario de hacer escaleras ya que lo correcto es hacer uno mismo la escalera para luego no se tengan errores al modificar cualquier parte de programa ya que cada uno tiene una forma de programación.

Attached file of how to do the correct programming, of the inputs and outputs of LDMicro, of programmer errors and it is not an error of LDMicro (Program).
This happens because the output bits are 0 or 1, if in the output we say that it has bit 0, it will never be activated in bit 1 (in other lines), so we have to use the internal (R) relays and over all with names of different variables.
For more details you can contact me through this same forum and I will give the necessary explanation. I am not a supporter of making stairs because the correct thing is to make the staircase yourself so you do not have mistakes when modifying any part of the program since each one has a programming form.

Fichier joint expliquant comment programmer correctement, des entrées et des sorties de LDMicro, des erreurs de programmation et ce n’est pas une erreur de LDMicro (programme).
Cela se produit parce que les bits de sortie sont 0 ou 1, si dans la sortie nous disons qu'il a le bit 0, il ne sera jamais activé dans le bit 1 (sur d'autres lignes), nous devons donc utiliser les relais internes (R) et plus. tous avec des noms de variables différentes.
Pour plus de détails, vous pouvez me contacter via ce même forum et je donnerai les explications nécessaires. Je ne suis pas partisan de la fabrication d'escaliers, car la bonne chose à faire est de créer l'escalier vous-même afin d'éviter toute erreur lors de la modification d'une partie du programme, car chacun a une forme de programmation.

File allegato su come eseguire la corretta programmazione, degli ingressi e delle uscite di LDMicro, degli errori del programmatore e non è un errore di LDMicro (Programma).
Questo accade perché i bit di uscita sono 0 o 1, se nell'output si dice che ha il bit 0, non sarà mai attivato nel bit 1 (in altre righe), quindi dobbiamo usare i relè interni (R) e oltre il tutto con nomi di variabili diverse.
Per maggiori dettagli puoi contattarmi attraverso questo stesso forum e darò la spiegazione necessaria. Non sono un sostenitore di fare scale perché la cosa giusta è fare da soli la scala in modo da non avere errori quando si modifica qualsiasi parte del programma poiché ognuno ha una forma di programmazione.

Прикрепленный файл о том, как правильно программировать входы и выходы LDMicro, ошибки программиста, и это не ошибка LDMicro (Программа).
Это происходит потому, что выходные биты равны 0 или 1, если на выходе мы говорим, что он имеет бит 0, он никогда не будет активирован в бите 1 (в других строках), поэтому мы должны использовать внутренние реле (R) и более все с именами разных переменных.
Для более подробной информации вы можете связаться со мной через этот же форум, и я дам необходимые объяснения. Я не сторонник создания лестниц, потому что правильная вещь состоит в том, чтобы сделать лестницу самостоятельно, чтобы у вас не было ошибок при изменении какой-либо части программы, поскольку каждая из них имеет форму программирования.

प्रोग्रामर त्रुटियों की LDMicro के इनपुट और आउटपुट की सही प्रोग्रामिंग कैसे करें, इसकी संलग्न फाइल और यह LDMicro (प्रोग्राम) की त्रुटि नहीं है।
ऐसा इसलिए होता है क्योंकि आउटपुट बिट्स 0 या 1 होते हैं, अगर आउटपुट में हम कहते हैं कि इसमें बिट 0 है, तो यह बिट 1 (अन्य लाइनों में) में कभी भी सक्रिय नहीं होगा, इसलिए हमें आंतरिक (आर) रिले और ओवर का उपयोग करना होगा विभिन्न चर के नाम के साथ सभी।
अधिक जानकारी के लिए आप मुझे इसी मंच के माध्यम से संपर्क कर सकते हैं और मैं आवश्यक स्पष्टीकरण दूंगा। मैं सीढ़ियाँ बनाने का समर्थक नहीं हूँ क्योंकि सही बात यह है कि सीढ़ी को स्वयं बनाना है ताकि कार्यक्रम के किसी भी हिस्से को संशोधित करते समय आपसे कोई गलती न हो क्योंकि हर एक के पास प्रोग्रामिंग फॉर्म है।
Sun Jun 9 2019, 09:51:59, download attachment saverprogramar.ld
sigue del anterior. Follow from the previous (by Calubert)
Sigue del anterior.

Follow from the previous
Sun Jun 9 2019, 09:54:47, download attachment temp.pl
(no subject) (by Alex)
excuseme, for setting path in mcuflash wich one do i have to change or both of them?

@rem SET PCC_PATH="C:\Program Files (x86)\HI-TECH Software\PICC\9.82"

SET PCC_PATH=C:\Program Files (x86)\HI-TECH Software\PICC\9.82
Wed Jun 12 2019, 15:17:47
(no subject) (by Alex)
and so with avr?

SET GCC_PATH=C:\Program Files\Atmel\AVR-Gcc-8.2.0
@rem SET GCC_PATH=C:\Program Files (x86)\Atmel\AVR Studio 5.0\AVR Toolchain
Wed Jun 12 2019, 15:19:10
(no subject) (by Alex)
the one with "@rem" and withut it
Wed Jun 12 2019, 15:19:44
(no subject) (by Alex)
oh it is a remark, so it is like comment? then i have to set path in path without "@rem"
Wed Jun 12 2019, 15:42:25
(no subject) (by José GILLES)

Yes, @rem means "remark" = "comment"

The true path is in SET PCC_PATH ... or SET GCC_PATH ...

Wed Jun 12 2019, 17:00:12
(no subject) (by Alex)
To Ahmad sakr:

Here is a basic tutorial for i2c lcd with pic and avr, hope it helps you: (btw hope audio english speaker is understandable at least most of it)



Thanks for your reply
Thu Jun 13 2019, 00:45:22
bug report (by MGP)
Ihor, after version 4430 LDmicro has no pwm-pin for a 16F628a.
Can you have a look at it, thanks.
Fri Jun 14 2019, 09:10:54
(no subject) (by Ihor Nehrutsa)
to MGP
to all
Are there any more bug reports?
Fri Jun 14 2019, 11:28:30
(no subject) (by MGP)
Also, all 16F8xx have only 1 pwm-pin instead of 2.
Fri Jun 14 2019, 11:51:46
(no subject) (by Ihor Nehrutsa)
to MGP
Select Timer 0 as PLC cycle timer.
Fri Jun 14 2019, 15:33:37
(no subject) (by MGP)
Yes it works, I was using the new download and there timer 1 is default.
And then it works on the 16F88 also, great..thanks.
Fri Jun 14 2019, 17:00:38
(no subject) (by Alex)
could you give an example how to use a servomotor using 16f88 with internal oscilator?
Sat Jun 15 2019, 01:25:21
(no subject) (by MGP)
Alex, here you have a program that's NOT tested because the lack of time today.

The program is taken from Ihor's wiki list with a slight change and it uses the 500kHz intosc.

Change the IO-pins as you like.
Sat Jun 15 2019, 03:05:40, download attachment servo pwm Pic16f88_test.ld
(no subject) (by Ihor Nehrutsa)
Sat Jun 15 2019, 15:52:30
(no subject) (by Alex)
thanks MGP i will try.

Thanks Ihor, i guess i can use link example using 16f88 intead with internal oscilator
Sun Jun 16 2019, 00:47:13
(no subject) (by MGP)
I made an error in my LDmicro file.
The value of rung 5 must be 0x3E.

When I have time I will update the wiki page as Ihor Has requested, but first I will setup a test.
Sun Jun 16 2019, 03:08:16, download attachment 16F88_osccon_settings.jpg
OS interno (by paulino)
Hola Alex, te adjunto Microsoft-Word par que veas como hacer la pantalla LCD y cambiar el oscilador de las PIC.

Hi Alex, I'll attach Microsoft-Word, so you can see how to do the LCD screen and change the internal oscillator of the PIC.
Mon Jun 17 2019, 04:25:09, download attachment Binario para lcd.doc
Post a reply to this comment:
Your Name:
Your Email:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):