|
Joined: Feb 2014
Posts: 1,124 Likes: 193
Very Senior Member
|
OP
Very Senior Member
Joined: Feb 2014
Posts: 1,124 Likes: 193 |
so the stepper motor steps at full steps, and if we just use the current position, it looks terrible. If we use a simple algorithm of using the last stepper position as our "starting position" and add an amount based on our current speed and the elapsed time interval, it looks 100% better. ![[Linked Image from i.imgur.com]](https://i.imgur.com/CeXPD6W.png) edit: tried the same routine on the Amstrad dmp3000 self test: ![[Linked Image from i.imgur.com]](https://i.imgur.com/4j0jMq4.png)
Last edited by Golden Child; 10/18/24 11:05 AM.
|
2 members like this:
robcfg, Darkstar |
|
|
|
Joined: Dec 2015
Posts: 173 Likes: 12
Senior Member
|
Senior Member
Joined: Dec 2015
Posts: 173 Likes: 12 |
The documentation for the stepper motor controller blocks in Toshiba MCUs refer to a (programmable) difference between full-step excitation and half-step excitation. That sounds a little like what's going on here.
Last edited by AJR; 10/18/24 01:31 PM.
|
|
|
|
Joined: Feb 2014
Posts: 1,124 Likes: 193
Very Senior Member
|
OP
Very Senior Member
Joined: Feb 2014
Posts: 1,124 Likes: 193 |
I instrumented it with a bunch of printfs and it looks like it's doing full steps and firing the pins in between the steps, so you get sub-halfstep resolution.
The 0x1ff for the pins is like a "nop" where it fires the pins, but no pins will energize.
cr STEPPER = 4 4 Update pos=525.000000 Speed = 466.645880 average with last = 471.960753 time=310.099806 FIRE @ 310.100580 sincelast=0.000870 pins=17f FIRE @ 310.101454 sincelast=0.000874 pins=1ff FIRE @ 310.102325 sincelast=0.000871 pins=17f FIRE @ 310.103198 sincelast=0.000873 pins=1ff STROBE 8c cr STEPPER = 8 1 Update pos=527.000000 Speed = 488.889333 average with last = 477.767607 time=310.103897 FIRE @ 310.104072 sincelast=0.000874 pins=17f FIRE @ 310.104944 sincelast=0.000871 pins=1ff FIRE @ 310.105816 sincelast=0.000873 pins=17f FIRE @ 310.106690 sincelast=0.000874 pins=1ff FIRE @ 310.107562 sincelast=0.000871 pins=17f STROBE 1c cr STEPPER = 1 8 Update pos=529.000000 Speed = 477.275626 average with last = 483.082480 time=310.108088 FIRE @ 310.108434 sincelast=0.000873 pins=1ff FIRE @ 310.109309 sincelast=0.000874 pins=160 FIRE @ 310.110180 sincelast=0.000871 pins=1df FIRE @ 310.111053 sincelast=0.000873 pins=17f FIRE @ 310.111927 sincelast=0.000874 pins=1ff STROBE 2c cr STEPPER = 2 2 Update pos=531.000000 Speed = 477.586454 average with last = 477.431040 time=310.112276 FIRE @ 310.112799 sincelast=0.000873 pins=17f FIRE @ 310.113671 sincelast=0.000871 pins=1ff FIRE @ 310.114544 sincelast=0.000873 pins=17f FIRE @ 310.115418 sincelast=0.000874 pins=1df STROBE 4c FIRE @ 310.116289 sincelast=0.000871 pins=17f cr STEPPER = 4 4 Update pos=533.000000 Speed = 477.275626 average with last = 477.431040 time=310.116466 FIRE @ 310.117162 sincelast=0.000873 pins=1ff FIRE @ 310.118036 sincelast=0.000874 pins=17f FIRE @ 310.118907 sincelast=0.000871 pins=1ff FIRE @ 310.119780 sincelast=0.000873 pins=17f
|
|
|
|
Joined: Feb 2014
Posts: 1,124 Likes: 193
Very Senior Member
|
OP
Very Senior Member
Joined: Feb 2014
Posts: 1,124 Likes: 193 |
Making it print "interleaved" for dual pass NLQ: ![[Linked Image from i.imgur.com]](https://i.imgur.com/ME5vgL2.png) If you look at 200% you can see that the vertical alignment of some characters are off on the second pass but at 100% it looks good.
|
2 members like this:
Guru, robcfg |
|
|
|
Joined: Feb 2014
Posts: 1,124 Likes: 193
Very Senior Member
|
OP
Very Senior Member
Joined: Feb 2014
Posts: 1,124 Likes: 193 |
I was using the stepper from machine/steppers.cpp but the "standard drive table" isn't used by many steppers. If you break it down, steppers use 4 bits for the phase, and if you swap the bits around you can make one "drive table" equivalent to another. I'd rather be able to call a routine to set the "drive table" by using a list of bit positions. If you had a list of bit positions, you can choose which bit is the start, then the next, all the way to the last.
void stepper_device::advance_phase()
{
//Standard drive table is 2,6,4,5,1,9,8,a
//NOTE: This runs through the stator patterns in such a way as to drive the reel forward (downwards from the player's view, clockwise on our rose)
//The Heber 'Pluto' controller runs this in reverse, this needs checking on real hardware
switch (m_pattern)
{ //Black Blue Red Yellow
case 0x02:// 0 0 1 0
m_phase = 7;
break;
case 0x06:// 0 1 1 0
m_phase = 6;
break;
case 0x04:// 0 1 0 0
m_phase = 5;
break;
case 0x05:// 0 1 0 1
m_phase = 4;
break;
case 0x01:// 0 0 0 1
m_phase = 3;
break;
case 0x09:// 1 0 0 1
m_phase = 2;
break;
case 0x08:// 1 0 0 0
m_phase = 1;
break;
case 0x0A:// 1 0 1 0
m_phase = 0;
break;
// Black Blue Red Yellow
case 0x03:// 0 0 1 1
{
if ((m_old_phase ==6)||(m_old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now
{
m_phase = 7;
}
else //otherwise it will line up due south
{
m_phase = 3;
}
}
break;
case 0x0C:// 1 1 0 0
{
if ((m_old_phase ==6)||(m_old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now
{
m_phase = 5;
}
else //otherwise it will line up due west
{
m_phase = 1;
}
}
break;
}
}
u8 m_stepper_pattern[4] = {1, 2, 0, 3}; // "standard table" goes from bit 1 to bit 2 to bit 0 to bit 3.
bool m_stepper_reverse = false;
void set_stepper_pattern(u8 a, u8 b, u8 c, u8 d, bool reverse = false)
{ m_stepper_pattern[0] = a;
m_stepper_pattern[1] = b;
m_stepper_pattern[2] = c;
m_stepper_pattern[3] = d;
m_stepper_reverse = reverse;
}
u8 calc_pattern(u8 a, u8 b = 100);
void test() { set_stepper_pattern(0,1,2,3); }
u8 stepper_device::calc_pattern(u8 a, u8 b)
{
u8 retval = 1 << m_stepper_pattern[a];
if (b < 4) retval |= (1 << m_stepper_pattern[b]);
return retval;
}
void stepper_device::advance_phase()
{
//Standard drive table is 2,6,4,5,1,9,8,a
//NOTE: This runs through the stator patterns in such a way as to drive the reel forward (downwards from the player's view, clockwise on our rose)
//The Heber 'Pluto' controller runs this in reverse, this needs checking on real hardware
if (m_pattern == calc_pattern( 0)) m_phase = 7;
else if (m_pattern == calc_pattern(1, 0)) m_phase = 6;
else if (m_pattern == calc_pattern( 1)) m_phase = 5;
else if (m_pattern == calc_pattern(2, 1)) m_phase = 4;
else if (m_pattern == calc_pattern( 2)) m_phase = 3;
else if (m_pattern == calc_pattern(3, 2)) m_phase = 2;
else if (m_pattern == calc_pattern( 3)) m_phase = 1;
else if (m_pattern == calc_pattern(0, 3)) m_phase = 0;
else if (m_pattern == calc_pattern(0, 2))
{
if ((m_old_phase ==6)||(m_old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now
{
m_phase = 7;
}
else //otherwise it will line up due south
{
m_phase = 3;
}
}
else if (m_pattern == calc_pattern(1, 3))
{
{
if ((m_old_phase ==6)||(m_old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now
{
m_phase = 5;
}
else //otherwise it will line up due west
{
m_phase = 1;
}
}
}
}
So by choosing a bit order, you can set the bit pattern for a given stepper and then not have to use bitswap code, as one you call set_stepper_pattern() you will have the order you need. u8 crdata = BIT(m_printer_shift_output,4,4); u8 crswap = bitswap<4>(crdata, 0, 2, 1, 3); m_bitmap_printer->update_cr_stepper(crswap);
|
|
|
|
Joined: Feb 2008
Posts: 173 Likes: 13
Senior Member
|
Senior Member
Joined: Feb 2008
Posts: 173 Likes: 13 |
Just curious, did you make PRs for any of the other stuff you got working like the Commodore 4-color pen plotter and all the other Commodore printers you showed working (or mostly working) above?
|
|
|
|
Joined: Mar 2001
Posts: 17,234 Likes: 259
Very Senior Member
|
Very Senior Member
Joined: Mar 2001
Posts: 17,234 Likes: 259 |
He can't. Printers are under the Vas Death Penalty, at least until someone makes an Adobe-compliant middle layer.
|
1 member likes this:
Darkstar |
|
|
|
Joined: Feb 2014
Posts: 1,124 Likes: 193
Very Senior Member
|
OP
Very Senior Member
Joined: Feb 2014
Posts: 1,124 Likes: 193 |
I suppose there's nothing stopping me from doing stuff in my own fork. I may as well put it on github for I've got a bunch queued up, just waiting for the green light.
Last edited by Golden Child; 11/18/24 03:23 PM.
|
1 member likes this:
robcfg |
|
|
Forums9
Topics9,328
Posts122,128
Members5,074
|
Most Online1,283 Dec 21st, 2022
|
|
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!
|
|
|
|