I think you need mode 4 in the SHIFTIN.
And it needs to shift 16 bits, not 12. Even though it's a 12-bit result.
A few other changes and ... try this ...
Code:#HEADER ERRORLEVEL -306 ; SUPRESS PAGE BOUNDRY ERROR #ENDHEADER #CONFIG __CONFIG _XT_OSC & _WDT_OFF & _LVP_OFF & _CPD_ON & _CP_ALL & _PWRTE_ON & _BODEN_ON #ENDCONFIG DEFINE DEBUGIN_REG PORTC DEFINE DEBUGIN_BIT 7 DEFINE DEBUG_REG PORTC DEFINE DEBUG_BIT 6 DEFINE DEBUG_BAUD 2400 DEFINE DEBUG_MODE 1 '-- MCP3201 pins CLK Var PortE.0 DIN Var PortE.1 CS Var PortE.2 '------------------- Calibration CON -1 ; Signed value in 0.1 deg. C Sensor VAR WORD '------------------- ADCON1 = 7 CMCON = 7 HIGH CS Main: LOW CS SHIFTIN Din,Clk,4,[Sensor\16] HIGH CS Sensor = (Sensor & $FFF) * 5000 Sensor = DIV32 4095 + Calibration IF Sensor <= 1500 THEN DEBUG DEC Sensor/10,".",DEC1 Sensor,13,10 PAUSE 1000 Goto Main




Bookmarks