CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Newbie / Frustration (very both)
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Wed Dec 03, 2003 1:11 pm     Reply with quote

A crystal clock implies that it is an active device (ie needs power) and once power is applied and maybe a control signal is set to the RUN level it will generate a clock signal by itself. Usually 50% duty cycle and usually rail-to-rail output. These are frequently found in small metal "cans" with the approximate footprint of an 8 or 14 pin dip. There are also plastic packaging options and many surfacemount options. The simplest ones only have 3 connected pins out of 4. Some have additional pins for running internal heaters, reference levels, shut-down control and calibration. Low end of about $1.50 each to hundreds of dollars apiece depending on their specifications.

A crystal is a piece of quartz that has been cleved to produce a specific shape. It is a passive element and can be modeled by an RLC (resistor, inductor, capacitor) tank circuit. Two basic cuts of crystals are parallel resonant and series resonant. You want to get the parallel resonant kind for the PIC. You can make the series resonant ones work but takes more parts. If the catalog doesn't say which kind but it does give a crystal capacitance, then it is most likely a parallel cut. The crystal is usually packaged in a small metal can but I believe I've seen plastic parts for surfacemount.

In order of cost:

Crystal Oscillator $$$$
Crystal $$
Ceramic resonator $$
RC circuit $

However the Crystal vs ceramic resonator cost comparison is a little funny because you can get cheap crystals and expensive resonators or expensive crystals and cheap resonators.

Next time you order parts, get yourself a bunch of 20MHz, 12MHz, 8MHz and 4MHz parallel resonant crystals in the HC49 or HC49/s package. Easy to work with and cheap. If you need greater stability or wider temperature range then you can shop around and spend more than $0.50 each for them. If you think all your experiments could tolerate 0.5% to 1.0% frequency accuracy, get ceramic resonators instead. Get the ones with the built in capacitors (they will have 3 leads). Saves you a little time when you are trying to whip up a test circuit.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
iso9001



Joined: 02 Dec 2003
Posts: 262

View user's profile Send private message

PostPosted: Wed Dec 03, 2003 5:20 pm     Reply with quote

ARRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRGGGGGG!!!!!!

It still does not work!

Code:

#include <16F872.h>
#fuses RC,LVP,NOWDT,NOPROTECT
#use delay(clock=1000000)

void main()
 {
  while(1)
   {
    output_high(PIN_B4);
     delay_ms(300);
    output_low(PIN_B4);
     delay_ms(125);
 }
} //eom


and i have EXACTLY this:


And it does not work... I do have the config bit set up (3FFA). I verified the programming, pretty much bit by bit.

I took a MM to the pins, have continuity where there should be, grounds are good, vdd is on, tried a 47K and a 10K r on the mclr pin... tried moving things around etc...

Any ideas ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 03, 2003 5:53 pm     Reply with quote

Well, I have a few questions.

1. Do you remove the 16LF872 chip from your circuit, when you
program it with the TLVP programmer ?

ie., Do you physically take the chip out of your demo board,
and move it over to your PC, where you then plug it into
the TLVP programmer ?

Or, are you trying to program it "in-circuit" -- while it's still
plugged into your demo board ?

2. Where did you get these 16LF872 chips ? If they were given to
you, do you know if they were previously used by someone else ?
Were they ever programmed in a conventional programmer ?
(ie., PicStart-Plus, or Warp-13a, etc.)


3. How do you know that the capacitor is really 100 pf ?


The basic problem with this whole enterprise is that:
1. You're trying to learn electronics.
2. You are using an unconventional PIC programmer, that you built
yourself, and that might not even work the first time if one of us
were to build it.
3. You're learning about PICs, which have a lot of "gotchas", especially
for a newbie.
4. You're trying to solve all this by remote control, through asking
questions on a web board.

I mean, how do I know that you even know the resistor color code ?
Or, the TLVP programmer requires a very short cable (only a few inches)
coming off the back of your PC. What if you, unbeknownst to us, have
a 24 inch cable ? Do you see what I'm getting at ?

Is it possible that you could contact someone locally, perhaps from
an electronics club at a school, to give the "hands on" help that you
need to initially get started ?
iso9001



Joined: 02 Dec 2003
Posts: 262

View user's profile Send private message

PostPosted: Wed Dec 03, 2003 6:12 pm     Reply with quote

Ok, to clear this up....

I'm not using a cable for the tlvp, plug in directly... and i know it works b/c I can watch pin 10 follow pin 2 when I toggle 2, and after i get the success message I clear the screen, go back and click READ... it reads back exactly what is in my hex file. This is not a question of wether or not my programmer works. I am 99% certain it does.

I am not tring to icsp this. I physicaly remove it from the demo board and place it in the programmer... see above for notes on the programmer.

These chips came to me directly from microchip samples... but again, i can read back that they did in fact program correctly.

I know the cap is 100pF b/c that is what the box it came in says all over it.

I know my resistor color codes and that these are the correct values.


There should be "gotchas" in multimaster I2C bussing... not my led light thingie.

Like i said, there are no resonators or crystals w/in 100mi of me (aside from assembled items), so its VERY safe to assume that if there were someone local to me that could help, they are very well hidden... nope, no local help... this board is pretty much my only shot to get this all working so why oh why is my example not working ???
iso9001



Joined: 02 Dec 2003
Posts: 262

View user's profile Send private message

PostPosted: Wed Dec 03, 2003 6:29 pm     Reply with quote

If i have the RC disconnected, wouldn't my program still set B4 to high and then stop when it got to delay_ms()?

If i MM the pins (all the io) I get nothing... should they all be natually low when the chip is on?

I'de really like to start making some progress here... Sad
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Dec 03, 2003 6:36 pm     Reply with quote

Shouldn't you be using the powerup timer in the fuse setting? I would add this.

Quote:

If i have the RC disconnected, wouldn't my program still set B4 to high and then stop when it got to delay_ms()?


Nope, the micro needs a clock signal to execute an instruction. Delays are usually just loops of 'nops' which is just another instruction.
iso9001



Joined: 02 Dec 2003
Posts: 262

View user's profile Send private message

PostPosted: Wed Dec 03, 2003 6:53 pm     Reply with quote

Good to know about the clock/instruction thing...

I dont know, should I be using power up timer fuse? Whats it do?


Here is a pic a grabbed real quick:
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Wed Dec 03, 2003 7:14 pm     Reply with quote

You should have a capacitor on the output of your voltage regulator. Assuming you are using something like a 7805 or LM340, try 10uF. Positive lead to the +5 and negative lead to ground.

A DMM may or may not tell you if the +5V is oscillating. Most DMMs are too slow repsonding.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Dec 03, 2003 7:23 pm     Reply with quote

I don't have a 16LF872, I just have a 16F877. But I modified one
of my test boards to use your RC oscillator circuit, and then I
programmed the PIC with a PicStart-Plus programmer.

It works fine. I can see pin B4 toggle up and down with my
oscilloscope.

Is it possible that your LED polarity is reversed ?
Could the LED be burned out ?

Try setting the delays in your while() loop to something larger,
such as 1000 ms, and just look at Pin B4 with your multi-meter.
Does it toggle between low and high voltages ?

Here's the test program that I used.
Also, just as a test, I tried it with NOPUT and NOBROWNOUT.
It still worked.
I also grounded pin B3 with a jumper lead, to try and make my
setup be as close to yours as possible.

Your photo looks OK.

Maybe you should order a 16F877. I have no experience with the
LF parts.

#include <16F877.h>
#fuses RC, NOWDT, NOPROTECT, BROWNOUT, PUT, LVP
#use delay(clock = 1000000)

main()
{

while(1)
{
output_high(PIN_B4);
delay_ms(500);
output_low(PIN_B4);
delay_ms(500);
}

}
iso9001



Joined: 02 Dec 2003
Posts: 262

View user's profile Send private message

PostPosted: Wed Dec 03, 2003 8:08 pm     Reply with quote

I need a 28pin for the application i'm going to be working on, so no 877s.

'Is it possible that your LED polarity is reversed ?" Nope
"Could the LED be burned out ?" Nope... I can test with a MM and see nothing.

I think the cap filtering my V-Out is a good idea, but not my problem.

I tried using a few different power sources... a 9V, a 15V wall unit, an old power supply at 5V and 12V... all no blinky.

I'l try a new flash with larger delays, PUT, different chips... One thing I noticed is that the 100pF cap doesnt have a distinctive + and -.... Does it matter and if so, which on is which ?
iso9001



Joined: 02 Dec 2003
Posts: 262

View user's profile Send private message

PostPosted: Wed Dec 03, 2003 9:55 pm     Reply with quote

Ok....

So now after reading more I have doubts that the FPP software i'm using is completely programming...

I read about other people getting a 'normal' error w/ the tlvp, about when it tries to write the lvp config bit (which o/c it cant do)... I get no error....

I'm thinking FPP isnt writing the config bit... My code would still read off the chip normal no ? (I read the chip and it matches the file exactly)

I want to try and use IC-Prog, but cant figure out the settings for the TLVP in it...

Any advice ?
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

PostPosted: Wed Dec 03, 2003 10:09 pm     Reply with quote

I don't think I've ever seen a 100pF polarized capacitor before. You are probably safe to assume it is a non-polarized part.

I think PCM Programmer is right, you need to beg, borrow or "steal" a different programmer to burn your chip. Post the city you are in and maybe somebody in the forum is close enough to you to help you in person.

The only 28-pin DIP parts I have handy are PIC16F73s. I can program one for you and mail it to you if you are in the USA. Probably take as long as your finding a different programmer to use.

On that note, I used the picallw for a few years and I was very happy with it. Available as a kit. Software runs on W98 and W2Kpro just fine. Google on "picallw" and you should find a link.
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
iso9001



Joined: 02 Dec 2003
Posts: 262

View user's profile Send private message

YAYYYYYYYYYYYY....
PostPosted: Wed Dec 03, 2003 10:56 pm     Reply with quote

Figured it out... to use IC-Prog and the TLVP, use the "Tait Serial Programmer" and turn off the inverts off.

Got my led blinking finally!!! YAYYYYY

I'de like to say thanks to everyone here that helped a noob out.

Also, I'de like to pound a nail into tait's head for making such a POS program. As it turns out, my programmer has worked flawlessly the whole time, my code was good, I did need help on the circuit, but thats ok, and once I used IC-Prog instead of tait's FPP-CRAP-O-MATIC everything worked peaches!

The irony is that now everytime i start ic-prog, i need to select the 'tait' programmer.... such is a cruel cruel world.

i hate tait Cool
rwyoung



Joined: 12 Nov 2003
Posts: 563
Location: Lawrence, KS USA

View user's profile Send private message Send e-mail

Re: YAYYYYYYYYYYYY....
PostPosted: Thu Dec 04, 2003 8:44 am     Reply with quote

iso9001 wrote:
Got my led blinking finally!!! YAYYYY


About time! ;-) Go take a nap!
_________________
Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group