Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Reading Serial ADC...

Status
Not open for further replies.

lowkb

New Member
Hi all,

I met with a problem, just need a few pointers so i can tackle the problem with your expertise and appreciate that.

First im using a Serial ADC chip. TLC549, an SPI, 8 bit(Serial) ADC. Ok. as i really wanna cut my time short to interface the ADC, i've used 2 clk to drive CS and CLK serpartely. Its working and i've check.

But now i wanna read out this data, possibly to send to the pc for some signal processing and i've have tried to write a program with it. i have tried to use VB, using the MSCOMM thingie for serial comm. looks really easy though but just unable to get my adc to send it over. the program seems to work btw 2 terminals, so i tot the program shd be fine.

Can anyone tell me anything that is wrong with wat i have done? also, wat better ways is there to read off the adc and send the data to the comp?

Regards all...
 
SPI and RS232 look nothing alike, on both the electrical and protocol level.

I'm confused how you "used 2 clk to drive CS and CLK serpartely". CS is set to an active level and kept that way while CLK used to clock bits in or out of the device.

You would need a device to bridge these. Most microcontrollers can do this job when combined with a MAX232 interface chip to make the voltage levels compatible with the computer's serial port.
 
Oznog said:
SPI and RS232 look nothing alike, on both the electrical and protocol level.

I'm confused how you "used 2 clk to drive CS and CLK serpartely". CS is set to an active level and kept that way while CLK used to clock bits in or out of the device.

You would need a device to bridge these. Most microcontrollers can do this job when combined with a MAX232 interface chip to make the voltage levels compatible with the computer's serial port.

oh, thats bad. is it possible to do without the microcontroller? and also how will i be able to read off the adc from the comp then?
 
it may be misleading at first, but just because a device is "serial" does not necessarily mean that it works with a computer's serial port... the term 'serial' simply refers to the general classification of communication schemes where the data is sent down the line 1 bit at a time, as opposed to parallel... but every serial transmission scheme is different, like RS232, I2C, SPI, etc etc... like different languages.

maybe if you can find some pre-built device that is designed to convert from serial to SPI you could do it without dealing with a microcontroller yourself...
http://www.protocolanalyser.com/spispec.htm


It would likely be a poor solution though... using a microcontroller would allow you to transmit data to the PC formatted in whatever way you needed, and you could let the microcontroller handle all the initialization and stuff too. The main idea of interfaces like SPI and I2C is to allow easy communication between embedded devices like microcontrollers, sensors, ADC's, etc... that's why it's rather hard to find a device for communicating directly between a computer and one of these buses; it's assumed that any device that used them would likely already be using a microcontroller or similar to do the communication, and the user could add in whatever form of external communication they wished.
 
thanks evandude,

i'll really need to reconsider now. pretty convince i shd use a microcontroller. anyway, any good recomendation of a simple to use most importantly cheap microcontroller to use? want to spend as minimum as i can, as the evaluation board for the microcontroller would be quite expensive..
 
akg said:
u can use a cheap 16f628a wchich has inbuit usart and a little bit of code will do what u want.

The only problem is that he may have to tool up (buy a programmer) to program the PIC16F628A and then write the code which can be a mission in itself.

Or he could look into getting a USB to SPI convertor!

If it was my decision I would definately tool up for the PIC. That way if you doing any other electronic stuff you can implement PIC's.

Well that is my 2 cents

Thanks

Stolzie
 
lowkb said:
thanks evandude,

i'll really need to reconsider now. pretty convince i shd use a microcontroller. anyway, any good recomendation of a simple to use most importantly cheap microcontroller to use? want to spend as minimum as i can, as the evaluation board for the microcontroller would be quite expensive..

Dump the ADC you have, buy a PIC with it inbuilt, the 16F88 or 16F819 are 18 pin ones, or the 12F675 is an 8 pin one! - all these are ten bit as well, and probably cheaper than your existing ADC.
 
ok one more thing .. if u r not particular in using com port , then , this can be done using the parallel port , without the need of a micro , ie interface the 549 to the lpt..

but u will need a library for accessing the par: port, which u can get from
**broken link removed**
 
Be aware of the issues regarding isolation here.

The serial port is tied to the computer's ground. Unless you do some tricks with optical isolation, your MAX232 interface chip and microcontroller will share the same ground. The ADC can only take between 0 and 5v versus gnd and no negative voltages. The range can be increased with voltage dividers and such but the voltage limits on the ADC's pins must be respected at all times. Being nonisolated might be ok if you only have to measure the voltage of a battery out of its circuit or a transformer output, but in general you need an isolated ADC.
 
evandude said:
good point oznog. shouldn't be too hard to make it isolated by simply using optoisolators between the microcontroller and the max232.

Note you'll need a power supply for both the MAX232/PIC and the ADC. The MAX232's will share a ground with the serial port; the ADC is free-floating. There's some small DC/DC converters like the DCCR01 series, though they're not a really "economy" part. But they'll allow the first supply to generate isolated power for the ADC without a second bulky transformer.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top