(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.
Pic16f88 Internal Oscillator (by DFX)
Program that doesn't work (internal crystal fuses)
(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.
(no subject) (by Ihor Nehrutsa)
Also you must configure
OSCCON: OSCILLATOR CONTROL REGISTER (ADDRESS 8Fh)
(no subject) (by Ihor Nehrutsa)
to DFX
Please measure the frequency at pin 13 PB7.
It should be 1 kHz.
(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
(no subject) (by Alex)
interesting, that would be very helpful for designed circuits in the past
(no subject) (by Ihor Nehrutsa)
(no subject) (by Alex)
to Ihor:
what is 0X72 in your example (OPCODE FIELD DESCRIPTIONS ?),
(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.
(no subject) (by Ihor Nehrutsa)
(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...
(no subject) (by Ihor Nehrutsa)
Yes. First PLC cycle will wrong, but next will right 1ms.
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.
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.
(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
(no subject) (by Alex)
it is a bug then
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.
(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.
(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
(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?
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
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
(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.
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.
(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?
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.
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.
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.
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.
(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.
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
(no subject) (by s.meiyazhakan)
pic16f886 how to use internal osc
por s.meiyazhakan (by Paulino)
por s.meiyazhakan.
I attached program how you should do it
Post a reply to this comment:
|