编码电位器驱动
请问各位大神:STM8如何驱动编码电位器,需要中断吗?我是初学者,请各位大神多多指教@far @interrupt void NonHandledInterrupt (void)
{
/* in order to detect unexpected events during development,
it is recommended to set a breakpoint on the following instruction
*/
return;
}
extern void _stext(); /* startup routine */
struct interrupt_vector const _vectab[] =
{
{
0x82, (interrupt_handler_t)_stext
}
, /* reset */
//{0x82, (interrupt_handler_t)main}, /* reset */
{0x82, NonHandledInterrupt}, /* trap */
//{0x82, NonHandledInterrupt}, /* irq0 - tli */
{0x82, NonHandledInterrupt}, /* irq0 - tli */
{0x82, NonHandledInterrupt}, /* irq1 - awu */
{0x82, NonHandledInterrupt}, /* irq2 - clk */
{0x82, NonHandledInterrupt}, /* irq3 - exti0 */
{0x82, REMOTE_IRQHandler}, /* irq4 - exti1 */
{0x82, KEY_IRQ}, /* irq5 - exti2 */
{0x82, NonHandledInterrupt}, /* irq6 - exti3 */
{0x82, RotaryEncoder_IRQHandler}, /* irq7 - exti4 */
{0x82, NonHandledInterrupt}, /* irq8 - can rx */
{0x82, NonHandledInterrupt}, /* irq9 - can tx */
{0x82, NonHandledInterrupt}, /* irq10 - spi*/
{0x82, TIM1_IRQHandler}, /* irq11 - tim1 */
{0x82, NonHandledInterrupt}, /* irq12 - tim1 */
{0x82, TIM2_IRQHandler}, /* irq13 - tim2 */
{0x82, NonHandledInterrupt}, /* irq14 - tim2 */
{0x82, TIM3_IRQHandler}, /* irq15 - tim3 */
{0x82, NonHandledInterrupt}, /* irq16 - tim3 */
{0x82, NonHandledInterrupt}, /* irq17 - uart1 */
{0x82, NonHandledInterrupt}, /* irq18 - uart1 */
{0x82, NonHandledInterrupt}, /* irq19 - i2c */
{0x82, NonHandledInterrupt}, /* irq20 - uart2/3 */
{0x82, UART2_IRQHandler}, /* irq21 - uart2/3 */
{0x82, NonHandledInterrupt}, /* irq22 - adc */
{0x82, NonHandledInterrupt}, /* irq23 - tim4 */
{0x82, NonHandledInterrupt}, /* irq24 - flash */
{0x82, NonHandledInterrupt}, /* irq25 - reserved */
{0x82, NonHandledInterrupt}, /* irq26 - reserved */
{0x82, NonHandledInterrupt}, /* irq27 - reserved */
{0x82, NonHandledInterrupt}, /* irq28 - reserved */
{0x82, NonHandledInterrupt}/* irq29 - reserved */
};
还有一个问题是这个中断向量表里面有优先级吗?编码器需要中断的话,应该把中断程序放在哪里? 你说的编码电位器没用过,但是芯片的中断优先级就了解一些。一般用到的普通中断可以通过软件设置优先级配置,实现灵活的嵌套。软件库中有对应的函数。 已经搞定了,多谢回复
页:
[1]