LM75 - temperature sensor support

LM75 - temperature sensor support - ; LM75.ASM ; ; Written...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
; LM75.ASM ; ; Written by Aaron Hickman <Aaron.Hickman@drexel.edu> ; Added to PIC archive: 21/May/1998 LIST p=16c84 #include <p16c84.inc> __CONFIG 11h CONSTANT VARS=0CH CONSTANT SCL=7 CONSTANT SDA=6 ; bits on Portb defined CONSTANT TX=5 DEVICE_ADR EQU VARS+0 ; A2 A1 A0 address O_BYTE EQU VARS+1 ; byte sent on I2C bus I_BYTE EQU VARS+2 ; byte received on I2C bus _N EQU VARS+3 ; index _25US_LOOP EQU VARS+4 ; timing IN_BYTE_MSB EQU VARS+5 IN_BYTE_LSB EQU VARS+6 BCD_0 EQU VARS+7 BCD_1 EQU VARS+8 BCD_2 EQU VARS+9 COUNT EQU VARS+10 TEMP EQU VARS+11 DATA_BYTE EQU VARS+12 SEROUT_LP EQU VARS+13 BAUD_RATE EQU VARS+14 DELAY_A EQU VARS+15 DELAY_B EQU VARS+16 DELAY_LP1 EQU VARS+17 DELAY_LP2 EQU VARS+18 FRACTION EQU VARS+19 ORG 000H MOVLW 90H MOVWF DEVICE_ADR MOVLW 0EH MOVWF BAUD_RATE CONFIG_PORTS: BSF STATUS, RP0 ; select Bank 1 MOVLW 1FH MOVWF TRISB BCF STATUS, RP0 ; select Bank 0 READ_LM75: CALL START MOVF DEVICE_ADR, W IORLW 01H MOVWF O_BYTE CALL OUT_BYTE CALL NACK CALL IN_BYTE CALL ACK
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
MOVF I_BYTE, W MOVWF IN_BYTE_LSB CALL IN_BYTE CALL NACK CALL STOP MOVF I_BYTE, W MOVWF FRACTION CLRF IN_BYTE_MSB MOVLW 0CH CALL DISPLAY BTFSS IN_BYTE_LSB, 7 GOTO POSITIVE MOVLW '-' CALL DISPLAY COMF IN_BYTE_LSB, W MOVWF IN_BYTE_LSB GOTO FINISHUP POSITIVE: MOVLW '+' CALL DISPLAY FINISHUP: CALL BIN_BCD MOVF BCD_1, W CALL ASCII_LOW CALL DISPLAY MOVF BCD_2, W CALL ASCII_HIGH CALL DISPLAY MOVF BCD_2, W CALL ASCII_LOW CALL DISPLAY MOVLW '.' CALL DISPLAY BTFSC FRACTION, 7 MOVLW '5' BTFSS FRACTION, 7 MOVLW '0' CALL DISPLAY MOVLW
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

LM75 - temperature sensor support - ; LM75.ASM ; ; Written...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online