/**
This is a sample application for openMSP430 softcore MCU with external HW UART
-peripheral <git@rtime.felk.cvut.cz:fpga/uart> and quadcount peripheral.
+periphery <git@rtime.felk.cvut.cz:fpga/uart> and quadcount and pwm periphery.
First of all "Hello world" is printed and then application works like echo and
also prints quadrature count whenever its value is changed.
-AB error of quadrature counter peripheral is handled by irq routine which prints
+AB error of quadrature counter periphery is handled by irq routine which prints
message "IRQ: QCounter AB error!".
+In endless main loop, when nothing else is doing, triangle singnal is being
+generated by the PWM periphery.
+
Baudrate is set to 115200.
*/
uint32_t qcnt = qcount();
uint32_t qcnt_new;
+ int sign = 1;
+
//UBAUD = 0x04E1; //24.00MHz - 9600 baud
UBAUD = 0x0067; //24.00MHz - 115200 baud
printf("[QCount = 0x%08lX]\n", qcnt_new);
qcnt = qcnt_new;
}
+
+ if (sign) {
+ if (++PWM == 0xFFFF) sign = 0;
+ } else {
+ if (--PWM == 0x0000) sign = 1;
+ }
}
}