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

LDmicro Forum - Pic16f88 Internal Oscillator

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

Pic16f88 Internal Oscillator (by DFX)
Hi there!

I'm having a problem with internal oscillator of Pic16f88.

I think its probably a n00b problem, but I can't make the attached basic program to work.

I've set the oscillator frequency to 4Mhz and fuses to 0x3F50 and also to 0x3F70 in LDMicro 4.1.7 and even in Pickit2, but doesn't work.

I've tested the exact program but with external 20Mhz crystal and different pinout and it works.

So it must be an internal crystal problem.

Can anyone help me with it?

Thanks in advance.
Thu Mar 9 2017, 16:01:36, download attachment first_click_HS_DifferentPinout.ld
Pic16f88 Internal Oscillator (by DFX)
Program that doesn't work (internal crystal fuses)
Thu Mar 9 2017, 16:02:54, download attachment first_click_intosc.ld
(no subject) (by Ihor Nehrutsa)
PIC16F88 has two Configuration word

You must use
RA5 - Input pin.
RA6, RA7 - Bidirectional I/O pin.
Fri Mar 10 2017, 07:11:06, download attachment pic16f88intOsc8MHz.JPG
(no subject) (by Ihor Nehrutsa)
Also you must configure
Fri Mar 10 2017, 07:13:37, download attachment pic16f88intOsc8MHz.ld
(no subject) (by Ihor Nehrutsa)
to DFX
Please measure the frequency at pin 13 PB7.
It should be 1 kHz.
Fri Mar 10 2017, 08:06:18
(no subject) (by DFX)

Ihor i've tested your program and it works!

In pin13 i've got 0.997Khz that is expected as 1ms PLCcycle time.

And it was by looking to your program that I realised what was causing me problems with mine.

Besides enabling internal oscillator, my problem was Internal Pull-Ups enabled.

Since I use in my circuit 10k pull-down resistors that was the cause of my problem.

So what I did was write/move 0xff to #0x81 register to disable pull-up resistors at PORTB.

Maybe there is a better way of doing this..

Because my circuit was already made I didn't change to 1K pull-down resistor that could have worked.
Is there a chance of enabling or disabling internal pull-up resistor in LDMicro just by using a checkbox for example?

Many thanks Ihor for your great work and help!

Best regards
Sun Mar 12 2017, 18:53:45
(no subject) (by Alex)
interesting, that would be very helpful for designed circuits in the past
Sun Mar 12 2017, 19:47:11
(no subject) (by Ihor Nehrutsa)
Sun Mar 12 2017, 19:52:12
(no subject) (by Alex)
to Ihor:

what is 0X72 in your example (OPCODE FIELD DESCRIPTIONS ?),
Sun Mar 12 2017, 21:19:32
(no subject) (by MGP)
I wonder how you can change the internal oscillator and not changing the timer of the cycletime.

The internal oscillator is only 31.25KHz at the start and you change that in the program.

I don't know what the result is if you compile at 8MHz and run the program with the internal oscillator at 31kHz.
Mon Mar 13 2017, 03:25:11
(no subject) (by Ihor Nehrutsa)
Mon Mar 13 2017, 06:46:04
(no subject) (by MGP)
Yes I know this, but you must select in config1 0X400E (2007) that you are going to use the internal oscillator (31kHz) at start.

The pic is running at 8MHz after the LD program is started (at 31kHz)

But it works as DFX wrote, excellent...
Mon Mar 13 2017, 07:08:33
(no subject) (by Ihor Nehrutsa)
Yes. First PLC cycle will wrong, but next will right 1ms.
Mon Mar 13 2017, 07:24:43
(no subject) (by Alex)
Mon Mar 13 2017, 08:40:01
pora (DFX) (by paulino)
Hello (DFX). I attached program with internal resistance and no internal resistance, keep in mind that according to the ports that you use, there are specific ports that you can use and there are ports that can not be used.

Hola (DFX), te adjunto programa con resistencia internas y sin resistencias internas, ten en cuenta que los puertos de según que micro utilices hay puertos específicos que las puedes usar y hay puertos que no se pueden usar.
Mon Jun 24 2019, 08:17:12, download attachment con resis y sin.ld
por DFX) (by paulino)
For DFX) hello I attach your modified program with internal oscillator. I put the bits in the comment.

Para DFX) hola adjunto tu programa modificado con oscilador interno. te puse los bit en el comentario.
Mon Jun 24 2019, 08:36:52, download attachment first_click_HS_DifferentPinout modificado.ld
(no subject) (by MGP)
Finally I found the time to program.
The test with the 16F88 internal oscillator failed and stopped the controller.

Then once the test was done with a 20Mhz crystal and then the controller blocks also.

With 20Mhz crystal:
In the attached program, the LED oscillator (Yled) only works if the PWM instruction is removed.
The LED continues to light up with the PWM instruction.
Without the PWM instruction it works fine.

So something is wrong with Ldmicro(5310) for a 16F88
Fri Jul 19 2019, 09:50:59, download attachment 16F88_osc_test.ld
(no subject) (by Alex)
it is a bug then
Fri Jul 19 2019, 18:53:57
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):