DatasheetQ Logo
Electronic component search and free download site. Transistors,MosFET ,Diode,Integrated circuits

AN857 查看數據表(PDF) - Microchip Technology

零件编号
产品描述 (功能)
生产厂家
AN857
Microchip
Microchip Technology Microchip
AN857 Datasheet PDF : 48 Pages
1 2 3 4 5 6 7 8 9 10 Next Last
FIGURE 4:
#define
#define
#define
#define
COMMUTATION CODE SEGMENT
DrivePort
SensorMask
SensorPort
DirectionBit
PORTC
B’00000111’
PORTE
PORTA, 1
Commutate
movlw
andwf
xorwf
btfsc
return
SensorMask
SensorPort
LastSensor, w
STATUS, Z
;retain only the sensor bits
;get sensor data
;test if motion sensed
;zero if no change
;no change - return
xorwf
btfss
goto
LastSensor, f
DirectionBit
FwdCom
;replace last sensor data with current
;test direction bit
;bit is zero - do forward commutation
movlw
movwf
movlw
goto
FwdCom
movlw
movwf
movlw
Com2
addwf
btfsc
incf
HIGH RevTable
PCLATH
LOW RevTable
Com2
HIGH FwdTable
PCLATH
LOW FwdTable
LastSensor, w
STATUS, C
PCLATH, f
;reverse commutation
;get MS byte to table
;prepare for computed GOTO
;get LS byte of table
;forward commutation
;get MS byte of table
;prepare for computed GOTO
;get LS byte of table
;add sensor offset
;page change in table?
;yes - adjust MS byte
call GetDrive
movwf DriveWord
return
;get drive word from table
;save as current drive word
GetDrive
movwf PCL
FwdTable
retlw B’00000000’
retlw B’00010010’
retlw B’00001001’
retlw B’00011000’
retlw B’00100100’
retlw B’00000110’
retlw B’00100001’
retlw B’00000000’
RevTable
retlw B’00000000’
retlw B’00100001’
retlw B’00000110’
retlw B’00100100’
retlw B’00011000’
retlw B’00001001’
retlw B’00010010’
retlw B’00000000’
;invalid
;phase 6
;phase 4
;phase 5
;phase 2
;phase 1
;phase 3
;invalid
;invalid
;phase /6
;phase /4
;phase /5
;phase /2
;phase /1
;phase /3
;invalid
AN857
2002-2011 Microchip Technology Inc.
DS00857B-page 5

Share Link: 

datasheetq.com  [ Privacy Policy ]Request Datasheet ] [ Contact Us ]