Best Stepper Motor Commands

eclectic

Moderator
Thank you Westaust55.

Much easier to achieve than my slower method.

b1 = 10
W1 = 5000

Code:
CWise:
pulsout 1,w1:pause b1
pulsout 2,w1:pause b1
pulsout 3,w1:pause b1
pulsout 4,w1:pause b1
return

CounterC:
pulsout 4,w1:pause b1
pulsout 3,w1:pause b1
pulsout 2,w1:pause b1
pulsout 1,w1:pause b1
return
But, I should have remembered the obvious first step
at the start of the program.

setfreq m8

Duuuh
e
 
Last edited:

mikemwa

Member
OK. I was using the pulseout but even fast didn't seem fast enough. I tried let pins again and this time it worked. I didn't realized that before I was using pins 1,2,3 and 4instead of pins 0,1,2,and 3. I just started to write the program and haven't had a chance to check this much out yet. This is what I've done so far.

Code:
;Forum Mikewma 190108
#picaxe 20M


b3 = 100			'long pause
b4 = 10			'short pause

b5 = 2			'move .002" for surface reading
b6 = 30			'move to minimum spec.    .030"
b7 = 33			'move a couple thousanths short of average reading   .033"
b8 = 34			'move another thousanth   .034"
b9 = 35			'move to average reading  .035"
b10 = 36			'move another thousanth   .036"
b11 = 37			'move another thousanth    037"
b12 = 50			'move to maximum spec.    .050"


'This section is used to manually posision the micrometer


main:
If pin1 =1 then 		'move in reverse slow
gosub CounterC
pause b3
endif

If pin2 =1 then 		'move in reverse fast
gosub CounterC
pause b4
endif

If pin3 =1 then 		'move forward slow
gosub CWise
pause b3
endif

If pin4 =1 then 		'move forward fast
gosub CWise
pause b4
endif



'This section runs the sequence for the Micrometer. 
'After it moves to one position it waits for a signal 
'then moves to the next position etc.
'Using a switch for the signal for right now


If pin5 =1 then
for b0 = 0 to 5
lookup b0, (b5, b6, b7, b8, b9, b10, b11, b12),W1
;type in the 6 values you need

for b1 = 1 to W1
gosub CWise
next 
next
endif

goto main

CWise:
let pins = %11000
pause b4
let pins = %01100
pause b4
let pins = %00110
pause b4
let pins = %10010
pause b4
return

CounterC:
let pins = %11000
pause b4
let pins = %10010
pause b4
let pins = %00110
pause b4
let pins = %01100
pause b4
return
Let me know if this is doable or you think I should still use the pulseout. Thanks.
 
Last edited:

eclectic

Moderator
Very quick first reply

This line
lookup b0, (2,30,33,34,35,50),W1

will interfere/overwrite your b3 value

In the manual reference I gave earlier, you'll see

b0 + b1 = W0
b2 + b3 = W1

try changing W1 to b2

I haven't had time to look at the rest.

e
 

mikemwa

Member
OK, if Let Pins will work will the lookup work or is there a better way to do that.
In the sequence it needs to wait for a signal before it moves to the next variable.
after it moves to one position it waits for a signal then moves to the next position etc.
I revised the code in post 42 a little to show you what I mean.
 

westaust55

Moderator
Thank you Westaust55.

Much easier to achieve than my slower method.

b1 = 10
W1 = 5000



But, I should have remembered the obvious first step
at the start of the program.

setfreq m8

Duuuh
e


eclectic, no far from a Duuh moment.

I had also thought about that option, but:

1. It only allows a 2:1 speed ratio - wondered if that is what is required.

2. when changing from 4MHz to 8MHz, although the manual does not mention any impact from clock speed change for READADC commands, I wonder if the necessary bits ADCS1 and ADCS0 in SFR ADCON0 ($1F) are changed in line with the datasheet to keep the ADC conversions optimal.

Guess some peeks while using SETFREQ will verify that by looking at bits 6 and 7.
 

eclectic

Moderator
@mikemwa

I've found a 6 wire unipolar, which I've wired as a bipolar.
I copied the Bipolar/L293 circuit from manual 3. (outputs 4 -7)

My motor's 48 steps, but the principle are similar.

I've changed a few lines/values in your program (******)

It's working.

e

Code:
;Forum Mikewma 190108
#picaxe 20M


b3 = 100			'long pause
b4 = 10			'short pause

b5 = 2			'move .002" for surface reading
b6 = 30			'move to minimum spec.    .030"
b7 = 33			'move a couple thousanths short of average reading   .033"
b8 = 34			'move another thousanth   .034"
b9 = 35			'move to average reading  .035"
b10 = 36			'move another thousanth   .036"
b11 = 37			'move another thousanth    037"
b12 = 50			'move to maximum spec.    .050"


'This section is used to manually posision the micrometer


main:
If pin1 =1 then 		'move in reverse slow
gosub CounterC
pause b3
endif

If pin2 =1 then 		'move in reverse fast
gosub CounterC
pause b4
endif

If pin3 =1 then 		'move forward slow
gosub CWise
pause b3
endif

If pin4 =1 then 		'move forward fast
gosub CWise
pause b4
endif



'This section runs the sequence for the Micrometer. 
'After it moves to one position it waits for a signal 
'then moves to the next position etc.
'Using a switch for the signal for right now


If pin5 =1 then
for b0 = 0 to 7 ;****** for 8 values
lookup b0, (b5, b6, b7, b8, b9, b10, b11, b12),b2 ;***


for b1 = 1 to b2;***
gosub CWise
next 
next
endif

goto main

CWise:
pins = %01100000 : pause 3 ;4
pins = %01010000 : pause 3 ;3
pins = %10010000 : pause 3 ;2
pins = %10100000 : pause 3 ;1
return

CounterC:
pins = %10100000 : pause 3 ;1
pins = %10010000 : pause 3 ;2
pins = %01010000 : pause 3 ;3
pins = %01100000 : pause 3 ;4
 
return

Added 15.20 GMT

I inserted the line

symbol pslen = 1000

then changed CW CCw to
Code:
CWise:
pulsout 4, pslen
pulsout 6, pslen
pulsout 5, pslen
pulsout 7, pslen
return

CounterC:
pulsout 7, pslen
pulsout 5, pslen
pulsout 6, pslen
pulsout 4, pslen
return
Works fine as well.
I haven't done any timing tests.
 
Last edited:

mikemwa

Member
Eclectic,

I tried your program. At first it wasn't working. I had to change the let pins. I see you just used different pins than I did. Anyway it still didn't run quite right for some reason.
I've been working on the code and below is what seems to work good for pins 1-4 for the positioning.
The problem starts when I push the button on pin 5 to start the sequence. From that point on it won't work. Also from that point on I know the code is a mess. I've tried different things.
A push button has been added on pin 6 to simulate the signal from the machine this will be attached to.
The other problem is I'm running out of memory. I don't know how to condense this so it will take less memory like you do. (I'm learning slowly but surely) If you could guide me in doing that it would be nice.
At this point timing is no problem I can figure that out when I get this thing working.
It's getting so close.
Code:
;Forum Mikewma 190108
#picaxe 20M

b3 = 2500			'long pause
b4 = 5			'short pause

b5 = 2			'move .002" for surface reading
b6 = 30			'move to minimum spec.    .030"
b7 = 33			'move a couple thousanths short of average reading   .033"
b8 = 34			'move another thousanth   .034"
b9 = 35			'move to average reading  .035"
'b10 = 36			'move another thousanth   .036"
'b11 = 37			'move another thousanth    037"
b12 = 50			'move to maximum spec.    .050"

'This section is used to manually posision the micrometer

main:
If pin1 =1 then 		'move in reverse slow
gosub CounterCs
'pause b3
endif

If pin2 =1 then 		'move in reverse fast
gosub CounterCf
'pause b4
endif

If pin3 =1 then 		'move forward slow
gosub CWises
'pause b3
endif

If pin4 =1 then 		'move forward fast
gosub CWisef
'pause b4
endif

'This section runs the sequence for the Micrometer. 
'After it moves to one position it waits for a signal 
'then moves to the next position etc.
'Using a switch for the signal for right now

If pin5 =1 then goto sequstart
'for b0 = 0 to 5
'lookup b0, (b5, b6, b7, b8, b9, b10, b11, b12),W1
'type in the 6 values you need

'for b1 = 1 to W1
'gosub CWisef
'next 
'next			'syntax error
'endif		'syntax error

goto main

CWises:
let pins = %00011000
pause b3
let pins = %00001100
pause b3
let pins = %00000110
pause b3
let pins = %00010010
pause b3
return

CounterCs:
let pins = %00011000
pause b3
let pins = %00010010
pause b3
let pins = %00000110
pause b3
let pins = %00001100
pause b3
return

CWisef:
let pins = %00011000
pause b4
let pins = %00001100
pause b4
let pins = %00000110
pause b4
let pins = %00010010
pause b4
return

CounterCf:
let pins = %00011000
pause b4
let pins = %00010010
pause b4
let pins = %00000110
pause b4
let pins = %00001100
pause b4
return



'problems starting here

sequstart:
for b13=1 to 50				
for b2=1 to b5 
pulsout 1,1000:pause 100
pulsout 2,1000:pause 100
pulsout 3,1000:pause 100
pulsout 4,1000:pause 100
next b2
next b13
If pin6 =1 then goto Minspec


Minspec:
for b13=1 to 50				
for b2=1 to b6
pulsout 1,1000:pause 100
pulsout 2,1000:pause 100
pulsout 3,1000:pause 100
pulsout 4,1000:pause 100
next b2
next b13
If pin6 =1 then goto fstchk


fstchk:
for b13=1 to 50				
for b2=1 to b7
pulsout 1,1000:pause 100
next b2
next b13
If pin6 =1 then goto avgchk

avgchk:
for b13=1 to 50				
for b2=1 to b8
pulsout 1,1000:pause 100
next b2
next b13
'If pin6 =1 then goto maxspec

'maxspec:
'for b13=1 to 50				
'for b2=1 to b8
'pulsout 1,1000:pause 100
'next b2
'next b13
'If pin6 =1 then goto main
 

eclectic

Moderator
@mikemwa
This is becoming difficult for me, because your program
and your requirements keep changing.
I'll have another go.

First, just use two move routines. One CW and one Ccw
Change the delay times outside the routines.

Sequstart.
Here, for instance
Code:
next b13
If pin6 =1 then goto Minspec

Minspec:
The code will move to the next line automatically.
It will not wait for a button press. You need a loop.

Let's build on an original program.
Please try the following cut-down code on your setup.
Does it work?
Does it need adjusting?

Code:
;Forum Mikewma4 220108
#picaxe 20M

symbol longdel  = 2500	'long pause
symbol shortdel = 5	'short pause

b5 = 2			'move .002" for surface reading
b6 = 30			'move to minimum spec.    .030"
b7 = 33			'move a couple thousanths short of average reading   .033"
b8 = 34			'move another thousanth   .034"
b9 = 35			'move to average reading  .035"
'b10 = 36			'move another thousanth   .036"
'b11 = 37			'move another thousanth    037"
b12 = 50			'move to maximum spec.    .050"

'This section is used to manually posision the micrometer

main:
If pin1 =1 then 		'move in reverse slow
gosub CounterC
pause longdel
endif

If pin2 =1 then 		'move in reverse fast
gosub CounterC
pause shortdel
endif

If pin3 =1 then 		'move forward slow
gosub CWise
pause longdel
endif

If pin4 =1 then 		'move forward fast
gosub CWise
pause shortdel
endif

'
If pin5 =1 then 
goto sequstart
endif

goto main


CWise:
let pins = %00011000
pause shortdel
let pins = %00001100
pause shortdel
let pins = %00000110
pause shortdel
let pins = %00010010
pause shortdel
return

CounterC:
let pins = %00011000
pause shortdel
let pins = %00010010
pause shortdel
let pins = %00000110
pause shortdel
let pins = %00001100
pause shortdel
return



sequstart:

for b0 = 0 to 4
lookup b0, (b5, b6, b7, b8, b9),b1
W1= b1*50

for W6 = 1 to W1
gosub CWise
next 

Do
Loop until pin6 = 1

next			

goto main
e
 
Last edited:

mikemwa

Member
The code you posted worked OK. I changed the timing and added the other positions in and it is actually working pretty good now but not perfect.
Things I changed have '***** in the comment line.
Code:
;Forum Mikewma4 220108
#picaxe 20M

symbol longdel  = 100	'long pause
symbol shortdel = 5	'short pause

b5 = 2		'*****	'move .002" for surface reading
b6 = 28		'*****	'move to minimum spec.    .030"
b7 = 3		'*****	'move a couple thousandths short of average reading   .033"
b8 = 1		'*****	'move another thousandth   .034"
b9 = 1		'*****	'move to average reading  .035"
b10 = 1		'*****	'move another thousandth   .036"
b11 = 1		'*****	'move another thousandth    037"
b12 = 13		'*****	'move to maximum spec.    .050"

'This section is used to manually position the micrometer

main:
If pin1 =1 then 		'move in reverse slow
gosub CounterC
pause longdel
endif

If pin2 =1 then 		'move in reverse fast
gosub CounterC
pause shortdel
endif

If pin3 =1 then 		'move forward slow
gosub CWise
pause longdel
endif

If pin4 =1 then 		'move forward fast
gosub CWise
pause shortdel
endif

'
If pin5 =1 then 
goto sequstart
endif

goto main


CWise:
let pins = %00011000
pause shortdel
let pins = %00001100
pause shortdel
let pins = %00000110
pause shortdel
let pins = %00010010
pause shortdel
return

CounterC:
let pins = %00011000
pause shortdel
let pins = %00010010
pause shortdel
let pins = %00000110
pause shortdel
let pins = %00001100
pause shortdel
return



sequstart:

for b0 = 0 to 7	'*****
lookup b0, (b5, b6, b7, b8, b9, b10, b11, b12),b1	'*****
W1= b1*6	'*****

for W6 = 1 to W1
gosub CWise
next 

Do
Loop until pin6 = 1

next			

goto main
Manual positioning works and the sequstart: section works as far as when I push the button on pin 6 it will move to the next position.
I only see 2 issues left.
1. When I press the button on pin 6 sometimes it will continue for 2 or 3 positions. Sometimes these movements are very short. I should be able to fix that with a pause somewhere right?

2. The micrometer isn't moving to the right position.
Some Information:
Post # 35 shows my setup.

Stepper motor - 200 steps per revolution.
Ratio - 1 on stepper and 5 on micrometer.
One rotation of the micrometer handle moves it 0.0200 inch. (1000 Steps on the motor)

This is what it should do This is what it's doing

Should Steps Is Steps
Move to on Moving Moving
Position Motor Now Now

0.0020 100 0.0009 45
0.0300 1500 0.0143 750
0.0330 1650 0.0157 785
0.0340 1700 0.0162 810
0.0350 1750 0.0167 835
0.0360 1800 0.0172 860
0.0370 1850 0.0177 885
0.0500 2500 0.0211 1055

Seems to be more than 50% off.
I'm pretty sure these figures are correct. I will double check when I get home.
 

eclectic

Moderator
2 immediate responses

Code:
sequstart:

for b0 = 0 to 7	'*****
lookup b0, (b5, b6, b7, b8, b9, b10, b11, b12),b1	'*****
W1= b1*6	'*****

for W6 = 1 to W1
gosub CWise
next 

Do
Loop until pin6 = 1

next			

goto main
1. Add a Pause 1000 after the loop until line.
2. You are over-writing the value of b12 when you use W6.

I'll try and have a look later today.

e
 

eclectic

Moderator
I've done some modifications.

NB
I've included code for MY motor. Please remove.
I've also made other modifications to variables.

Please can you test it "as is"
and let me know.

e

Code:
;POSTED on forum Gr 230101
 ;ALTERED
 
#picaxe 20M
symbol plslen = 500 ; ****************************remove
symbol longdel  = 100	'long pause
symbol shortdel = 5	'short pause

b6 = 2		'*****	'move .002" for surface reading
b7 = 28		'*****	'move to minimum spec.    .030"
b8 = 3		'*****	'move a couple thousandths short of average reading   .033"
b9 = 1		'*****	'move another thousandth   .034"
b10 = 1		'*****	'move to average reading  .035"
b11 = 1		'*****	'move another thousandth   .036"
b12 = 1		'*****	'move another thousandth    037"
b13 = 13		'*****	'move to maximum spec.    .050"

'This section is used to manually position the micrometer

main:
If pin1 =1 then 		'move in reverse slow
gosub CounterC
pause longdel
endif

If pin2 =1 then 		'move in reverse fast
gosub CounterC
pause shortdel
endif

If pin3 =1 then 		'move forward slow
gosub CWise
pause longdel
endif

If pin4 =1 then 		'move forward fast
gosub CWise
pause shortdel
endif

'
If pin5 =1 then 
goto sequstart
endif

goto main

CounterC:; ****************************** Take out my code

pulsout 7, plslen 
pulsout 4, plslen  
pulsout 6, plslen 
pulsout 5, plslen 
return

CWise:
pulsout 7, plslen 
pulsout 5, plslen 
pulsout 6, plslen 
pulsout 4, plslen 
return 
#rem
;*********************************** Put YOUR code back in
CWise:
let pins = %00011000
pause shortdel
let pins = %00001100
pause shortdel
let pins = %00000110
pause shortdel
let pins = %00010010
pause shortdel
return

CounterC:
let pins = %00011000
pause shortdel
let pins = %00010010
pause shortdel
let pins = %00000110
pause shortdel
let pins = %00001100
pause shortdel

return
#endrem

sequstart:

for b0 = 0 to 7	
lookup b0, ( b6, b7, b8, b9, b10, b11,b12,b13),W2	'***** W2
W2= W2 *6	'*****

for W1 = 1 to W2
sertxd (#w1," ")

gosub CWise
next 

Do
Loop until pin6 = 1
pause 500 ; allow for switch bounce

next			

goto main
e
 

mikemwa

Member
The Position tests are the same as before unless I didn't do somethiing you wanted me to do. Heres what I did.
Code:
;POSTED on forum Gr 230101
 ;ALTERED
 
#picaxe 20M
symbol plslen = 500 ; ****************************remove
symbol longdel  = 100	'long pause
symbol shortdel = 5	'short pause

b6 = 2		'*****	'move .002" for surface reading
b7 = 28		'*****	'move to minimum spec.    .030"
b8 = 3		'*****	'move a couple thousandths short of average reading   .033"
b9 = 1		'*****	'move another thousandth   .034"
b10 = 1		'*****	'move to average reading  .035"
b11 = 1		'*****	'move another thousandth   .036"
b12 = 1		'*****	'move another thousandth    037"
b13 = 13		'*****	'move to maximum spec.    .050"

'This section is used to manually position the micrometer

main:
If pin1 =1 then 		'move in reverse slow
gosub CounterC
pause longdel
endif

If pin2 =1 then 		'move in reverse fast
gosub CounterC
pause shortdel
endif

If pin3 =1 then 		'move forward slow
gosub CWise
pause longdel
endif

If pin4 =1 then 		'move forward fast
gosub CWise
pause shortdel
endif

'
If pin5 =1 then 
goto sequstart
endif

goto main

#rem
CounterC:; ****************************** Take out my code

pulsout 7, plslen 
pulsout 4, plslen  
pulsout 6, plslen 
pulsout 5, plslen 
return

CWise:
pulsout 7, plslen 
pulsout 5, plslen 
pulsout 6, plslen 
pulsout 4, plslen 
return 

;*********************************** Put YOUR code back in
#endrem


CWise:
let pins = %00011000
pause shortdel
let pins = %00001100
pause shortdel
let pins = %00000110
pause shortdel
let pins = %00010010
pause shortdel
return

CounterC:
let pins = %00011000
pause shortdel
let pins = %00010010
pause shortdel
let pins = %00000110
pause shortdel
let pins = %00001100
pause shortdel

return

sequstart:

for b0 = 0 to 7	
lookup b0, ( b6, b7, b8, b9, b10, b11,b12,b13),W2	'***** W2
W2= W2 *6	'*****

for W1 = 1 to W2
sertxd (#w1," ")

gosub CWise
next 

Do
Loop until pin6 = 1
pause 500 ; allow for switch bounce

next			

goto main
 

eclectic

Moderator
Thanks for your reply

OK, this is a test of the Stepper.

I'm interested to see its behaviour.

1. Attach a "marker" to your stepper.
2. Record the Mic' reading.

3. Try the program.

Code:
; First, check the start position
; on the stepper AND the Mic'
for b0 = 1 to 200

gosub CWise

next

; then repeat the program, but using CounterC
stop

CWise:
let pins = %00011000
pause shortdel
let pins = %00001100
pause shortdel
let pins = %00000110
pause shortdel
let pins = %00010010
pause shortdel
return

CounterC:
let pins = %00011000
pause shortdel
let pins = %00010010
pause shortdel
let pins = %00000110
pause shortdel
let pins = %00001100
pause shortdel

return
Big questions.

Q1. Does 200 Program steps = exactly ONE stepper-revolution?

Q2. How much does the Mic' change in 200 program steps?

e
 

mikemwa

Member
The motor makes 4 complete revolutions.
The Mic reads 0.0160
The Mic needs 5 revolutions of the motor for it to go to 0.0200
 

eclectic

Moderator
The motor makes 4 complete revolutions.
The Mic reads 0.0160
The Mic needs 5 revolutions of the motor for it to go to 0.0200
Thanks. Looks like some simple maths and gearing calculations. (Famous last ... )
Then, a re-hash of some of the software variables.

Calculator time?

Back tomorrow (Brit) evening.

e
 

BCJKiwi

Senior Member
That figures,
motor = 200 steps per rev,
gearing = 5:1

1000 motor steps required for one rev of Micrometer
5000 motor steps required for 5 revs of Mic = 0.0200

Currently doing 4/5ths of what you wnat so change
for b0 = 1 to 200
to
for b0 = 1 to 250
 
Last edited:

eclectic

Moderator
Tired,
but, each "thou" = 1.25 stepper steps.

(it's been years since I've tried to think in "thous")

Look what I found in the shed.
A rare Imperial / Metric Shardlow.
(No comments Dippy.) :)
e
 

Attachments

mikemwa

Member
Changing:
for b0 = 1 to 200
to
for b0 = 1 to 250

Does work for this Mic

This got me thinking:
This Mic at home is 1 revolution = 0.0200"
The one at work which is what this will ultimately go on might be 1 revolution = 0.0250"
I will have to check for sure when I get to work tonight.
If possible what would the changes be to the code on both Mic's so I could use it on this one also.
 

BCJKiwi

Senior Member
Mike,

you need to understand the relationship and do the calcs, then you can change the code to suit whatever you need.

The critical piece of info is steps per thou or mm or whatever base the measurement is.
As discussed (post #59) - Setup @ Home
Motor = 200 steps per rev,
Drive ratio = 5:1
1000 motor steps required for one rev of Micrometer
5000 motor steps required for 5 revs of Mic = 0.0200
As the 0.0200 is 20 thou", then 5000 / 20 = 250 steps per thou

If the unit @ work is 5000 steps for 25 thou, then 5000 / 25 = 200 steps per thou.

So the number eclectic started with of a loop of 200 would suit the work mic (if it's at 25 thou per rev).

Interestingly, the 0-25mm vernier graduated manual micrometer I have has a barrel thread pitch of 0.5mm (= 0.0197" - i.e. basically the same as your mic @ home with 0.020"). It also has 50 divisions around the barrel and 10ths of that on the vernier for a final resolution on the vernier marks of 0.001mm ~ 4/10ths of a thou"
 

eclectic

Moderator
Mikemwa.
A slightly altered viewpoint. Currency exchange.

For your original micrometer setup,
How many gosubs make a thou' ?

From post# 56

200 gosubs makes 4 complete motor revolutions.
The Mic' reads 0.0160

So 200 gosubs is worth 16 thou'

50 gosubs = 4 thou' and finally,

1 thou' is worth 12.5 gosubs.

Next, try this alteration to the most recent program.
Code:
for b0 = 0 to 7	
lookup b0, ( b6, b7, b8, b9, b10, b11,b12,b13),b1
	
W2= b1*25 ; new "currency exchange
W2 = W2/2 ;	new "currency exchange

for W1 = 1 to W2
sertxd (#w1," ") ; remove after test

gosub CWise
next
It will NOT be perfect metrology, but, what is your allowed tolerance?
(In old Brit, how big are the Gnats?)

For your second micrometer,
1 motor rev. is worth 5 thou', so
1 thou' is worth 10 gosubs.

Any mistakes are the result of me rushing a reply.
Please test first.
Then let me know.

e
 

mikemwa

Member
Eclectic,

As far as the gosubs, it goes like this.

Length....Gosubs........Difference
.001...........13.................13
.002...........25.................12
.003...........38.................13
.004...........51.................13
.005...........63.................12
.006...........76.................13
.007...........88.................12
.........
After inserting your code it’s darn near perfect. This is what I am getting.

Should be.....Is
.0020.........0020
.0300.........0299
.0330.........0329
.0340.........0339
.0350.........0348
.0360.........0358
.0370.........0368
.0500.........0497

Being off .0003 out of .0500 is good in my book. There could possibly be other reasons for that. I don’t think you could get much closer.

Mike
 

eclectic

Moderator
Thanks for the reply and the fast testing.
The gnats are reasonable in your area.

If you go to the other Mic', the the errors may
be reduced.

Keep experimenting. :)

e
 

mikemwa

Member
Well thank you Eclectic and everyone else for all your help. I really appreciate it. Now all I have to do is get it on a circuit board, in a box and on the machine (hoping I don't blow it up) and see what happens.
 

eclectic

Moderator
Mike.
A possible improvement.

If none of the values b6 – b13 ever exceed ~ 250,
then please try this and see what happens.

Code:
for b0 = 0 to 7 
lookup b0, ( b6, b7, b8, b9, b10, b11,b12,b13),b1
        
W2= b1*250 ; new 2"currency exchange
W2 = W2/20 ;     new 2 "currency exchange

for W1 = 1 to W2
sertxd (#w1," ") ; remove after test

gosub CWise

e
 

mikemwa

Member
2 thoughts

1. Does it matter in what position Let pins start matter?
2. Is it possible to increment 1 Let Pins line so many times with a variable?

Just curious if that would be another way to do it. Like I say It's darn near perfect now and when I get everything solid that small error might go away.
 

eclectic

Moderator
2 thoughts

1. Does it matter in what position Let pins start matter?
2. Is it possible to increment 1 Let Pins line so many times with a variable?

Just curious if that would be another way to do it. Like I say It's darn near perfect now and when I get everything solid that small error might go away.
Just write some little test programs,
and see if there are any differences.

Or if it works at all.

e
 

eclectic

Moderator
Mike.
There's another possibility.

See here for the explanation and diagrams/animation.
http://www.doc.ic.ac.uk/~ih/doc/stepper/control2/sequence.html

Look at the differences between
Single coil
2 coil (Which you are using).
Interleaving / half step.

However, rather than get into more complexities,
may I suggest using what you have for the moment.

When it's all bolted together properly, test it.
If it's good enough, then just leave it.
If not, then possibly half-step time?

Next. Referring to the circuit in your post #13.
I strongly suggest that you include the full download circuit,
along with a 3mm stereo socket.
You WILL want to alter the programming, sometime.

And possibly finally, a RED, all-off, toggle switch, just in case. :)

e
 

mikemwa

Member
I have that site bookmarked. Lots of good info there.
When things are finished I will see if I need to change things or not.

I was planning on including the download circuit. Those variables b6-b13 will be changing constantly probably 15-20 times a day. I hope the Picaxe isn't too limited as far as how many times it can be changed.

I will also have an on/off switch for the whole thing. I have attached a file showing what my panel is going to look like. Is there anything else I might need?
 

Attachments

eclectic

Moderator
Suggestions?

1. Build the unit in "modules" which can be re-used and moved around.
Use plug-in / cable / other system.

2. Test it thoroughly.

3. Plan for a Mark II version.

If you're going to change 8 variables 20 times a day, you'll be better off with
a LC display and a button entry menu.
But, that's for the future.

e
 

westaust55

Moderator
Those variables b6-b13 will be changing constantly probably 15-20 times a day. I hope the Picaxe isn't too limited as far as how many times it can be changed.
The PICAXE variable b0 to b13 (and onward for X1/X2 parts) are stored in RAM memory and so have no limitation on the number of time they can be written to.

Only EEPROM memory has a limitation of around 100,000 writes per location but an infinite number of reads per memory location.
 

mikemwa

Member
Eclectic,
Sometimes you and I think alike:). Since getting those other problems fixed I have been working on the box and am starting on the circuit.I have about 5 cables/connectors and am trying to separate things into 1. power supply section, 2. chip section, and 3. LED/switch section.
There are probably 30-40 different parts and specs. that we test on a regular basis. I was trying to figure out a way to do that more automatically and faster but I wasn't sure what the capabilities of the Picaxe were. Plus I have no idea how to work with and program an LCD display at this time. But I'll cross that bridge when I come to it.

Westaust55,
That's good to know. At least I won't have to change chips all the time.
 

eclectic

Moderator
" Plus I have no idea how to work with and program an LCD display at this time.
But I'll cross that bridge when I come to it."


Actually, that's probably the easiest part!
Rev-Ed sell an excellent and simple serial display called the AXE033.
Plenty of references on the forum.

Plus, there are USA versions, but I haven't any experience of these.

For the future, it may be worth investing in the 28X1 chip.
Lots more inputs, variables and memory.

e
 

mikemwa

Member
That's really good to know. I do have the 28X1. When I first got into this I got the 08M, 20M, 18X and 28X1 starter kits. I wanted to save on shipping and I knew if I liked this and could do it I would be getting them anyway.
I have only assembled and worked with the o8M and the 20M so far.
I took a quick look and didn't see any vendors in the U.S. but will look more later. Maybe someone in this forum knows where I can get one.
Will the AXE033 work with the 20M?
 

BeanieBots

Moderator
Can't advise on US suppliers but the AXE033 will work with ANY PICAXE in serial mode. It must be an "X" type if you want to use it I2C mode.
 

eclectic

Moderator
That's really good to know. I do have the 28X1. When I first got into this I got the 08M, 20M, 18X and 28X1 starter kits. I wanted to save on shipping and I knew if I liked this and could do it I would be getting them anyway.
I have only assembled and worked with the o8M and the 20M so far.
I took a quick look and didn't see any vendors in the U.S. but will look more later. Maybe someone in this forum knows where I can get one.
Will the AXE033 work with the 20M?
Now that's being well prepared! :)

As far as the 20M / AXE033 goes, then yes.
All Picaxe chips can do "serout" (manual 2 page158)
(Don't worry about the details yet).

And, I'll whisper this quietly.
Perhaps post a new thread,
asking US picaxers to suggest a serial LCD that works easily with Picaxe.

But don't tell anyone I told ya. :)
e
 
Top