MOTOR LOGIC IN PIC16f877

Status
Not open for further replies.

flemmard

New Member
Hi,
I wish to drive the motor clockwise for 5 secs and halt for 5 secs and then continue running in ANTI-clockwise for 5 seconds....the cycle should continue this way.How do i do the delay in PIC 16f877 of MICROTECH? Any built-in function or sample code?

Thanks
 
If you go to the PICList there is a delay code generator, which will generate assembler code for you simply by specifying the delay required and the clock speed.
 
Well..

Hi,
I wish to drive the motor clockwise for 5 secs and halt for 5 secs and then continue running in ANTI-clockwise for 5 seconds....the cycle should continue this way.

well, very simple.. go to this site.. and enter values..

the code will come automatically..



How do i do the delay in PIC 16f877 of MICROTECH?

PIC is by microchip' ...

Regards,

Simran..
 
simrantogether said:
well, very simple.. go to this site.. and enter values..

the code will come automatically..





PIC is by microchip' ...

Regards,

Simran..

Thanks Simran ! Your name rocks !
 
simrantogether said:
well, very simple.. go to this site.. and enter values..

the code will come automatically..





PIC is by microchip' ...

Regards,

Simran..

Hi, I'm here once again.Is it possible to get the code in C.I'm using Hi-tech PIC C compiler.
Thanks!
 
in c...

In c, it is definitely much easier..

Find out a function .. or make a function that generate a delay of 1 micro second..

hence if you need a 5000 micro second delay.. then just put the value 5000 in brackets of function call..

The function of delay of one microsecond .. you can have it from Sir Nigel..

or, develop by yourself.. or net.. or book..

or give me some time.. i'll try..

Regards,

Simran..
 

Thank you very much.I'm trying to get the function.Meanwhile,if you get any, please post it here.

Btw, your favourite actress is Simran?
 
simrantogether said:
You'll also have to mention the value of crystal you are using for the project..

Regards,

Simran..

This is just a home project.I'm planning to do some travellator kinda stuff.I really don't know from technical aspect as I'm newbie here.I'm using a small motor for this.Kindly advice !
 
simrantogether said:
In c, it is definitely much easier..

It's really dead simple in assembler as well, just load a register with the delay you want and call a delay routine that number of times - most of my tutorials do just that.

Find out a function .. or make a function that generate a delay of 1 micro second..

Not in C you don't, at least not with a 4MHz clock - and even in assembler you don't use a function for that, just a single NOP at 4MHz for a 1uS delay.

hence if you need a 5000 micro second delay.. then just put the value 5000 in brackets of function call..

The function of delay of one microsecond .. you can have it from Sir Nigel..

'NOP' - there you go!

Or for a 20MHz clock?

'NOP
NOP
NOP
NOP
NOP'
 
simrantogether said:
Which motor you are using..?

Stepper motor or DC motor.. ?

Regards,

Simran..

I'm using DC motor. Btw, heard stepper motor is much costlier than DC...

Thanks !
 
Last edited:
Nigel Goodwin said:
'NOP' - there you go!

Or for a 20MHz clock?

'NOP
NOP
NOP
NOP
NOP'

and Sir Nigel.. when we want a delay for 5000 milliseconds.. then?

we do have to add nested loops...

sometimes three.. if it is 8 bit rom ..

hence it is complicated than C language.. atleast for the beginner..

Regards,

Simran..
 
follow the trick..

flemmard said:
I'm using DC motor. Btw, heard stepper motor is much costlier than DC...

Thanks !

Who says that stepper motor is expensive.. follow the trick..

yes, i know it is expensive for the hobbyist..

TRICK : Remember, if you want to buy the stepper motor all you have to do is.. ' go to the junk market .. and ask for stepper motor '

They are available for less than 1 USD..

stepper motor are easily available over there.. because they are taken out of second hand Printers..

Junk market in Subcontinent is also called " KABAAD MARKET"..

REGARDS,

SIMRAN..
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…