Phone Dialer
A phone dialer built in 15 minutes.
Note: this script uses Easy Control version 1.4 syntax.
This project assumes you have a modem connected on one of your PC serial ports, with
a telephone line in. It is a normal setup for Internet dial-up connections.
Step 1
Design rack in Rack Designer, or you may download example archive which contains the
phonedialer rack (see screenshot on the left side of this article).
Controls on this rack are:
- pbutton1 to pbutton10 as the keypad digits
- a LCD display
- label1 to display tel. no.
- label2 to display status
- pbutton11 as "Dial" button
- pbutton12 as "Close" line button
- pbutton13 as "Clear" display button
- 4 borders
Step 2
Write or open in Easy Control this script code :
crlf=chr(13)&chr(10)
#Open rack, don't forget to provide correct path
openrack (d:\phone\phone.res)
#Initialization of display
label1=""
label2="StandBy"
#Pop-up Setup port window
setport
#Open port
openport (myport,9600,8,n,1)
#Your modem may require this
setrts (myport)
setdtr (myport)
#Send initializatin string to the modem
send (myport,"atz"&crlf)
dial:
#Reset Close button and check if "Clear" button was pressed
pbutton12=0
if (pbutton13==1)
pbutton13=0
label1=""
endif
#Read keyboard, add digits to the tel. no. and resets buttons
if (pbutton1==1)
label1=label1&"1"
pbutton1=0
endif
if (pbutton2==1)
label1=label1&"2"
pbutton2=0
endif
if (pbutton3==1)
label1=label1&"3"
pbutton3=0
endif
if (pbutton4==1)
label1=label1&"4"
pbutton4=0
endif
if (pbutton5==1)
label1=label1&"5"
pbutton5=0
endif
if (pbutton6==1)
label1=label1&"6"
pbutton6=0
endif
if (pbutton7==1)
label1=label1&"7"
pbutton7=0
endif
if (pbutton8==1)
label1=label1&"8"
pbutton8=0
endif
if (pbutton9==1)
label1=label1&"9"
pbutton9=0
endif
if (pbutton10==1)
label1=label1&"0"
pbutton10=0
endif
#Check if "Dial" button was pressed
if (pbutton11==1)
#Yes, go to the dial no. code
goto godial
endif
#No, scan keyboard again
goto dial
godial:
#send command to the modem to dial tel. no. displayed
send (myport,"atdt"&label1&crlf)
#Change status on display
label2="Calling"
repeat
#Remain here until "Close" button is pressed
until (pbutton12==1)
#Close the line
send (myport,"ath0"&crlf)
#Reset
pbutton11=0
pbutton12=0
label1=""
label2="StandBy"
#And go again, and again...
goto dial
Download this project :
Phone Dialer
More ?
Well, more care on buttons resets, visual enhancements,...
Enjoy !