I have a msp430f1611 develoment board. I am intend to use it control a switch. the algorithm is to read the voltage input.
While(1)
Read voltage on DC bus
If voltage > upper threshold{
Start PWM on buck converter
Read voltage on DC bus
While voltage > lower threshold {
Read voltage on DC bus
}
Stop PWM on buck converter
}
}
above is the pseudo code I think.
BUt im confused because it seems the comparator A can only compare voltage with reference built-in, like 0.25 V or 0.5 V. but I am intend to have two boundaries. Pleeeeeease! help me! I am in a super hurry.
Take a look at CCS’ example projects; you just need an external voltage divider if you need to exceed the internal limits; easily done with few external resistors
You can literally copy and paste the “low battery detection” CCS sample project and just change the values to match whatever the external resistor network would read…
Couldn’t you read in the voltage using the ADC converter?
oh sure you could but the MSP isn’t as popular as Arduino so a good working example code out there is scarce… so if it doesn’t work you are left at your own devices. Using the examples removes the frustration because those actually work… amazing