English
Language : 

MC1H3 Datasheet, PDF (56/60 Pages) Microchip Technology – High Voltage Power Module Users Guide
dsPICDEM™ MC1H 3-Phase High Voltage Power Module
;start ADC convertion on ch2, which has now finished aquiring
bsf ADCON0,GO
bcf GPIO,SDO ;send bit 3
bsf GPIO,SCK
btfsc BYTE_TO_SEND,3
bsf GPIO,SDO
bcf GPIO,SCK
bcf GPIO,SDO ;send bit 2
bsf GPIO,SCK
btfsc BYTE_TO_SEND,2
bsf GPIO,SDO
bcf GPIO,SCK
bcf GPIO,SDO ;send bit 1
bsf GPIO,SCK
btfsc BYTE_TO_SEND,1
bsf GPIO,SDO
bcf GPIO,SCK
bcf GPIO,SDO ;send bit 0
bsf GPIO,SCK
btfsc BYTE_TO_SEND,0
bsf GPIO,SDO
bcf GPIO,SCK
finish_conversion
btfsc ADCON0,GO
goto finish_conversion
movf ADRES,W
movwf BYTE_TO_SEND
;need a min 4us delay before starting next acquire
;begin to transmit value from channel 2 |VAC|_SENSE
bcf GPIO,SDO ;send bit 7
bsf GPIO,SCK
btfsc BYTE_TO_SEND,7
bsf GPIO,SDO
bcf GPIO,SCK
;set up ADC to begin sampling channel 0
movlw 0x41
;Fosc/8, A/D enabled channel 0 selected
movwf ADCON0
;begin sampling ch0 BUS_SENSE
bcf GPIO,SDO ;send bit 6
bsf GPIO,SCK
btfsc BYTE_TO_SEND,6
bsf GPIO,SDO
bcf GPIO,SCK
DS70096A-page 50
© 2003 Microchip Technology Inc.