Serial Communication using propeller
Hi! I really need help trying to figure this out before my capstone deadline. I am trying to send a numeric value 1 through the serial port of the propstick to the propeller. So far the code in spin works when typing 1 on the PST. But when I use matlab to send the numeric value 1 to the propeller the communication led on the chip blinks once in blue (so it means it is receiving something) but the led that is supposed to turn on is not turning on.
The code in spin:
The code in Matlab
Any help will be greatly appreciated!
The code in spin:
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ ser : "FullDuplexSerialPlus" PUB main | Number ser.Start(31, 30, 0, 9600) waitcnt(clkfreq*2+cnt) dira[4]~~ repeat ser.Str(String("Value received from PST:")) Number := ser.rx ser.tx(13) if Number == "1" !outa[4] ' toggle LED for each incoming 1
The code in Matlab
s=serial('COM3','BaudRate',9600); fopen(s); ledon=[1]; fwrite(s,ledon) fclose(s);
Any help will be greatly appreciated!
Comments
2) I don't know MATLAB, but I suspect that your MATLAB program is not sending the character "1". It's probably sending a byte with the value 1. Change your MATLAB program to send the character "1" instead. You probably don't want to change your Spin program since, the way it's written, you can type a "1" using PST for testing. It's harder to use PST to send a byte value of 1.