Go to Post A few years of stress is worth a lifetime of opportunity. - omegasis25 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #16   Spotlight this post!  
Unread 27-03-2006, 22:23
Gdeaver Gdeaver is offline
Registered User
FRC #1640
Team Role: Mentor
 
Join Date: Mar 2004
Rookie Year: 2001
Location: West Chester, Pa.
Posts: 1,370
Gdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond reputeGdeaver has a reputation beyond repute
Re: ADC code effecting motor outs???

Refreshing the victors faster will not help. It's a limitation of the vectors. However, by generating the pulses with hardware could accomplish somethings with the hobby servos. The period could go below 1 ms and above 2 ms. This can give about 170 degree's on the model Hitec servo I have. The period generation can also be finer than the 8 bit values available with the default code. That may help with the resolution of the camera aiming.
  #17   Spotlight this post!  
Unread 28-03-2006, 15:12
Mike Bortfeldt Mike Bortfeldt is offline
Registered User
FRC #1126 (& 1511)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Rochester, NY
Posts: 119
Mike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud of
Re: ADC code effecting motor outs???

Gary,

Actually I wrote the code that way more for efficiency and to keep the footprint as small as possible. The first line, as Joel says, performs a multiplication that when used with the timer and CCP module determines the duration of the pulse. It is written in that particular manner to ensure that the compiler uses the 8x8 hardware multiplier (chapter 9 of the PIC18F8722 data sheet) rather than one of the math library routines to perform the operation. The result of the 8 bit multiply is automatically placed in the PROD register pair (this is a 1 instruction clock cycle operation). While I could have assigned a variable to receive the result of this multiplication (and cast the variables as ints), it was an unnecessary step as the next line can just as easily use the result from the PROD registers (10,000 = 1 millisecond). If you want, you can look in the generated .lst file to see how these statements are converted into assembly code. The relevant operation is the MULWF instruction and additional information on that can be found in chapter 26 (Instruction Set Summary) of the data sheet. (If you have some free time, take a look at what the C18 "WREG tracking" optimization does to the assembly code and how that would change the pulse width slightly)

Mike
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Out of the Box Camera Code russell Programming 9 21-10-2009 05:28
Analog-to-Digital Converter Code Kevin Watson Programming 29 17-02-2008 13:07
adc code problem railerobotics Programming 6 24-01-2006 22:26
Team THRUST - Kevin's Code and Camera Code Combine Chris_Elston Programming 3 31-01-2005 22:28
heres the code. y this not working omega Programming 16 31-03-2004 15:18


All times are GMT -5. The time now is 20:57.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi