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 - LDmicro.GitHub news v4.2.1

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

LDmicro.GitHub news v4.2.1 (by Ihor Nehrutsa)
https://github.com/LDmicro/LDmicro/releases/tag/4.2.1

== Release 4.2.1

* Fixed: The 'Help' and 'About' dialog boxes are displayed in the selected Color scheme.

* Fixed: Simulation of the GOTO and GOSUB instructions.

* Fixed: Pull-Up resistors in ATmega MCU and ANSIC code.

* Wiki: SUBPROG, RETURN, ENDSUB and GOSUB, LABEL and GOTO instruction. Part 2
https://github.com/LDmicro/LDm...L-and-GOTO-instruction.-Part-2

SUBPROG, RETURN, ENDSUB and GOSUB, LABEL and GOTO instruction. Part 3
https://github.com/LDmicro/LDm...L-and-GOTO-instruction.-Part-3
Wed May 17 2017, 06:35:06, download attachment build421.zip
(no subject) (by MGP)
Thanks for the new version.

I was experimenting with the Delay(µs) function and I was suprised that the time was only given by numbers and not a variable.

I was trying to make servosignals (ppm) 1 to 2mS on 20ms timebase.
Is it difficult to change this?
Wed May 17 2017, 08:12:08
(no subject) (by Ihor Nehrutsa)
manual.txt :
> DELAY 1 us
---[DELAY]---

The DELAY instruction causes a delay in us. DELAY instruction does not
use any timers/counters. The NOP and JMP(Current Address+1) instructions
are used to make delay.
See https://github.com/LDmicro/LDmicro/wiki/DELAY-us



Delay(µs) designed specifically for short times, less than 100 us. Although the parameter (µs) is not limited. Simply more NOP's and JMP+1 will written to hex during the LD compilation time ;)
1-2 mS is too big for the Delay(µs) instruction.

Delay(µs) not for your purposes in this case.
Use minimal PLC cycle time and TON, TOF, ....
Wed May 17 2017, 08:47:27
(no subject) (by MGP)
Ok thanks you for the explanation.
Wed May 17 2017, 12:08:35
(no subject) (by Alex)
thanks for the updates, could you add a simple example using pull-up resistors with ansi c.



I made a program using ansi c, i attach the program (ansic_example.c and ansic_example.h ), proteus simulation and ladder software.
Wed May 17 2017, 13:58:03, download attachment ANSI C example 16f877A.rar
(no subject) (by Alex)
i have some questions, i attach images to make it clear, i have noticed that one or some unused pins are high level using ansic code, that´s why i used "output_b(0)", this coomand initializes port b with low level, due to that, unsued pins are no longer in high level, but is this a good way to do that?
Wed May 17 2017, 14:02:16, download attachment questions.rar
(no subject) (by Alex)
I used Pic C Complier 5

the other question is that if i want to use plc cycle time 0 as ldmicro does, in ansic is it correct just to call it using the smallest period of time pic c compiler can do with timer 1?

0.0016ms

image attach
Wed May 17 2017, 14:05:48, download attachment Cycle time 0.jpg
(no subject) (by Alex)
by the way,in the ansi c example there are just 3 leds, the 4th one in the images (question.rar) is to show high level of unused pins
Wed May 17 2017, 14:08:19
(no subject) (by Ihor Nehrutsa)
to Alex
PLC cycle time "0" is equivalent to picture

In fact, the duration of the PLC cycle
is unstable, variable and uncertain, undefined.
PLC cycle time depends of the сomplexity of the
PlcCycle() algorithm.
Wed May 17 2017, 17:03:36, download attachment PLC_cycle_0.JPG
(no subject) (by Ihor Nehrutsa)
to Alex
You need an additional resistor RA0->GND.
Wed May 17 2017, 17:33:23, download attachment R_to_GND.JPG
(no subject) (by Ihor Nehrutsa)
to Alex

RTFM
After reset value of PORTB is unknown. May be 0, may be 0xFF.
Proteus fill it randomly.
Wed May 17 2017, 17:55:14, download attachment PORTB_after_RESET.JPG
(no subject) (by Alex)
Thanks for you reply, made it oe clear,yes, i´m reading the manual :(
Thu May 18 2017, 15:06:12, download attachment high level unused pin.jpg
(no subject) (by Alex)
*made it to me clear
Thu May 18 2017, 15:06:43
(no subject) (by Ihor Nehrutsa)
to Alex

Set_trisb(~0x07) PBO-PB2 will outputs, PB3-PB7 will inputs
Thu May 18 2017, 15:57:06
(no subject) (by bfwolf)
Hello Ihor ;-)

Congratulations and many thx for the new version!
Many improvements! ;-)
GOTO and GOSUB seem to be functional and very useful. :-)

I also noticed, that you now enabled the UART-code for ANSIC...
I have one sugggestion for this:
You include full support functions for the UART in the produced c-source-file, but these are only working for AVR chips
and the main() and setupPlc() functions are very simple or better stub-functions. OK, they allow the file to be compiled and self-hosted but limited to AVR.
How about making the functions switchable using #ifndef ? ;-)
Eg:
....
#ifndef EXTERN_UART_Transmit
void UART_Transmit(unsigned char data) // AVR
{...}
#endif
#ifndef EXTERN_UART_Receive
unsigned char UART_Receive(void) // AVR
{...}
#endif
....
#ifndef EXTERN_setupPlc
void setupPlc(void)
{...}
#ifndef EXTERN_main
int main(void)
{...}
#endif

Regards and many thanks! ;-)
Thu May 18 2017, 16:12:18
(no subject) (by Alex)
Thanks a lot Ihor, now it works ok :)
Thu May 18 2017, 16:41:32, download attachment FIXED unused pin_1.jpg
(no subject) (by Alex)
image 2
Thu May 18 2017, 16:42:06, download attachment FIXED unused pin_2.jpg
(no subject) (by Alex)
wow uart for ansi c, i would like to test it on microship pic´s when avaliable
Thu May 18 2017, 23:41:02
(no subject) (by Alex)
using this command (image attach) unused pins are ok too
Fri May 19 2017, 13:47:44, download attachment set_tris_x(0bxxxxxxxx).jpg
(no subject) (by Alex)
i have a doubt, while compiling ansic in 4.2.1 i get a message (cmd) why is that?
Fri May 19 2017, 13:50:12, download attachment cmd.jpg
(no subject) (by Ihor Nehrutsa)
Pay attension to the postcompile.bat.
I use it for small automatione of the routine.
After F5 Compile I call the C or ASM compiler and get another hex file, etc.
But you can delete postcompile.bat or change it as you wish
Sat May 20 2017, 01:51:27
PIC18F4520 (by Antonio)
Hi Ihor!

Is possible to include the PIC18F4520 in the next version of
LDMICRO compiler?

This device is pinout compatible with pic16f877a... but more powerfull.

Thanks so much!
Mon May 29 2017, 20:37:36
(no subject) (by Ihor Nehrutsa)
Perhaps on a fee basis.
Please contact [email protected]
Tue May 30 2017, 03:30:44
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):