ImageVerifierCode 换一换
格式:DOCX , 页数:62 ,大小:24.64KB ,
资源ID:30533114      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/30533114.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(河北联合程序.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

河北联合程序.docx

1、河北联合程序/* Including needed modules to compile this module/procedure */ #include Cpu.h #include Events.h #include sci0.h #include io_b0.h #include hs_interrupt.h #include vs_interrupt.h #include res_5110.h #include sce_5110.h #include dc_5110.h #include sdin_5110.h #include sclk_5110.h #include bmq_js

2、.h #include dianji.h #include duoji.h #include dianji_io0.h #include dianji_io1.h #include k1.h #include k2.h #include k3.h #include k4.h #include k5.h #include k6.h #include buzzer.h #include Bit1.h #include Bit2.h #include key_low.h #include key_high.h /* Including shared modules, which are used f

3、or whole project */ #include PE_Types.h #include PE_Error.h #include PE_Const.h #include IO_Map.h #define res(a) res_5110_PutVal(a) #define sce(a) sce_5110_PutVal(a) #define dc(a) dc_5110_PutVal(a) #define sdin(a) sdin_5110_PutVal(a) #define sclk(a) sclk_5110_PutVal(a) /* Global variables */ volatil

4、e word SR_lock = 0; /* Lock */ volatile word SR_reg; /* Current value of the SR register */ /* * = * Method : Cpu_Interrupt (component 56F8366) * * Description : * The method services unhandled interrupt vectors. * This method is internal. It is used by Processor Expert only. * = */ #pragma interrup

5、t alignsp void Cpu_Interrupt(void) asm(DEBUGHLT); /* Halt the core and placing it in the debug processing state */ /*lint -save -e? Disable MISRA rule (all) checking. */ asm void Cpu_Delay100US(word us100) /* Total irremovable overhead: about 16 cycles */ /* move.w: 2 cycles overhead (load parameter

6、 into register) */ /* jsr: 5 cycles overhead (jump to subroutine) */ /* rts: 8 cycles overhead (return from subroutine) */ /* nop: 1 cycles overhead (aditional nops) */ loop: /* 100 us delay block begin */ /* * Delay * - requested : 100 us 100MHz, * - possible : 10000 c, 100000 ns * - without remova

7、ble overhead : 9994 c, 99940 ns */ adda #2, SP /* (1 c: 10 ns) move SP forward */ move.l A10, X:(SP) /* (2 c: 20 ns) push A */ move.w #4989, A /* (2 c: 20 ns) number of iterations */ do A, label0 /* (8 c: 80 ns) repeat 4989x nop */ nop /* (1 c: 10 ns) wait for 1 c */ label0: move.l X:(SP), A /* (2 c

8、: 20 ns) pop A */ suba #2, SP /* (1 c: 10 ns) move SP back */ /* 100 us delay block end */ dec.w Y0 /* us100 parameter is passed via Y0 register */ jne loop /* next loop */ nop /* avoid pipeline conflicts */ rts /* return from subroutine */ /*lint -restore */ /* * = * Method : Cpu_DisableInt (compon

9、ent 56F8366) * * Description : * Disables all maskable interrupts * Parameters : None * Returns : Nothing * = */ /* void Cpu_DisableInt(void) * This method is implemented as macro in the header module. * */ /* * = * Method : Cpu_EnableInt (component 56F8366) * * Description : * Enables all maskable

10、interrupts * Parameters : None * Returns : Nothing * = */ /* void Cpu_EnableInt(void) * This method is implemented as macro in the header module. * */ /* * = * Method : Cpu_SetStopMode (component 56F8366) * * Description : * Sets low power mode - Stop mode. * For more information about the stop mode

11、 see this CPU * documentation. * Parameters : None * Returns : Nothing * = */ /* void Cpu_SetStopMode(void) * This method is implemented as macro in the header module. * */ /* * = * Method : Cpu_SetWaitMode (component 56F8366) * * Description : * Sets low power mode - Wait mode. * For more informati

12、on about the wait mode see this CPU * documentation. * Release from wait mode: Reset or interrupt * Parameters : None * Returns : Nothing * = */ /* void Cpu_SetWaitMode(void) * This method is implemented as macro in the header module. * */ /* * = * Method : Cpu_SetDataMode (component 56F8366) * * De

13、scription : * Sets the Data memory map to use either internal & * external resources or external resources only. * Parameters : * NAME - DESCRIPTION * Mode - Data memory access mode. * Possible modes: * INT_EXT_MODE - use internal & external * resources * EXT_MODE - use external resources only * Ret

14、urns : Nothing * = */ void Cpu_SetDataMode(byte Mode) if (Mode = INT_EXT_MODE) asm bfclr #0x0008,OMR /* Set internal and external data memory mode */ else asm bfset #0x0008,OMR /* Set external data memory mode */ /* * = * Method : _EntryPoint (component 56F8366) * * Description : * Initializes the w

15、hole system like timing and so on. At the end * of this function, the C startup is invoked to initialize stack, * memory areas and so on. * This method is internal. It is used by Processor Expert only. * = */ extern void init_56800_(void); /* Forward declaration of external startup function declared

16、 in startup file */ /* ! Here you can place your own code using property User data declarations on the build options tab. ! */ void _EntryPoint(void) #pragma constarray off /* ! Here you can place your own code before PE initialization using property User code before PE initialization on the build o

17、ptions tab. ! */ /* # 56F8366 Cpu init code . */ /* PE initialization code after reset */ /* System clock initialization */ setReg(PLLCR, (PLLCR_LCKON_MASK | PLLCR_ZSRC0_MASK); /* Enable PLL, LCKON and select clock source from prescaler */ /* PLLDB: LORTP=2,PLLCOD=0,PLLCID=1,?=0,PLLDB=99 */ setReg16

18、(PLLDB, 8547U); /* Set the clock prescalers */ while(!getRegBit(PLLSR, LCK0) /* Wait for PLL lock */ setReg(PLLCR, (PLLCR_LCKON_MASK | PLLCR_ZSRC1_MASK); /* Select clock source from postscaler */ /* FMCLKD: ?=0,?=0,?=0,?=0,?=0,?=0,?=0,?=0,DIVLD=0,PRDIV8=1,DIV=31 */ setReg16(FMCLKD, 95U); /* Set the

19、flash clock prescaler */ /* End of PE initialization code after reset */ /* ! Here you can place your own code after PE initialization using property User code after PE initialization on the build options tab. ! */ asm(JMP init_56800_); /* Jump to C startup code */ /* * = * Method : PE_low_level_ini

20、t (component 56F8366) * * Description : * Initializes beans and provides common register initialization. * The method is called automatically as a part of the * application initialization code. * This method is internal. It is used by Processor Expert only. * = */ void PE_low_level_init(void) /* DEC

21、0_FIR: ?=0,?=0,?=0,?=0,?=0,?=0,?=0,?=0,DELAY=0 */ setReg16(DEC0_FIR, 0U); /* Set up Filter Interval Register of Quadrature Decoder 0 */ /* DEC1_FIR: ?=0,?=0,?=0,?=0,?=0,?=0,?=0,?=0,DELAY=0 */ setReg16(DEC1_FIR, 0U); /* Set up Filter Interval Register of Quadrature Decoder 1 */ /* SIM_PCE: EMI=1,ADC_

22、B=1,ADC_A=1,CAN=1,DEC_1=1,DEC_0=1,TMR_D=1,TMR_C=1,TMR_B=1,TMR_A=1,SCI_1=1,SCI_0=1,SPI_1=1,SPI_0=1,PWM_B=1,PWM_A=1 */ setReg16(SIM_PCE, 65535U); /* Set up the peripheral clock enable register */ /* SIM_PCE2: ?=0,?=0,?=0,?=0,?=0,?=0,?=0,?=0,?=0,?=0,?=0,?=0,?=0,?=0,?=0,CAN2=1 */ setReg16(SIM_PCE2, 1U);

23、 /* Set up the peripheral clock enable register */ /* SIM_CONTROL: ?=0,?=0,?=0,?=0,?=0,?=0,?=0,?=0,?=0,emi_mode=0,OnceEbl=0,SWRst=0,stop_disable=0,wait_disable=0 */ setReg16(SIM_CONTROL, 0U); /* Set up the SIM control register */ /* SIM_CLKOSR: ?=0,?=0,?=0,?=0,?=0,?=0,A23_b=0,A22_b=0,A21_b=0,A20_b=0

24、,CLKDIS=1,CLKOSEL=0 */ setReg16(SIM_CLKOSR, 32U); /* Set up the SIM clock output select register */ /* TSENSOR_CONTROL: PWR=0 */ clrReg16Bits(TSENSOR_CONTROL, 1U); /* Disable power source for the temperature sensor */ /* Common initialization of the CPU registers */ /* GPIO_E_PER: PE10=1,PE8=1,PE3=0

25、,PE2=0,PE1=1,PE0=1 */ clrSetReg16Bits(GPIO_E_PER, 12U, 1283U); /* GPIO_B_PUR: PU=1 */ setReg16Bits(GPIO_B_PUR, 1U); /* GPIO_B_PPMODE: PPMODE=1 */ setReg16Bits(GPIO_B_PPMODE, 1U); /* GPIO_B_DR: D=0 */ clrReg16Bits(GPIO_B_DR, 1U); /* GPIO_B_DDR: DD=0 */ clrReg16Bits(GPIO_B_DDR, 1U); /* GPIO_B_PER: PE=

26、0 */ clrReg16Bits(GPIO_B_PER, 1U); /* GPIO_B_IPOLR: IPOL=0 */ clrReg16Bits(GPIO_B_IPOLR, 1U); /* GPIO_B_IENR: IEN=0 */ clrReg16Bits(GPIO_B_IENR, 1U); /* INTC_IPR6: TMRC_0_IPL=2,TMRD_0_IPL=2 */ clrSetReg16Bits(INTC_IPR6, 16448U, 32896U); /* GPIO_E_PUR: PU10=1,PU8=1 */ setReg16Bits(GPIO_E_PUR, 1280U); /* GPIO_A_IENR: IEN&=255 */ clrReg16Bits(GPIO_A_IENR, 255U); /* GPIO_A_IAR: IA&=255 */ clrReg16Bits(GPIO_A_IAR, 255U);

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1