MyTetra Share
Делитесь знаниями!
main.asm
Время создания: 05.12.2017 15:48
Раздел: Electronics - Microcontrollers - AVR8 - AVR ASM - ASM_PROJ - DS18B20 - DS18B20 v.3

;.include "m8adef.inc"

.include "m1281def.inc"


.include "macro.inc"


;INTERRUPT VECTORS

rjmp reset ;ïðåðûâàíèå îò RESET, ññûëàåìñÿ íà îáðàáîò÷èê ïðåðûâàíèÿ - initial

; rjmp 0 ;rjmp service_INT0 ;âíåøíåå ïðåðûâàíèå 0

; rjmp 0 ;rjmp service_INT1 ;âíåøíåå ïðåðûâàíèå 1

; rjmp 0 ;rjmp service_OC2 ;ñîâïàäåíèå TCNT2 è OCR2

; rjmp 0 ;rjmp service_OVF2 ;ïåðåïîëíåíèå TCNT2

; rjmp 0 ;rjmp service_ICP1 ;çàõâàò â ICP1

; rjmp 0 ;rjmp service_OC1A ;ñîâïàäåíèå TCNT1 è OCR1A

; rjmp 0 ;rjmp service_OC1B ;ñîâïàäåíèå TCNT1 è OCR1B

; rjmp 0 ;rjmp service_OVF1 ;ïåðåïîëíåíèå TCNT1

; rjmp 0 ;rjmp service_OVF0 ;ïåðåïîëíåíèå TCNT0

; rjmp 0 ;rjmp service_SPI ;ïðåðûâàíèå îò ìîäóëÿ SPI

; rjmp 0 ;rjmp service_URXC ;ïîëó÷åíèå áàéòà ïî USART

; rjmp 0 ;rjmp service_UDRE ;îïóñòîøåíèå UDR â USART

; rjmp 0 ;rjmp service_UTXC ;ïåðåäà÷à áàéòà ïî USART

; rjmp 0 ;rjmp service_ADCC ;ïðåðûâàíèå îò ÀÖÏ

; rjmp 0 ;rjmp service_ERDY ;çàâåðøåíèå çàïèñè â EEPROM

; rjmp 0 ;rjmp service_ACI ;ïðåðûâàíèå îò êîìïàðàòîðà

; rjmp 0 ;rjmp service_TWI ;ïðåðûâàíèå îò ìîäóëÿ TWI

; rjmp 0 ;rjmp service_SPMR ;çàâåðøåíèå âûïîëíåíèÿ spm




.include "memory.asm"


.cseg

.org 0x20


;STACK INITIALISATION

reset:

ldi R16,low(RAMEND)

out SPL,R16

ldi R17,high(RAMEND)

out SPH,R17


;DEFINES

.equ SENSOR_DDR = DDRD

.equ SENSOR_PORT = PORTD

.equ SENSOR_PIN = PIND

.equ SENSOR = 0

.equ SENSOR_MASK = 0x01


;Commands for temperature sensor:

.set SEN_NOID = 0xCC ; skip identification

.set SEN_CONVERT = 0x44 ; convert temperature to HEX

.set SEN_READ_DAT = 0xBE ; send all data to master


;PERIPHERY INITIALISATION

SBI SENSOR_DDR, SENSOR

CBI SENSOR_PORT,SENSOR


;MAIN PROGRAM

main:

CALL sensor_get_data

LDS R16, var_temperature

CALL convert_HEX_to_DEC

//------

// show temperature

//------

rjmp main

#include "sensor_ds18b20.asm"

#include "math.asm"


Так же в этом разделе:
 
MyTetra Share v.0.53
Яндекс индекс цитирования