iVenky
Advanced Member level 2
- Joined
- Jul 11, 2011
- Messages
- 584
- Helped
- 37
- Reputation
- 76
- Reaction score
- 35
- Trophy points
- 1,318
- Location
- College Station, Texas
- Activity points
- 6,124
Hello!
I use IAR, but I don't understand what can be done with a simulator.
If you use ONLY the chip, that's fine, but if you try to program a chip that connects
to an external device, then you simply get no reply. If you try to simulate the communication
with a SPI device, for instance, you get stuck at every read byte since the flag never comes.
Simulting a program that runs only internally without I/O seems of limited interest to me...
Well, that said, I have never tried to fully understand it, so there are probably many issues
I am missing...
Dora.
Hello!
GPS can be interfaced quite easily with MSP430 (and I guess any other processor).
There is an example here. Quite old...
**broken link removed**
But I don't know how to simulate it...
Hello!
GPS can be interfaced quite easily with MSP430 (and I guess any other processor).
There is an example here. Quite old...
**broken link removed**
But I don't know how to simulate it...
Dora.
Hello!
Why not using TI's sample code? There are many examples for each
peripheral. Many examples for ports, for uart, SPI, I2C, ADC, etc.
Download the samples set corresponding to your processor and you
will find examples that correspond almost 100% to what you want to
do. You will just have to change a few #define statements to make
the code suit your needs.
Dora.
#define LCD_CS_DIR P5_DIR
#define LCD_CS_OUT P5_OUT
#define LCD_CS 0x08
void lcd_chip_select(uint8 select) {
if(select) LCD_CS_OUT &= ~LCD_CS;
else LCD_CS_OUT |= LCD_CS;
}
Hello!
Sorry, I don't understand your question.
Inside of MSP430 (and I guess inside of any processor), register contain bits.
You can decide that these bits represent characters or integers, that's just up to
you. What I meant is, for example if in TI code, the chip select of one device is
on P4.0 and in your hardware on P5.3, then you redefine it like this. Let's suppose
it is an LCD:
and in your code you can define:Code:#define LCD_CS_DIR P5_DIR #define LCD_CS_OUT P5_OUT #define LCD_CS 0x08
Or you can avoid defining a function and use a preprocessor macro:Code:void lcd_chip_select(uint8 select) { if(select) LCD_CS_OUT &= ~LCD_CS; else LCD_CS_OUT |= LCD_CS; }
#define LCD_SELECT LCD_CS_OUT &= ~LCD_CS
#define LCD_DESELECT LCD_CS_OUT |= LCD_CS
and so on. As a long time user of MSP430, I can tell you that usually TI code
works right out of the box. Well, out of the zip file. If one example is written
for USCIA0 and you want to use USCIB1, then replace A0 with B1 in their
code and it will work.
Dora.
uint8 NMEAData[DATA_LEN];
main () {
[some initializations here, stop watch dog, initialize your LCD, etc..]
InitUsart0(); // Initialize UART0
while() {
USART0RecvBuffer(NMEAData, DATA_LEN);
ParseData(); // You have to write this one according to what output you want
DisplayData(); // You have to write this one according to how you want to display your data
}
}
Hello!
MC_1, ID_3, etc are not strings, but hardware definitions. And TASSEL_2, TACLR
are related to timer setup. You don't need a timer if you just want to display GPS data.
What you need is to configure the MCU UART. Check the baud rate of your GPS
module, and set the same baud date to the CPU. I would advice to use either
an external crystal for the clock. If your processor allows it, use a high frequency
(a few MHz) as MCLK using FLL locked on the 32k crystal. If you have a HF crystal,
then use this external crystal. When you set the UART baud rate, set the UCBR
value according to your crystal. UCBR is for bit rate. Example: if you use a 8MHz
crystal (or if you set the frequency to 8MHz using FLL), and if your GPS talks at
115200 bps, then the UBR value will be 8000000/115200 which is 69. (I like this
value). It should work although it's not exactly 69.
- Connect your GPS to UART (depending on MSP430 type, UART RX and TX
can be called UTXD / URXD or UCxxRX / UXccTX, xx being A0, A1, B0, or B1.
By the way connect MCU's TX to GPS RX and vice versa, not TX on TX and RX on RX.
- Now receive the NMEA data buffer from the GPS device.
- Next, parse the data (see the sample code on the site I have referenced).
- Display the data.
As for the link I have posted earlier, sorry, but I don't understand what you don't
understand. Yes, there are a couple of function. What's the problem?
For example, function InitUsart0 initializes UART0. Do you have any problem in
understanding this? And USART0RecvBuffer receives a buffer of NMEA data.
Your program will therefore consist in:
Code:uint8 NMEAData[DATA_LEN]; main () { [some initializations here, stop watch dog, initialize your LCD, etc..] InitUsart0(); // Initialize UART0 while() { USART0RecvBuffer(NMEAData, DATA_LEN); ParseData(); // You have to write this one according to what output you want DisplayData(); // You have to write this one according to how you want to display your data } }
Now please understand that I don't know which GPS, which MSP430 and which
LCD you use, so I cannot write a more detailed code. And beside this, I think you
should try to program instead of waiting that I write it for you.
Why not trying to write some code first and then ask questions if it doesn't work?
Dora.
PS: If you write code, please write SHORT functions. If one function is more than about 20 ~ 30
lines long, then split it. Whatever you write, be it the main program or some other function,
it should fit within one single screen so that you can see everything at once. If it's longer,
split it wisely. And if you ever post it, please use the appropriate formatting.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?