Sie sind auf Seite 1von 6

21st May 2007

[http://3.bp.blogspot.com/-vv4ZillJh-8/UVcM8Y76zwI/AAAAAAAAAdk/6fQIjwUfvdI/s1600
/ScreenHunter_01+May.+03+18.25.gif]
This tutorial covers the main code procedures used in the CAT controller app that I have
developed under Visual Basic 6. The Yaesu FT-840 is a communication euipment that covers the
!am "adio !F #ands $%60& 80& 40& '0& %(& %0 meters). It use the "*'+' serial port ,or connection
to a computer. The euipment I-. serial port level is TT/ 0(V& ho1ever a TT/ to "*'+' converter
is necessar2 #ecause on a 3C the levels are 0-%'V.
Visual Basic 6 code explanation on Yaesu FT-840 CAT
application
Visual Basic 6 code explanation on Yaesu FT-840 CAT application http://alfredoblogspage.blogspot.in/2007/05/yaesu-ft-840-cat-controller...
1 of 6 6/1/2014 8:12 PM
[http://2.bp.blogspot.com/-aQogInxg3Ps/UVdLVn7PnGI/AAAAAAAAAd0/16qXHwUbuNc/s1600
/Yaesu_FT_840.sized.jpg]
A cheap option to #uild is the TT/ to "*'+' si4nals converter inte4rated circuit 5A6'+'. The CAT
inter,ace is ver2 eas2 to #uild so I stron4l2 recommend to do it 2oursel,.
[http://2.bp.blogspot.com/-JUPtdEfbN20/UVcHEorfr0I/AAAAAAAAAdc/gdu4JY-t_bw/s1600
/max232_serial_microcontroller.gif]
The C.A.T. $Computer Aided Transceiver) protocol provides complete control ,rom a 3C.
.perations such T6-"6 mode selection& ,reuenc2 input& memor2 stora4e and retrieve&
transceiver status data dump and others ,unctions are availa#le. All the commands sent to the
Visual Basic 6 code explanation on Yaesu FT-840 CAT application http://alfredoblogspage.blogspot.in/2007/05/yaesu-ft-840-cat-controller...
2 of 6 6/1/2014 8:12 PM
euipment consist o, #loc7s o, ,ive #2tes. The last #2te sent in each #loc7 is the instruction opcode
and previous ,our #2tes the ar4uments.
Belo1 is an command #loc7 e8ample that set the 9A5 1ide reception9 operation 95.:;9 on the
transceiver<
MSComm1.Output = Chr$(0)
MSComm1.Output = Chr$(0)
MSComm1.Output = Chr$(0)
MSComm1.Output = Chr$(4)
MSComm1.Output = Chr$(12)
The ,irst ,our #2tes are the ar4uments. The parameter =4 select 9A5 1ide reception9 and the
opcode =%' set the command 95.:;9 $T6-"6 mode on A5 procedure).

Be,ore startin4 to send or receive data the serial port must #e set to 4800 #auds& % start #it& 8 #it
data& ' stops #its& no parit2. The ,ollo1in4 procedure initiali>e the serial port<
MSComm1.CommPort = Text1
MSComm1.Settings = "4800!82"
MSComm1.PortOpen = True
MSComm1."nput#en = $

The main procedures are the numeric 7e2 arra2 ,or ,reuenc2 operation entr2 and the numeric
data conversions. The numeric 7e2pad arra2 use the inde8 parameter to 7no1 1hich 7e2 is
pressed. ?hen the num#er o, input di4its reach @ the procedure *end,recAClic7 is called and
t8tBumero varia#le is passed as parameter to evaluate ,irst i, the input value is .C or out o,
ran4e.
Pri%&te Su' (m)*otones+C,i(- (in)ex .s "nteger) St&ti( & .s "nteger
MC"./rom = 0
MC".Comm&n) = "P,&0"
"1 txt!umero = "" Then & = 0
txt!umero = txt!umero 2 /orm&t (in)ex)
& = & 2 1
"1 & = 3 Then
Sen)1re(+C,i(-
4n) "1
4n) Su'

Be,ore the numeric data conversion the pro4ram veri,2 i, the ,reuenc2 value a7a t8tBumero
parameter is out o, ran4e. The ,reuenc2 covera4e ran4e on the FT-840 4oes ,rom %00.000 $%00
7h>) to +0.000.000 $+0 mh>). An2 value out o, this ran4e sho1s a 1arnin4 messa4e #o8 to re
enter the ,reuenc2.
The ,ollo1in4 procedure chec7 i, the numeric value is out o, ran4e<
Pri%&te Su' Sen)1re(+C,i(-()
5im n1$ n2$ n6$ n4$
5im (&)en& .s *oo,e&n
5im 71 72 76 74 p&1 p&2 p&6 p&4 .s "nteger
St&ti( numero .s String
On 4rror 8oTo M&ne9oerror
(&)en& = txt!umero #i-e ":::::::"
"1 (&)en& = /&,se Then
Visual Basic 6 code explanation on Yaesu FT-840 CAT application http://alfredoblogspage.blogspot.in/2007/05/yaesu-ft-840-cat-controller...
3 of 6 6/1/2014 8:12 PM
Msg*ox "P,e&se input 1re(uen(0 %&,ue " %'Criti(&, ";&esu /T<840 4rror"
txt!umero = numero
4n) "1
"1 txt!umero = "" Then
Msg*ox "P,e&se input 1re(uen(0 %&,ue " %'Criti(&, ";&esu /T<840 4rror"
txt!umero = numero
4xit Su'
4n) "1
"1 txt!umero == 6000001 Then
Msg*ox "The 1re(uen(0 %&,ue must 'e > txtnumero = "" txtnumero =" numero"= 100.00
?h7" %'Criti(&, ";&esu /T<840 4rror"
txt!umero = ""
txt!umero = numero
4n) "1
4n) "1

The numeric data conversions #elo1 is the 7e2 procedure o, the pro4ram to convert t8tBumero
varia#le to the CAT protocol ,ormat accepted #2 the trasnceiver. The procedure use numerical
,unctions ,or e8ample the val ,unction to return the numeral part o, a strin4. The use o, the
,unctions le,t=& mid=& ri4ht= split the strin4 chain #ecause the parameters ,or ,reuenc2 operation
need to #e separated into ' di4it #loc7s to #uild the ,our #2tes ar4ument reuired in the CAT
protocol. The last ,ive instructions send the ar4ument result and the command instruction in CAT
protocol ,ormat to the Yaesu FT-840 transceiver.
numero = txt!umero
n1$ = #e1t$(txt!umero 1)
n2$ = Mi)$(txt!umero 2 2)
n6$ = Mi)$(txt!umero 4 2)
n4$ = @ight$(txt!umero 2)
71 = A&,(n1$)
72 = A&,(n2$)
76 = A&,(n6$)
74 = A&,(n4$)
"1 72 == 10 Then
7e2 = #e1t(72 1)
72 = 72 2 (7e2 B C)
4n) "1
"1 76 == 10 Then
7e6 = #e1t(76 1)
76 = 76 2 (7e6 B C)
4n) "1
"1 74 == 10 Then
7e4 = #e1t(74 1)
74 = 74 2 (7e4 B C)
4n) "1
MSComm1.Output = Chr$(74)
MSComm1.Output = Chr$(76)
MSComm1.Output = Chr$(72)
MSComm1.Output = Chr$(71)
MSComm1.Output = Chr$(10)
Visual Basic 6 code explanation on Yaesu FT-840 CAT application http://alfredoblogspage.blogspot.in/2007/05/yaesu-ft-840-cat-controller...
4 of 6 6/1/2014 8:12 PM

For the meter incomin4 si4nal and po1er transmit output data readin4 the app use a timer set at
(00 ms to read periodical the actual transceiver status in,ormation. The pro4ram need to anal2>e
the dump o, data and e8tract the proper values. A pro4ress #ar4raph control displa2 the incomin4
value. The meter status data consist o, ,our identical #2tes ,ollo1ed #2 a ,iller #2te. The incomin4
meterin4 value ran4e 4oes ,rom % to '(( $8 #its). The .n ;rror procedure avoid the application
han4 up in case o, accidental "*'+' serial ca#le disconnection.
Pri%&te Su' Timer2+Timer()
On 4rror 8oTo error
MSComm1.Output = Chr$(0)
MSComm1.Output = Chr$(0)
MSComm1.Output = Chr$(0)
MSComm1.Output = Chr$(0)
MSComm1.Output = Chr$(243)
/or & = 1 To $000000
!ext &
/or & = 1 To $
'u11er$ = 'u11er$ D MSComm1."nput
!ext &
'$ = #e1t('u11er$ 1)
( = .s(('$)
*&rr&.A&,ue = (
4xit Su'
errorE
*&rr&.A&,ue = 1
4n) Su'

;ver2 time i, a command #utton on the dash#oard panel is pressed a #eep sound is pla2ed to
in,orm to the user the event. For this procedure the 5CI multimedia control is used. The ne8t code
select the tone.1av ,ile to reproduce a %7h> #eep sound.
Pri%&te Su' /orm+#o&)()
Timer2.4n&',e) = /&,se
MC".5e%i(eT0pe = "F&%e.u)io"
MC"./i,e!&me = .pp.P&th 2 "GTone.H&%"
MC".F&it = True
MC".!oti10 = /&,se
MC".Comm&n) = "Open"
MC".Ip)&te"nter%&, = 100
4n) Su'

In this #rie, tutorial the most important sections o, the code in Visual Basic 6 are covered. .,
course the pro4ram can #e improved addin4 ,or e8ample a menu plus a small data#ase ,or the
stora4e o, memories and CD contacts& etc. The core ,unctions ,or I-. remote operation are
completed and operational. Also the application is 1or7in4 1ithout critical issues& an important
aspect in so,t1are development. ., course addin4 more ,unctions and ,eatures is m2 ne8t tas7.
!o1 to resolve the data and parameters conversions on the proEect under Visual Basic 6 usin4
Yaesu CAT protocol inter,ace 1as the o#Eective.
Posted 21st May 2007 by Alfredo Alejandro
Visual Basic 6 code explanation on Yaesu FT-840 CAT application http://alfredoblogspage.blogspot.in/2007/05/yaesu-ft-840-cat-controller...
5 of 6 6/1/2014 8:12 PM

Comment as:
Publish

2
View comments
m.alas November 21, 2008 at 12:29 PM
Hello
i also have a FT840 and would like to use your programm to control it .Would it be possible to get a copy of
it
thanks in advance and best 73 de F1OK
site: http://alas.ifrance.com/atlas
Reply
Alfredo Alejandro March 4, 2009 at 6:55 PM
Hello Mr Alas, this application was written in VB6 and my idea is to convert it to NET platform. There are
some issues that I must fix, also I want to add a menu and database for contacts, preferences, etc. Today
the NET framework is the standard, another reason to convert it. In my article I publish the main procedures
to give an idea how it works. Anyone can use it in a new project, the goal is to experiment and solve the
problems !!!, thats the idea. Bye !
Reply
Visual Basic 6 code explanation on Yaesu FT-840 CAT application http://alfredoblogspage.blogspot.in/2007/05/yaesu-ft-840-cat-controller...
6 of 6 6/1/2014 8:12 PM

Das könnte Ihnen auch gefallen