Dynomotion

Group: DynoMotion Message: 5143 From: gracemckay Date: 6/4/2012
Subject: Progress, and a question...
Hi Tom,

I am making some progress on the scanner. I now have film moving through the system fairly well, and pretty consistently.I will come back to the transport for refinements after I get the camera trigger system working.

Here is what I have to work with: I have an Allen Bradley 845 encoder in the film path. I believe it has 2500 counts per rev, and it is driven by a sprocket with 18 teeth(frames) per rotation, so 2500/18=138.888889 counts per film frame. At each frame I need to trigger the camera to capture, and the light to flash. Each requires a 5v pulse to trigger. I have pins 9 and 10 available on JP7 for the triggers, and the encoder is configured on axis 1. I can see the counts in the axis screen. I need a way to vary the signals' timing to get perfect synchronization, and I may need to control to duration of the light flash.

Can you suggest some code to use the encoder to trigger the pulses I need? Do you see any problems with trying to do this this way?
Group: DynoMotion Message: 5144 From: Tom Kerekes Date: 6/4/2012
Subject: Re: Progress, and a question...
Hi Grace,
 
You didn't mention timing or positioning accuracy.  The simplest method would be to use software as something like shown below.
 
But this would have a time granularity of 180us.  A servo callback could reduce it to 90us.  Do you think this is adequate
 
Maybe you could adjust your recording speed to be a nearly exact multiple of 90us to get better results.
 
A Step/Dir Generator might be used as a more exact frequency generator.  This would basically involve commanding a motor axis to follow an encoder input.  This is very much like threading on a lathe where the Z motion must be slaved to the spindle position as measured by an encoder.
 
Actually if there is very little error in the servo motor that is moving the film, then the commanded position can be used instead of the measured position of the film.  If this is acceptable that then a dummy step/dir axis can be setup as a slave to the film axis with whatever the required SlaveGain to get the right output rate.
 
But the step/dir pulses are basically of fixed width 
 
Regards
TK
 
 
 
 
#include "KMotionDef.h"
#define FRAME 138.888889
#define FLASHBIT 2
#define CAMERABIT 3
main()
{
    double P = ch1->Position;
 
    for (;;)  // loop forever
    {
        P += FRAME;
  
        while (ch0->Position < P) // wait for encoder to advance
            WaitNextTimeSlice;
   
        SetBit(CAMERABIT);
        SetBit(FLASHBIT);
        Delay_sec(10e-6);
        ClearBit(FLASHBIT);
        ClearBit(CAMERABIT);
    }
}

Group: DynoMotion Message: 5152 From: gracemckay Date: 6/6/2012
Subject: Re: Progress, and a question...
Thanks Tom,

I am trying to work with the code you sent. I had expected to be able to
put a scope on pins 9 and 10, and get square waves at 5 volts. The
ground is hooked to pin 25. But this is not happening. I am not sure
what is wrong. I will upload my files to the scanner folder.

To answer your questions: timing and position accuracy. The max capture
speed of the camera is somewhere around 36 frames per second, so about
.0278 second. If I have my scale correct, that's about 28 milliseconds,
right? So that is about as accurate as the camera requires. The light
may need to be much faster, but 180us or 90us, either one, would work.
Position accuracy is important, the film frame is only about 4
millimeters in height, so that equates to our 138.whatever encoder
count. I'm not sure what a servo callback is but I'm game if I can make
it work. The actual recording speed is unimportant, as long at is within
the range of the camera and software. Right now that means pretty slow,
probably 6 frames a second. ( we have not set up a production capture
PC, using an older slower box for testing. speed can be ramped up later.

I'm not sure we could access the motor encoder, as it is wired the the
servo's step/dir amplifier and not to Kflop.

Anyway, thanks for your help. Please let me know what you think.

Grace




--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Grace,

> You didn't mention timing or positioning accuracy. The simplest
method would be to use software as something like shown below.

> But this would have a time granularity of 180us. A servo callback
could reduce it to 90us. Do you think this is adequate?

> Maybe you could adjust your recording speed to be a nearly exact
multiple of 90us to get better results.

> A Step/Dir Generator might be used as a more exact frequency
generator. This would basically involve commanding a motor axis to
follow an encoder input. This is very much like threading on a
lathe where the Z motion must be slaved to the spindle position as
measured by an encoder.

> Actually if there is very little error in the servo motor that is
moving the film, then the commanded position can be used instead of the
measured position of the film. If this is acceptable that then a dummy
step/dir axis can be setup as a slave to the film axis with whatever the
required SlaveGain to get the right output rate.

> But the step/dir pulses are basically of fixed width

> Regards
> TK


#include "KMotionDef.h"
#define FRAME 138.888889
#define FLASHBIT 2
#define CAMERABIT 3
main()
{
double P = ch1->Position;

for (;;) // loop forever
{
P += FRAME;

while (ch0->Position < P) // wait for encoder to advance
WaitNextTimeSlice;

SetBit(CAMERABIT);
SetBit(FLASHBIT);
Delay_sec(10e-6);
ClearBit(FLASHBIT);
ClearBit(CAMERABIT);

}



> From: gracemckay grace@...
> To: DynoMotion@yahoogroups.com
> Sent: Monday, June 4, 2012 1:20 PM
> Subject: [DynoMotion] Progress, and a question...

> Hi Tom,
>
> I am making some progress on the scanner. I now have film moving
through the system fairly well, and pretty consistently.I will come back
to the transport for refinements after I get the camera trigger system
working.
>
> Here is what I have to work with: I have an Allen Bradley 845 encoder
in the film path. I believe it has 2500 counts per rev, and it is driven
by a sprocket with 18 teeth(frames) per rotation, so 2500/18=138.888889
counts per film frame. At each frame I need to trigger the camera to
capture, and the light to flash. Each requires a 5v pulse to trigger. I
have pins 9 and 10 available on JP7 for the triggers, and the encoder is
configured on axis 1. I can see the counts in the axis screen. I need a
way to vary the signals' timing to get perfect synchronization, and I
may need to control to duration of the light flash.
>
> Can you suggest some code to use the encoder to trigger the pulses I
need? Do you see any problems with trying to do this this way?
>
Group: DynoMotion Message: 5153 From: Tom Kerekes Date: 6/6/2012
Subject: Re: Progress, and a question...
Hi Grace,
 
I was assuming you wanted to trigger from the encoder position so the program looks at:
 
ch1->Position
 
If there is no encoder connection then the Position will never change and hence no pulses.
 
Change that to the commanded Destination.
 
ch1->Dest
 
Actually there is a bug where we looked at ch0->Position one place and ch1->Position another place.  Set the axis channel number to whichever axis moves the film.
 
I would think a ~0.5% timing jitter on the flash strobe position would give a small but unacceptable image jitter.  But let's get this working first before you consider other techniques.
 
The term "square waves" normally implies pulses with 50% duty cycle.  The pulses are only 10us every 28 milliseconds so they would be tiny.  Increase the pulse time length to see them better if you need to.
 
Regards
TK 
 
 

Group: DynoMotion Message: 5156 From: gracemckay Date: 6/7/2012
Subject: Re: Progress, and a question...
H Tom,
I made you a video to help explain the machine. Here is a link http://www.scanbox.tv (too big for yahoo files)

Axis0 is the drive motor, and the encoder driven by the film is on Axis1 (there is no motor on axis1), so your assumption is correct that we want to trigger from the Axis1 encoder. The actual code is in the files section TriggerTesting-1.c

So I understand that it SHOULD work, and yet I have no pulses (AKA Rectangular Waves?)

So I think maybe I have an init problem, or some other problem in my code. The other file I am using to setup the other axes is also in the files area: CombinedAxis023-v1.c

Thanks, Grace




--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Grace,
>  
> I was assuming you wanted to trigger from the encoder position so the program looks at:
>  
> ch1->Position
>  
> If there is no encoder connection then the Position will never change and hence no pulses.
>  
> Change that to the commanded Destination.
>  
> ch1->Dest
>  
> Actually there is a bug where we looked at ch0->Position one place and ch1->Position another place.  Set the axis channel number to whichever axis moves the film.
>  
> I would think a ~0.5% timing jitter on the flash strobe position would give a small but unacceptable image jitter.  But let's get this working first before you consider other techniques.
>  
> The term "square waves" normally implies pulses with 50% duty cycle.  The pulses are only 10us every 28 milliseconds so they would be tiny.  Increase the pulse time length to see them better if you need to.
>  
> Regards
> TK 
>  
>  
>
>
> ________________________________
> From: gracemckay <grace@...>
> To: DynoMotion@yahoogroups.com
> Sent: Wednesday, June 6, 2012 4:49 PM
> Subject: [DynoMotion] Re: Progress, and a question...
>
>
>  
> Thanks Tom,
>
> I am trying to work with the code you sent. I had expected to be able to
> put a scope on pins 9 and 10, and get square waves at 5 volts. The
> ground is hooked to pin 25. But this is not happening. I am not sure
> what is wrong. I will upload my files to the scanner folder.
>
> To answer your questions: timing and position accuracy. The max capture
> speed of the camera is somewhere around 36 frames per second, so about
> .0278 second. If I have my scale correct, that's about 28 milliseconds,
> right? So that is about as accurate as the camera requires. The light
> may need to be much faster, but 180us or 90us, either one, would work.
> Position accuracy is important, the film frame is only about 4
> millimeters in height, so that equates to our 138.whatever encoder
> count. I'm not sure what a servo callback is but I'm game if I can make
> it work. The actual recording speed is unimportant, as long at is within
> the range of the camera and software. Right now that means pretty slow,
> probably 6 frames a second. ( we have not set up a production capture
> PC, using an older slower box for testing. speed can be ramped up later.
>
> I'm not sure we could access the motor encoder, as it is wired the the
> servo's step/dir amplifier and not to Kflop.
>
> Anyway, thanks for your help. Please let me know what you think.
>
> Grace
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Grace,
>
> > You didn't mention timing or positioning accuracy. The simplest
> method would be to use software as something like shown below.
>
> > But this would have a time granularity of 180us. A servo callback
> could reduce it to 90us. Do you think this is adequate?
>
> > Maybe you could adjust your recording speed to be a nearly exact
> multiple of 90us to get better results.
>
> > A Step/Dir Generator might be used as a more exact frequency
> generator. This would basically involve commanding a motor axis to
> follow an encoder input. This is very much like threading on a
> lathe where the Z motion must be slaved to the spindle position as
> measured by an encoder.
>
> > Actually if there is very little error in the servo motor that is
> moving the film, then the commanded position can be used instead of the
> measured position of the film. If this is acceptable that then a dummy
> step/dir axis can be setup as a slave to the film axis with whatever the
> required SlaveGain to get the right output rate.
>
> > But the step/dir pulses are basically of fixed width
>
> > Regards
> > TK
>
> #include "KMotionDef.h"
> #define FRAME 138.888889
> #define FLASHBIT 2
> #define CAMERABIT 3
> main()
> {
> double P = ch1->Position;
>
> for (;;) // loop forever
> {
> P += FRAME;
>
> while (ch0->Position < P) // wait for encoder to advance
> WaitNextTimeSlice;
>
> SetBit(CAMERABIT);
> SetBit(FLASHBIT);
> Delay_sec(10e-6);
> ClearBit(FLASHBIT);
> ClearBit(CAMERABIT);
>
> }
>
> > From: gracemckay grace@
> > To: DynoMotion@yahoogroups.com
> > Sent: Monday, June 4, 2012 1:20 PM
> > Subject: [DynoMotion] Progress, and a question...
>
> > Hi Tom,
> >
> > I am making some progress on the scanner. I now have film moving
> through the system fairly well, and pretty consistently.I will come back
> to the transport for refinements after I get the camera trigger system
> working.
> >
> > Here is what I have to work with: I have an Allen Bradley 845 encoder
> in the film path. I believe it has 2500 counts per rev, and it is driven
> by a sprocket with 18 teeth(frames) per rotation, so 2500/18=138.888889
> counts per film frame. At each frame I need to trigger the camera to
> capture, and the light to flash. Each requires a 5v pulse to trigger. I
> have pins 9 and 10 available on JP7 for the triggers, and the encoder is
> configured on axis 1. I can see the counts in the axis screen. I need a
> way to vary the signals' timing to get perfect synchronization, and I
> may need to control to duration of the light flash.
> >
> > Can you suggest some code to use the encoder to trigger the pulses I
> need? Do you see any problems with trying to do this this way?
> >
>
Group: DynoMotion Message: 5157 From: Tom Kerekes Date: 6/7/2012
Subject: Re: Progress, and a question...
Hi Grace,
 
The Video doesn't work for me - just a black screen.
 
You have Axis Channel 1 configured to use Encoder InpuChan0=0 was that intentional?  Or should that be 1?
 
When the Film is moving look at the Axis Screen does the Position change appropriately?  Which axis?
 
Regards
TK

From: gracemckay <grace@...>
To: DynoMotion@yahoogroups.com
Sent: Thursday, June 7, 2012 11:06 AM
Subject: [DynoMotion] Re: Progress, and a question...

 
H Tom,
I made you a video to help explain the machine. Here is a link http://www.scanbox.tv (too big for yahoo files)

Axis0 is the drive motor, and the encoder driven by the film is on Axis1 (there is no motor on axis1), so your assumption is correct that we want to trigger from the Axis1 encoder. The actual code is in the files section TriggerTesting-1.c

So I understand that it SHOULD work, and yet I have no pulses (AKA Rectangular Waves?)

So I think maybe I have an init problem, or some other problem in my code. The other file I am using to setup the other axes is also in the files area: CombinedAxis023-v1.c

Thanks, Grace



--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Grace,
>  
> I was assuming you wanted to trigger from the encoder position so the program looks at:
>  
> ch1->Position
>  
> If there is no encoder connection then the Position will never change and hence no pulses.
>  
> Change that to the commanded Destination.
>  
> ch1->Dest
>  
> Actually there is a bug where we looked at ch0->Position one place and ch1->Position another place.  Set the axis channel number to whichever axis moves the film.
>  
> I would think a ~0.5% timing jitter on the flash strobe position would give a small but unacceptable image jitter.  But let's get this working first before you consider other techniques.
>  
> The term "square waves" normally implies pulses with 50% duty cycle.  The pulses are only 10us every 28 milliseconds so they would be tiny.  Increase the pulse time length to see them better if you need to.
>  
> Regards
> TK 
>  
>  
>
>
> ________________________________
> From: gracemckay <grace@...>
> To: DynoMotion@yahoogroups.com
> Sent: Wednesday, June 6, 2012 4:49 PM
> Subject: [DynoMotion] Re: Progress, and a question...
>
>
>  
> Thanks Tom,
>
> I am trying to work with the code you sent. I had expected to be able to
> put a scope on pins 9 and 10, and get square waves at 5 volts. The
> ground is hooked to pin 25. But this is not happening. I am not sure
> what is wrong. I will upload my files to the scanner folder.
>
> To answer your questions: timing and position accuracy. The max capture
> speed of the camera is somewhere around 36 frames per second, so about
> .0278 second. If I have my scale correct, that's about 28 milliseconds,
> right? So that is about as accurate as the camera requires. The light
> may need to be much faster, but 180us or 90us, either one, would work.
> Position accuracy is important, the film frame is only about 4
> millimeters in height, so that equates to our 138.whatever encoder
> count. I'm not sure what a servo callback is but I'm game if I can make
> it work. The actual recording speed is unimportant, as long at is within
> the range of the camera and software. Right now that means pretty slow,
> probably 6 frames a second. ( we have not set up a production capture
> PC, using an older slower box for testing. speed can be ramped up later.
>
> I'm not sure we could access the motor encoder, as it is wired the the
> servo's step/dir amplifier and not to Kflop.
>
> Anyway, thanks for your help. Please let me know what you think.
>
> Grace
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Grace,
>
> > You didn't mention timing or positioning accuracy. The simplest
> method would be to use software as something like shown below.
>
> > But this would have a time granularity of 180us. A servo callback
> could reduce it to 90us. Do you think this is adequate?
>
> > Maybe you could adjust your recording speed to be a nearly exact
> multiple of 90us to get better results.
>
> > A Step/Dir Generator might be used as a more exact frequency
> generator. This would basically involve commanding a motor axis to
> follow an encoder input. This is very much like threading on a
> lathe where the Z motion must be slaved to the spindle position as
> measured by an encoder.
>
> > Actually if there is very little error in the servo motor that is
> moving the film, then the commanded position can be used instead of the
> measured position of the film. If this is acceptable that then a dummy
> step/dir axis can be setup as a slave to the film axis with whatever the
> required SlaveGain to get the right output rate.
>
> > But the step/dir pulses are basically of fixed width
>
> > Regards
> > TK
>
> #include "KMotionDef.h"
> #define FRAME 138.888889
> #define FLASHBIT 2
> #define CAMERABIT 3
> main()
> {
> double P = ch1->Position;
>
> for (;;) // loop forever
> {
> P += FRAME;
>
> while (ch0->Position < P) // wait for encoder to advance
> WaitNextTimeSlice;
>
> SetBit(CAMERABIT);
> SetBit(FLASHBIT);
> Delay_sec(10e-6);
> ClearBit(FLASHBIT);
> ClearBit(CAMERABIT);
>
> }
>
> > From: gracemckay grace@
> > To: DynoMotion@yahoogroups.com
> > Sent: Monday, June 4, 2012 1:20 PM
> > Subject: [DynoMotion] Progress, and a question...
>
> > Hi Tom,
> >
> > I am making some progress on the scanner. I now have film moving
> through the system fairly well, and pretty consistently.I will come back
> to the transport for refinements after I get the camera trigger system
> working.
> >
> > Here is what I have to work with: I have an Allen Bradley 845 encoder
> in the film path. I believe it has 2500 counts per rev, and it is driven
> by a sprocket with 18 teeth(frames) per rotation, so 2500/18=138.888889
> counts per film frame. At each frame I need to trigger the camera to
> capture, and the light to flash. Each requires a 5v pulse to trigger. I
> have pins 9 and 10 available on JP7 for the triggers, and the encoder is
> configured on axis 1. I can see the counts in the axis screen. I need a
> way to vary the signals' timing to get perfect synchronization, and I
> may need to control to duration of the light flash.
> >
> > Can you suggest some code to use the encoder to trigger the pulses I
> need? Do you see any problems with trying to do this this way?
> >
>



Group: DynoMotion Message: 5158 From: gracemckay Date: 6/7/2012
Subject: Re: Progress, and a question...
Sorry the video didn't work. I just uploaded it to Vimeo. Maybe you can see it there. https://vimeo.com/43629295

You are right about "Axis Channel 1 configured to use Encoder InpuChan0=0" It was intentional, but also a mistake. Axis 1 was supposed to be the Sprocket Encoder, but I had it wired to pins 7 and 8, which is apparently Axis0. I have now rewired to pins 9 and 10 and it is working there- showing encoder counts on the Axis screen at Position #1.

But now I need to use pins 7 and 8 for the triggers. So I assume the code should now be

#include "KMotionDef.h"
#define FRAME 138.888889
#define FLASHBIT 0 //Bit 0 corresponds to Pin7 JP7
#define CAMERABIT 1 //Bit 1 corresponds to Pin8 JP7

if I understand this correctly.

and the rest of the code is

double P = ch1->Position; //define P as position of channel 1

for (;;) // loop forever
{
P += FRAME; //position = position + frame

while (ch1->Position < P) // wait for encoder to advance
WaitNextTimeSlice;

SetBit(CAMERABIT);
SetBit(FLASHBIT);
Delay_sec(10e-6);
ClearBit(FLASHBIT);
ClearBit(CAMERABIT);

}

So, so far so good, BUT still no actual signals coming from pins 7 and 8.

Thanks, Grace




--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Grace,
>  
> The Video doesn't work for me - just a black screen.
>  
> You have Axis Channel 1 configured to use Encoder InpuChan0=0 was that intentional?  Or should that be 1?
>  
> When the Film is moving look at the Axis Screen does the Position change appropriately?  Which axis?
>  
> Regards
> TK
>
>
> ________________________________
> From: gracemckay <grace@...>
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, June 7, 2012 11:06 AM
> Subject: [DynoMotion] Re: Progress, and a question...
>
>
>
>  
>
> H Tom,
> I made you a video to help explain the machine. Here is a link http://www.scanbox.tv (too big for yahoo files)
>
> Axis0 is the drive motor, and the encoder driven by the film is on Axis1 (there is no motor on axis1), so your assumption is correct that we want to trigger from the Axis1 encoder. The actual code is in the files section TriggerTesting-1.c
>
> So I understand that it SHOULD work, and yet I have no pulses (AKA Rectangular Waves?)
>
> So I think maybe I have an init problem, or some other problem in my code. The other file I am using to setup the other axes is also in the files area: CombinedAxis023-v1.c
>
> Thanks, Grace
>
>
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Grace,
> >  
> > I was assuming you wanted to trigger from the encoder position so the program looks at:
> >  
> > ch1->Position
> >  
> > If there is no encoder connection then the Position will never change and hence no pulses.
> >  
> > Change that to the commanded Destination.
> >  
> > ch1->Dest
> >  
> > Actually there is a bug where we looked at ch0->Position one place and ch1->Position another place.  Set the axis channel number to whichever axis moves the film.
> >  
> > I would think a ~0.5% timing jitter on the flash strobe position would give a small but unacceptable image jitter.  But let's get this working first before you consider other techniques.
> >  
> > The term "square waves" normally implies pulses with 50% duty cycle.  The pulses are only 10us every 28 milliseconds so they would be tiny.  Increase the pulse time length to see them better if you need to.
> >  
> > Regards
> > TK 
> >  
> >  
> >
> >
> > ________________________________
> > From: gracemckay <grace@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Wednesday, June 6, 2012 4:49 PM
> > Subject: [DynoMotion] Re: Progress, and a question...
> >
> >
> >  
> > Thanks Tom,
> >
> > I am trying to work with the code you sent. I had expected to be able to
> > put a scope on pins 9 and 10, and get square waves at 5 volts. The
> > ground is hooked to pin 25. But this is not happening. I am not sure
> > what is wrong. I will upload my files to the scanner folder.
> >
> > To answer your questions: timing and position accuracy. The max capture
> > speed of the camera is somewhere around 36 frames per second, so about
> > .0278 second. If I have my scale correct, that's about 28 milliseconds,
> > right? So that is about as accurate as the camera requires. The light
> > may need to be much faster, but 180us or 90us, either one, would work.
> > Position accuracy is important, the film frame is only about 4
> > millimeters in height, so that equates to our 138.whatever encoder
> > count. I'm not sure what a servo callback is but I'm game if I can make
> > it work. The actual recording speed is unimportant, as long at is within
> > the range of the camera and software. Right now that means pretty slow,
> > probably 6 frames a second. ( we have not set up a production capture
> > PC, using an older slower box for testing. speed can be ramped up later.
> >
> > I'm not sure we could access the motor encoder, as it is wired the the
> > servo's step/dir amplifier and not to Kflop.
> >
> > Anyway, thanks for your help. Please let me know what you think.
> >
> > Grace
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Grace,
> >
> > > You didn't mention timing or positioning accuracy. The simplest
> > method would be to use software as something like shown below.
> >
> > > But this would have a time granularity of 180us. A servo callback
> > could reduce it to 90us. Do you think this is adequate?
> >
> > > Maybe you could adjust your recording speed to be a nearly exact
> > multiple of 90us to get better results.
> >
> > > A Step/Dir Generator might be used as a more exact frequency
> > generator. This would basically involve commanding a motor axis to
> > follow an encoder input. This is very much like threading on a
> > lathe where the Z motion must be slaved to the spindle position as
> > measured by an encoder.
> >
> > > Actually if there is very little error in the servo motor that is
> > moving the film, then the commanded position can be used instead of the
> > measured position of the film. If this is acceptable that then a dummy
> > step/dir axis can be setup as a slave to the film axis with whatever the
> > required SlaveGain to get the right output rate.
> >
> > > But the step/dir pulses are basically of fixed width
> >
> > > Regards
> > > TK
> >
> > #include "KMotionDef.h"
> > #define FRAME 138.888889
> > #define FLASHBIT 2
> > #define CAMERABIT 3
> > main()
> > {
> > double P = ch1->Position;
> >
> > for (;;) // loop forever
> > {
> > P += FRAME;
> >
> > while (ch0->Position < P) // wait for encoder to advance
> > WaitNextTimeSlice;
> >
> > SetBit(CAMERABIT);
> > SetBit(FLASHBIT);
> > Delay_sec(10e-6);
> > ClearBit(FLASHBIT);
> > ClearBit(CAMERABIT);
> >
> > }
> >
> > > From: gracemckay grace@
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Monday, June 4, 2012 1:20 PM
> > > Subject: [DynoMotion] Progress, and a question...
> >
> > > Hi Tom,
> > >
> > > I am making some progress on the scanner. I now have film moving
> > through the system fairly well, and pretty consistently.I will come back
> > to the transport for refinements after I get the camera trigger system
> > working.
> > >
> > > Here is what I have to work with: I have an Allen Bradley 845 encoder
> > in the film path. I believe it has 2500 counts per rev, and it is driven
> > by a sprocket with 18 teeth(frames) per rotation, so 2500/18=138.888889
> > counts per film frame. At each frame I need to trigger the camera to
> > capture, and the light to flash. Each requires a 5v pulse to trigger. I
> > have pins 9 and 10 available on JP7 for the triggers, and the encoder is
> > configured on axis 1. I can see the counts in the axis screen. I need a
> > way to vary the signals' timing to get perfect synchronization, and I
> > may need to control to duration of the light flash.
> > >
> > > Can you suggest some code to use the encoder to trigger the pulses I
> > need? Do you see any problems with trying to do this this way?
> > >
> >
>
Group: DynoMotion Message: 5159 From: Tom Kerekes Date: 6/7/2012
Subject: Re: Progress, and a question...
Hi Grace,
 
I think we might have just forgotten to set the bits as outputs.  Add:
 
SetBitDirection(FLASHBIT,1);
SetBitDirection(CAMERABIT,1);
 
btw it actually isn't necessary to enable axis 1 which has not motor, but is shouldn't hurt anything.
 
Nice video.
 
Regards
TK 

From: gracemckay <grace@...>
To: DynoMotion@yahoogroups.com
Sent: Thursday, June 7, 2012 2:26 PM
Subject: [DynoMotion] Re: Progress, and a question...

 
Sorry the video didn't work. I just uploaded it to Vimeo. Maybe you can see it there. https://vimeo.com/43629295

You are right about "Axis Channel 1 configured to use Encoder InpuChan0=0" It was intentional, but also a mistake. Axis 1 was supposed to be the Sprocket Encoder, but I had it wired to pins 7 and 8, which is apparently Axis0. I have now rewired to pins 9 and 10 and it is working there- showing encoder counts on the Axis screen at Position #1.

But now I need to use pins 7 and 8 for the triggers. So I assume the code should now be

#include "KMotionDef.h"
#define FRAME 138.888889
#define FLASHBIT 0 //Bit 0 corresponds to Pin7 JP7
#define CAMERABIT 1 //Bit 1 corresponds to Pin8 JP7

if I understand this correctly.

and the rest of the code is

double P = ch1->Position; //define P as position of channel 1

for (;;) // loop forever
{
P += FRAME; //position = position + frame

while (ch1->Position < P) // wait for encoder to advance
WaitNextTimeSlice;

SetBit(CAMERABIT);
SetBit(FLASHBIT);
Delay_sec(10e-6);
ClearBit(FLASHBIT);
ClearBit(CAMERABIT);

}

So, so far so good, BUT still no actual signals coming from pins 7 and 8.

Thanks, Grace

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Grace,
>  
> The Video doesn't work for me - just a black screen.
>  
> You have Axis Channel 1 configured to use Encoder InpuChan0=0 was that intentional?  Or should that be 1?
>  
> When the Film is moving look at the Axis Screen does the Position change appropriately?  Which axis?
>  
> Regards
> TK
>
>
> ________________________________
> From: gracemckay <grace@...>
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, June 7, 2012 11:06 AM
> Subject: [DynoMotion] Re: Progress, and a question...
>
>
>
>  
>
> H Tom,
> I made you a video to help explain the machine. Here is a link http://www.scanbox.tv (too big for yahoo files)
>
> Axis0 is the drive motor, and the encoder driven by the film is on Axis1 (there is no motor on axis1), so your assumption is correct that we want to trigger from the Axis1 encoder. The actual code is in the files section TriggerTesting-1.c
>
> So I understand that it SHOULD work, and yet I have no pulses (AKA Rectangular Waves?)
>
> So I think maybe I have an init problem, or some other problem in my code. The other file I am using to setup the other axes is also in the files area: CombinedAxis023-v1.c
>
> Thanks, Grace
>
>
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Grace,
> >  
> > I was assuming you wanted to trigger from the encoder position so the program looks at:
> >  
> > ch1->Position
> >  
> > If there is no encoder connection then the Position will never change and hence no pulses.
> >  
> > Change that to the commanded Destination.
> >  
> > ch1->Dest
> >  
> > Actually there is a bug where we looked at ch0->Position one place and ch1->Position another place.  Set the axis channel number to whichever axis moves the film.
> >  
> > I would think a ~0.5% timing jitter on the flash strobe position would give a small but unacceptable image jitter.  But let's get this working first before you consider other techniques.
> >  
> > The term "square waves" normally implies pulses with 50% duty cycle.  The pulses are only 10us every 28 milliseconds so they would be tiny.  Increase the pulse time length to see them better if you need to.
> >  
> > Regards
> > TK 
> >  
> >  
> >
> >
> > ________________________________
> > From: gracemckay <grace@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Wednesday, June 6, 2012 4:49 PM
> > Subject: [DynoMotion] Re: Progress, and a question...
> >
> >
> >  
> > Thanks Tom,
> >
> > I am trying to work with the code you sent. I had expected to be able to
> > put a scope on pins 9 and 10, and get square waves at 5 volts. The
> > ground is hooked to pin 25. But this is not happening. I am not sure
> > what is wrong. I will upload my files to the scanner folder.
> >
> > To answer your questions: timing and position accuracy. The max capture
> > speed of the camera is somewhere around 36 frames per second, so about
> > .0278 second. If I have my scale correct, that's about 28 milliseconds,
> > right? So that is about as accurate as the camera requires. The light
> > may need to be much faster, but 180us or 90us, either one, would work.
> > Position accuracy is important, the film frame is only about 4
> > millimeters in height, so that equates to our 138.whatever encoder
> > count. I'm not sure what a servo callback is but I'm game if I can make
> > it work. The actual recording speed is unimportant, as long at is within
> > the range of the camera and software. Right now that means pretty slow,
> > probably 6 frames a second. ( we have not set up a production capture
> > PC, using an older slower box for testing. speed can be ramped up later.
> >
> > I'm not sure we could access the motor encoder, as it is wired the the
> > servo's step/dir amplifier and not to Kflop.
> >
> > Anyway, thanks for your help. Please let me know what you think.
> >
> > Grace
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Grace,
> >
> > > You didn't mention timing or positioning accuracy. The simplest
> > method would be to use software as something like shown below.
> >
> > > But this would have a time granularity of 180us. A servo callback
> > could reduce it to 90us. Do you think this is adequate?
> >
> > > Maybe you could adjust your recording speed to be a nearly exact
> > multiple of 90us to get better results.
> >
> > > A Step/Dir Generator might be used as a more exact frequency
> > generator. This would basically involve commanding a motor axis to
> > follow an encoder input. This is very much like threading on a
> > lathe where the Z motion must be slaved to the spindle position as
> > measured by an encoder.
> >
> > > Actually if there is very little error in the servo motor that is
> > moving the film, then the commanded position can be used instead of the
> > measured position of the film. If this is acceptable that then a dummy
> > step/dir axis can be setup as a slave to the film axis with whatever the
> > required SlaveGain to get the right output rate.
> >
> > > But the step/dir pulses are basically of fixed width
> >
> > > Regards
> > > TK
> >
> > #include "KMotionDef.h"
> > #define FRAME 138.888889
> > #define FLASHBIT 2
> > #define CAMERABIT 3
> > main()
> > {
> > double P = ch1->Position;
> >
> > for (;;) // loop forever
> > {
> > P += FRAME;
> >
> > while (ch0->Position < P) // wait for encoder to advance
> > WaitNextTimeSlice;
> >
> > SetBit(CAMERABIT);
> > SetBit(FLASHBIT);
> > Delay_sec(10e-6);
> > ClearBit(FLASHBIT);
> > ClearBit(CAMERABIT);
> >
> > }
> >
> > > From: gracemckay grace@
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Monday, June 4, 2012 1:20 PM
> > > Subject: [DynoMotion] Progress, and a question...
> >
> > > Hi Tom,
> > >
> > > I am making some progress on the scanner. I now have film moving
> > through the system fairly well, and pretty consistently.I will come back
> > to the transport for refinements after I get the camera trigger system
> > working.
> > >
> > > Here is what I have to work with: I have an Allen Bradley 845 encoder
> > in the film path. I believe it has 2500 counts per rev, and it is driven
> > by a sprocket with 18 teeth(frames) per rotation, so 2500/18=138.888889
> > counts per film frame. At each frame I need to trigger the camera to
> > capture, and the light to flash. Each requires a 5v pulse to trigger. I
> > have pins 9 and 10 available on JP7 for the triggers, and the encoder is
> > configured on axis 1. I can see the counts in the axis screen. I need a
> > way to vary the signals' timing to get perfect synchronization, and I
> > may need to control to duration of the light flash.
> > >
> > > Can you suggest some code to use the encoder to trigger the pulses I
> > need? Do you see any problems with trying to do this this way?
> > >
> >
>



Group: DynoMotion Message: 5813 From: gracemckay Date: 10/18/2012
Subject: Re: Progress, and a question...
Hi Tom,

I am finally ready to continue on this code. I had to update our capture computer to a really fast system, capable of capturing the data rates that the camera was transmitting. I now have that in place and I have the teaming connectivity working, so the camera system is now in tip-top condition.

We left this code example kind of unfinished. But it is now working to trigger the camera and light effectively--here is the working code

#include "KMotionDef.h"
#define FRAME 625 //constant based on 10000 counts per rev
//and 16 teeth per rev for SUPER8
#define FLASHBIT 0 //Bit 0 corresponds to Pin7 JP7
#define CAMERABIT 1 //Bit 1 corresponds to Pin8 JP7

main()
{
SetBitDirection(FLASHBIT,1); //Sets bit 0 to output
SetBitDirection(CAMERABIT,1); //Sets bit 1 to output
Zero(1); //Sets channel 1 encoder count to zero
double P = ch1->Position; //define P as position of channel 1

Jog(0,1000); // start moving

for (;;) // loop forever

{
P += FRAME; //position = position + frame

while (ch1->Position < P) // wait for encoder to advance
WaitNextTimeSlice;


SetBit(FLASHBIT); //turns led light on
SetBit(CAMERABIT); //triggers camera capture

ClearBit(CAMERABIT); //clears camera capture
Delay_sec(.005); //This sets the light duration and exposure
// Delay_sec(10e-6); //Tom's original delay code

ClearBit(FLASHBIT); //turns led light off
}
}


So here is my next question. I need a way to adjust the framing up and down during a capture, which means within the loop in the above code. I am thinking of an additional rotary encoder in a control panel to do this. Can I send the encoder output-- basically up or down-- to a memory register, and then read it inside the loop somehow? I think my constant FRAME needs to be a variable that can change up or down by a small amount to adjust the timing of the capture. Can you suggest code to get me on the right path?

Grace McKay






--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Grace,
>  
> I think we might have just forgotten to set the bits as outputs.  Add:
>  
> SetBitDirection(FLASHBIT,1);
> SetBitDirection(CAMERABIT,1);
>  
> btw it actually isn't necessary to enable axis 1 which has not motor, but is shouldn't hurt anything.
>  
> Nice video.
>  
> Regards
> TK 
>
>
> ________________________________
> From: gracemckay <grace@...>
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, June 7, 2012 2:26 PM
> Subject: [DynoMotion] Re: Progress, and a question...
>
>
>
>  
>
> Sorry the video didn't work. I just uploaded it to Vimeo. Maybe you can see it there. https://vimeo.com/43629295
>
> You are right about "Axis Channel 1 configured to use Encoder InpuChan0=0" It was intentional, but also a mistake. Axis 1 was supposed to be the Sprocket Encoder, but I had it wired to pins 7 and 8, which is apparently Axis0. I have now rewired to pins 9 and 10 and it is working there- showing encoder counts on the Axis screen at Position #1.
>
> But now I need to use pins 7 and 8 for the triggers. So I assume the code should now be
>
> #include "KMotionDef.h"
> #define FRAME 138.888889
> #define FLASHBIT 0 //Bit 0 corresponds to Pin7 JP7
> #define CAMERABIT 1 //Bit 1 corresponds to Pin8 JP7
>
> if I understand this correctly.
>
> and the rest of the code is
>
> double P = ch1->Position; //define P as position of channel 1
>
> for (;;) // loop forever
> {
> P += FRAME; //position = position + frame
>
> while (ch1->Position < P) // wait for encoder to advance
> WaitNextTimeSlice;
>
> SetBit(CAMERABIT);
> SetBit(FLASHBIT);
> Delay_sec(10e-6);
> ClearBit(FLASHBIT);
> ClearBit(CAMERABIT);
>
> }
>
> So, so far so good, BUT still no actual signals coming from pins 7 and 8.
>
> Thanks, Grace
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Grace,
> >  
> > The Video doesn't work for me - just a black screen.
> >  
> > You have Axis Channel 1 configured to use Encoder InpuChan0=0 was that intentional?  Or should that be 1?
> >  
> > When the Film is moving look at the Axis Screen does the Position change appropriately?  Which axis?
> >  
> > Regards
> > TK
> >
> >
> > ________________________________
> > From: gracemckay <grace@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Thursday, June 7, 2012 11:06 AM
> > Subject: [DynoMotion] Re: Progress, and a question...
> >
> >
> >
> >  
> >
> > H Tom,
> > I made you a video to help explain the machine. Here is a link http://www.scanbox.tv (too big for yahoo files)
> >
> > Axis0 is the drive motor, and the encoder driven by the film is on Axis1 (there is no motor on axis1), so your assumption is correct that we want to trigger from the Axis1 encoder. The actual code is in the files section TriggerTesting-1.c
> >
> > So I understand that it SHOULD work, and yet I have no pulses (AKA Rectangular Waves?)
> >
> > So I think maybe I have an init problem, or some other problem in my code. The other file I am using to setup the other axes is also in the files area: CombinedAxis023-v1.c
> >
> > Thanks, Grace
> >
> >
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Grace,
> > >  
> > > I was assuming you wanted to trigger from the encoder position so the program looks at:
> > >  
> > > ch1->Position
> > >  
> > > If there is no encoder connection then the Position will never change and hence no pulses.
> > >  
> > > Change that to the commanded Destination.
> > >  
> > > ch1->Dest
> > >  
> > > Actually there is a bug where we looked at ch0->Position one place and ch1->Position another place.  Set the axis channel number to whichever axis moves the film.
> > >  
> > > I would think a ~0.5% timing jitter on the flash strobe position would give a small but unacceptable image jitter.  But let's get this working first before you consider other techniques.
> > >  
> > > The term "square waves" normally implies pulses with 50% duty cycle.  The pulses are only 10us every 28 milliseconds so they would be tiny.  Increase the pulse time length to see them better if you need to.
> > >  
> > > Regards
> > > TK 
> > >  
> > >  
> > >
> > >
> > > ________________________________
> > > From: gracemckay <grace@>
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Wednesday, June 6, 2012 4:49 PM
> > > Subject: [DynoMotion] Re: Progress, and a question...
> > >
> > >
> > >  
> > > Thanks Tom,
> > >
> > > I am trying to work with the code you sent. I had expected to be able to
> > > put a scope on pins 9 and 10, and get square waves at 5 volts. The
> > > ground is hooked to pin 25. But this is not happening. I am not sure
> > > what is wrong. I will upload my files to the scanner folder.
> > >
> > > To answer your questions: timing and position accuracy. The max capture
> > > speed of the camera is somewhere around 36 frames per second, so about
> > > .0278 second. If I have my scale correct, that's about 28 milliseconds,
> > > right? So that is about as accurate as the camera requires. The light
> > > may need to be much faster, but 180us or 90us, either one, would work.
> > > Position accuracy is important, the film frame is only about 4
> > > millimeters in height, so that equates to our 138.whatever encoder
> > > count. I'm not sure what a servo callback is but I'm game if I can make
> > > it work. The actual recording speed is unimportant, as long at is within
> > > the range of the camera and software. Right now that means pretty slow,
> > > probably 6 frames a second. ( we have not set up a production capture
> > > PC, using an older slower box for testing. speed can be ramped up later.
> > >
> > > I'm not sure we could access the motor encoder, as it is wired the the
> > > servo's step/dir amplifier and not to Kflop.
> > >
> > > Anyway, thanks for your help. Please let me know what you think.
> > >
> > > Grace
> > >
> > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > >
> > > > Hi Grace,
> > >
> > > > You didn't mention timing or positioning accuracy. The simplest
> > > method would be to use software as something like shown below.
> > >
> > > > But this would have a time granularity of 180us. A servo callback
> > > could reduce it to 90us. Do you think this is adequate?
> > >
> > > > Maybe you could adjust your recording speed to be a nearly exact
> > > multiple of 90us to get better results.
> > >
> > > > A Step/Dir Generator might be used as a more exact frequency
> > > generator. This would basically involve commanding a motor axis to
> > > follow an encoder input.ÃÆ'‚ This is very much like threading on a
> > > lathe where the Z motion must be slaved to the spindle position as
> > > measured by an encoder.
> > >
> > > > Actually if there is very little error in the servo motor that is
> > > moving the film, then the commanded position can be used instead of the
> > > measured position of the film. If this is acceptable that then a dummy
> > > step/dir axis can be setup as a slave to the film axis with whatever the
> > > required SlaveGain to get the right output rate.
> > >
> > > > But the step/dir pulses are basically of fixed width
> > >
> > > > Regards
> > > > TK
> > >
> > > #include "KMotionDef.h"
> > > #define FRAME 138.888889
> > > #define FLASHBIT 2
> > > #define CAMERABIT 3
> > > main()
> > > {
> > > double P = ch1->Position;
> > >
> > > for (;;) // loop forever
> > > {
> > > P += FRAME;
> > >
> > > while (ch0->Position < P) // wait for encoder to advance
> > > WaitNextTimeSlice;
> > >
> > > SetBit(CAMERABIT);
> > > SetBit(FLASHBIT);
> > > Delay_sec(10e-6);
> > > ClearBit(FLASHBIT);
> > > ClearBit(CAMERABIT);
> > >
> > > }
> > >
> > > > From: gracemckay grace@
> > > > To: DynoMotion@yahoogroups.com
> > > > Sent: Monday, June 4, 2012 1:20 PM
> > > > Subject: [DynoMotion] Progress, and a question...
> > >
> > > > Hi Tom,
> > > >
> > > > I am making some progress on the scanner. I now have film moving
> > > through the system fairly well, and pretty consistently.I will come back
> > > to the transport for refinements after I get the camera trigger system
> > > working.
> > > >
> > > > Here is what I have to work with: I have an Allen Bradley 845 encoder
> > > in the film path. I believe it has 2500 counts per rev, and it is driven
> > > by a sprocket with 18 teeth(frames) per rotation, so 2500/18=138.888889
> > > counts per film frame. At each frame I need to trigger the camera to
> > > capture, and the light to flash. Each requires a 5v pulse to trigger. I
> > > have pins 9 and 10 available on JP7 for the triggers, and the encoder is
> > > configured on axis 1. I can see the counts in the axis screen. I need a
> > > way to vary the signals' timing to get perfect synchronization, and I
> > > may need to control to duration of the light flash.
> > > >
> > > > Can you suggest some code to use the encoder to trigger the pulses I
> > > need? Do you see any problems with trying to do this this way?
> > > >
> > >
> >
>
Group: DynoMotion Message: 5814 From: Tom Kerekes Date: 10/18/2012
Subject: Re: Progress, and a question...
Hi Grace,

The first step would be to connect your thumb wheel encoder to some hardware encoder input.  Then configure some unused axis channel to (ie ch7) as encoder input of that encoder.  ch7->Position would then be your offset value.  Verify on the Axis Screen that the Position changes appropriately.  You might also configure ch7->InputGain0 to scale the value as needed.

Then I think you could just change the line
while (ch1->Position < P) // wait for encoder to advance

to

while (ch1->Position + ch7->Position < P) // wait for encoder to advance

Unless I'm not understanding I think you need to add an offset like this rather than change FRAME which would be a scale effect and cause the image to "roll" at a set speed.

Regards
TK


Group: DynoMotion Message: 5815 From: gracemckay Date: 10/18/2012
Subject: Re: Progress, and a question...
Thanks Tom,

I have the encoder hooked to JP7 Pins 5 and 6, which correspond to IO 44 and 45. I am getting a response from the encoder on the Digital I/O screen.

But I am stuck on how to hook IO44 and 45 to Axis 7. I think I used to know this, but today, I don't remember, and I haven't yet found it in the docs.

Can you help?

Grace



--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Grace,
>
> The first step would be to connect your thumb wheel encoder to some hardware encoder input.  Then configure some unused axis channel to (ie ch7) as encoder input of that encoder.  ch7->Position would then be your offset value.  Verify on the Axis Screen that the Position changes appropriately.  You might also configure ch7->InputGain0 to scale the value as needed.
>
> Then I think you could just change the line
>
>
> while (ch1->Position < P) // wait for encoder to advance
>
> to
>
> while (ch1->Position + ch7->Position < P) // wait for encoder to advance
>
> Unless I'm not understanding I think you need to add an offset like this rather than change FRAME which would be a scale effect and cause the image to "roll" at a set speed.
>
>
> Regards
> TK
>
>
>
>
> ________________________________
> From: gracemckay <grace@...>
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, October 18, 2012 8:54 AM
> Subject: [DynoMotion] Re: Progress, and a question...
>
>
>  
> Hi Tom,
>
> I am finally ready to continue on this code. I had to update our capture computer to a really fast system, capable of capturing the data rates that the camera was transmitting. I now have that in place and I have the teaming connectivity working, so the camera system is now in tip-top condition.
>
> We left this code example kind of unfinished. But it is now working to trigger the camera and light effectively--here is the working code
>
> #include "KMotionDef.h"
> #define FRAME 625 //constant based on 10000 counts per rev
> //and 16 teeth per rev for SUPER8
> #define FLASHBIT 0 //Bit 0 corresponds to Pin7 JP7
> #define CAMERABIT 1 //Bit 1 corresponds to Pin8 JP7
>
> main()
> {
> SetBitDirection(FLASHBIT,1); //Sets bit 0 to output
> SetBitDirection(CAMERABIT,1); //Sets bit 1 to output
> Zero(1); //Sets channel 1 encoder count to zero
> double P = ch1->Position; //define P as position of channel 1
>
> Jog(0,1000); // start moving
>
> for (;;) // loop forever
>
> {
> P += FRAME; //position = position + frame
>
> while (ch1->Position < P) // wait for encoder to advance
> WaitNextTimeSlice;
>
>
> SetBit(FLASHBIT); //turns led light on
> SetBit(CAMERABIT); //triggers camera capture
>
> ClearBit(CAMERABIT); //clears camera capture
> Delay_sec(.005); //This sets the light duration and exposure
> // Delay_sec(10e-6); //Tom's original delay code
>
> ClearBit(FLASHBIT); //turns led light off
> }
> }
>
> So here is my next question. I need a way to adjust the framing up and down during a capture, which means within the loop in the above code. I am thinking of an additional rotary encoder in a control panel to do this. Can I send the encoder output-- basically up or down-- to a memory register, and then read it inside the loop somehow? I think my constant FRAME needs to be a variable that can change up or down by a small amount to adjust the timing of the capture. Can you suggest code to get me on the right path?
>
> Grace McKay
>
> --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Grace,
> >  
> > I think we might have just forgotten to set the bits as outputs.  Add:
> >  
> > SetBitDirection(FLASHBIT,1);
> > SetBitDirection(CAMERABIT,1);
> >  
> > btw it actually isn't necessary to enable axis 1 which has not motor, but is shouldn't hurt anything.
> >  
> > Nice video.
> >  
> > Regards
> > TK 
> >
> >
> > ________________________________
> > From: gracemckay <grace@>
> > To: DynoMotion@yahoogroups.com
> > Sent: Thursday, June 7, 2012 2:26 PM
> > Subject: [DynoMotion] Re: Progress, and a question...
> >
> >
> >
> >  
> >
> > Sorry the video didn't work. I just uploaded it to Vimeo. Maybe you can see it there. https://vimeo.com/43629295
> >
> > You are right about "Axis Channel 1 configured to use Encoder InpuChan0=0" It was intentional, but also a mistake. Axis 1 was supposed to be the Sprocket Encoder, but I had it wired to pins 7 and 8, which is apparently Axis0. I have now rewired to pins 9 and 10 and it is working there- showing encoder counts on the Axis screen at Position #1.
> >
> > But now I need to use pins 7 and 8 for the triggers. So I assume the code should now be
> >
> > #include "KMotionDef.h"
> > #define FRAME 138.888889
> > #define FLASHBIT 0 //Bit 0 corresponds to Pin7 JP7
> > #define CAMERABIT 1 //Bit 1 corresponds to Pin8 JP7
> >
> > if I understand this correctly.
> >
> > and the rest of the code is
> >
> > double P = ch1->Position; //define P as position of channel 1
> >
> > for (;;) // loop forever
> > {
> > P += FRAME; //position = position + frame
> >
> > while (ch1->Position < P) // wait for encoder to advance
> > WaitNextTimeSlice;
> >
> > SetBit(CAMERABIT);
> > SetBit(FLASHBIT);
> > Delay_sec(10e-6);
> > ClearBit(FLASHBIT);
> > ClearBit(CAMERABIT);
> >
> > }
> >
> > So, so far so good, BUT still no actual signals coming from pins 7 and 8.
> >
> > Thanks, Grace
> >
> > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Grace,
> > >  
> > > The Video doesn't work for me - just a black screen.
> > >  
> > > You have Axis Channel 1 configured to use Encoder InpuChan0=0 was that intentional?  Or should that be 1?
> > >  
> > > When the Film is moving look at the Axis Screen does the Position change appropriately?  Which axis?
> > >  
> > > Regards
> > > TK
> > >
> > >
> > > ________________________________
> > > From: gracemckay <grace@>
> > > To: DynoMotion@yahoogroups.com
> > > Sent: Thursday, June 7, 2012 11:06 AM
> > > Subject: [DynoMotion] Re: Progress, and a question...
> > >
> > >
> > >
> > >  
> > >
> > > H Tom,
> > > I made you a video to help explain the machine. Here is a link http://www.scanbox.tv (too big for yahoo files)
> > >
> > > Axis0 is the drive motor, and the encoder driven by the film is on Axis1 (there is no motor on axis1), so your assumption is correct that we want to trigger from the Axis1 encoder. The actual code is in the files section TriggerTesting-1.c
> > >
> > > So I understand that it SHOULD work, and yet I have no pulses (AKA Rectangular Waves?)
> > >
> > > So I think maybe I have an init problem, or some other problem in my code. The other file I am using to setup the other axes is also in the files area: CombinedAxis023-v1.c
> > >
> > > Thanks, Grace
> > >
> > >
> > >
> > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > >
> > > > Hi Grace,
> > > > ÃÆ'‚ 
> > > > I was assuming you wanted to trigger from the encoder position so the program looks at:
> > > > ÃÆ'‚ 
> > > > ch1->Position
> > > > ÃÆ'‚ 
> > > > If there is no encoder connection then the Position will never change and hence no pulses.
> > > > ÃÆ'‚ 
> > > > Change that to the commanded Destination.
> > > > ÃÆ'‚ 
> > > > ch1->Dest
> > > > ÃÆ'‚ 
> > > > Actually there is a bug where we looked at ch0->Position one place and ch1->Position another place.ÃÆ'‚  Set the axis channel number to whichever axis moves the film.
> > > > ÃÆ'‚ 
> > > > I would think a ~0.5% timing jitter on the flash strobe position would give a small but unacceptable image jitter.ÃÆ'‚  But let's get this working first before you consider other techniques.
> > > > ÃÆ'‚ 
> > > > The term "square waves" normally implies pulses with 50% duty cycle.ÃÆ'‚  The pulses are only 10us every 28 milliseconds so they would be tiny.ÃÆ'‚  Increase the pulse time lengthÃÆ'‚ to see them better if you need to.
> > > > ÃÆ'‚ 
> > > > Regards
> > > > TKÃÆ'‚ 
> > > > ÃÆ'‚ 
> > > > ÃÆ'‚ 
> > > >
> > > >
> > > > ________________________________
> > > > From: gracemckay <grace@>
> > > > To: DynoMotion@yahoogroups.com
> > > > Sent: Wednesday, June 6, 2012 4:49 PM
> > > > Subject: [DynoMotion] Re: Progress, and a question...
> > > >
> > > >
> > > > ÃÆ'‚ 
> > > > Thanks Tom,
> > > >
> > > > I am trying to work with the code you sent. I had expected to be able to
> > > > put a scope on pins 9 and 10, and get square waves at 5 volts. The
> > > > ground is hooked to pin 25. But this is not happening. I am not sure
> > > > what is wrong. I will upload my files to the scanner folder.
> > > >
> > > > To answer your questions: timing and position accuracy. The max capture
> > > > speed of the camera is somewhere around 36 frames per second, so about
> > > > .0278 second. If I have my scale correct, that's about 28 milliseconds,
> > > > right? So that is about as accurate as the camera requires. The light
> > > > may need to be much faster, but 180us or 90us, either one, would work.
> > > > Position accuracy is important, the film frame is only about 4
> > > > millimeters in height, so that equates to our 138.whatever encoder
> > > > count. I'm not sure what a servo callback is but I'm game if I can make
> > > > it work. The actual recording speed is unimportant, as long at is within
> > > > the range of the camera and software. Right now that means pretty slow,
> > > > probably 6 frames a second. ( we have not set up a production capture
> > > > PC, using an older slower box for testing. speed can be ramped up later.
> > > >
> > > > I'm not sure we could access the motor encoder, as it is wired the the
> > > > servo's step/dir amplifier and not to Kflop.
> > > >
> > > > Anyway, thanks for your help. Please let me know what you think.
> > > >
> > > > Grace
> > > >
> > > > --- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > > >
> > > > > Hi Grace,
> > > >
> > > > > You didn't mention timing or positioning accuracy. The simplest
> > > > method would be to use software as something like shown below.
> > > >
> > > > > But this would have a time granularity of 180us. A servo callback
> > > > could reduce it to 90us. Do you think this is adequate?
> > > >
> > > > > Maybe you could adjust your recording speed to be a nearly exact
> > > > multiple of 90us to get better results.
> > > >
> > > > > A Step/Dir Generator might be used as a more exact frequency
> > > > generator. This would basically involve commanding a motor axis to
> > > > follow an encoder input.ÃÆ'Æ'‚ This is very much like threading on a
> > > > lathe where the Z motion must be slaved to the spindle position as
> > > > measured by an encoder.
> > > >
> > > > > Actually if there is very little error in the servo motor that is
> > > > moving the film, then the commanded position can be used instead of the
> > > > measured position of the film. If this is acceptable that then a dummy
> > > > step/dir axis can be setup as a slave to the film axis with whatever the
> > > > required SlaveGain to get the right output rate.
> > > >
> > > > > But the step/dir pulses are basically of fixed width
> > > >
> > > > > Regards
> > > > > TK
> > > >
> > > > #include "KMotionDef.h"
> > > > #define FRAME 138.888889
> > > > #define FLASHBIT 2
> > > > #define CAMERABIT 3
> > > > main()
> > > > {
> > > > double P = ch1->Position;
> > > >
> > > > for (;;) // loop forever
> > > > {
> > > > P += FRAME;
> > > >
> > > > while (ch0->Position < P) // wait for encoder to advance
> > > > WaitNextTimeSlice;
> > > >
> > > > SetBit(CAMERABIT);
> > > > SetBit(FLASHBIT);
> > > > Delay_sec(10e-6);
> > > > ClearBit(FLASHBIT);
> > > > ClearBit(CAMERABIT);
> > > >
> > > > }
> > > >
> > > > > From: gracemckay grace@
> > > > > To: DynoMotion@yahoogroups.com
> > > > > Sent: Monday, June 4, 2012 1:20 PM
> > > > > Subject: [DynoMotion] Progress, and a question...
> > > >
> > > > > Hi Tom,
> > > > >
> > > > > I am making some progress on the scanner. I now have film moving
> > > > through the system fairly well, and pretty consistently.I will come back
> > > > to the transport for refinements after I get the camera trigger system
> > > > working.
> > > > >
> > > > > Here is what I have to work with: I have an Allen Bradley 845 encoder
> > > > in the film path. I believe it has 2500 counts per rev, and it is driven
> > > > by a sprocket with 18 teeth(frames) per rotation, so 2500/18=138.888889
> > > > counts per film frame. At each frame I need to trigger the camera to
> > > > capture, and the light to flash. Each requires a 5v pulse to trigger. I
> > > > have pins 9 and 10 available on JP7 for the triggers, and the encoder is
> > > > configured on axis 1. I can see the counts in the axis screen. I need a
> > > > way to vary the signals' timing to get perfect synchronization, and I
> > > > may need to control to duration of the light flash.
> > > > >
> > > > > Can you suggest some code to use the encoder to trigger the pulses I
> > > > need? Do you see any problems with trying to do this this way?
> > > > >
> > > >
> > >
> >
>
Group: DynoMotion Message: 5816 From: Tom Kerekes Date: 10/18/2012
Subject: Re: Progress, and a question...
Hi Grace,
 
The KFLOP Hardware encoder counters are wired to fixed pins.  There is an option to mux the JP7 encoder signals over to JP4 and another option to mux the JP5 encoder signals over to JP6.   But there isn't an option for using IO44 and IO45 as a hardware encoder signal.  It is however possible to use C code to count the encoder position using software.  The advantage is that any IO pins can be used.  Speed is limited but normally more than adequate for a manual MPG.  See the MPGSmooth.c example of how to count encoder position in software.  The code that watches the two IO bits and counts the encoder position would need to be merged into your frame sync loop.
 
Regards
TK


Group: DynoMotion Message: 5818 From: gracemckay Date: 10/19/2012
Subject: Re: Progress, and a question...
OK, that helped me figure it out. I moved the light and camera triggers to pins 4 and 5, and used 6 and 7 for the encoder. And that was the missing link. So it is working now, and perfectly thanks!
Thank you again!

Grace

--- In DynoMotion@yahoogroups.com, Tom Kerekes <tk@...> wrote:
>
> Hi Grace,
>  
> The KFLOP Hardware encoder counters are wired to fixed pins.  There is an option to mux the JP7 encoder signals over to JP4 and another option to mux the JP5 encoder signals over to JP6.   But there isn't an option for using IO44 and IO45 as a hardware encoder signal.  It is however possible to use C code to count the encoder position using software.  The advantage is that any IO pins can be used.  Speed is limited but normally more than adequate for a manual MPG.  See the MPGSmooth.c example of how to count encoder position in software.  The code that watches the two IO bits and counts the encoder position would need to be merged into your frame sync loop.
>  
> Regards
> TK
>
>
>
> ________________________________
> From: gracemckay <grace@...>
> To: DynoMotion@yahoogroups.com
> Sent: Thursday, October 18, 2012 2:08 PM
> Subject: [DynoMotion] Re: Progress, and a question...
>
>  
> Thanks Tom,
>
> I have the encoder hooked to JP7 Pins 5 and 6, which correspond to IO 44 and 45. I am getting a response from the encoder on the Digital I/O screen.
>
> But I am stuck on how to hook IO44 and 45 to Axis 7. I think I used to know this, but today, I don't remember, and I haven't yet found it in the docs.
>
> Can you help?
>
> Grace
>
> --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> >
> > Hi Grace,
> >
> > The first step would be to connect your thumb wheel encoder to some hardware encoder input.  Then configure some unused axis channel to (ie ch7) as encoder input of that encoder.  ch7->Position would then be your offset value.  Verify on the Axis Screen that the Position changes appropriately.  You might also configure ch7->InputGain0 to scale the value as needed.
> >
> > Then I think you could just change the line
> >
> >
> > while (ch1->Position < P) // wait for encoder to advance
> >
> > to
> >
> > while (ch1->Position + ch7->Position < P) // wait for encoder to advance
> >
> > Unless I'm not understanding I think you need to add an offset like this rather than change FRAME which would be a scale effect and cause the image to "roll" at a set speed.
> >
> >
> > Regards
> > TK
> >
> >
> >
> >
> > ________________________________
> > From: gracemckay <grace@>
> > To: mailto:DynoMotion%40yahoogroups.com
> > Sent: Thursday, October 18, 2012 8:54 AM
> > Subject: [DynoMotion] Re: Progress, and a question...
> >
> >
> >  
> > Hi Tom,
> >
> > I am finally ready to continue on this code. I had to update our capture computer to a really fast system, capable of capturing the data rates that the camera was transmitting. I now have that in place and I have the teaming connectivity working, so the camera system is now in tip-top condition.
> >
> > We left this code example kind of unfinished. But it is now working to trigger the camera and light effectively--here is the working code
> >
> > #include "KMotionDef.h"
> > #define FRAME 625 //constant based on 10000 counts per rev
> > //and 16 teeth per rev for SUPER8
> > #define FLASHBIT 0 //Bit 0 corresponds to Pin7 JP7
> > #define CAMERABIT 1 //Bit 1 corresponds to Pin8 JP7
> >
> > main()
> > {
> > SetBitDirection(FLASHBIT,1); //Sets bit 0 to output
> > SetBitDirection(CAMERABIT,1); //Sets bit 1 to output
> > Zero(1); //Sets channel 1 encoder count to zero
> > double P = ch1->Position; //define P as position of channel 1
> >
> > Jog(0,1000); // start moving
> >
> > for (;;) // loop forever
> >
> > {
> > P += FRAME; //position = position + frame
> >
> > while (ch1->Position < P) // wait for encoder to advance
> > WaitNextTimeSlice;
> >
> >
> > SetBit(FLASHBIT); //turns led light on
> > SetBit(CAMERABIT); //triggers camera capture
> >
> > ClearBit(CAMERABIT); //clears camera capture
> > Delay_sec(.005); //This sets the light duration and exposure
> > // Delay_sec(10e-6); //Tom's original delay code
> >
> > ClearBit(FLASHBIT); //turns led light off
> > }
> > }
> >
> > So here is my next question. I need a way to adjust the framing up and down during a capture, which means within the loop in the above code. I am thinking of an additional rotary encoder in a control panel to do this. Can I send the encoder output-- basically up or down-- to a memory register, and then read it inside the loop somehow? I think my constant FRAME needs to be a variable that can change up or down by a small amount to adjust the timing of the capture. Can you suggest code to get me on the right path?
> >
> > Grace McKay
> >
> > --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> > >
> > > Hi Grace,
> > >  
> > > I think we might have just forgotten to set the bits as outputs.  Add:
> > >  
> > > SetBitDirection(FLASHBIT,1);
> > > SetBitDirection(CAMERABIT,1);
> > >  
> > > btw it actually isn't necessary to enable axis 1 which has not motor, but is shouldn't hurt anything.
> > >  
> > > Nice video.
> > >  
> > > Regards
> > > TK 
> > >
> > >
> > > ________________________________
> > > From: gracemckay <grace@>
> > > To: mailto:DynoMotion%40yahoogroups.com
> > > Sent: Thursday, June 7, 2012 2:26 PM
> > > Subject: [DynoMotion] Re: Progress, and a question...
> > >
> > >
> > >
> > >  
> > >
> > > Sorry the video didn't work. I just uploaded it to Vimeo. Maybe you can see it there. https://vimeo.com/43629295
> > >
> > > You are right about "Axis Channel 1 configured to use Encoder InpuChan0=0" It was intentional, but also a mistake. Axis 1 was supposed to be the Sprocket Encoder, but I had it wired to pins 7 and 8, which is apparently Axis0. I have now rewired to pins 9 and 10 and it is working there- showing encoder counts on the Axis screen at Position #1.
> > >
> > > But now I need to use pins 7 and 8 for the triggers. So I assume the code should now be
> > >
> > > #include "KMotionDef.h"
> > > #define FRAME 138.888889
> > > #define FLASHBIT 0 //Bit 0 corresponds to Pin7 JP7
> > > #define CAMERABIT 1 //Bit 1 corresponds to Pin8 JP7
> > >
> > > if I understand this correctly.
> > >
> > > and the rest of the code is
> > >
> > > double P = ch1->Position; //define P as position of channel 1
> > >
> > > for (;;) // loop forever
> > > {
> > > P += FRAME; //position = position + frame
> > >
> > > while (ch1->Position < P) // wait for encoder to advance
> > > WaitNextTimeSlice;
> > >
> > > SetBit(CAMERABIT);
> > > SetBit(FLASHBIT);
> > > Delay_sec(10e-6);
> > > ClearBit(FLASHBIT);
> > > ClearBit(CAMERABIT);
> > >
> > > }
> > >
> > > So, so far so good, BUT still no actual signals coming from pins 7 and 8.
> > >
> > > Thanks, Grace
> > >
> > > --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > >
> > > > Hi Grace,
> > > > ÃÆ'‚ 
> > > > The Video doesn't work for me - just a black screen.
> > > > ÃÆ'‚ 
> > > > You have Axis Channel 1 configured to use Encoder InpuChan0=0 was that intentional?ÃÆ'‚  Or should that be 1?
> > > > ÃÆ'‚ 
> > > > When the Film is moving look at the Axis Screen does the Position change appropriately?ÃÆ'‚  Which axis?
> > > > ÃÆ'‚ 
> > > > Regards
> > > > TK
> > > >
> > > >
> > > > ________________________________
> > > > From: gracemckay <grace@>
> > > > To: mailto:DynoMotion%40yahoogroups.com
> > > > Sent: Thursday, June 7, 2012 11:06 AM
> > > > Subject: [DynoMotion] Re: Progress, and a question...
> > > >
> > > >
> > > >
> > > > ÃÆ'‚ 
> > > >
> > > > H Tom,
> > > > I made you a video to help explain the machine. Here is a link http://www.scanbox.tv/ (too big for yahoo files)
> > > >
> > > > Axis0 is the drive motor, and the encoder driven by the film is on Axis1 (there is no motor on axis1), so your assumption is correct that we want to trigger from the Axis1 encoder. The actual code is in the files section TriggerTesting-1.c
> > > >
> > > > So I understand that it SHOULD work, and yet I have no pulses (AKA Rectangular Waves?)
> > > >
> > > > So I think maybe I have an init problem, or some other problem in my code. The other file I am using to setup the other axes is also in the files area: CombinedAxis023-v1.c
> > > >
> > > > Thanks, Grace
> > > >
> > > >
> > > >
> > > > --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > > >
> > > > > Hi Grace,
> > > > > ÃÆ'Æ'‚ÃÆ'‚ 
> > > > > I was assuming you wanted to trigger from the encoder position so the program looks at:
> > > > > ÃÆ'Æ'‚ÃÆ'‚ 
> > > > > ch1->Position
> > > > > ÃÆ'Æ'‚ÃÆ'‚ 
> > > > > If there is no encoder connection then the Position will never change and hence no pulses.
> > > > > ÃÆ'Æ'‚ÃÆ'‚ 
> > > > > Change that to the commanded Destination.
> > > > > ÃÆ'Æ'‚ÃÆ'‚ 
> > > > > ch1->Dest
> > > > > ÃÆ'Æ'‚ÃÆ'‚ 
> > > > > Actually there is a bug where we looked at ch0->Position one place and ch1->Position another place.ÃÆ'Æ'‚ÃÆ'‚  Set the axis channel number to whichever axis moves the film.
> > > > > ÃÆ'Æ'‚ÃÆ'‚ 
> > > > > I would think a ~0.5% timing jitter on the flash strobe position would give a small but unacceptable image jitter.ÃÆ'Æ'‚ÃÆ'‚  But let's get this working first before you consider other techniques.
> > > > > ÃÆ'Æ'‚ÃÆ'‚ 
> > > > > The term "square waves" normally implies pulses with 50% duty cycle.ÃÆ'Æ'‚ÃÆ'‚  The pulses are only 10us every 28 milliseconds so they would be tiny.ÃÆ'Æ'‚ÃÆ'‚  Increase the pulse time lengthÃÆ'Æ'‚ÃÆ'‚ to see them better if you need to.
> > > > > ÃÆ'Æ'‚ÃÆ'‚ 
> > > > > Regards
> > > > > TKÃÆ'Æ'‚ÃÆ'‚ 
> > > > > ÃÆ'Æ'‚ÃÆ'‚ 
> > > > > ÃÆ'Æ'‚ÃÆ'‚ 
> > > > >
> > > > >
> > > > > ________________________________
> > > > > From: gracemckay <grace@>
> > > > > To: mailto:DynoMotion%40yahoogroups.com
> > > > > Sent: Wednesday, June 6, 2012 4:49 PM
> > > > > Subject: [DynoMotion] Re: Progress, and a question...
> > > > >
> > > > >
> > > > > ÃÆ'Æ'‚ÃÆ'‚ 
> > > > > Thanks Tom,
> > > > >
> > > > > I am trying to work with the code you sent. I had expected to be able to
> > > > > put a scope on pins 9 and 10, and get square waves at 5 volts. The
> > > > > ground is hooked to pin 25. But this is not happening. I am not sure
> > > > > what is wrong. I will upload my files to the scanner folder.
> > > > >
> > > > > To answer your questions: timing and position accuracy. The max capture
> > > > > speed of the camera is somewhere around 36 frames per second, so about
> > > > > .0278 second. If I have my scale correct, that's about 28 milliseconds,
> > > > > right? So that is about as accurate as the camera requires. The light
> > > > > may need to be much faster, but 180us or 90us, either one, would work.
> > > > > Position accuracy is important, the film frame is only about 4
> > > > > millimeters in height, so that equates to our 138.whatever encoder
> > > > > count. I'm not sure what a servo callback is but I'm game if I can make
> > > > > it work. The actual recording speed is unimportant, as long at is within
> > > > > the range of the camera and software. Right now that means pretty slow,
> > > > > probably 6 frames a second. ( we have not set up a production capture
> > > > > PC, using an older slower box for testing. speed can be ramped up later.
> > > > >
> > > > > I'm not sure we could access the motor encoder, as it is wired the the
> > > > > servo's step/dir amplifier and not to Kflop.
> > > > >
> > > > > Anyway, thanks for your help. Please let me know what you think.
> > > > >
> > > > > Grace
> > > > >
> > > > > --- In mailto:DynoMotion%40yahoogroups.com, Tom Kerekes <tk@> wrote:
> > > > > >
> > > > > > Hi Grace,
> > > > >
> > > > > > You didn't mention timing or positioning accuracy. The simplest
> > > > > method would be to use software as something like shown below.
> > > > >
> > > > > > But this would have a time granularity of 180us. A servo callback
> > > > > could reduce it to 90us. Do you think this is adequate?
> > > > >
> > > > > > Maybe you could adjust your recording speed to be a nearly exact
> > > > > multiple of 90us to get better results.
> > > > >
> > > > > > A Step/Dir Generator might be used as a more exact frequency
> > > > > generator. This would basically involve commanding a motor axis to
> > > > > follow an encoder input.ÃÆ'Æ'Æ'ÃÆ'¢â‚¬Å¡ This is very much like threading on a
> > > > > lathe where the Z motion must be slaved to the spindle position as
> > > > > measured by an encoder.
> > > > >
> > > > > > Actually if there is very little error in the servo motor that is
> > > > > moving the film, then the commanded position can be used instead of the
> > > > > measured position of the film. If this is acceptable that then a dummy
> > > > > step/dir axis can be setup as a slave to the film axis with whatever the
> > > > > required SlaveGain to get the right output rate.
> > > > >
> > > > > > But the step/dir pulses are basically of fixed width
> > > > >
> > > > > > Regards
> > > > > > TK
> > > > >
> > > > > #include "KMotionDef.h"
> > > > > #define FRAME 138.888889
> > > > > #define FLASHBIT 2
> > > > > #define CAMERABIT 3
> > > > > main()
> > > > > {
> > > > > double P = ch1->Position;
> > > > >
> > > > > for (;;) // loop forever
> > > > > {
> > > > > P += FRAME;
> > > > >
> > > > > while (ch0->Position < P) // wait for encoder to advance
> > > > > WaitNextTimeSlice;
> > > > >
> > > > > SetBit(CAMERABIT);
> > > > > SetBit(FLASHBIT);
> > > > > Delay_sec(10e-6);
> > > > > ClearBit(FLASHBIT);
> > > > > ClearBit(CAMERABIT);
> > > > >
> > > > > }
> > > > >
> > > > > > From: gracemckay grace@
> > > > > > To: mailto:DynoMotion%40yahoogroups.com
> > > > > > Sent: Monday, June 4, 2012 1:20 PM
> > > > > > Subject: [DynoMotion] Progress, and a question...
> > > > >
> > > > > > Hi Tom,
> > > > > >
> > > > > > I am making some progress on the scanner. I now have film moving
> > > > > through the system fairly well, and pretty consistently.I will come back
> > > > > to the transport for refinements after I get the camera trigger system
> > > > > working.
> > > > > >
> > > > > > Here is what I have to work with: I have an Allen Bradley 845 encoder
> > > > > in the film path. I believe it has 2500 counts per rev, and it is driven
> > > > > by a sprocket with 18 teeth(frames) per rotation, so 2500/18=138.888889
> > > > > counts per film frame. At each frame I need to trigger the camera to
> > > > > capture, and the light to flash. Each requires a 5v pulse to trigger. I
> > > > > have pins 9 and 10 available on JP7 for the triggers, and the encoder is
> > > > > configured on axis 1. I can see the counts in the axis screen. I need a
> > > > > way to vary the signals' timing to get perfect synchronization, and I
> > > > > may need to control to duration of the light flash.
> > > > > >
> > > > > > Can you suggest some code to use the encoder to trigger the pulses I
> > > > > need? Do you see any problems with trying to do this this way?
> > > > > >
> > > > >
> > > >
> > >
> >
>