Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 4 months ago.
Why my stm32F302 Nucleo calls KL25Z Comparator library????
- include "mbed.h"
-------- Hyperterminal configuration 9600 bauds, 8-bit data, no parity-------- Serial pc(SERIAL_TX, SERIAL_RX); DigitalOut myled(LED1); Clear GPIO LOCK register. LD2 on stm32F302 board
int main() { static unsigned int COMP2_adrs = 0x40010024; +20 RM0365 P421 Analog comparator COMP2 setting register adrs?? checked in Keil uvision5 +24
volatile unsigned int *comp2 = (unsigned int *)COMP2_adrs;
- comp2 = 0x00000061; COMP2 enabled. +input:PA7, -input:PA2
pc.printf("COMP2_reg: 0x%x\n", *((unsigned int *)COMP2_adrs)); wait(0.1); UART Tx end delay timer
while (true) { if (*comp2 & 0x40000000) get comp OUT bit if (*comp4 & 0x40000000) if (*comp6 & 0x40000000) { myled = 1; } else { myled = 0; } } }