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 - 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
CONFIG1: CONFIGURATION WORD 1 REGISTER (ADDRESS 2007h)
CONFIG2: CONFIGURATION WORD 2 REGISTER (ADDRESS 2008h)

You must use
0x33F50
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
OSCCON: OSCILLATOR CONTROL REGISTER (ADDRESS 8Fh)
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)
Hi!

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
por MGP) (by paulino)
Hello MPG Try this Modified LDMicro program, you must place the output Led pin.
I would like to know if it worked for you.

Hola MPG Prueba este programa LDMiicro Modificado, debes colocar el pin de Led de salida.
me gustaría saber si te funciono correcto.
Mon Jul 22 2019, 06:12:52, download attachment 16F88_osc_test.ld
(no subject) (by MGP)
Paulino, it is not the intention to reset every cycle time the PWM output.
Even if you just place an "open circuit" in the pwm rung, it no longer works.
I think the error is in the used timers of the pwm and cycle time, but that is my impression.
Mon Jul 22 2019, 06:55:03
(no subject) (by paulino)
Hello MGP.
Thanks, I have attached a program that has PWM and it works very well I did it for Pic 887 and ATmega328P, it is short and easy to read if you know the programming in stairs that I think is not your case.
Note: you have to see what timer you put in the configuration since in the atmega328p it is T1 and in pic887 T1 does not work with T0 or T2 in LDMicro.
the program also has for LCD.
forgive my english is not very good

Hola MGP.
Gracias , te adjunto un programa que tiene PWM y funciona muy bien lo hice para Pic 887 y ATmega328P, es corto y fácil de leer si se sabe la programación en escalera que creo que no sea tu caso.
Nota: tienes que ver que temporizador colocas en la configuración ya que en el atmega328p es T1 y en la pic887 T1 no funciona con T0 o T2 en LDMicro.
el programa también tiene para LCD
Mon Jul 22 2019, 10:30:59, download attachment LD Fuente 220vAc_Dc.ld
(no subject) (by MGP)
With timer1 you cannot select a pwm pin on a 16F88 so we must use timer0.
If my short program does not work do you think that yours will work then?
Mon Jul 22 2019, 13:05:57
Para MGP Pic88 (by paulino)
You can try it on 887 and you will see that it works, I don't have any 88 to try, but use the LD and change the pins and try to see if it works, I will try to do it in Proteus and see if it works and tell you something. Pauline greetings

Puedes probarlo en la 887 y veras que funciona, no tengo ninguna 88 para probar, pero usa el LD y cambia los pines y prueba ver si funciona, intentare hacerlo en Proteus y veré si funciona y te digo algo. Saludos paulino
Wed Jul 24 2019, 11:28:03
por MGP (by paulino)
Hello and tested in proteus and in LDMicro you have to go to configuration parameters PLcCycleDuty and Mark the box, once marked you put the pin 2.
It works for me in this way and if you want I make the software

Hola e probado en proteus y en LDMicro tienes que ir a configuración parámetros PLcCycleDuty y Marcar la casilla, una vez marcado le colocas el pin 2.
a mi me funciona de esta manera y si quieres te hago el software
Wed Jul 24 2019, 13:20:41
(no subject) (by MGP)
I found the bug in LDmicro for the 16F88.

LDmicro uses pin 9 as PWM pin but the datasheet says that pin 6 is default.

You can not choose pin6 in LDmicro therefore you need to set pin6 as output with a rung or #TRISB, until Ihor has updated LDmicro.

I made a program that works but I going to start a new thread for a servomotor.
Thu Jul 25 2019, 06:48:27
cambio de pin PWM en pic 16f88 (by paulino)
on line 4 move the bits so that the PWM will get you through Pin 6.
Thu Jul 25 2019, 07:05:44, download attachment 16F88_osc_test pin6.ld
(no subject) (by MGP)
I dont know how this affect the rest of the ports(B).
What if you use other ports on B as in/output?
Thu Jul 25 2019, 07:09:51
Para MGP (by paulino)
If it is a mistake I saw your email after making this software.
I'm glad you did it, you did it = that I, if not, can send your example to know a little more.

Si es un error vi tu correo después de hacerte este sotfwar.
me alegro que lo hagas conseguido, lo hiciste = que yo, si no es puedes mandar tu ejemplo para saber un poquito mas.
Thu Jul 25 2019, 07:12:28
(no subject) (by MGP)
Thu Jul 25 2019, 07:16:00
PARA MPG (by paulino)
I attached .Hex, you must cut the track of l pin 9 and place it on pin 6, tell me if it worked for you since I did the test with proteus.

Te adjunto .Hex, Debes cortar la pista de l pin 9 y colocarlo en el pin 6, dime si te funciono ya que yo lo hice la prueba con proteus.
Thu Jul 25 2019, 07:20:19, download attachment 16F88_osc_test pin6.hex
MGP (by paulino)
If this is for the internal oscillator, not for the PWM output.

Si esto es para el oscilador interno, no para la salida PWM.
Thu Jul 25 2019, 07:29:05
MPG (by paulino)
I did a quick test, but you can select all the pins as you fence always moving the bits, since LDMicro acts as if it were programmed in assembly. with Move Bit.

you can activate, move, save, modify ETC.
With this I want to tell you that you can make a program just by modifying bit.

yo te hice una prueba rápida, pero puedes seleccionar todos los pines como te valla bien siempre moviendo los bit, ya que LDMicro actúa como si se programara en ensamble. con Move Bit.

puedes activar, mover, guarda, modificar ETC.
con esto te quiero decir que se puede hacer un programa solo modificando bit.
Thu Jul 25 2019, 07:38:18
(no subject) (by MGP)
I tried this with #TRISB or 0x86 as in your case, and it worked with introsc version.

But you cannot change the data direction register 0x86h IN the program, first you must read 0x86h then carry out an AND with you changes en then write it to the 0x86h register.
Otherwise you mess up the other ports on B.
Thu Jul 25 2019, 07:48:53
MGP (by paulino)
You can change the bits of the ports one by one as inputs and outputs of the ports, always knowing the direction of each bit or each port. I like doing it more in HEX than in BIN

Puedes cambiar los bit de los puertos uno a uno como entradas y salidas de los puertos, siempre sabiendo la direcion de cada bit o cada puerto. yo me gusta mas hacerlo en HEX que en BIN
Thu Jul 25 2019, 08:07:14
(no subject) (by s.meiyazhakan)
pic16f886 how to use internal osc
Thu Aug 15 2019, 13:00:17
por s.meiyazhakan (by Paulino)
por s.meiyazhakan.

I attached program how you should do it
Thu Aug 15 2019, 14:52:45, download attachment Frecuencia.ld
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):