communication with matlab..
panagiotis
Posts: 14
Hello to everyone. The last two days i try to communicate the Bs/2 with matlab via the serial port ( asychronous communication, with the command serin right;[noparse];)[/noparse]. So, my problem is that neither of the two works..If i run first the Bs/2 program, then matlab sais it cannot communicate with the serial port due its use from Bs/2 probably ,and vice versa.. Can anyone figure out something to help me; thanks
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
' {$STAMP BS2}
' {$PBASIC 2.5}
s VAR Byte(10)
SERIN 5, 9600 ,[noparse][[/noparse]STR s\9]
DEBUG STR s
i download it and that's the code i use on matlab
>> s = serial('COM2','BaudRate',9600,'DataBits',8)
·· Serial Port Object : Serial-COM2
·· Communication Settings
····· Port:·············· COM2
····· BaudRate:·········· 9600
····· Terminator:········ 'LF'
·· Communication State
····· Status:············ closed
····· RecordStatus:······ off
·· Read/Write State·
····· TransferStatus:···· idle
····· BytesAvailable:···· 0
····· ValuesReceived:···· 0
····· ValuesSent:········ 0
>> fopen(s)···· 'when i try to open the s object the following message appears..(COM2 is the port of BS/2)
??? Error using ==> serial.fopen
Port: COM2 is not available. Available ports: COM1.
Use INSTRFIND to determine if other instrument objects are connected to the requested device.
If i do run first the matlab code and then BS/2 then matlab runs ok but at the window of downloading process of the BS/2 there is a message that sais port2 is in use..
Its likely the reason COM1 is not availible, is it's already in use. Id first disable the debug terminal and try it, switching on an LED if a predetermined pattern is received, blinking it if something was received but not what was expected.
Jon can instruct you on disabling the debug terminal (I know it can be done, but don't know how).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Post Edited (Paul Baker) : 2/4/2006 10:06:15 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
thanks for your time..
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax