| Electronic Components Datasheet Search |
|
AN1495 Datasheet(PDF) 21 Page - STMicroelectronics |
|
|
|||||||||||||||||||||||||||||
AN1495 Datasheet(HTML) 21 Page - STMicroelectronics |
|
21 / 25 page ![]() AN1495 Code Doc ID 8700 Rev 3 21/25 Appendix B Code The following is an except from the firmware which executes on the ST7264 based control which is part of the PractiSPIN™ evaluation system. This code segment is executed when the decision has been made that it is time for the L6208 to take the next microstep (either forward or reverse). ; PB.4 is the L6208 clock pin ; PB.5 is the L6208 reset pin ; stepstate is a byte variable which controls the motor stepping. ; torquscaler is a byte used to modulate the normalized sine wave values read from the table to set the current level ; TAOC1LR is a register that controls Vrefa (via the duty cycle into the low pass filter) ; TBOC1LR is a register that controls Vrefb (via the duty cycle into the low pass filter) bres PBDR,#4 ;take clock back low ready to generate rising edge later bset PBDR,#5 ;normal state for reset jumpifflagclear forward, doclockrev; jump if direction is reverse ;direction is forward inc stepstate jrne for002 ; skip if stepstate has not rolled over to zero bres PBDR,#5 ; activate reset to maintain sync (just for added noise immunity insurance) for002: ld a,stepstate and a, #%00011111 ; use only lower five bits as index for table lookup ld x,a ; save index ; on indexes 8 and 9, clock L6208 to sequence through zero and then polarity reversal and a, #%00001110 cp a, #8 ; 8 or 9 jrne for001 bset PBDR,#4 ; rising edge for clock for001: ld a, (microtable1,x); get normalized value from table ld y, torquescaler mul y,a ; y:a = (table value) * torquescaler ld TAOC1LR,y ; duty cycle = (table value) * torquescaler/256 ; repeat for phase B |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |