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 - Wrong Logic generated for PIC16f877A Microcontroller by LDmicro

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

Wrong Logic generated for PIC16f877A Microcontroller by LDmicro (by USMAN ALI BUTT(Pakistan))
Hi Jonathan Westhues!

I just made a simple logic in LDmicro. Its when ever Port-C Pin#0 is high. Then portB Pin#7 should accutated..

Push button is attached to port-c pin0 and output is at port-b pin7...

When i run the simulation it is ok.....

But when i download it in pic16f8777a microcontroller. It blinks the output led. I haven't pressed any button etc nor did i do any thing just downloaded the IHEX file in microcontroller, power it and it starts blinking. I cant figure it out whats the problem is...

When i change the cycle time led starts blinking faster etc....

Can you figure it out...

I write the same logic in c++ language, generated IHEX and downloaded it in microcontroller and its working fine....

I attacted both files.....
Mon Feb 16 2015, 00:22:44, download attachment testing PLC.ld
Wrong Logic generated for PIC16f877A Microcontroller by LDmicro (by USMAN ALI BUTT(Pakistan))
Heres c++ code which is working fine...
Mon Feb 16 2015, 00:24:34, download attachment PLC button check.c
(no subject) (by MGP)
_____Port-C Pin#0 is high. Then portB Pin#7_____

I think you are confused

RC0 = pin 15
RB7 = pin 40

And use a pullup resistor at the input and disconnect your programmer because RB7 is used for programming the chip.
Mon Feb 16 2015, 02:43:11
(no subject) (by USMAN ALI BUTT(Pakistan))
MGP did you looked at my testing PLC.ld file... Is it ok? I think its ok.. But the IHEX file it generates is not working properly... Heres the IHEX file....
Mon Feb 16 2015, 03:03:51, download attachment testing plc.hex
(no subject) (by Boris)
Look the size of this program and pic is 94% full and everything is working correctly.
Check programer and hardware.
Mon Feb 16 2015, 04:36:16, download attachment Rotacija.ld
(no subject) (by USMAN ALI BUTT(Pakistan))
One thing more i noticed that LDmicro is treating RA1 pin-3 of pic16f877a as RA0 pin-2 .... I think its a bug.....

But my question is still their.... Why pic16f877a is working by its own blinking etc.... I am not giving any input... I made ladder that if push button is pressed than their should be output(coil energized)... Please help me i have to show it working condition to my teachers.....

Well Boris if i write logic in c++ and made IHEX its working fine... But LD-Micro IHEX is not working fine...
Mon Feb 16 2015, 09:14:18
(no subject) (by MGP)
Can we see your schematic?
Mon Feb 16 2015, 11:11:12
(no subject) (by USMAN ALI BUTT(Pakistan))
Yes why not its working fine when IHEX file is generated by writting C++ code in MPLAB-IDE by microchip......
Mon Feb 16 2015, 22:45:28, download attachment Project 2nd report.docx
(no subject) (by MGP)
Most of your problems are caused by your printed circuit board.

-No decoupling capacitors.

-Floating controller inputs, no GND when the opto is not conducting. (see the 2 ways in the attached file)

-+V and GND lines are to small and too long.

It's not the software, but the oscillating hardware.
Make your circuit on a breadboard with 1 input and 1 output, so you can test your software.
Tue Feb 17 2015, 03:36:48, download attachment Opto_inputs.jpg
(no subject) (by David R)
Ldmicro NEVER makes incorrect code!
Thu Feb 19 2015, 02:58:33
(no subject) (by USMAN ALI BUTT(Pakistan))
Thanks MGP

Previously i didn't pay mush attention on PULL down resistors.. Now when i put pull down resistors, circuit is working properly...

Once again thanks.....
Mon Feb 23 2015, 23:15:11
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):