I'm trying to write an interface for a TE Tech thermocouple and temperature controller for our lab. While I'm an intermediate user of Matlab I've never had to write an instrument driver before. I've already written half the code to control and read from our spectrometer and written the control GUI.
It's connected via an RS232 port to the computer. I can connect to the serial object, but when I try to send it the commands that the manufacturer supplies to query the thermocouple, I don't get anything back. All I can do is open it, see what settings it has (can't change any) and close it again.
My question is, do I need to write it a driver or can I treat it as a serial object directly in the interface code? I need to send it strings such as *000400000000041(etx) to communicate with it
I've trolled the forums the last few days but haven't come up with anything that works. Any suggestions would be greatly appreciated!
No products are associated with this question.
For anyone trying to do this I managed to crack it without downloading anything extra:
I needed to change 2 things:
1 FlowControl was set to hardware for some reason, I had to explicitly change it to software
2 Weirdly, although I could see the serial port and communicate with it on hyperterminal ONLY over COM8 I HAD to use COM1 within Matlab to get a reply. This is a pain, as my matlab GUI I've written uses a spectrometer on COM1, so hopefully I don't get a hardware clash on the serial ports. Anyway, that's a separate issue.
Thanks for you help!
actually I wrote that wrong, it's
I've tried a wide range of commands to send this but I THINK whatever I'm doing isn't correct.
My serial port is configured as per the manufacturer's specs: Baud rate=9600, parity=none, flowcontrol=none, data bits=8, start/stop bits=1
I'm new to this, so I'm probably asking help with something simple.
Latest thing I've tried is to produce a generic driver in the matlab driver editor and use a device object to communicate with the controller, but that hasn't seemed to work either
sorry, I'm new to this type of coding. (stx) is a line terminator, just like the * is a line beginning indicator.
I've just heard back from the company who supplied the controller, they've sent me a labview driver that they use in-house. I'm hoping this will fix everything!
I'm now thinking that I'm not sending the correct signal to the serial port. I need to send it an ascii code, such as the one I showed; ie (stx)00010000000041(etx)
(stx) and (etx) are start/end text indicators
HOW do I actually accomplish this? What, for this example, would I send via fprintf (or something else?) to send this command?
(The drivers I got sent haven't helped)
so it doesn't complain now but what I get is:
Where before and after the number is a little square which I've never seen before. This is frustrating.
(thanks for your help)