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

LDmicro Forum - New I2C functions in ldmicro for ARMs and AVRs

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

New I2C functions in ldmicro for ARMs and AVRs (by José GILLES)
Here's a new version of my ldmicro, which supports I2C via C programming for ARMs and AVR targets (ATMegas).

There are two new I2C functions, to read or write one byte in an I2C peripheral register. Peripheral can be selected by its I2C address.

For the time being I have just had time to test it with a true DS1307 I2C real time clock, and it worked... but it needs to be tested further more.

The principle is the same as for previous versions (see HowTo in zip file), with external I2C libraries.

Be aware that I2C peripherals (ie DS1307) can be very slow even at high speed (100 KHz), and have a look at cycle timing !!!

Try and let me know about your experience.

Sat Dec 29 2018, 17:49:32, download attachment LdMicro32.zip
(no subject) (by John)
Hi, you could put a simple example hello world in 12C.

Thank you great job.

Sun Dec 30 2018, 04:22:30
(no subject) (by José GILLES)
Yes, but I2C is not really made to communicate with displays ; rather with sensors, expanders...
Sun Dec 30 2018, 12:15:20
(no subject) (by John)
OK thanks.
You know how I could connectSerial I2C 1602 16×2 Character LCD Module
Sun Dec 30 2018, 12:41:00, download attachment 1.jpg
(no subject) (by José GILLES)

I suppose you want to connect this display to an arduino board ?

Theoritically, it shoudn't be very difficult because:

- 16x2 LCD displays are well known and many libraries are available to make them work
- PCF8574 is just an 8-bit I2C IO expander connected to pins
E, RW, RS (command lines) and D4-D7 (data lines in 4-bit mode)
of the display
- I2C wiring is available on the Net

But I think itsn't worth trying to do it because these displays are very slow (all the more in 4-bit mode), and I2C interface will make it slower, so that it won't work in ldmicro, unless you have a huge cycle time !

Sun Dec 30 2018, 16:15:07
(no subject) (by John)
OK thanks.
Sun Dec 30 2018, 22:19:39
(no subject) (by Ahmad sakr)
To jose
Is it possible to make ldmicro work directly with parallel lcd. As I know that ldmicro deal only with serial lcd.
Mon Dec 31 2018, 02:10:14
(no subject) (by José GILLES)

I guess you can use directly a parallel 16x2 LCD display, but it remains the same pb: it needs wait states between commands and it's very slow.

To avoid it you may have another µC driving the display, to which you send formatted text (from time to time) via Uart, Spi, I2c...
Mon Dec 31 2018, 02:42:08
(no subject) (by Ahmad sakr)
I am using parallel lcd with ldmicro by compiling the sketch to arduino then in arduino ide I add the message by using arduino instructions and it works good.
What I need and asking for is to make ldmicro deal with parallel lcd like arduino ide without using any other software or microcontroller or shift register.
Thanks for your great work
Mon Dec 31 2018, 11:52:12
(no subject) (by José GILLES)

Yes, its possible, but needs to had new functions for LCD16x2...
in ldmicro => much work

In your case, do you send many messages to your display, or just from time to time ?
And what is your cycle timing ?

Mon Dec 31 2018, 12:09:00
(no subject) (by Tami Duke)
Hi..LDmicro allow you to make your ladder schematic then to generate HEX code which does the ladder logic implementation in program code which you program to your AVR or PIC and got the ladder logic functionality.
Wed Jan 9 2019, 13:22:43
Example I2C (by EDAM)
Hi you could put a simple example to communicate with other arduino in 12C.
Thank you.
Wed Mar 6 2019, 18:32:42
(no subject) (by José GILLES)
I2C under ldmicro works only in master mode.
To communicate, you must have a master and a slave...

It's designed here to drive sensors.

Fri Mar 8 2019, 02:58:49
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):