⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainprogram.asm

📁 The circuit is drawn for measurement of acceleration from –1000 mg until + 1000 mg. It can be place
💻 ASM
字号:
;------------------------------------------------------------------------------------------------------
;Name		:MainProgram
;------------------------------------------------------------------------------------------------------
.cseg
.org		SegmentMainProgram
;------------------------------------------------------------------------------------------------------
.org 		_RESET_VECTOR
	rjmp	Reset
.org 		_EXTERNAL_INTERRUPT0
	rjmp	Interrupt
;------------------------------------------------------------------------------------------------------
.include	"ProgramVersion.asm"
;------------------------------------------------------------------------------------------------------
.cseg
.org		SegmentMainProgram
;------------------------------------------------------------------------------------------------------
Reset:
	rjmp	CPUInitialization									;Initialize the CPU
CPUIsBeenSet:
	ldi		TempRegisterB,_1_SEC								;wait 1 sec 
	rcall	Delaysec
	rcall	IOInitialization									;Initialize the I/O Ports
	rcall	LCDInitialization									;Initialize the LCD module
	rcall	AccelerometterCalibration							;calibrate the accelerometter
	sbi		PortLCDLed,PinLCDLed								;light the LED
	rcall	ExternalInterrupt0									;Initialize the External Interrupt 0
	sei															;enable alla interrupts
	rcall	WaitOneInterrupt									;wait some time
	rcall	WaitOneInterrupt					
	rcall	ClearLCD											;clear the LCD module
	ldi		TempRegisterB,_15_MSEC								;wait 15 msec
	rcall	Delaymsec
MainProgram:
	rcall	UpdateLine1											;Update LCD's line1
MainProgramInLoop:
	rcall	AccelerometterMeasurement							;make the acceleration measurement
	ldi		TempRegister,_500_MSEC								;wait 500 msec
	rcall	DelaySec
	rcall	UpdateLine2											;Update LCD's line2
	sbrs	TimeFlagRegister,SecondFlag
	rjmp	MainProgramInLoop
	andi	TimeFlagRegister,ClrSecondFlag
	rjmp	MainProgram											;always loop to MainProgram
;------------------------------------------------------------------------------------------------------


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -