Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 8th September 2007, 04:11 AM   (permalink)
Default MOTOR LOGIC IN PIC16f877

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
flemmard is offline  
Old 8th September 2007, 09:11 AM   (permalink)
Default

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.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 8th September 2007, 09:42 AM   (permalink)
Smile Well..

Quote:
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..

http://www.piclist.com/techref/picli...egen/delay.htm

Quote:
How do i do the delay in PIC 16f877 of MICROTECH?
PIC is by microchip' ...

Regards,

Simran..
__________________
Simran..
8051 Specialist..
simrantogether is offline  
Old 8th September 2007, 11:39 AM   (permalink)
Default

Quote:
Originally Posted by simrantogether
well, very simple.. go to this site.. and enter values..

the code will come automatically..

http://www.piclist.com/techref/picli...egen/delay.htm



PIC is by microchip' ...

Regards,

Simran..
Thanks Simran ! Your name rocks !
flemmard is offline  
Old 8th September 2007, 11:41 AM   (permalink)
Default

Quote:
Originally Posted by simrantogether
well, very simple.. go to this site.. and enter values..

the code will come automatically..

http://www.piclist.com/techref/picli...egen/delay.htm



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!
flemmard is offline  
Old 8th September 2007, 11:49 AM   (permalink)
Smile 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..
__________________
Simran..
8051 Specialist..
simrantogether is offline  
Old 8th September 2007, 11:53 AM   (permalink)
Default

Quote:
Originally Posted by simrantogether
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?
flemmard is offline  
Old 8th September 2007, 11:55 AM   (permalink)
Smile well..

You'll also have to mention the value of crystal you are using for the project..

Regards,

Simran..
__________________
Simran..
8051 Specialist..
simrantogether is offline  
Old 8th September 2007, 11:57 AM   (permalink)
Smile My name..

Quote:
Originally Posted by flemmard
Btw, your favourite actress is Simran
My name is Simran..

Simran Singh..

Regards,

Simran..
__________________
Simran..
8051 Specialist..
simrantogether is offline  
Old 8th September 2007, 12:01 PM   (permalink)
Default

Quote:
Originally Posted by simrantogether
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 !
flemmard is offline  
Old 8th September 2007, 01:47 PM   (permalink)
Smile listen..

Which motor you are using..?

Stepper motor or DC motor.. ?

Regards,

Simran..
__________________
Simran..
8051 Specialist..
simrantogether is offline  
Old 8th September 2007, 02:22 PM   (permalink)
Default

Quote:
Originally Posted by simrantogether
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.

Quote:

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.

Quote:

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'
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now  
Old 8th September 2007, 03:51 PM   (permalink)
Default

Quote:
Originally Posted by simrantogether
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 by flemmard; 8th September 2007 at 08:31 PM.
flemmard is offline  
Old 9th September 2007, 05:44 AM   (permalink)
Default

Quote:
Originally Posted by simrantogether
You'll also have to mention the value of crystal you are using for the project..

Regards,

Simran..
20MHz for my DC motor
flemmard is offline  
Old 10th September 2007, 06:31 AM   (permalink)
Smile

Quote:
Originally Posted by Nigel Goodwin

'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..
__________________
Simran..
8051 Specialist..
simrantogether is offline  
Reply

Bookmarks

Thread Tools
Display Modes



Similar Threads
Title Starter Forum Replies Latest
Need help with Intel Assembly Language and PIC16F877 avinsinanan Micro Controllers 10 4th March 2008 11:02 AM
Line Detection Robot using PIC16F877 helmyshahryl Micro Controllers 0 28th August 2007 02:54 AM
serial features of pic16f877 jambulov Micro Controllers 1 4th November 2004 10:08 PM
some newbie's questions concerning pic16f877.. kimhsieh2 Micro Controllers 4 12th January 2004 11:53 PM
Help in programming PIC16F877..... Azhar Ali chohan Micro Controllers 3 24th June 2003 12:08 PM



All times are GMT. The time now is 09:50 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker