Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

plz help me !!

Status
Not open for further replies.

pike

Member
hey guys,

I am having trouble trying to get the internal oscillator of the 16F819 to actually work.

Do I need any commands in the program to calibrate or startup the oscilator?

I'm using IC-Prog for now and it gives me the option of :LS, HS, XT,EXT Clock, IntRC, IntRC Clockout, ExtRC and ExtRC Clockout.

-I know I should use either IntRC or IntRC Clockout. But whats the difference between the 2 and which one do I need???

I also have the options of using fuses:

watch dog timer
power up timer
Master clear
Brown out
Debugger
and CCP1 selection

-Can anyone give me a brief description of these fuses, particurly "brown out"???
-So how do i get my internal oscillator working??? (well how did you guys get your working)

plz help me guys, i'm totally stumped on this problem :?
 
The two IntRC options both use the internal oscillator, but the second one outputs itself on one of the PIC pins - if you don't require this (and most applications won't) chose the plain IntRC.

I've not used a 16F819, but the 'brown out' option affects the reset capability of the chip - if the HT supply to the chip drops it can corrupt the running program, the 'brown out' option causes the chip to do a hardware reset if the HT drops sufficiently.

If you read the datasheet they will all be explained, mostly you tend to set them the same once you've decided on how you want them - only altering them when you have a particular need.

If you set the 'watch dog timer' you need to place 'CLRWDT' instructions throughout your program - if one of these doesn't appear before the timer runs out the PIC is reset - it's intended to rescue a program stuck in an endless loop.
 
pike said:
hey guys,

I am having trouble trying to get the internal oscillator of the 16F819 to actually work.

Do I need any commands in the program to calibrate or startup the oscilator?

I'm using IC-Prog for now and it gives me the option of :LS, HS, XT,EXT Clock, IntRC, IntRC Clockout, ExtRC and ExtRC Clockout.

-I know I should use either IntRC or IntRC Clockout. But whats the difference between the 2 and which one do I need???

Both settings activate the internal RC oscillator. But IntRC clockout outputs the frequency generated by the intOsc on a certain pin (see datasheet to see wich one). This allows you to use this frequency elsewhere in your circuit. The normal IntRC setting does not output the frequency, in stead the pin is a normal I/O line

pike said:
I also have the options of using fuses:

watch dog timer
The watchdog timer runs in the background. Your software must reset the timer at certain intervals (with a CLRWDT command). If your software fails to do so in time (because it is stuck in an infinite loop for example) the watchdog timer will overflow and this will reset the pic. If you turn it off then there is no need for CLRWDT commands in your code

pike said:
power up timer
When power is applied to the pic it will wait a short time (less then half a sec) before it starts running. This could come in handy if there is equipment connected to the pic that needs time to stabilize when power is applied (a LCD for example).

pike said:
Master clear
With master clear switched to external you can reset the PIC at any time by driving the MCLR pin low (see datasheet to know wich pin is MCLR). To make the pic run you must pull MCLR high.
With master clear switched to internal you can no longer reset the pic from outside (of course, if you turn the pic off and back on it is also reset)
but the MCLR pin can now be used as a digital input pin.

pike said:
Brown out
When supply voltage drops below a certain voltage the pic may start acting weird due to this voltage shortage. To prevent this you can enable brown-out. With brown-out enabled the pic will keep resetting itself as long as the supply voltage is too low. Once the voltage is restored the pic will start running again.

pike said:
debugger option sets some pins on the pic so they can be connected to an in-circuit debugger device wich allows you to monitor what the pic is doing wile it is running. The pins will be no longer available as normal I/O lines

pike said:
-So how do i get my internal oscillator working??? (well how did you guys get your working)
just set your fuse settings to INTOSC RC
 
wow, you guys are fast eh??

Exo, what software programmer are you running?? IC-Prog doesn't have a fuse called INTOSC RC. maybe i have have an old version of IC-Prog.

If I enabled "debugger", would i need an LCD to display whats happening inside the PIC or would i use my computer??

thanx for your quick replies.
 
I'm using both Winpicprog and IC-prog.
In IC-Prog 1.05C it's called "IntRC" at oscillator settings.

But you should add the config settings in your code. When you are programming your assembler file you should add a command to the top of your code
__CONFIG number (thats 2 underscores _ )
In MPLAB IDE (a free pic development program available from microchips website) you can generate the number you need. this way the settings are incorporated into your code itself and you don't need to set it in ic-prog.

debugger option is for an In-circuit debugger. This is a device connected to the PC.
 
How would I write that in BASIC?? Sorry i'm not familiar assembler.
But either way they should work right?? Otherwise i think my 4 brand new 819's are dead and useless :x
 
Picbasic normally sets the configuration settings for you.
just change the oscillator to IntRC in IC-prog. Leave the other settings, they should be set right by basic
 
Thanks for your input guys, I found (I think) the problem. The problem was the programmer or programmer software.

verify ocassionally works, and when it does it shows that the chip was programmed to use an LP oscillator. I'm pointing the finger at the software most likely. :evil:

When verify doesn't work it is because IC-Prog has automatically set the fuse Code Protect on.
 
What programmer hardware do you use ?

Are you using long and/or unshielded cables between pc/programmer and programmer/Pic.

this tends to give 'occasional' problems.
 
I'm using a JDM based programmer. Yeh the cable is shielded, and its 1.5 metres long. funny, the programmer wasn't playing up last night.

I just did some more experimenting. The oscillator works, but at a very low speed. I programmed this into it last night when the programmer was working.

Code:
Poke trisB, 0   'configure portb to output only
Test: 
poke portB, 1   'turn RB0 high
poke portb, 0   'turn RB0 low
goto test       'repeat for ever

When the program runs it runs flawlessly except for the timing. In a normal PIC, you wouldn't see the leds light up or respond due to the quick timing of the code. But with the (faulty??) 819's I have, you can actaully see the leds light up for about 10ms.

I can program other chips succesfully (16F84a) but not the 819. Sounds like i've killed the chips.
 
If it runs then the pic is probabely not defective. Some oscillator setting will still be wrong or something.

I would try to write a little assembly program and see how it acts.
could also be the basic acting up.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top