Jump to content


  • Content Count

  • Joined

  • Last visited

About sol25

  • Rank

Profile Information

  • Location
    United States
  1. sol25

    Communication Protocols, CAN, SPI etc..

    @@dubnet, yes, these would be 2 chips on different boards and different power supplies. Im guessing i will have to stay with CAN. The distance im looking at is about ~4 or 5 meters. Where would be a good place to look for a tutorial on CAN for noobs like me?
  2. sol25

    Communication Protocols, CAN, SPI etc..

    Thanks everyone for your help. What I need to do is send commands to a C2000 micro. I am trying to emulate a thermostat for a fan, I will be sending H, L, or M speed, ON or OFF and scheduling data. What would be my limitations if i use I2C? Again, thanks for all your help.
  3. sol25

    Communication Protocols, CAN, SPI etc..

    @@spirilis, Thank you for your fast response! Is there any simple code examples to send and receive out there that you know of?
  4. Hello everyone! Just wanted to say thank you for all the support and guidance everyone in this forum has towards beginners, you guys have been of so much help!! Now, here is a question: I am trying to interface 2 microcontrollers, a MSP430F5529 with a C2000 F28335 I was told the MSP doesnt support CAN, I would have to convert SPI to CAN and go from there. What do you guys suggest? I have never successfully used communication protocols. Any good examples of send and receive out there? Thanks in advance!
  5. sol25

    I2C 2 msp430g2553 simple example Help.

    @@bobnova Hi thanks again for your help! I am using this. //code for Sending void setup() { Serial.begin(9600); } void loop() { Serial.write(52); delay(500); } //code for Receiving void setup() { Serial.begin(9600); } void loop() { if (Serial.available()) { int inByte = Serial.read(); if(inByte==52){pinMode(5,OUTPUT);}else{digitalWrite(5, LOW);} Serial.print(inByte); } } I cant see anything on the serial monitor so i added the code to light up an LED if i get "52" which is what the other launchap id sending. Nothing seems to work. I have connected pin 3(TXD) of launchpad 1 to pin 4 (RXD)of launchpad 2 and all the way around. have tried all configurations of jumperpins for rx and tx and still no luck. I feel a bit discouraged.
  6. Hello everyone! im here again for the 3rd time to ask for some advice/help. This forum has been so helpful! Recently i've implemented some code on a msp430g2553 to read a 7 segment LED display. My next step is to send that reading to another msp430 or maybe a c2000 micro-controller. End goal: Msp430-1 decodes the LED display and sends 2 digit number to the Msp430-2 then i display the numbers on my monitor. I was looking at the "wire" master write and slave read examples. I have implemented them but they seem not to work, i'm not sure of a couple of things. How do i address SCL and SDA ? how do i rout them to the specific pin? Wire.begin(4); // join i2c bus with address #4 is 4 the pin for SDA? where do i tell energia where my SCL pin is? I am attaching the examples i'm using in order to get more familiar with this "wire" method. Do I have to change the orientation of the TX and RX jumpers?(see picture) PS. is there any other communication protocol that i could use for my application? maybe something easier? or something where i could see a clear example of?? Thanks in advance for all the help and comments. // Wire Master Writer // by Nicholas Zambetti <http://www.zambetti.com> // Demonstrates use of the Wire library // Writes data to an I2C/TWI slave device // Refer to the "Wire Slave Receiver" example for use with this // Created 29 March 2006 // This example code is in the public domain. #include <Wire.h> void setup() { Wire.begin(); // join i2c bus (address optional for master) } byte x = 0; void loop() { Wire.beginTransmission(4); // transmit to device #4 Wire.write("x is "); // sends five bytes Wire.write(x); // sends one byte Wire.endTransmission(); // stop transmitting x++; delay(500); } //======================================================================================//====================================================================================== //this goes in the other msp430 // Wire Slave Receiver // by Nicholas Zambetti <http://www.zambetti.com> // Demonstrates use of the Wire library // Receives data as an I2C/TWI slave device // Refer to the "Wire Master Writer" example for use with this // Created 29 March 2006 // This example code is in the public domain. #include <Wire.h> void setup() { Wire.begin(4); // join i2c bus with address #4 Wire.onReceive(receiveEvent); // register event Serial.begin(9600); // start serial for output } void loop() { delay(100); } // function that executes whenever data is received from master // this function is registered as an event, see setup() void receiveEvent(int howMany) { while(1 < Wire.available()) // loop through all but the last { char c = Wire.read(); // receive byte as a character Serial.print(c); // print the character } int x = Wire.read(); // receive byte as an integer Serial.println(x); // print the integer }
  7. sol25

    MSP430G2553 on breadboard

    Thanks everyone! with all of your help, I got it working!
  8. sol25

    MSP430G2553 on breadboard

    @@RobG. @@spirilis, @@Antscran, @@rockets4kids you guys have all been very helpful! As far as code? I am using energia, Im not sure if i need to set up a DCO or Flash cmd file into energia to run it on the breadboard? I tried the cap and the resistor and i still cant get it to run. I know in CCS i can set up the DCO and program in flash, im just not sure how to do that, or if energia does that.
  9. sol25

    MSP430G2553 on breadboard

    Hi everyone! This is my second time on the forum. The first time i was here it was to ask for help with interrupts and an LED display. 43oh was very helpful and I accomplished my goal. Today I am here to ask for help again. Goal: Implement the code previously written into the chip only and drive it without the development board. (breadboard mode) I did some research and most post/websites told me that all i need is 3.3V and a 47k resistor going from VCC to the RST pin on the chip and that my program would start working... I tried this and it did not. reference:http://crossplatform.net/running-msp430-launchpad-on-a-breadboard/ My question is, since I am working with interrupts and my code is a bit complicated, would i need an external clock/crystal? What do i need to move away from the development board and onto the breadboard? Thanks in advanced, everyone here is so helpful!!
  10. @@bobnova, the delay helped a bit, I have move on to check every bit instead of the whole port at the same time. But i dont think this is efficient at all, if(State_A==0 && State_B==0 && State_C==0 && State_D==0 && State_E==0 && State_F==0 && State_G==1){digit2=0;} Im not sure if this method will take longer than creating an array and reading it in a for loop? I also changed my interrupts and disabled the opposite interrupt after one is triggered for example: interrupt 1 is triggered { disable interrupt 1 enable interrupt 2 } interrupt 2 is triggered { disable interrupt 2 enable interrupt 1 } seems to work great!! my only problem now is displaying the correct number that i am reading for example, id the LED is displaying 78 my monitor would show something like this: 78 78 78 78 778 78 78 780 78 780 78 78 78 maybe is a timing issue? @@abecedarian, the goal is to read a 2 digit, 7 segment LED display with only 10 pins. 2 of those pins are driver pins, the other 8 control the 7 segments and a decimal point. Thank for all of you guys' help!! seems im getting closer to having this done. PS. If i store digit1 and digit2 into variables lets say x and y, could i send these 2 variables to another msp430? or even another MCU like the C2000 via SCI or any other communication protocol?
  11. @@bobnova. @@abecedarian yeah this is what i did #pragma vector=PORT2_VECTOR __interrupt void Port_2A(void) { if(P2IFG & BIT2) { flag1=1; value=P1IN; P2IFG &= ~BIT2; } if(P2IFG & BIT1) { flag2=1; P2IFG &= ~BIT1; } seems to work fine. I still need a way to check all 7 inputs in port one and match them to a set pattern to read digits 0-9 ;/
  12. @@bobnova, Yes thats exactly what im showing when i pause the code. Another question i had is that since i have 2 digit displays, can i use the same port for 2 interrupts?
  13. @@bobnova I added while(1) //Loop forever { if(flag1 == 1) { if(value == 0x40){digit1=0;} if(value == 0x79){digit1=1; P2OUT ^=BIT4;} if(value == 0x24){digit1=2; } //value=0; flag1 = 0; } } } // Port 2 interrupt service routine #pragma vector=PORT2_VECTOR __interrupt void Port_2(void) { value=P1IN; flag1=1; P2IFG &= ~BIT2 ; // P1.4 IFG cleared } im outputting 0x79 which corresponds to digit 1 on the 7 segment display. if the "P2OUT ^= BIT4;" is inside that if statement my led never toggles meaning that the P1IN value is never 0x79. if i put the "P2OUT ^= BIT4" outside the if statements my LED toggle so i know its working.. Any ideas to check if my P1IN equals something? or should i do it byte by byte?
  14. @@bobnova, if(value == 0x40){ digit1=0; } //if(value == 0x79){ digit1=1; P2OUT ^=BIT4; } //0x79 0xb01111001 //if(value == 0x24){ digit1=2; } // 0x24 0xb00100100 this is where my problem is. I disabled this and toggled P2.2 or bit 4 and i get the same results as you in my O scope.!!!! Now the question is, where would i do my "if P1IN = Something then digit1=number"? should i do it in the forever loop or in the interrupt itself?
  15. #include <msp430.h> #ifndef TIMER0_A1_VECTOR #define TIMER0_A1_VECTOR TIMERA1_VECTOR #define TIMER0_A0_VECTOR TIMERA0_VECTOR #endif volatile int i = 0; volatile int digit1; volatile char value; void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF) { while(1); //trap for the Digitally controlled O. } BCSCTL1 = CALBC1_1MHZ; //set range for the O. DCOCTL = CALDCO_1MHZ; //set DCO step modulation 1MHZ P1DIR = 0; // Set set BIT0-6 AS INPUT BIT 7 AS OUTPUT. P2DIR = 0XF9; // set P2.1 AND P2.2 as inputs P2OUT = BIT4; P2REN = BIT2; P2IE |= BIT2; // P2.2 interrupt enabled P2IES |= BIT2; // P2.2 Hi/lo edge P2IFG &= ~BIT2; // P2.2 IFG cleared //_BIS_SR(LPM4_bits + GIE); // Enter LPM4 w/interrupt __bis_SR_register(GIE); // Enable all interrupts while(1) //Loop forever { } } #pragma vector=PORT2_VECTOR __interrupt void Port_2(void) { value=P1IN; if(value == 0x40){ digit1=0; } if(value == 0x79){ digit1=1; P2OUT ^=BIT4; } //0x79 0xb01111001 if(value == 0x24){ digit1=2; } // 0x24 0xb00100100 P2IFG &= ~BIT2; } @@bobnova This is what i am working on at the moment and it works great if i debug step by step, I get to the for ever loop and i can only move forward if i connect P2.2 to 3volts which triggers my interrupt. then the rest of the code works, however when i connect P2.2 to my sqr wave which goes on and off at 4khz, it seems that my interrupt is never triggered.