Go Down

Topic: Inerfacing with smart card (Read 4 times) previous topic - next topic

PaulS

Quote
So I have no idea how to send one clock, i tried to do it in my code (see clock() function) but it doesn't work.

Despite it's misleading name, the analogWrite() function affects digital pins only. It is doing nothing to the analog pin that the clock line is connected to.

You are going to need to connect the reset line to a digital pin, and set that pin's mode to OUTPUT, and use digitalWrite() to set that pin HIGH or LOW.

You'll need to look at how the wire library modifies the clock pin setting. Analog pins 4 and 5 are special in that they are the I2C pins, so, under the right circumstances, they can output data.

Finally, just a note, the maximum value for analogWrite is 255, not 1023.

MetroExpress

Depending on what kind of smart card your trying to read it can actually be quite complex, the hardware is the easy part but if you want to actually see whats on the chip its quite and intense programming procedure. I've researched it a bit and I might possibly play with it for my next project.

Anyways keep us updated :)

prodigyQB

I have made no progress...
Since you have called Wire.begin() you can't modify analog pin #4 and #5 unless with Wire lib functions...
Doing something like "digitalWrite(A5, HIGH); ... ; digitalWrite(A5, LOW)" doesn't work...
I can't understand how the Wire lib (or in general how the I2C protocol) threat the clock process: there is an explicited called clock() function or internally there is something like an oscillator that works continuously?
Any help?

PaulS

Quote
Since you have called Wire.begin() you can't modify analog pin #4 and #5 unless with Wire lib functions...

Analog pins are input only. You can't modify them even if you haven't called Wire.begin().

Quote
Doing something like "digitalWrite(A5, HIGH); ... ; digitalWrite(A5, LOW)" doesn't work...

Sure it does. But, if you are trying to observe the effect on the analog pins, you are looking on the wrong side of the board. Despite the names, these functions affect the digital pins. Since the analog pins are input only, there are no functions to write to them.

weirdo557

from the playground


Quote
The analog pins can be used identically to the digital pins, using the aliases A0 (for analog input 0), A1, etc. For example, the code would look like this to set analog pin 0 to an output, and to set it HIGH:

pinMode(A0, OUTPUT);
digitalWrite(A0, HIGH);


care to clarify?


Go Up