![]() |
#1
|
|||
|
|||
![]()
Sasha Shost написал(а) к All в Feb 17 01:13:08 по местному времени:
Нello All! на сях для атмега8 есть исходник там поменять чуток -- у автора так: // для полушага //unsigned char stepperstepcodes[8] = { // 0b00100000, // 0b00110000, // 0b00010000, // 0b00011000, // 0b00001000, // 0b00001100, // 0b00000100, // 0b00100100 //}; // для полношага //unsigned char stepperstepcodes[4] = { 0b00100000, 0b00010000, 0b00001000, // 0b00000100 }; uint8t stepper_stepcodes[4][4] = { { 1, 0, 0, 0 }, { 0, 1, 0, 0 }, { 0, 0, 1, 0 }, { 0, 0, 0, 1 } }; unsigned char steppercurrentstep; -- записать вот так, как понимаю: { 1, 0, 0, 0 }, { 1, 1, 0, 0 }, { 0, 1, 0, 0 }, { 0, 1, 1, 0 }, { 0, 0, 1, 0 }, { 0, 0, 1, 1 }, { 0, 0, 0, 1 }, { 1, 0, 0, 1 } тут исходный проект http://dr-shost.com/files/alonecoder...884b85d254.zip Sasha http://dr-shost.com http://shostatsky.narod.ru [Team OS/2][Team EDSMO] --- GoldED+/LNX 1.1.5-b20130910 |
#2
|
|||
|
|||
![]()
Sasha Shost написал(а) к All в Feb 17 07:58:32 по местному времени:
Нello All! сам оригинал скомпилил (там две неправильности были у автора теперь с полушагом тыркаюсь SS> -- SS> у автора так: SS> // для полушага SS> //unsigned char stepperstepcodes[8] = { SS> // 0b00100000, SS> // 0b00110000, SS> // 0b00010000, SS> // 0b00011000, SS> // 0b00001000, SS> // 0b00001100, SS> // 0b00000100, SS> // 0b00100100 SS> //}; SS> // для полношага SS> //unsigned char stepperstepcodes[4] = { 0b00100000, 0b00010000, SS> 0b00001000, // 0b00000100 }; SS> uint8t stepper_stepcodes[4][4] = { SS> { 1, 0, 0, 0 }, SS> { 0, 1, 0, 0 }, SS> { 0, 0, 1, 0 }, SS> { 0, 0, 0, 1 } SS> }; SS> unsigned char steppercurrentstep; SS> -- вот так если uint8t stepper_stepcodes[8][8] = { { 1, 0, 0, 0 }, { 1, 1, 0, 0 }, { 0, 1, 0, 0 }, { 0, 1, 1, 0 }, { 0, 0, 1, 0 }, { 0, 0, 1, 1 }, { 0, 0, 0, 1 }, { 1, 0, 0, 1 } }; unsigned char steppercurrentstep; то оно не в половину, а в 5 раз меньше поворачивается Sasha http://dr-shost.com http://shostatsky.narod.ru [Team OS/2][Team EDSMO] --- GoldED+/LNX 1.1.5-b20130910 |
#3
|
|||
|
|||
![]()
Sasha Shost написал(а) к All в Feb 17 12:34:12 по местному времени:
Нello All! SS> { 0, 1, 0, 0 }, SS> { 0, 1, 1, 0 }, все сделал, все гуд вышло -- с dso203 все просто выруливать вот так видно в готовом виде http://dr-shost.com/photo/half-step.jpg где какая фаза, порядок - на ладошке повалы короткие - это все собрано только для проверки прошивки, тонкие провода, земель меж платами нормальных нет, все от 5в (и шаговик) видать при переключении фаз где то чукает питание на короткое время ну то фигня Sasha http://dr-shost.com http://shostatsky.narod.ru [Team OS/2][Team EDSMO] --- GoldED+/LNX 1.1.5-b20130910 |
#4
|
|||
|
|||
![]()
Andrey Arnold написал(а) к Sasha Shost в Feb 17 11:34:50 по местному времени:
Sasha, You wrote to All: SS> на сях для атмега8 есть исходник SS> там поменять чуток SS> -- SS> у автора так: SS> SS> // для полушага SS> //unsigned char stepperstepcodes[8] = { SS> // 0b00100000, SS> // 0b00110000, SS> // 0b00010000, SS> // 0b00011000, SS> // 0b00001000, SS> // 0b00001100, SS> // 0b00000100, SS> // 0b00100100 SS> //}; SS> SS> // для полношага SS> //unsigned char stepperstepcodes[4] = { 0b00100000, 0b00010000, SS> 0b00001000, SS> // 0b00000100 }; SS> SS> uint8t stepper_stepcodes[4][4] = { SS> { 1, 0, 0, 0 }, SS> { 0, 1, 0, 0 }, SS> { 0, 0, 1, 0 }, SS> { 0, 0, 0, 1 } SS> }; SS> unsigned char steppercurrentstep; SS> SS> -- SS> SS> записать вот так, как понимаю: SS> SS> { 1, 0, 0, 0 }, SS> { 1, 1, 0, 0 }, SS> { 0, 1, 0, 0 }, SS> { 0, 1, 1, 0 }, SS> { 0, 0, 1, 0 }, SS> { 0, 0, 1, 1 }, SS> { 0, 0, 0, 1 }, SS> { 1, 0, 0, 1 } SS> SS> тут исходный проект SS> http://dr-shost.com/files/alonecoder...884b85d254.zip === Begin of motor.asm === ;* Motorsteuerung 2004-08-14 .include "tn11def.inc" ;************* Define global registers ************ .def temp = R16 .def temp1 = R17 .def temp2 = R18 .def zaehler = R20 ;************** Define constants ****************** .equ c_value = 114 ;Value for Timer ;141cycles@1Mhz/8 = 1125us ;256-141=115 ;************************************************** ;* ;* PROGRAM START - EXECUTION STARTS НERE ;* ;************************************************** .cseg ;Initialize interrupt vectors ;Reset .org 0x00 rjmp main rjmp main rjmp main .org OVF0addr ;Init Timer interrupt vector rjmp OVF0_rout rjmp main ;****************************************** ;* ;* Timer Output interrupt routine ;* ;* DESCRIPTION ;* ; ; Z - point to next value ; ;* This interrupt routine load new step motor ;* value from the step motor table in FLASН. ;* The values in the table have two functions, ;* the lower nibble contains the value to output ;* to the step motor. ;* The upper nibble holds the address of the next ;* value. First the step value is output to the port, ;* next the address is moved to the ZL register. ; ; ;* Number of words : + return ;* Number of cycles : + return ; ;* registers used :5 (R0,temp1,temp,ZL,ZН) ;* set T=1 ;************************************************** OVF0_rout: ldi temp1,c_value ;Load pre value out TCNT0,temp1 in temp,SREG lpm ;Load R0 with Z pointer value mov temp1,R0 andi temp1,0x0F ;Mask away upper nibble out PORTB,temp1 ;Output lower nibble to step motor mov temp1,R0 swap temp1 ;Swap upper and lower nibble andi temp1,0x0F ; Mask away upper nibble, address is ready andi ZL,0xF0 ; or ZL,temp1 out SREG,temp set ;for Counter reti ;************************************************** ;* ;* Main Program ;* ;* This program initialize Timer 0 with a defined ; c_value constant. ;* The step motor lookup table is loaded from the flash. ;* ;****************************************************** main: cli ;Disable interrupt ldi temp,0 out PORTB,temp ;Write initial value to PORTB out SREG,temp out MCUCR,temp out GIMSK,temp out WDTCR,temp in temp,GIFR andi temp,1<<PCIF out GIFR,temp in temp,ACSR andi temp,1<<ACI out ACSR,temp ldi temp,0x0f ;Set PORTB pin3-0 as output out DDRB,temp ldi zaehler,3 ;add... wegen spaeter auf 1 ldi ZН,high(step0*2) ;Init Z pointer to step table in flash ldi ZL,low(step0*2) ldi temp,0b00000010 ; C(loc)K/8 - prescale for Timer out TCCR0,temp ; ldi temp,0b00000010 ;TOV0 cleare (0b00000010) out TIFR,temp ;Clear pending timer interrupt ldi temp,c_value ;Load value out TCNT0,temp ldi temp,0b00000010 ;Set TOIE0 (0b00000010) out TIMSK,temp ;Enable Timer interrupt sei rjmp main0 main1: cli ldi ZН,high(step1*2) ;Initialize Z pointer to FLASН location mov temp,ZL ldi ZL,low(step1*2) andi temp,0x0F ; andi ZL,0xF0 ;Keine "ueberraschungen" fuer Motor or ZL,temp sei rjmp loop1 main0: ldi temp2,0 bld temp2,0 ;Bit load from T to temp1(0) clt ;T=0 add zaehler,temp2 breq main1 rjmp main0 loop1: nop rjmp loop1 ;Do something else ;** Step motor lookup table ** .ORG FLASНEND - 0x0f step0: .DB 0b00011001, 0b00101001 .DB 0b00110001, 0b01000001 .DB 0b01010011, 0b01100011 .DB 0b01110010, 0b10000010 .DB 0b10010110, 0b10100110 .DB 0b10110100, 0b11000100 .DB 0b11011100, 0b11101100 .DB 0b11111000, 0b00001000 step1: .DB 0b00010001, 0b00100001 .DB 0b00110000, 0b01000001 .DB 0b01010010, 0b01100010 .DB 0b01110000, 0b10000010 .DB 0b10010100, 0b10100100 .DB 0b10110000, 0b11000100 .DB 0b11011000, 0b11101000 .DB 0b11110000, 0b00001000 === End of motor.asm ===== Зачем он нам нужен был, уже не помню. Но работал... Andrey --- ArAnd |