Page 1 of 1

Eb003 erratic crystal

Posted: Sat Feb 25, 2012 3:45 pm
by fkuk
Im using a eb006 to program a stepper motor using a l297, I created a simple program that creates a clock signal by looping bsf and bcf with a delay of 10ms eachway

I programed it using a pickit3 and the first problem was the clock was very slow 1 step per second
The crystal on the board is k19.660 im not sure what the frequency of it is

so just to get the program to work I reduced the delay to something stupidly short
And the motor was spinning at a reasonable speed


But when I hover my hand above the osciltor switches the speed of the motor goes up and it becomes erratic

So I took off the motor and wired a led to blink
And with a really short delay the blink of the led is really noticable
And frequency changes as I hover my hand ovrr the crystal
and it stops the program is I touch the metal of the port connector

Could you tell me what is going on
Also what is the frequency of the oscilator, I thought it.was 19MHz but the way the harware is working it doesnt seem that.

The pic im using is p16f877a and im using assembley and mplab to program it

Re: Eb003 erratic crystal

Posted: Mon Feb 27, 2012 12:48 pm
by Benj
Hello,

Try firmly switching the RC / XTAL switch from the XTAL position to the RC position and back again.

If this doesn't help then maybe try pulling the crystal from it's socket using a screwdriver and then try re-seating it in the socket.

The crystal speed is 19.6608MHz, to ensure delays on the hardware match what you are expecting go into the Flowcode project options and ensure that the clock speed is set to match the crystal speed.

You may also have to go into your configuration settings and ensure these are correct for driving your device from a crystal. This would normally be oscillator mode HS, watchdog disabled, LVP disabled, extended CPU disabled.

Edit, Reread your post and seen your using assembler and MPLAB. I would check that you have setup the clock speed definition correctly if using library delay calls. If you are making your own delays using loops then the clock definition shouldn't cause any problems.

Re: Eb003 erratic crystal

Posted: Wed Feb 29, 2012 8:31 pm
by fkuk
hi

i figured out the problem it was the configuration bits for the oscilator it was set as xl then once i changed it to hs and it started working properly

thanks for pointing me in the correct direction

Re: Eb003 erratic crystal

Posted: Thu Mar 01, 2012 10:27 am
by Benj
Thanks for letting us know, glad your up and running now.

On an 8-bit PIC XT mode is for crystals under 4MHz and HS mode is for crystals greater then or equal to 4MHz.