Phone card Reader by com port!!




This is a Another project but about pc interface . I write this project in vb6. this application read data of a telecard and you can store data in programs. You can read 64 byte data of data of card. For this project we need to a port com. Port com have 9 pins:
For relief I used to dll module by name "Port.dll" . I found this module in PC interface book by author Berndt, Hans-joachim. This module have 35 API . you must add port.bas in your form project of vb6. While you press connect button , programs check the atachament circuit , if device was ok then program check the card , if card is insert or no . this application is proved by a timer.dtr of rs232 pin provide power of card , clk is txd pin and reset is rts. Ri pin is input signal of card. Below picture shown The schematic of project.

Phoncard pins details

D1 d2 d3 all are 5.1v diode zener .circuits is very sample for assembly.sample pcb is proved by proteus :


You can download here. If you need to source code of vb6 you can send email to me. for read of card you must tend to wave chart waveform.


init tele card waveform

For read serial data of com port and convert to byte , I write a function .in first byte shifted to right then the byte add by ri logic. Result export to function(rx_byte).

Public Function rx_byte() As Integer

Dim k As Integer

Dim retval As Integer

For k = 0 To 7

retval = retval * 2

retval = retval + RI

TXD 1 'clk 1

waitms 10

TXD 0 'clk 0

waitms 10

Next k

rx_byte = retval

End Function

So I need to delay by millisecond value . I can used of sleep API but this API don’t worked true.

I write another sub by timer:

Dim wait1 As Long

Private Sub waitms(ByVal delay1 As Integer)

'delay1 = delay1 / 10

Timer2.Enabled = True

While delay1 > wait1

DoEvents

If Me.Visible = False Then End 'for don’t hang it in exit

Wend

wait1 = 0

Timer2.Enabled = False

End Sub

Private Sub Timer2_Timer()

wait1 = wait1 + 1

End Sub

You can download programs here.