mainprogram.asm

来自「The circuit is drawn for measurement of 」· 汇编 代码 · 共 47 行

ASM
47
字号
;------------------------------------------------------------------------------------------------------
;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 + =
减小字号Ctrl + -
显示快捷键?