
Aditya
-
Content Count
4 -
Joined
-
Last visited
Reputation Activity
-
Aditya reacted to srv in Using MSP430 as a relay between a function generator and MATLAB
see file:http://energia.nu/AttachInterrupt.html
use this function:
attachInterrupt(interrupt, function, mode);
first change the intrrupt with your input pin and then
in place of mode put: RISING
and in place of function write you function which one you want to call
here you want to send data using serial port so write inside your function :
void function(void){ Serial.println("High Pulse"); } so your final program is like:
void setup() { Serial.begin(9600); attachInterrupt(P2_2, serial_call, RISING); } void loop() { // put your main code here, to run repeatedly: } void serial_call(void) { Serial.println("HIGH PULSE"); delay(100); } -
Aditya reacted to pjkim in Using MSP430 as a relay between a function generator and MATLAB
How you implement this will depend on the expected frequency of your square wave. You would need different implementations for 10 kHz signal vs a 0.01 Hz signal. A slower signal will be lot easier to do as the time jitter will be negligible.
As for input signal, TTL is usually 0 to 5V which will nicely fry the GPIO pins on the MSP430 so you will need to do level shifting/converting.
As for the program, you can use the attachInterrupt function. See http://energia.nu/AttachInterrupt.html
Attach your interrupt routine to a GPIO pin (can pick rising or falling). This routine can send a message through the serial port using Serial.print().
As for interfacing to MATLAB, I haven't used MATLAB in ages so I don't know. I would imagine you would need MATLAB to monitor the serial port (one of the COM ports in Windows or one of the /dev/tty* devices in linux/mac).