Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

A few beginner questions

$
0
0

Hi All,

 

I have never used an MCU with interrupts before (previous experience using the Propeller which does not have interrupts), and am trying to nut out the main routines in my upcoming project. Hoping I can get some insight from people here!

 

My program needs to sample 3 sensors, 1 every 2.5ms, 1 every 10ms, 1 every 25ms, perform some logic and write 256 bytes to SPI Flash memory every 25ms.

I plan to use interrupts for each of these tasks, and synchronise the start times so the time periods line up at the end of 1 second (i.e. in 1 second I will have recorded 400 samples, 100 samples and 40 samples, before writing all this to dataflash and starting over.

Each sensor will have a bit of fixed point math applied to the results.

 

I'm not sure yet if I will include this math in the sensor interrupts (which will spread the load but make my interuprts longer), or to put the in the main routine and perform them once an interrupt returns with a new sensor reading (which will allow the math to be interrupted and keep my sensor readings more in sync). Im leaning towards the later.

 

Question 1: My question relating to this is, what happens if an interrupted is triggered while i'm handling an earlier interrupt? Does it queue up and start once i'm done with the first one? Do interrupts have certain priorities and an interrupt with a higher priority will interrupt one with a lower priority?

 

Regarding writing 256 bytes to DF. It seems I can only write 1 byte at a time using the USCI.

 

Question 2: Is my thinking correct, that to send larger chunks of data I can trigger an interrupt once the byte is sent, and in that interrupt increment a pointer to the next byte then start transmitting the next byte etc etc until 256 bytes have been sent?

 

Question 3: Do timers restart automatically once they have triggered their interrupt (thus staying in sync) or do they restart after the interrupt has been handled (thus, I need to re-sync them)?

 

Question 4: Last question for now is just a general electronics question.

 

I am using a super cap in this design which I have never done before. I have it in parallel with the 3.3V LDO output, and calculate it will hold the system above 2.7V for ~8 seconds in the event of battery disconnection or brownout. Do I need to put a resistor in series with the supercap to prevent it discharging too much power into my devices, or can I just use it as is?

 

Sorry for the wall of text and thanks in advance!


Viewing all articles
Browse latest Browse all 2077

Trending Articles