Eb003 erratic crystal

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
fkuk
Posts: 2
Joined: Sat Feb 25, 2012 2:12 pm

Eb003 erratic crystal

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Eb003 erratic crystal

Post 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.

fkuk
Posts: 2
Joined: Sat Feb 25, 2012 2:12 pm

Re: Eb003 erratic crystal

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Eb003 erratic crystal

Post 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.

Post Reply