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

📄 int_device02.s

📁 小车自动寻迹代码,可以进行电子设计,设计电动小车
💻 S
字号:
	.module int_device02.c
	.area text(rom, con, rel)
	.dbfile C:\DOCUME~1\Administrator.1B4135EF7FF9405\桌面\电机试用\time0_ctc---电机调试\int_device02.c
	.dbfunc e port_init _port_init fV
	.even
_port_init::
	.dbline -1
	.dbline 7
; //ICC-AVR application builder : 2006-9-7 0:27:10
; // Target : M32
; // Crystal: 7.3728Mhz
; #include "config.h"
; 
; void port_init(void)
; {
	.dbline 8
;  PORTA = 0x00;
	clr R2
	out 0x1b,R2
	.dbline 9
;  DDRA  = 0x00;
	out 0x1a,R2
	.dbline 10
;  PORTB = 0x00;
	out 0x18,R2
	.dbline 11
;  DDRB  = 0xFF;
	ldi R24,255
	out 0x17,R24
	.dbline 12
;  PORTC = 0x00;
	out 0x15,R2
	.dbline 13
;  DDRC  = 0x00;
	out 0x14,R2
	.dbline 14
;  PORTD = 0x00;
	out 0x12,R2
	.dbline 15
;  DDRD  = 0x80;
	ldi R24,128
	out 0x11,R24
	.dbline -2
L1:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e timer0_init _timer0_init fV
	.even
_timer0_init::
	.dbline -1
	.dbline 23
; }
; 
; //============timer1 PWM输出==================//
; //TIMER0 initialize - prescale:1024
; // desired value: 25mSec
; // actual value: 25.000mSec (0.0%)
; void timer0_init(void)
; {
	.dbline 24
;  TCCR0 = 0x00;  //stop
	clr R2
	out 0x33,R2
	.dbline 25
;  TCNT0= 0x01;  //set count
	ldi R24,1
	out 0x32,R24
	.dbline 26
;  OCR0 = 0x66;  //set compare
	ldi R24,102
	out 0x3c,R24
	.dbline 27
;  TCCR0 = (1<<WGM00)|(1<<WGM01)|(1<<COM01)|0x04;//0x04 0100B 代表256预分频
	ldi R24,108
	out 0x33,R24
	.dbline -2
L2:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e init_devices _init_devices fV
	.even
_init_devices::
	.dbline -1
	.dbline 34
; }
; 
; //TIMER1 initialize - prescale:8
; // desired value: 50mSec
; // actual value:  50mSec (0.0%)
; void init_devices(void)
; {
	.dbline 35
;  CLI(); //disable all interrupts
	cli
	.dbline 36
;  port_init();
	xcall _port_init
	.dbline 37
;  timer0_init();
	xcall _timer0_init
	.dbline 39
; 
;  MCUCR = 0x00;
	clr R2
	out 0x35,R2
	.dbline 40
;  GICR  = 0x00;
	out 0x3b,R2
	.dbline 41
;  TIMSK|=(1<<TOIE0)|(1<<OCIE0);     //允许溢出中断和比较匹配中断
	in R24,0x39
	ori R24,3
	out 0x39,R24
	.dbline 42
;  SEI(); //re-enable interrupts
	sei
	.dbline -2
L3:
	.dbline 0 ; func end
	ret
	.dbend

⌨️ 快捷键说明

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