Kayıtlar

Communication between two MSP430 with using UART (MSP430 Application C ++)

Hello guys, This tutorial shows you how to communicate between two MSPs. Firstly,  one of them must be a master controller. And the other remaining one must be slaves. Basically , when you enter some input from master contoller, A signal comes from master, goes  into slave's input. This tutorial is show us when you press button from master controller, other controller led will light up.  Embed the codes into microcontroller separately. Play the code as you wish. Mail me if there are any problems with code. Mail: g.haddeler@gmail.com You all succeed! ------------------------- MASTER MSP430 CODES #include "msp430g2553.h" // When you press buton , data which is 0x01 , sends it to slave msp via UART . As long as the data coming from master msp is equal to '2' , the master msp's led lights up. // function prototypes void UARTInit(void); void main(void){ WDTCTL = WDTPW + WDTHOLD;// watchdog timer OFF //DCO clock freq settings BCSCTL1...

Calculator with using MSP430G2553 and UB232R module .

Resim
Calculator with using MSP430G2553 and UB232R              Purpose : Creating Basic calculator(*,/,-,+) by using MSP430 . This will be done by processing the numbers entered from the computer into MSP and printing the result on the computer screen. Used: 1 unit MSP430G2553 1 unit UB232R (uart modülü) 4  jumper cables A  computer program called Putty (You can connect your computer with Putty via terminal via various commands ) CIRCUIT DIAGRAM In order to run the program, first you have to send the codes to MSP430, so plug the USB cable into MSP430 and embed the codes with the IAR program. Then remove the usb cable from msp and plug it into the UART module( UB232R) . Right click on the computer icon and press Manage. In the "Device Manager" section on the left you can find the Port number of the USB connected to the UART module in the...

Write Measured Voltage on LCD Screen (MSP430 Applications in C ++)

This tutorial shows us how to measure voltage with using MSP430, and display the voltage value into the LCD screen. Codes are half turkish so if you guys have question or misunderstoods you can mail me. I can glady help you ! mail: g.haddeler@gmail.com Have fun !! First you need to create an LCD library. Add a tab outside the main tab and get these codes. Lib Codes : ------------------------------- #include "io430.h" #include "lcd_msp.h" #define E_1     0x08 #define RS_E_1  0x0C void delay(unsigned long int d) {   d*=100;   for(;d>0;d--); } void hc595_yaz(unsigned char gelen) {   for(char i=8;i>0;i--)   {     Data=0;     if(gelen & 0x80)     Data=1;     Clock=1;     Clock=0;     gelen*=2;   }   Storage=1;   Storage=0; } void lcd_write(unsigned char port) {   //ilk 4 bit gönderiliyor...   hc595_yaz(E_1);   hc595_ya...

Thunderstorm Application (MSP430 Applications C ++)

Resim
CREATING THUNDERSTORM WITH USING BIT SHIFTING METHOD  The meaning of thunderstorm is lighting up leds one by  one in order. When  application is working first time BIT0 PIN 's value is 1 . P1OUT = P1OUT << 1 Using the bit shift command, we shifted the bits to the left first. We then add a shift right command to this function to get the pattern resembling cumbersome.thunderstorm. P1OUT = P1OUT >> 1; Codes that embed into MSP430: --------------------------------------------- #include <msp430.h>//chosing the library int a; void delay(long int ); // We have defined a delay function to see the led is on . void main(void) {   WDTCTL = WDTPW | WDTHOLD;   BCSCTL1= CALBC1_1MHZ; //DCOCLK 1MHZ is chosed....  DCOCTL = CALDCO_1MHZ;   P1DIR= 0x1F ; //P1.0,P1.1,P1.2,P1.3,P1.4 is chosed!!!!   P1OUT=0x01;//We made the first bit 1 for bitwise shifting. while (1){ //infinite loop for ( a=0; ...

Ledleri 1er bit artırarak yakmak( MSP430 Uygulamaları C++ )

#include <io430.h>// ledleri 1er bit artırarak yakmak. // ilk 3 bit 1 olduğunda tekrardan başa dönme .(bitleri sıfırlamak)P1.0 P1.1P1.2  LED KOY void main( void ) {   // Stop watchdog timer to prevent time out reset WDTCTL = WDTPW + WDTHOLD;   P1DIR= 0x07;   P1OUT=0x00;    int b=0;    long int i;   while (1)     {if(b==8)          b=0;   else    if( !(P1IN & 0x08))      {       i=0;        P1OUT=b;        b++;       while(i<100000)         i++;       while(!(P1IN & 0x08));          }                         }   }  

Reflect or lighten the LED during the button press (MSP430 Applications C ++)

#include <msp430.h> unsigned int bsayac=0; void main(void) {  WDTCTL = WDTPW | WDTHOLD; // Watchdog timer OFF BCSCTL1 = CALBC1_1MHZ; // Ocilator is 1MHz . DCOCTL = CALDCO_1MHZ; // Ocilator is 1MHz. P1DIR =0x07; P1OUT=0x00; TACCTL0 =CCIE; // CCR0 interrup is ON  // CCR0  set 1000 ms TACTL = TASSEL_1 + MC_1; // _BIS_SR(GIE); while (1){       while(!(P1IN & 0x08)) {         ++bsayac;           TACCR0 = (bsayac*5.05);     }              bsayac=0;                     } }         #pragma vector=TIMER0_A0_VECTOR // Timer0_A0 interrupt vector __interrupt void Timer_A (void) {                 P1OUT ^=0x07; // reverse Port1.1 }

Butona basıldığında 1. led yanar bırakıldığında 2.led yanar(MSP430 Uygulamaları C++ )

#include <io430x20x1.h>//butona basıldığında 1. led yanar bırakıldığında 2.led yanar void main( void ) {   WDTCTL = WDTPW + WDTHOLD; //Watchdog timer durduruluyor...   P1DIR = 0x03;  //P.1.0 ve P1.1 led koyulucağını belirtir   P1OUT = 0x00;   BCSCTL1= CALBC1_8MHZ; //DCOCLK 8MHZ Seçiliyor...   DCOCTL = CALDCO_8MHZ;   while(1)   {     if(0x80 & P1IN)       P1OUT=0x01;     else       P1OUT=0x02;   } }