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 - New C libraries for PIC 16 in ldmicro

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

New C libraries for PIC 16 in ldmicro (by José GILLES)

I've just posted on Github a new release of LdMicro32 (5.1b):
https://github.com/joegil95/LdMicro32

AVR libraries have been optimized (including timing), and new C libraries for PIC16F have been developped ; PWM and ADC for the time being, but SPI and I2C should follow.

It needs of course to be tested further more.

Beware: if you update LdMicro32 to version 5.1, replace ALL the older libraries by new ones to prevent inconsistancies. (download complet 5.1b zip file). You must also update your flashMCU.bat file from Batch directory to the one where LdMicro32 executable lies, expecially for PIC targets.

Full Spanish version will also be added soon ; thanks to Calubert for translations.

JG
Fri Jan 18 2019, 15:44:23
(no subject) (by Alex)
i tried to compile, that´s all i can do:

https://www.youtube.com/watch?v=m__JKbPoRNg&feature=youtu.be
Sun Jan 20 2019, 00:10:55
(no subject) (by José GILLES)
OK Alex

I can see 2 pbs in your sketch:

1) I have forgotten that in AtMega328 some EEPROM bits have changed names (EEME -> EEPE etc) thus new Usrlib can't compile correctly for this target. I have corrected on Github, and here's attached the good file to replace in lib folder.

2) You MUST set I2C address of your IO-Expander in I2clib.c
at line:

#define LCD_I2C_ADR 0x20 // a adapter selon afficheur

Replace 0x20 by your own I2C address ; maybe 0x27, but it depends on modules ; look at your documentation.


I can't see on video if there are other errors.
Recompile and let me know ?
Sun Jan 20 2019, 03:52:52, download attachment UsrLib.h
(no subject) (by Alex)
Thanks Jóse GUILLES it compiles now :)

do i have to edit UsrLib.c and increase delays until i catch the right values? it is a cursor blinking whe uploading to arduino uno with lcd i2c
Sun Jan 20 2019, 07:36:42
(no subject) (by José GILLES)

A full spanish version of LdMicro32 (5.1.0.c) is now available on Github:

https://github.com/joegil95/LdMicro32

Thanks to Calubert for his help

JG
Sun Jan 20 2019, 14:59:54
(no subject) (by José GILLES)
To Alex:

Here's a photo showing I2cLcd16x2 compiled from LdMicro32 and working on my atmega328 (Myavr board). It runs at 4 Mhz, so I'll try to change the Crystal to 16 Mhz. But I'm not sure at all it's the pb because it works at 100 MHz on my ARM32 !

I believe your pb is a wrong I2C address...
You may try all addresses between 0x20 and 0x27 supported by MCF8574 IO expander ?

JG
Sun Jan 20 2019, 15:34:33, download attachment Lcd_i2C.jpg
(no subject) (by Alex)
mine is 0x27, i checked again for being sure, i changed I2Clib.c to:

#define LCD_I2C_ADR 0x27
#define LCD_I2C_REG 255


also i changed it inside ldmicro i2c function, mnmnm i am going to test it with a simple arduino program that uses i2c lcd, maybe mine one has some troubles jsut to be sure it hardware works ok
Sun Jan 20 2019, 16:28:46
SPI for PIC16F (by José GILLES)
Hi

SPI is now available for PIC16F via C compiling and external libraries in ldmicro.

Program, libraries and sources of this 5.1d version can be downloaded on Github:

https://github.com/joegil95/LdMicro32
_____________________________________

Beware to always use the same version for LdMicro32 and libraries (5.1d) to prevent inconsistancies between them.
And replace always flashMcu.bat by new version too.

WARNING:
Even if you don't intend to use SPI, download new version because some errors have been corrected in Pwm for litlle PICs ; and in flashMcu.bat (target had remained pic16f876 => previous version may be unusable for other PICs)

Libraries have been tested in a PIC simulator on pic16f876 and pic16f88. It's up to you to test other PICs, if possible on true targets.

(See HowTo files to configure environment)

JG
Wed Jan 23 2019, 11:52:09
(no subject) (by bfwolf)
To José GILLES

Hello ;-)

How about writing constant-macro definitions like

#define LCD_I2C_ADR 0x20 // a adapter selon afficheur

in your library sources like

#ifndef LCD_I2C_ADR
#define LCD_I2C_ADR 0x20 // a adapter selon afficheur
#endif

so that one could just give eg. an other I2C_ADR by just adding a -DLCD_I2C_ADR=0x21 in the compile batch-file ?? ;-)

This would give the possibillity to adapt to the hardware-needs without chnaging library source-files :-)

Regards
Thu Jan 24 2019, 04:05:37
(no subject) (by José GILLES)

Yes, why not.
It' done for next version !

JG
Thu Jan 24 2019, 04:13:38
(no subject) (by Ziggy)
and here we leave those who do not speak C behind and break faith with roots of LDmicro.
Thu Jan 24 2019, 05:50:59
(no subject) (by José GILLES)
Hi Ziggy,

Noboby's left behind !

ALL the improvements - if you permit I call it like that :) - I have done in ldmicro normally let it compatible with previous usages, for those who don't intend to use external C libraries.

One can still generate hex files directly for AVRs or PICs.
Only those who want to use new features (SPI and I2C) must use libraries. It would be much more - and probably stupid - work to
try to develop such new features inside ldmicro, because it's very target dependent and boring for developpers to work in ASM nowadays...

Best regards
JG
Thu Jan 24 2019, 06:44:51
(no subject) (by Alex)
ins´t hi-tech payable?

SET PCCPATH=C:\Program Files\HI-TECH Software\PICC\9.81

so develop new features inside ldmicro is because of too much work (boring) i thought it was becuase of too much work (very hard work - difficult to do)
Fri Jan 25 2019, 21:36:03
(no subject) (by Alex)
i am not a developer, i understand why any developer has never make other functions inside ldmicro (i2c, spi, parallel lcd, idk, etc)
Fri Jan 25 2019, 22:01:00
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):