0% found this document useful (0 votes)
162 views

MOdem Programming Using Visual Basic

This document discusses using Visual Basic to send a fax from a computer using modem commands. It outlines the steps: 1. Connecting the modem to the computer using MSComm controls and setting the port and baud rate. 2. Sending AT commands to the modem to initialize it for faxing, set the class and local ID, and dial the remote fax number. 3. Controlling the data transfer by sending additional AT commands to start and stop the fax transmission. 4. Closing the port when finished. The code provided shows how to send the commands and transfer a file for faxing.

Uploaded by

Manoj Kavedia
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
162 views

MOdem Programming Using Visual Basic

This document discusses using Visual Basic to send a fax from a computer using modem commands. It outlines the steps: 1. Connecting the modem to the computer using MSComm controls and setting the port and baud rate. 2. Sending AT commands to the modem to initialize it for faxing, set the class and local ID, and dial the remote fax number. 3. Controlling the data transfer by sending additional AT commands to start and stop the fax transmission. 4. Closing the port when finished. The code provided shows how to send the commands and transfer a file for faxing.

Uploaded by

Manoj Kavedia
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

MOdem Programming Using Visual Basic using AT Commands !!! objective: To send fax from MS visualbasic6.

0 Controls used: Mscomm controls. comport used : baud rate settings as per t!e mscomm control. Modem used : "Com #.S $obotics modem % class & class .0 modem% fax modem. steps involved: . ). ". +. 'ilaing t!e remote fax numver % (it! a modem . establis!ing communication (it! t!e remote fax mac!ine. !ands!a*ing (it! t!e fax mac!ine. once t!e fax mac!ine is responded % data is sent in binar, format.

modem codes used: standard -AT- Commands for class ).0 modems. program status. step : dilaing t!e remote fax mac!ine no: accomplis!ed. step ): establis!ing a !ands!a*e mode remote fax no: step ": sending data. code: .......... /rivate Sub 0axsend12 ..name of function 'im i As 3nteger 'im a As 4,te 'im pfad As String 'im dialstring As String 5setting t!e mscommm port setttings. MSComm .Comm/ort & MSComm ./ort6pen & True 3f 7rr T!en
1

Msg4ox -C6M /ort not available7xit Sub 7nd 3f 5setting t!e baud rates. MSComm .Settings & - 8)00%9%:% MSComm .3nput;en & 0 MSComm .3n4ufferCount & 0 5variuos AT modem commands are used to send to t!e modem 5modem reset MSComm .6utput & -AT<- = vbCr 3f (ait1-6>-2 & 0alse T!en 7xit Sub 5setting t!e fax class&).0 MSComm .6utput & -AT=0C;ASS&).0- = vbCr 3f (ait1-6>-2 & 0alse T!en 7xit Sub 5local id . MSComm .6utput & -AT=0;3&- = C!r?1"+2 = -"0"- = C!r?1"+2 = vbCr 3f (ait1-6>-2 & 0alse T!en 7xit Sub 5command for 3ntitiali@e t!e fax parameters MSComm .6utput & -AT=03/- = vbCr 3f (ait1-6>-2 & 0alse T!en 7xit Sub 5entering t!e number fomr t!e user 9umber & 3nput4ox1-7nter p!one number:-% -0AA)+BB)-2 5dialing t!e number using AT'T command dialstring & -AT'T- = 9umber = -C- = C!r?1 "2 MSComm .6utput & dialstring 3f (ait1-6>-2 & 0alse T!en 7xit Sub 5controls t!e mode t!at modem (ill act as datamodem. MSComm .6utput & -AT=0AA& - = vbCr 3f (ait1-6>-2 & 0alse T!en 7xit Sub 5MSComm .6utput & -AT=0'M- = vbCr 53f (ait1-6>-2 & 0alse T!en 7xit Sub 50;6 command selects t!e met!od of flo( control D69ED600& MSComm .6utput & -AT=0;6& - = vbCr
2

3f (ait1-6>-2 & 0alse T!en 7xit Sub 57nable to fax reception MSComm .6utput & -AT=fC$& - = vbCr 3f (ait1-6>-2 & 0alse T!en 7xit Sub 5indicates a document is availabel for polling MSComm .6utput & -AT=0lp& - = vbCr 3f (ait1-6>-2 & 0alse T!en 7xit Sub 5indicates (!et!er t!e originating station (ic!es to poll MSComm .6utput & -AT=0S/& - = vbCr 3f (ait1-6>-2 & 0alse T!en 7xit Sub 59egotiations message reporting MSComm .6utput & -AT=09$& - = vbCr 3f (ait1-6>-2 & 0alse T!en 7xit Sub MSComm .6utput & -AT=0MS&A- = vbCr 3f (ait1-6>-2 & 0alse T!en 7xit Sub 55document to poll 5MSComm .6utput & -AT=0T/& - = vbCr 53f (ait1-6>-2 & 0alse T!en 7xit Sub MSComm .6utput & -AT=0C6- = vbCr 3f (ait1-6>-2 & 0alse T!en 7xit Sub 5command for data transfer from modem ... MSComm .6utput & -AT=0'T- 5init fax data sending 3f (ait1-Connect-2 & 0alse T!en 7xit Sub i & 0ree0ile 6pen -c:(indo(sdes*topm,faxfax.txt- 0or 4inar, Access $ead As Fi -..... file manipulation ta*es place !ere... 5MSComm .6ut4ufferSi@e & ;en1tmpbuffer2 5MSComm .6utput & tmpbuffer MSComm .6utput & C!r?1 62 = C!r?1"2 5terminate sending fax data 3f (ait1-6>-2 & 0alse T!en 7xit Sub MSComm .6utput & -AT=07T&)- = vbCr 3f (ait1-6>-2 & 0alse T!en 7xit Sub MSComm ./ort6pen & 0alse 5 %close line 7nd Sub
3

....... (!ere t!e program stops is : sending t!e AT=0'T command % t!e modem even t!oug! being a class).0 modem % is giving error message (!en 0'T command is sent. Send AT Commands To Modem mm i !ave a little problem !ere (!en i use !,perterminal i can send AT commands (it!out problem: at@ 6> at=fclass&: 6> ats0& 6> (it! t!ese code i call m, /C and t!en m, /c ans(er t!e p!one call. no(.. (!en i use t!ese commans on a G46 Script i !ave not response &E !ere is t!e code: Sub ConfigModem12 MSComm .Comm/ort & + MSComm ./ort6pen & True MSComm .6utput & -AT<- = C!r1 "2 MSComm .6utput & -AT=0C;ASS&:- = C!r1 "2 MSComm .6utput & -ATS0& - = C!r1 "2 MSComm ./ort6pen & 0alse 7nd Sub /rivate Sub 0ormH;oad12 Call ConfiguraModem 7nd Sub

!ttp:EEsoft.udm+.comEdo(nloadingEvbHcodeHforHreadHsimHsmsE Code: 'port Client.MSComm1.CommPort = 1 'inputlen = 0 means to receive the full buffer Client.MSComm1.InputLen = 0 'activate oncomm receive event after 1 b te Client.MSComm1.!"hreshold = 1 'activate oncomm send event after 1 b te Client.MSComm1.S"hreshold = 1 'activate communication to modem Client.MSComm1.!"S#nable = "rue 'handsha$in% Client.MSComm1.&andsha$in% = ' 'settin%s Client.MSComm1.Settin%s = ()*00+,+-+1( 'open the port Client.MSComm1.Port.pen = "rue 'send attention command to modem and chec$ it responds /ith .0 Client.MSComm1..utput = (1"2130( 4 Chr56178 '/ait for the data to come bac$ from the serial port 9o 9o#vents m:uffer = m:uffer 4 Client.MSComm1.Input Loop ;ntil InStr6m:uffer+ (.0( 4 vbCrLf8 < 0 '.0 no/ modem is connected

You might also like