30.07.2013 Views

INTERVIEW VIKAS VINAYAK CEO & CO-FOUNDER ... - EEWeb

INTERVIEW VIKAS VINAYAK CEO & CO-FOUNDER ... - EEWeb

INTERVIEW VIKAS VINAYAK CEO & CO-FOUNDER ... - EEWeb

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The SPI interfaces to the max chip using a 32<br />

bit block of data. However the pre-written function<br />

within the mbed that allows direct access<br />

to the SPI bus only goes up to a 16 bit format.<br />

This would have made interfacing to the device<br />

as easy as the NTC and analog pins. However<br />

SPI is really easy to deal with anyway, so below<br />

I have written my own code to interface to the<br />

device.<br />

You will see that I only need the block of bits<br />

from bit 1 (where 0 is the first) to 11. The rest<br />

are thrown away. A little shift register in c code<br />

and you can quickly get your data from the max<br />

chip. I really should look at the<br />

timings on a scope but it’s working<br />

right now -- I will check the<br />

details later on but I suspect I’m<br />

well within limits.<br />

Output Code<br />

SPI_Code<br />

TECH ARTICLE<br />

The last thing I’ll need to add this time round is<br />

a serial connection to use for debugging and<br />

then later for our Xbee.<br />

Once again this is really easy to add to your<br />

mbed. Add the Serial class with the pre-defined<br />

RX and TX pins and then install the mbed USB<br />

to serial driver on your PC, and you are done!<br />

I use a small free program<br />

called putty.exe that can be<br />

used as a serial terminal. Set<br />

the baud rate to 9600 and<br />

coms port (you can find this<br />

in device manager under<br />

“Serial Ports” in Windows)<br />

and then you can get data<br />

from your mbed.<br />

Last thing to do this time<br />

round is to send the collected<br />

data, one second at a<br />

time, and send it over the serial<br />

port (code below). The<br />

data from the NTCs is still<br />

raw ADC counts and not in<br />

T’c as yet but the data from<br />

the max chip is.<br />

Output Code<br />

Next time I will turn the raw<br />

ADC counts into T’c and also<br />

look at storing the data on the mbed’s flash.<br />

If you would like to see the full code you can<br />

download it form here: http://mbed.org/users/<br />

monpjc/code/temperature_logger_Pt2/<br />

Visit www.eeweb.com<br />

25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!