MC9S12芯片知识相关

{//CPMU----------->clock reset and power management unit
时钟复位和电源管理单元
CPMUSYNR------->时钟合成寄存器--控制锁相环的倍增系数和选择VCO的频率的范围内。
VCO----->压控振荡器
SYNDIV 由 SYNR 寄存器的 0-5 位设定

CPMUPOSTDIV--S12CPMU Post Divider Register---POSTDIV寄存器控制VCOCLK PLLCLK之间的频率比

CPMUREFDIV------>时钟分频寄存器--提供了一个出色的细粒度的乘法步骤锁相环当在使用外部振荡器作为引用时。
REFDIV[3:0]
REFFRQ[1:0]位用于配置内部PLL滤波器。为了PLL正常的运行REFFRQ[1:0]位必须根据实际的REFCLK频率选择。

The CPMUFLG------>状态标志寄存器---This register provides S12CPMU status bits and flags.PLL是否是锁定状态,PLL是否是稳定状态

bit3-LOCK----->Lock Status Bit —LOCK reflects the current state of PLL lock condition. Writes have no effect. While PLL is
unlocked (LOCK=0) fPLL is fVCO / 4 to protect the system from high core clock frequencies during the PLL
stabilization time tlock.
0 VCOCLK is not within the desired tolerance of the target frequency.
fPLL = fVCO/4.
1 VCOCLK is within the desired tolerance of the target frequency.
fPLL = fVCO/(POSTDIV+1).
bit0-UPOSC----->Oscillator Status Bit—UPOSC reflects the status of the oscillator. Writes have no effect. While UPOSC=0 the
OSCCLK going to the MSCAN module is off. Entering Full Stop Mode UPOSC is cleared.
0 The oscillator is off or oscillation is not qualified by the PLL.
1 The oscillator is qualified by the PLL.

bit5-LVRF---Low Voltage Reset Flag------ 0 Low voltage reset has not occurred.---无低电压复位发生
1 Low voltage reset has occurred

bit6-PORF---Power on Reset Flag------ 0 Power on reset has not occurred.上电复位没发生 该标志位只能写1来清除
1 Power on reset has occurred.
MSCAN(可扩展控制器区域网络)是一种通信控制器
}
{//PLL 就是锁相环,作用就是提高总线的工作频率,通俗讲设置 PLL 锁相环就相当于超频。
无源晶振为 crystal(晶体),而有源晶振则叫做 oscillator(振荡器)。
总线频率(总线时钟为锁相环时钟的一半)
OSC为oscillator的缩写,意为振荡器,晶振。是一种能量转换装置——将直流电能转换为具有一定频率的交流电能。其构成的电路叫振荡电路.
}
{//速比选择使用的是H串口的相应寄存器
DDRH—Port H Data Direction Register
}
{//安全带的输入使用的是R串口的相应寄存器
Port R Data Direction Register (DDRR)
}
{//IRQ等的输入使用的是A串口的相应寄存器
DDRA_DDRA0=0; //IRQ输入 |--->API_EXTCLK—API external clock output pin------API外部时钟输出接脚
    DDRA_DDRA3=1; //蜂鸣器报警控制--------1 Associated pin is configured as output
    DDRA_DDRA4=1; //安全带未系报警灯控制
    DDRA_DDRA5=1; //低油量报警灯控制
    DDRA_DDRA6=1; //高水温报警灯控制
    DDRA_DDRA7=0; //按钮输入
}
{//电机控制相关寄存器
MTTCL0--------Motor Controller Control Register 0 电机控制器控制寄存器0
|----------这个寄存器控制电动机控制器模块的操作模式。
MCPRE[1:0]--------Motor Controller Prescaler Select --电动机控制器预分频器的选择
MCSWAI-----------Motor Controller Module Stop in Wait Mode--电动机控制器模块停止在等待模式

MCCTL1 -------Motor Controller Control Register 1
|----------这个寄存器控制电动机控制器的模拟部分以及中断的允许。
RECIRC-----Recirculation Full H-bridge mode---RECIRC =1, disable interrupt for PWM motor
|--完整的马达定速模式
MCCC0-7----------Motor Controller Channel Control Registers 每个PWM通道有一个相关的控制寄存器来控制输出延迟,PWM对齐,
输出模式。寄存器是命名MCCC0……MCCC7。
}
{//timer0 与 timer1的初始化
TIOS--Timer Input Capture/Output Compare Select (TIOS)---定时器输入捕获/输出比较选择(TIOS)   ----通道选择寄存器
|-----Input Capture or Output Compare Channel Configuration
0 The corresponding channel acts as an input capture.
1 The corresponding channel acts as an output compare.

TCTL1/TCTL2----Timer Control Register 1/Timer Control Register 2 (TCTL1/TCTL2)
TSCR2--Timer System Control Register 2 (TSCR2)
TSCR1--Timer System Control Register 1 (TSCR1)
|----TSWAI--Timer Module Stops While in Wait
0 Allows the timer module to continue running during wait.
1 Disables the timer module when the MCU is in the wait mode. Timer interrupts cannot be used to get the MCU out of wait.
TSWAI also affects pulse accumulator---脉冲累加器 
 TEN--Timer Enable |-功耗
  0 Disables the main timer, including the counter. Can be used for reducing power consumption.
1 Allows the timer to function normally.
If for any reason the timer is not active, there is no ÷64 clock for the pulse accumulator because the ÷64 is
generated by the timer prescaler.
 TFFCA--Timer Fast Flag Clear All --计时器快速标记清零
TIE--Timer Interrupt Enable Register (TIE)-------------定时器中断允许寄存器
|-- Input Capture/Output Compare “x” Interrupt Enable — The bits in TIE correspond bit-for-bit with the bits in
the TFLG1 status register. If cleared, the corresponding flag is disabled from causing a hardware interrupt. If set,
the corresponding Flag is enabled to cause a interrupt.
TIE 寄存器中的位与TFLG1 标志寄存的状态位是一一对应的。如果将 TIE 中的某位清 0,相应的通道将不会产生和响应硬件中断,同时标志位也被清零。
如果被置 1,相应的通道产生硬件中断。
TFLG1--Main Timer Interrupt Flag 1 (TFLG1)

TFFCA:定时器标志快速清除选择位。 
0:定时器标志位处于正常的指示状态,无人为干预。 
1:对于TFLGl($0E)中的各位,对输入捕捉和输出比较的读写操作,可以使对应的CnF位清零;对于TFLG2,任何对TCNT寄存器的访问将使TOF标志位清零;
任何对PACAN3和PACAN2寄存器的访问将使PAFLG寄存器中的PAOVF和PSIF标志位清零;任何对PACN1和PACN0寄存器的访问将使PBOVF标志位清零。

OCPD:输出引脚断开寄存器
0--使能定时器通道端口
1--禁用计时器通道端口-----输出比较动作不会发生在通道引脚上,但输出比较标志位仍然会置1

}
{//DFLASH
FSTAT----Flash Status Register (FSTAT)------标识了DFLASH的运行状态
|----最高位CCIF--Command Complete Interrupt Flag--命令完成中断标志位---CCIF=0时表示命令正在运行

FCLKDIV----Flash Clock Divider Register (FCLKDIV)-------用来控制定时事件程序和消除算法
|----bit7--FDIVLD--时钟分频器加载--------FDIVLD = 0 时时钟设置未成功。

DFPROT----D-Flash Protection Register (DFPROT)-------DFPROT寄存器被定义为D-FLASH不可编程和不可进行擦除操作。
|----bit7--DPOPEN--该位置1时 DPS[3:0]就不再有意义 他们都只能从1写为0不能从0写为1
|-D-Flash Protection Control |-D-Flash Protection Size

FCCOB----Flash Common Command Object Register (FCCOB)------

FCCOBIX-----Flash CCOB Index Register (FCCOBIX)----该寄存器用来索引FCCOBIX寄存器的内存操作
|----CCOBIX[2:0]------------CCOBIX位用于选择哪个命令的FCCOB寄存器数组被读或写。
}
{//ATD S12XS系列MCU的ATD模块有27个寄存器,六个转换控制寄存器,两个转换状态寄存器,一个比较使能寄存器,一个比较方式寄存器和16个转换结果寄存器
ATDCTL1----ATD Control Register 1 (ATDCTL1)---写这个寄存器将中止当前转换序列
|----6–5bit SRES[1:0]------A/D精度的选择。具体选择好多bit的数据参看Table 8-4. A/D Resolution Coding

ATDCTL2----ATD Control Register 2 (ATDCTL2)
|----6bit AFFC-----快速转换完成标志位清零---------------1 =  快速标志位清零顺序   每次读取结果寄存器自动清零 
  0 =  正常标志位清零顺序    需要手动对状态标志位清零 
  |----ETRIGE-------External Trigger Mode Enable---外部触发使能位,外部触发不会工作在停止模式下。-------0 Disable external trigger
|----ASCIE------ATD序列转换完成时的中断使能位----- 0 ATD Sequence Complete interrupt requests are disabled.
1 ATD Sequence Complete interrupt will be requested whenever SCF=1 is set.

ATDSTAT0----ATD Status Register 0 (ATDSTAT0)
|----7bit SCF----序列转换完成标志位------- 0 Conversion sequence not completed
1 Conversion sequence has completed
ATDCTL3----ATD Control Register 3 (ATDCTL3)
|----DJM----转换数据结果的对齐方式-----------1 右对齐  0 左对齐
|----6–3bit S8C, S4C,S2C, S1C-----转换序列的长度 These bits control the number of conversions per sequence.

ATDCTL4---- ATD Control Register 4 (ATDCTL4)
|----7-5bit SMP[2:0]--------采样时间的长度选择------Table 8-13. Sample Time Select  采样时间等于几个ATD转换时钟的周期
|----4-0bit PRS[4:0]---------ATD时钟分频的选择

ATDCTL5 ------ 4bit MULT ---- 多个通道采样--------- 0 Sample only one channel
1 Sample across several channels 1 Enable external trigger
}
{//SCI的初始化及相关操作
SCIBD-----SCI Baud Rate Registers (SCIBDH, SCIBDL)----波特率控制寄存器---------SCI波特率寄存器被用来确定SCI的波特率,以及控制红外线调制/解调子模块

}
{//PTAD1----Port AD Data Register (PT1AD)
该寄存器用来描述AD转换时的数据的输入输出,可以用来描述点火状态。
}
{//Port U Data Register (PTU)
Port U 7,5,3,1 pins are associated with the Motor PWM output.
Port U 6,4,2,0 pins are associated with the Motor PWM output and TIM0 channels 3-0
}
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值