.net barcode scanner sdk note We will play with similar programs as we develop our control algorithms. in Software

Make QR Code in Software note We will play with similar programs as we develop our control algorithms.

note We will play with similar programs as we develop our control algorithms.
Decode Quick Response Code In None
Using Barcode Control SDK for Software Control to generate, create, read, scan barcode image in Software applications.
QR Printer In None
Using Barcode creation for Software Control to generate, create QR Code 2d barcode image in Software applications.
Program 28-7 Potentiometers Motor Moves Back and Forth. Motor Gain and Distance Controlled by
Decode QR Code ISO/IEC18004 In None
Using Barcode reader for Software Control to read, scan read, scan image in Software applications.
QR Creator In Visual C#.NET
Using Barcode drawer for .NET Control to generate, create QR-Code image in Visual Studio .NET applications.
{{04 Nov 09 Harprit Sandhu MotorBckForPotGain.Spin Propeller Tool Version 1.2.6 28 Program 07 This program runs the motor back and forth while you vary the gain and distance moved with two potentiometers. Pot1 controls the distance and Pot2 controls the gain.
Paint QR Code In .NET Framework
Using Barcode creator for ASP.NET Control to generate, create QR image in ASP.NET applications.
QR Code JIS X 0510 Maker In Visual Studio .NET
Using Barcode creator for .NET Control to generate, create QR Code image in Visual Studio .NET applications.
(continued)
Quick Response Code Generator In VB.NET
Using Barcode generation for VS .NET Control to generate, create QR Code image in .NET applications.
Creating Code 39 In None
Using Barcode generation for Software Control to generate, create USS Code 39 image in Software applications.
Running DC MotoRs with AttACheD inCReMentAl enCoDeRs
Printing Code-128 In None
Using Barcode encoder for Software Control to generate, create Code 128 Code Set C image in Software applications.
UPC-A Supplement 2 Generator In None
Using Barcode drawer for Software Control to generate, create UPC-A image in Software applications.
Program 28-7 Motor Moves Back and Forth. Motor Gain and Distance Controlled by Potentiometers (continued)
Paint Bar Code In None
Using Barcode generation for Software Control to generate, create barcode image in Software applications.
DataMatrix Drawer In None
Using Barcode creator for Software Control to generate, create Data Matrix ECC200 image in Software applications.
How we control the gain is determined by the method that sets the gain at the bottom of the programs. We will use the information gained here to design the equations to set the gain to make the move as fast as possible without overshoot. You may have to adjust the parameters for your particular motor. Connections are Amplifier brake Amplifier PWM Amplifier direction Potentiometer
Making Code 2 Of 5 In None
Using Barcode generator for Software Control to generate, create 2 of 5 Industrial image in Software applications.
Encoding Data Matrix 2d Barcode In .NET
Using Barcode creator for Reporting Service Control to generate, create Data Matrix 2d barcode image in Reporting Service applications.
P2 P3 P4 P19
Scanning Bar Code In Visual Studio .NET
Using Barcode reader for .NET Control to read, scan read, scan image in .NET applications.
Generate Barcode In None
Using Barcode maker for Word Control to generate, create barcode image in Office Word applications.
LCD on the usual P8..P18 }} OBJ Encoder : "Quadrature Encoder" LCD : "LCDRoutines4" 'for the LCD methods UTIL : "Utilities" 'for general methods CON _CLKMODE=XTAL1+ PLL2X _XINFREQ = 5_000_000 VAR long long long long long long long long long long long long long word word long
UPC A Encoder In Objective-C
Using Barcode encoder for iPhone Control to generate, create GS1 - 12 image in iPhone applications.
Drawing Bar Code In Visual C#.NET
Using Barcode generator for VS .NET Control to generate, create barcode image in .NET framework applications.
'The system clock spec
Painting Barcode In Visual Basic .NET
Using Barcode drawer for .NET framework Control to generate, create barcode image in VS .NET applications.
ANSI/AIM Code 128 Generator In None
Using Barcode maker for Word Control to generate, create Code 128 Code Set B image in Office Word applications.
Pos[3] stack2[25] stack3[25] stack4[25] stack5[25] stack6[25] stack7[25] pulswidth PresentPosition TargetPosition PositionError gain dgain PotReading startFlag startPosition
'Create buffer for encoder 'space for Cog_LCD 'space for Cog_SetMotorPower 'space for Cog_RunMotor 'space for Cog_FigureGain 'space for Cog_Start 'space for readpots ' ' ' ' ' 'displayed gain ' ' ' (continued)
holDing the MotoR Position
Program 28-7 Motor Moves Back and Forth. Motor Gain and Distance Controlled by Potentiometers (continued)
long distance long pot1 long Pot2
' ' '
PUB Go cognew(cog_LCD, @stack2) cognew(SetMotorPower, @stack3) cognew(RunMotor(3),@Stack4) cognew(figureGain, @stack5) cognew(StrtFlag, @stack6) cognew(ReadPots, @stack7) Encoder.Start(0, 1, 0, @Pos) 'Reads the encoder position startPosition:=Pos[0] 'position read distance:=42*0 'number of 1/4th revs is 8 for 1 rev repeat targetPosition:=StartPosition+distance waitcnt(24_000+cnt) repeat while startFlag==0 {The start flag is needed to make sure that one instruction gets done before the next instructions starts. This is managed with the start flag. Try eliminating these instructions to see what happens. Is there a better way to manage this As long as the start flag is 0 the program holds at this line. It took me a while to get this one figured out! } waitcnt(2_000_000+cnt) targetPosition:=startPosition waitcnt(24_000+cnt) repeat while startFlag==0 waitcnt(2_000_000+cnt) PRI SetMotorPower dira[2..4]~~ 'These pins control the motor amp repeat 'loop PresentPosition:=pos[0] 'read the encoder position PositionError:=TargetPosition-PresentPosition case PositionError 'decision variable -100_000_000..-2: 'negative range outa[4]~~ 'move in position direction PULSWIDTH:=gain*450 'set gain -1..1 : 'range for stopping PULSWIDTH:=0*450 'gain is 0 2..100_000_000: 'positive range OUTA[4]~ 'move in negative direction PULSWIDTH:=gain*450 'set gain (continued)
Running DC MotoRs with AttACheD inCReMentAl enCoDeRs
Program 28-7 Motor Moves Back and Forth. Motor Gain and Distance Controlled by Potentiometers (continued)
PRI cog_LCD LCD.INITIALIZE_LCD repeat LCD.POSITION (1,1) LCD.PRINT(STRING("Er=" )) LCD.PRINT_DEC(PositionError) LCD.SPACE(2) LCD.POSITION (1,10) LCD.PRINT_DEC(pot1) LCD.SPACE(2) LCD.POSITION (1,14) LCD.PRINT_DEC(pot2) LCD.SPACE(2) LCD.POSITION (2,1) LCD.PRINT(STRING("Gain=" )) LCD.PRINT_DEC(dgain) LCD.SPACE(2) LCD.POSITION (2,10) LCD.PRINT(STRING("Start=" )) LCD.PRINT_DEC(StartFlag) distance:=pot1*21
'manage the LCD 'initialize the LCD 'LCD loop 'Go to 1st line 1st space 'Error 'print error 'erase over old data 'Go to 1st line 10th space 'print error 'erase over old data 'Go to 1st line 14th space 'erase over old data 'erase over old data 'Go to 2nd line 1st space 'Potentiometer 'print the pot reading 'erase over old data 'Go to 2nd line 10th space 'Potentiometer 'print the pot reading
PRI RunMotor(Pin)|WaveLength,period ' toggle the output line, set dira[2..4]~~ ' the three amplifier lines ctra[30..26]:=%00100 'Set this cog's "A Counter" to run PWM ctra[5..0]:=Pin 'Set the "A pin" of this cog to Pin=3 frqa:=1 'Set this counter's frqa value to 1 PulsWidth:=0 'Start with position=0 WaveLength:=clkfreq/100 'Set the time for the wave L to 10 ms period:=cnt 'Store the current value of the counter repeat 'power PWM routine. phsa:=-PulsWidth ' high for Pulsewidth counts period:=period+WaveLength 'Calculate wave length waitcnt(period) 'Wait for end of wavelength PRI StrtFlag repeat if ||PositionError<2 startFlag:=1 else startFlag:=0 'used to determine if motor completed move 'is 'if '1f 'do move almost done it is it's ok to start not not start next move (continued)
Copyright © OnBarcode.com . All rights reserved.