Flash is currently the nonvolatile storage of choice for microcontrollers. Fast and reprogrammable, it replaces the ROM devices of the past and enables field software upgrades that are essential for every product. Because of the importance of understanding the underlying flash, I have added it as a new chapter in my MSP430 tutorial. Granted, there are more topics and example code to be used, but the information in the tutorial is good to get a start.
As always, comments are more than welcome.
www.glitovsky.com/Tutorialv0_4.pdf
Hi, i like a lot yout tutorial, but this link doesnt work, thanks
You’re right. The correct URL is:
http://www.glitovsky.com/Tutorialv0_4.pdf
Regards,
Gustavo
I fixed the link to the tutorial.
Thank you very much for writing this tutorial. Its been very helpful for a complete beginner like myself. Your comment about reading TI’s documentation is good advice that should be followed.
Hi,Gustavo!
Excellent tutorials, congratulations. I don’t know nothing about MCU, I started again to study electronics and I have the kit usb eZ430 (with the Msp430F2013), and you help me very much,thanks! But I have some issues if you can be help me, I’m very gratefull, here in Brazil is very dificult found someone which work with Msp430( everybody just talk about of the Arduino).
So, I would like Know how I work with my Msp in the Stand-Alone, on the Breadboard and to use the others pins,already which we have 14 pins for access.
Ah, I can’t to erase the Flash memory, have with errors, sorry by incovenience,Thanks!
Hi Gustavo,
This is a excellent tutorial. Thank you very much. It helped me a lot. If it’s possible I would like to see a chapter on I2C.
Kind Regards
I found there is a mistake in the MSP430 tutorial v 0.4, which is shown on the page of 13. When you transfer the Hex to the Bin, in the Table 3.3, the 0x1F
is represented by 1 1111 other than 11 1111 that is given wrongly in the table.
Thank you for this tutorial, it does help me a lot.
Sincerely, have a good one!
Jerry
Dear Sir,
I am fan of you sir.. your msp430 tutorial is superb.. I have a problem sir, would you share ADC Code for MSP430f2131 with me. I have a example code written by TI developer but It is not working for me. please sir can you mail me Slope ADC code at laxmimerit@gmail.com?
I simulated this code with Proteus 7.8 but I could not get result. code compiled with CCS v5
#include
#define VCC_VALUE (2980) // Actual system VCC (mV)
volatile unsigned int ADCResult; // volatile to prevent opt.
void Init_Sys(void); // Function prototypes
unsigned int Meas_ADC(void);
unsigned int Meas_ADC2(void);
int main(void)
{
Init_Sys(); // Init system peripherals
P1DIR = 0xFF;
while (1)
{
ADCResult = Meas_ADC(); // Measure ADC
_NOP(); // >>SET BREAKPOINT HERE<<
//P1OUT = ~P1OUT;
// P1OUT = ADCResult;
} // And read out 'ADCResult'
}
//—————————————————————————–
// Initialize System Peripherals
//—————————————————————————–
void Init_Sys(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
// P2OUT = 0x20; // P2.5 high
P2DIR = 0x21; // P2.0 = DAC, P2.5 powers pot
CACTL2 = P2CA0 + P2CA1; // Setup CA, P2.3+ P2.4-
if (CALBC1_8MHZ==0xFF) // If calibration constants erased
{
while(1); // do not load, trap CPU!!
}
DCOCTL = 0; // Select lowest DCOx and MODx settings
BCSCTL1 = CALBC1_8MHZ; // Set range
DCOCTL = CALDCO_8MHZ; // Set DCO step + modulation
}
//—————————————————————————–
// Measure A/D Converter, return offset-compensated result
//—————————————————————————–
unsigned int Meas_ADC(void)
{
unsigned int Result;
CACTL1 = CAON; // Comparator on
Result = Meas_ADC2(); // Do 1st ADC conversion
CACTL1 |= CAEX; // Invert comparator terminals
Result += Meas_ADC2(); // 2nd ADC, add inverted result
CACTL1 = 0; // Comparator off
return Result;
}
//—————————————————————————–
// A/D Converter Helper Function
//
// Attn: The loop cycle count has to be equal for both decision paths
// of the if() statement, otherwise the measurement result will
// not be accurate. It has been found with IAR V5.51.1, that the
// code below will implement this, even independent of the
// C compiler optimization settings. Another approach would be
// implementing the entire function in assembly language.
//—————————————————————————–
unsigned int Meas_ADC2(void)
{
unsigned int Counter = VCC_VALUE / 2;
unsigned int Result = 0;
P2OUT |= 0x01; // Set power to capacitor
while (!(CACTL2 & CAOUT)); // Wait for CAOUT to get set
do
{
if (CACTL2 & CAOUT) // Comparator high/low?
{
P2OUT &= ~0x01; // Remove power if high
}
else
{
P2OUT |= 0x01; // Set power if low
Result++; // Measure the 'ON' time
_NOP(); // Timing adjustment
}
} while (–Counter); // Decrement and loop
P2OUT &= ~0x01;
return Result;
} // Remove power from cap
//P1OUT = ~P1OUT;