English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I'm playing with an ATMega128 microcontroller and am somewhat confused how one would connect this controller to a component that requires a clock signal? For example, at the moment I'm trying to build a smart card reader. The transmit/receive data pins from the smartcard interface I can simply connect to the i/o ports of the microcontroller board. The smartcard requires a clock signal and I was originally hoping to simulate one using a pulsing i/o signal from the ATmega, however someone else advised me they had tried and not found success. Instead, using a crystal was recommended. My electronics knowledge is a little thin -- I can visualize how one would connect a clock to the smartcard reader interface if it was standalone, but it seems like the clock would also need to communicate with the microcontroller somehow? The microcontroller is running off it's own crystal at the moment. Any help/advice is appreciated. Thanks :)

2007-03-01 03:39:55 · 2 answers · asked by mdigitale 7 in Computers & Internet Programming & Design

2 answers

Is the smartcard reader a 3-wire interface? If so, you will have to have control of that clock signal for your project to be reliable. I can't see why clocking the thing with the AT won't work. It could be that all you need is a pullup resistor on the IO pin. Anyway, if it's a 3-wire, the data to/from the reader is synchronous, and will be hard to pull off with an external clock away from the cpu.

If the card reader is rs232 ttl or some async protocol then you can clock it separately, but the fact that the reader needs a clock tells me that it is a synchronous protocol.

2007-03-01 08:50:23 · answer #1 · answered by steve.c_50 6 · 0 0

yeah, you need to know what type of interface the smart card reader uses. you say it has a transmit, receive, and clock, which sounds like it could be I2C, or maybe SPI. does it also have a chip select line? if its one of these 2, then you need to generate the clock from the micro, because the data needs to be put out and read in on certain clock edges.
dont worry, its not hard to do, in fact its easier to do in assembly than in C.

2007-03-02 09:42:07 · answer #2 · answered by justme 7 · 0 0

fedest.com, questions and answers