157
The Transmitter The function of a transmitter is to take an analog or digital signal and, through an antenna, deliver it into free space. A simple transmitter is illustrated below. You will notice the transmitter has three primary components: a frequency source (the oscillator), a gain stage (the amplifier) and a free space coupler (the antenna). The oscillator generates the frequency at which the transmitter will operate. This frequency is called the Fundamental. In order for the fundamental frequency to be transmitted effectively through the resistance of free space, it is necessary for the signal to be amplified. This is the purpose of the gain stage. Once the oscillator’s frequency has been amplified, it must transition from being a frequency contained within conductors (called transmission lines) into free space. This is the function of the antenna. The transmitting antenna allows the RF energy to be efficiently radiated from the output stage into free space. It is, in essence, a bridge between a guided wave and free space. WHAT IS MODULATION? Now that you have a basic understanding of how a signal finds itself delivered into free space, you may be wondering how any useful information could be represented by that signal. The answer is Modulation. Modulation is the process whereby a carrier medium is impressed with content. The WIRELESS MADE SIMPLE ® APPLICATION NOTE AN-00100 RF 101 Information for the RF Challenged INTRODUCTION For those of you with previous RF experience or a good grasp of RF basics, skip this tutorial. Its simplicity will probably insult your intelligence. For those of you delving into the fearsome world of RF for the first time, however, read it fully and with care. When you finish you will have a clearer understanding of how signals are transmitted and received in an RF environment, and perhaps a newfound admiration for the unseen world of wireless intelligence that swirls around us. This application note goes to great lengths to remove the mysteries of RF. Please don't mistake the ease with which you may grasp these basic principals for the effort required to actually execute an RF design. Nooo, noooo, kiddies, don't try this at home. At least not if your job’s on the line. The science of RF is unlike any other area of discipline in electronics. Proficient RF design requires sophisticated test equipment, years of experience, lots of money, and a big smile from Above. Fortunately, while actual RF design is quite difficult, understanding basic RF concepts is amazingly straightforward. WHAT IS RADIO FREQUENCY? Radio Frequency (RF) does not refer just to radio broadcasting but rather encompasses all of the electromagnetic spectrum. RF energy is classified according to frequency. The range of frequencies is called the Radio Spectrum. While there is no precise beginning or end to frequencies making up the RF spectrum, Figure 1 shows the generally accepted ranges and class designations. HOW IS THE RF HARNESSED? In order for a signal to be transmitted wireless, it is necessary for the signal to be conveyed into free space then recovered and restored to its original form. Two devices are used to accomplish this task: the transmitter and the receiver. ELF VLF LF MW (MF) HF ( SW) VHF UHF SHF EHF IR Visible Light UV X-Ray 100 Hz 10 kHz 100 kHz 1 MHz 3 MHz 30 MHz 300 MHz 1 GHz (1000 MHz) 30 GHz 300 GHz 10 14 Hz 10 16 Hz 10 17 Hz 10 18 Hz Figure 1: The Electromagnetic Spectrum Figure 2: A Simple RF Transmitter Oscillator RF Amplifier Antenna Data In

WIRELESS MADE SIMPLE - University of Rochester

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: WIRELESS MADE SIMPLE - University of Rochester

TThhee TTrraannssmmiitttteerrThe function of a transmitter is to take an analog ordigital signal and, through an antenna, deliver it intofree space. A simple transmitter is illustrated below.

You will notice the transmitter has three primarycomponents: a frequency source (the oscillator), again stage (the amplifier) and a free space coupler(the antenna). The oscillator generates thefrequency at which the transmitter will operate. Thisfrequency is called the Fundamental. In order forthe fundamental frequency to be transmittedeffectively through the resistance of free space, it isnecessary for the signal to be amplified. This is thepurpose of the gain stage.

Once the oscillator’s frequency has been amplified,it must transition from being a frequency containedwithin conductors (called transmission lines) intofree space. This is the function of the antenna. Thetransmitting antenna allows the RF energy to beefficiently radiated from the output stage into freespace. It is, in essence, a bridge between a guidedwave and free space.

WHAT IS MODULATION?Now that you have a basic understanding of how asignal finds itself delivered into free space, you maybe wondering how any useful information could berepresented by that signal. The answer isModulation. Modulation is the process whereby acarrier medium is impressed with content. The

WIRELESS MADE SIMPLE ®

APPLICATION NOTE AN-00100RF 101 Information for the

RF Challenged

INTRODUCTIONFor those of you with previous RF experience or agood grasp of RF basics, skip this tutorial. Itssimplicity will probably insult your intelligence. Forthose of you delving into the fearsome world of RFfor the first time, however, read it fully and with care.When you finish you will have a clearerunderstanding of how signals are transmitted andreceived in an RF environment, and perhaps anewfound admiration for the unseen world ofwireless intelligence that swirls around us.

This application note goes to great lengths toremove the mysteries of RF. Please don't mistakethe ease with which you may grasp these basicprincipals for the effort required to actually executean RF design. Nooo, noooo, kiddies, don't try this athome. At least not if your job’s on the line. Thescience of RF is unlike any other area of disciplinein electronics. Proficient RF design requiressophisticated test equipment, years of experience,lots of money, and a big smile from Above.Fortunately, while actual RF design is quite difficult,understanding basic RF concepts is amazinglystraightforward.

WHAT IS RADIO FREQUENCY?Radio Frequency (RF) does not refer just to radiobroadcasting but rather encompasses all of theelectromagnetic spectrum. RF energy is classifiedaccording to frequency. The range of frequencies iscalled the Radio Spectrum. While there is noprecise beginning or end to frequencies making upthe RF spectrum, Figure 1 shows the generallyaccepted ranges and class designations.

HOW IS THE RF HARNESSED?In order for a signal to be transmitted wireless, it isnecessary for the signal to be conveyed into freespace then recovered and restored to its originalform. Two devices are used to accomplish this task:the transmitter and the receiver.

ELF VLF LF MW(MF)

HF(SW) VHF UHF SHF EHF IR Visible

Light UV X-Ray

100Hz

10kHz

100kHz

1MHz

3MHz

30MHz

300MHz

1GHz

(1000 MHz)

30GHz

300GHz

1014

Hz1016

Hz1017

Hz1018

Hz

Figure 1: The Electromagnetic Spectrum

Figure 2: A Simple RF Transmitter

Oscillator

RF Amplifier

Antenna

Data In

Page 2: WIRELESS MADE SIMPLE - University of Rochester

AN-00100RF 101 Information for the RF Challenged

frequency to be controlled is called the Carrier. Acarrier is like a moving truck. Just as you mightplace the contents of your house on the truck, sothe information you wish to transmit is loaded ontoa carrier. That signal, which has been impressedonto the carrier for “transportation”, is called theProgram or Control Signal. In the case of digitaldata transmission, a carrier frequency is modulatedwith a control signal consisting of binary data.

While there are many modulation methods, let usconsider the simplest and earliest form ofmodulation, Morse Code. Looking at Figure 3 youcan see that by turning on and off the carrier torepresent the intelligent content of a message, theoperator of the telegraph key is serving as themodulation source. Interestingly, this basic form ofmodulation is still one of the most popular, thoughtoday it is known as On-Off Keying (OOK) orCarrier-Present Carrier-Absent (CPCA). Byreplacing the telegraph key with a microprocessor,a serial transmission link is formed. If you would liketo learn more about modulation techniques, youmay wish to review Linx Application Note #00130.

TThhee RReecceeiivveerrThe purpose of a receiver is to receive themodulated carrier, remove it, and recover theoriginal program signal. This process is calledDemodulation.

Figure 4 illustrates a single-conversion superhetAM receiver. While receiver topologies vary widelyall involve several stages to affect the reception andrecovery process. First, the receiving antennaintercepts the electromagnetic waves radiated fromthe transmitting antenna. When these wavesimpinge upon the receiving antenna, they induce asmall voltage in it. This voltage causes a weakcurrent to flow, which contains the same frequencyas the original current in the transmitting antenna.That current is amplified to a more useable leveland then fed into a device called a mixer. The mixertakes this incoming signal and combines it with an

on-board frequency source called a local oscillator.This converts the signal to a new lower frequencycalled the Intermediate Frequency or IF for short.The detector then strips out the IF frequency andleaves present only the original information.

By now you should have a basic, but clear,understanding of how information signals aretransmitted and received. With that as a foundation,you are now ready to consider the steps involved inputting RF to work for you.

UNDERSTANDING AND RESPECTINGLEGAL ISSUESMany designers have steered away from integratingRF out of concern over the complexity of these legalissues. Some view the oversight of radiofrequencies by the FCC as yet another example ofunnecessary government intervention into the livesof private citizens. While the FCC has made manypolices and rulings that are unnecessarily limitingand sometimes border on the absurd, consider anexample of life without them.

After days of research, you choose the optimumfrequency for your company’s new product, theLoafmaster 2000. You then select a power levelappropriate for your range and power consumptionrequirements. Months later, after many nights ofeffort you proudly bring the Loafmaster to market.Happily, it garners awards and rave reviews. Threemonths later, a company in a different industry whoknows nothing of your product introduces theSlamometer XL. While this product operates on thesame frequency as yours, it was designed withcompletely different objectives in mind. To achievethose objectives the Slamometer needs tocontinuously output 500 watts of power across a500 MHz bandwidth. From all over the country your

Page 2

Oscillator

Mixer AM DetectorRF Amplifier

Antenna

RecoveredInformation

" . . . " " — — — " " . . . "

S O S

Telegraph Key (Modulator)

Oscillator

Antenna

Figure 4: Simple Superhet Receiver

Figure 3: A Telegraph

Page 3: WIRELESS MADE SIMPLE - University of Rochester

AN-00100RF 101 Information for the RF Challenged

once-pleased customers call demanding anexplanation for the sporadic operation of theirLoafmasters. Much to the anger of the Slamometermanufacturing company your solution is to retrofitall units with a 1,000 watt gain stage powered by acar battery in a backpack.

Undeniably, there are steps than can be taken tostreamline the certification process but regulation ofthe RF Spectrum worldwide is essential. Playing bythe regulatory rules helps to ensure that thecrowded RF spectrum is used efficiently, and itgives all RF products the best chance of functioningwithout conflict. To learn more about these consid-erations you will want to read Linx application notes#00140, #00125, #00126, and obtain copies of thegoverning regulations for the countries in which youintend your product to operate.

CHOOSE A FREQUENCY OF OPERATIONTo go somewhere you choose a road on which totravel. So, too, must you select a frequency onwhich your information signal will travel. This is adifficult task as there are many diverse issuesinvolved. Here are a number of the most critical toconsider.

PPrrooppaaggaattiioonn CChhaarraacctteerriissttiiccssThe transfer of energy through space is calledPropagation. In general, radio wave propagation isdivided into three broad categories: (1) GroundWave propagation, where the signal travels throughor along the earth’s surface; (2) Line-of-Sight,where the wave travels almost like a beam of lightin a straight line and thus requires that the

transmitter and receiver be within sighting distanceof each other; (3) Sky Wave propagation, where thesignal travels primarily through the air via reflectionsfrom the ionosphere.

It is important to consider the physical environmentin which the device will operate in order todetermine if the frequency you have chosenpossesses useable propagation characteristics. Forexample, transmission through walls would behighly attenuated and poorly served by frequenciesin the microwave region, while effective trans-mission through water might require selection of afrequency in the VLF range.

RReeqquuiirreedd BBaannddwwiiddtthhThe amount of information that can be transferreddepends on the carrier frequency and availablebandwidth. The carrier frequency must be manytimes the required bandwidth, thus, applicationssuch as video and data links, which require widebandwidths, utilize frequencies well into the micro-wave range. In general, the bandwidth should be asnarrow as possible to accommodate the requiredinformation content. This yields the best immunity tonoise and allows the highest possible systemsensitivity.

PPoowweerr CCoonnssuummppttiioonnIn battery-powered applications, powerconsumption is generally a critical issue.Surprisingly, the relationship between frequencyand power consumption is often overlooked. Sincepropagation efficiency is reduced as frequencyclimbs, higher frequencies require more power toachieve range.

PPootteennttiiaall IInntteerrffeerreenncceeThe final component of frequency selection is tounderstand what potential interference sourcesyour device will be up against in the real world.Interference is the presence of unwanted noise orsignals that increases the difficulty of reception. Youmay find that many frequencies suited to yourapplication have a high level of interference presentbecause of their broad popularity.

Interference can be divided into three primarycategories: natural noise, man-made noise, andman-made signals. Natural noise originates inspace and the earth's atmosphere. It tends to begreater at low frequencies. Man-made noise iscaused by unintentional RF radiation from man-

Page 3

Figure 5: Propagation Categories

Sky Wave

Ground Wave

Line-of-Sight

Page 4: WIRELESS MADE SIMPLE - University of Rochester

AN-00100RF 101 Information for the RF Challenged

made devices, such as motors, switching powersupplies and microwaves. Man-made signals areintentional RF emissions such as radio, television,cellular, etc.

Immunity to noise depends on bandwidth and thefrequency accuracy of the transmitter. The moreaccurate a signal’s frequency and the narrower asignal’s bandwidth, the narrower the receiver’sfront-end filter can be. This increases the ratiobetween the signal and noise and greatly reduces

the potential for off-frequency interference. Figure 6illustrates how a receiver with a narrow front endbandpass opening (A) has a much better chance ofreceiving the incoming signal than receiver (B) withits wide front end bandpass opening.

DEVELOP RF REQUIREMENT SPECIFICATIONS

This specification is simply a list of characteristicsyou feel are important. It will act as a roadmapduring your consideration of the various RFsolutions that are available. You will want to listparticulars, such as preferred operational voltages,power consumption requirements, data rates, rangerequirements and frequency choices.

EXPLORE RF OPTIONSArmed with a basic understanding of RF and yourindividual needs, you can now consider your RFoptions more intelligently. Your initial decision willbe whether to use a custom discreet design or apre-made RF module. The table in the next columndetails some of the advantages of each.

In order to fairly compare the cost of a discrete vs.modular design, be sure to bear in mind the partplacement, tuning and testing costs incurred in theproduction phase of a discrete design.

CHOOSE AN ANTENNA

The antenna choice is critical in determining theoverall performance and legality of a system. Thereare many issues related to understanding andselecting an antenna, which are covered in Linxapplication note #00500. It should be noted here,however, that as frequency increases antennalength is reduced. In some applications a largeantenna element is unsuitable for size or cosmeticreasons. This requires the designer to use a highoperational frequency or create a unique antennasolution.

Page 4

B

A DesiredCarrier

Figure 6: Desired Bandwidth AAddvvaannttaaggeessComplete control over performance specificationsControl over manufacturing process and design changesPerformance compromises can be tailored to cost

requirementsParts may be available from multiple vendors

DDiissaaddvvaannttaaggeessHigh design costLengthy time to marketIncreased production testingHigher board material costDifficult parts procurementSignificant equipment investment

AAddvvaannttaaggeessMinimal time to marketLow cost of evaluationEasy regulatory complianceStable, consistent performanceNo production tuning or testing requiredReduced size and part countSingle part placement lowers production costComparable cost to a discreet design

DDiissaaddvvaannttaaggeessPerformance may not exactly match requirementsSingle vendor availabilityNo control over production life Custom modifications available only in high quantities

Discreet RF Design

Modular RF Product

Page 5: WIRELESS MADE SIMPLE - University of Rochester

AN-00100RF 101 Information for the RF Challenged

CERTIFY THE PRODUCTOnce your product is in its finished form, exactly asit will be produced, it should be sent to one of themany testing laboratories authorized to conductFCC Part 15 compliance testing. The testing usedto take up to three weeks with another 60 to 90 daysfor the FCC filing and ID number to be issued. TheFCC now allows the test lab to issue the IDnumbers on behalf of the FCC, which has greatlyshortened the certification process. The testing andcertification process now takes about a week andgenerally costs about $5,000. After the product hasbeen tested and found to be compliant, the testlaboratory will submit the documentation to the FCCon your behalf and issue an ID number.

PUTTING IT ALL TOGETHERFrom this application note you have, hopefully,learned a bit more about the basics of RF and thesteps involved in putting it to work for you. You mayalso have gained an additional measure of respectfor the fine balance of considerations that any RFproduct represents. At Linx the science of RF is ourbusiness. We attempt to make its application asstraightforward as possible so that you canconcentrate on profitably bringing your product tomarket. If you have questions that were not coveredin this application note or you would like help inachieving an optimum wireless solution please feelfree to contact a Linx application engineer [email protected] or (800) 736-6677.

Page 5

Page 6: WIRELESS MADE SIMPLE - University of Rochester

Unlicensed operation in the frequencies from 260 to470MHz is governed by Part 15, section 231. Part15 is what is termed “Living Legislation”. Thismeans it is subject to interpretation on a case-by-case basis. If your application is not clearly incompliance, it is best to consult the FCC directlybefore proceeding with a design.

WHAT MUST I DO TO BE UNLICENSED?The regulations of Part 15.231 are rather unusual.In many bands the FCC specifies only fundamentalpower, harmonic levels, and allowed bandwidth. Inthe case of the 260-470MHz band, the FCC actuallyconsiders what the data being sent originallyconsisted of and what their intended function is.You will want to review the text of 15.231 in itsentirety. (It has been included at the end of thisapplication note for your convenience.) Whenreviewing this section, it is critical to realize thatparagraphs (A)-(D) are intended to be read as aunit, while paragraph (E) applies only if the rules ofparagraph (A) are being violated. Because of thecomplexity and application-dependent nature of therules, they are best illustrated in a flowchart style asfollows.

WIRELESS MADE SIMPLE ®

INTRODUCTIONThis application note is designed to give the readera basic understanding of the technical and legalissues that apply to the operation of RF devices inthe 260MHz to 470MHz band. Since the alloweduse of these frequency bands varies considerablyworldwide, it should be recognized that thisapplication note is intended for designers planningfor operation in the United States under the rules ofCFR47 Part 15.

When working with RF, a clear distinction mustalways be made between what is technicallypossible and what is legally acceptable. Sinceconsideration of technical issues serves littlepurpose if the chosen frequency cannot be legallyused for your intended purpose, let us considerissues of legality first.

LEGAL CONSIDERATIONS In the United States, the Federal CommunicationsCommission (FCC) is responsible for the regulationof all RF devices. These regulations are containedin the Code of Federal Regulations (CFR), Title 47.Title 47 is made up of numerous volumes, however,all regulations applicable to operation in the 260 to470MHz band are contained in volume 0-19. It isstrongly recommended that a copy be obtained andreviewed in its entirety. You can get a full copy ofthe code from your local government bookstore, theGovernment Printing office in Washington(http://bookstore.gpo.gov/) or the FCC web site at:http://wireless.fcc.gov/rules.html

WHAT IS UNLICENSED OPERATION?Here in the United States, the FCC requires anydevice that intentionally radiates RF energy to betested for compliance with FCC rules. Certainbands within the RF spectrum are available for“unlicensed” operation. The term “Unlicensed” isoften misunderstood. The manufacturer of aproduct designed for “Unlicensed” operation is notexempt from the certification procedure. Indeed,both the transmitter and receiver must be tested bya qualified testing laboratory and an FCC IDnumber obtained before the product can be legallysold. Once this has been done, however, the enduser of the product can operate it without obtaininga license for its use.

APPLICATION NOTE AN-00125Considerations For OperationWithin the 260-470MHz Band

Page 7: WIRELESS MADE SIMPLE - University of Rochester

AN-00125Considerations For Operation Within the 260-470MHz Band Page 2

Is My Application Legal for OperationUnder Part 15.231 A-D?

YESYESYES

Is It Legal Under Para. (E)?Transmitter Activation Method

NONONO

Allowed Transmission Types

Under 15.231 A-D You May Transmit:• control or command signals• ID codes in order to identify a system component• radio control signals during emergencies• variable data as long as a control or ID code is sent as well

Banned Transmission Types

Under 15.231 A-D You May Not send:• voice or video• control toys• variable data without a control code (time, pressure, temperature, etc.)• periodic transmissions at regular pre-determined intervals except to poll integrity of system components

1. The output power is halved.2. Maximum transmission time 1 sec.3. The minimum period between transmissions is 30 times the transmission period but never less than 10 seconds.4. The harmonic and bandwidth requirements of Para. B-D are complied with.

Any Operation Is Allowed Under Paragraph E Provided:

MANUALAUTOMATICTransmission mustcease within 5 sec.of activation

Operation must cease within 5 sec.of switch being released after use.

Comply with the output power,bandwidth, and harmonic requirements of paragraphs B-D and the product is suitable for certification.

Page 8: WIRELESS MADE SIMPLE - University of Rochester

By reviewing Part 15 and the preceding flow chart,you have, hopefully, determined that yourapplication is appropriate for operation in the 260 to470MHz band. If you are still uncertain or feel yourapplication falls into a “gray” area, you may wish toconsult directly with an FCC engineer. You may doso by contacting the FCC directly at:

Federal Communications Commission Office of Engineering and Technology

7435 Oakland Mills RoadColumbia, MD 21046

Phone: (301) 362-3000Fax: (301) 344-2050

E-mail: [email protected] Site: www.fcc.gov/oet/

FUNCTIONAL REQUIREMENTSOnce you are certain your application is allowed inprinciple, you will want to focus on understandingthe specific functional requirements that must bemet in order for your completed device to receivecertification.

DETERMINE AND COMPLY WITHALLOWED OUTPUT POWER

The above table illustrates the linear relationshipbetween the fundamental frequency of operationand the allowed output power. Since the outputpower is allowed to climb as the frequencyincreases, it might at first appear that selecting thehighest frequency would give the best rangeperformance. This is not the case, however, sincefree space attenuation increases proportional tofrequency. Thus, linear interpolation serves only toequalize the transmission’s propagation charac-teristics so that range performance is similar acrossthe band.

It is important to note that the RF level radiated intofree space is dependent not only on raw outputpower but also on the type of antenna employed.Most transmitter modules, including thosemanufactured by Linx, have an output level that issufficient to produce a radiated RF level that is non-compliant. The transmitter is purposely set highbecause many designers may wish to utilizeinefficient antenna styles, such as a loop-trace orhelical, for cost or cosmetic reasons. If the moduleis matched to a highly efficient antenna, such as afull whip or yagi, the output power may need to bereduced externally by an attenuation pad. Forfurther details review Linx application note #00150.

In addition to the restrictions on fundamental outputpower, the FCC also regulates allowed harmoniclevels and occupied bandwidth. Since thisapplication note is oriented toward users of Linxproducts, little detail is needed or will be given onthese points as our modules are inherentlydesigned to meet these requirements. It isimportant, however, to note that there are severalways in which a user can adversely affect harmoniccontent. The most common is the use of a poorlymatched antenna. Consider, for example, anantenna that has a high Standing Wave Ratio(SWR) at the fundamental frequency and a lowSWR at a harmonic frequency. When thetransmitter’s output power is raised to achievemaximum legal output at the fundamental, theharmonic may rise to an unacceptable level byvirtue of the antenna’s misplaced efficiency.Harmonics can also be affected by noise present inthe transmitter supply. This noise can causeoscillator instability and subsequent spurs andharmonic events.

While these issues of legality may appearformidable, they generally are not. By choosing acorrect operational frequency and using a pre-madeRF module, a product designer’s burden is greatlyreduced. With proper attention to such basics asgood layout, clean supply lines, and a properlymatched antenna, RF success is a nearly painlessprocess.

Now that your application has, hopefully, survivedthe legal considerations outlined above, let’sconsider the actual technical issues of operation inthese frequencies.

AN-00125Considerations For Operation Within the 260-470MHz Band Page 3

Allo

wab

le F

ield

Str

engt

hµv

/m @

3m

Fundamental Frequency

12,500

1,250

2,500

3,750

4,000

5,250

6,500

7,750

9,000

10,250

11,250

260 275 290 305 320

*315

335 350 365 380 395 410 425 440 455 470

*418 *433

* Available Linx Module Frequencies

Under Paragraph B

Under Paragraph E

Figure 1: Output Power vs. Frequency

Page 9: WIRELESS MADE SIMPLE - University of Rochester

BENEFITS OF OPERATION WITHIN THE260-470MHZ BANDFirst, it should be recognized that the unusualrestrictions placed on the band by the FCC do morethan just make your life miserable. They also help tokeep this set of frequencies quite clear ofinterference. Other Part 15 bands, such as the 902-928MHz band, are crowded with continuoustransmissions of voice, data, video and hi-levelinterference from microwave ovens to SpreadSpectrum devices.

Second, longer transmission distances areachieved with less power. The free spacepropagation of frequencies in this range issignificantly better than at higher frequencies, suchas 900MHz or 2.4GHz. Therefore, lower outputpower is needed to attain any particular distance.Since less output power is needed, transmitterpower consumption is significantly reduced andbattery life extended.

Third is cost effectiveness. The components usedat these frequencies are significantly lower in costthan those designed for operation at higherfrequencies. This allows an excellent balancebetween product cost and performance.

Fourth is ease of export. Many countries worldwidehave allocated these frequencies for similar uses. Ifyour product will be sold abroad, this band willprovide a wide range of international compatibility.

COMMON FREQUENCIES WITHIN THEBAND AND THEIR USESAs you review Linx product offerings, you will noticethree standard frequencies within the band from260 to 470MHz. These frequencies are 315, 418,and 433.92MHz.

• 315MHz is commonly used for gate/garage dooropeners, security and keyless entry systems.

• 418MHz is a very clean frequency here in the USand also appropriate for operation in the UK.

• 433.92MHz is used throughout all of Europe. Whileit is appropriate for use here in the US, interferencefrom amature radio and the nearby pager bandmay sometimes pose a problem.

If you are a high volume user (500k+/yr.), you maywish to further reduce the potential for interferenceby selecting a custom frequency within the band.

SUMMARYThe 260-470MHz band is ideal for instances wherecontrol, command or status signals need to be sent.In addition, it should also be given consideration forall applications where periodic short-range analogor digital transmissions are required.

SECTION 15.231PPeerriiooddiicc ooppeerraattiioonn iinn tthhee bbaanndd 4400..6666 -- 4400..7700MMHHzzaanndd aabboovvee 7700MMHHzz..

(a) The provisions of this Section are restricted toperiodic operation within the band 40.66 -40.70MHz and above 70MHz. Except as shown inparagraph (e) of this Section, the intentionalradiator is restricted to the transmission of a controlsignal such as those used with alarm systems, dooropeners, remote switches, etc. Continuoustransmissions, voice, video and the radio control oftoys are not permitted. Data is permitted to be sentwith a control signal. The following conditions shallbe met to comply with the provisions for thisperiodic operation:

(1) A manually operated transmitter shall employ aswitch that will automatically deactivate thetransmitter within not more than 5 seconds of beingreleased.

(2) A transmitter activated automatically shall ceasetransmission within 5 seconds after activation.

(3) Periodic transmissions at regular predeterminedintervals are not permitted. However, polling orsupervision transmissions, including data, todetermine system integrity of transmitters used insecurity or safety applications are allowed if thetotal duration of transmissions does not exceedmore than two seconds per hour for eachtransmitter. There is no limit on the number ofindividual transmissions, provided the totaltransmission time does not exceed two seconds perhour.

(4) Intentional radiators which are employed forradio control purposes during emergenciesinvolving fire, security, and safety of life, whenactivated to signal an alarm, may operate during thependency of the alarm condition.

(b) In addition to the provisions of Section 15.205,the field strength of emissions from intentionalradiators operated under this Section shall notexceed the following:

AN-00125Considerations For Operation Within the 260-470MHz Band Page 4

Page 10: WIRELESS MADE SIMPLE - University of Rochester

[Where F is the frequency in MHz, the formulas forcalculating the maximum permitted fundamentalfield strengths are as follows: for the band 130-174MHz, uV/m at 3 meters = 56.81818(F) -6136.3636; for the band 260-470MHz, uV/m at 3meters = 41.6667(F) - 7083.3333. The maximumpermitted unwanted emission level is 20dB belowthe maximum permitted fundamental level.]

(1) The above field strength limits are specified at adistance of 3 meters. The tighter limits apply at theband edges.

(2) Intentional radiators operating under theprovisions of this Section shall demonstratecompliance with the limits on the field strength ofemissions, as shown in the above table, based onthe average value of the measured emissions. Asan alternative, compliance with the limits in theabove table may be based on the use ofmeasurement instrumentation with a CISPR quasi-peak detector. The specific method ofmeasurement employed shall be specified in theapplication for equipment authorization. If averageemission measurements are employed, theprovisions in Section 15.35 for averaging pulsedemissions and for limiting peak emissions apply.Further, compliance with the provisions of Section15.205 shall be demonstrated using themeasurement instrumentation specified in thatsection.

(3) The limits on the field strength of the spuriousemissions in the above table are based on thefundamental frequency of the intentional radiator.Spurious emissions shall be attenuated to theaverage (or, alternatively, CISPR quasi-peak) limitsshown in this table or to the general limits shown inSection 15.209, whichever limit permits a higherfield strength.

(c) The bandwidth of the emission shall be no widerthan 0.25% of the center frequency for devicesoperating above 70MHz and below 900MHz. For

devices operating above 900MHz, the emissionshall be no wider than 0.5% of the center frequency.Bandwidth is determined at the points 20dB downfrom the modulated carrier.

(d) For devices operating within the frequency band40.66 - 40.70MHz, the bandwidth of the emissionshall be confined within the band edges and thefrequency tolerance of the carrier shall be + 0.01%.This frequency tolerance shall be maintained for atemperature variation of -20 degrees to +50degrees C at normal supply voltage, and for avariation in the primary supply voltage from 85% to115% of the rated supply voltage at a temperatureof 20 degrees C. For battery operated equipment,the equipment tests shall be performed using a newbattery.

(e) Intentional radiators may operate at a periodicrate exceeding that specified in paragraph (a) andmay be employed for any type of operation,including operation prohibited in paragraph (a),provided the intentional radiator complies with theprovisions of paragraphs (b) through (d) of thisSection, except the field strength table in paragraph(b) is replaced by the following:

[Where F is the frequency in MHz, the formulas forcalculating the maximum permitted fundamentalfield strengths are as follows: for the band 130-174MHz, uV/m at 3 meters = 22.72727(F) -2454.545; for the band 260-470MHz, uV/m at 3meters = 16.6667(F) - 2833.3333. The maximumpermitted unwanted emission level is 20dB belowthe maximum permitted fundamental level.]

In addition, devices operated under the provisionsof this paragraph shall be provided with a means forautomatically limiting operation so that the durationof each transmission shall not be greater than onesecond and the silent period between transmissionsshall be at least 30 times the duration of thetransmission but in no case less than 10 seconds.

AN-00125Considerations For Operation Within the 260-470MHz Band Page 5

Fundamental Field Strength of Field Strength ofFrequency Fundamental Spurious Emission(MHz) (microvolts/meter) (microvolts/meter)________________________________________________40.66 - 40.70 1,000 10070 - 130 500 50130 - 174 500 to 1,500 ** 50 to 150 **174 - 260 1,500 150260 - 470 1,500 to 5,000 ** 150 to 500 **Above 470 5,000 500________________________________________________** linear interpolations

Fundamental Field Strength of Field Strength ofFrequency Fundamental Spurious Emission(MHz) (microvolts/meter) (microvolts/meter)________________________________________________40.66 - 40.70 2,250 22570 - 130 1,250 125130 - 174 1,250 to 3,750** 125 to 375**174 - 260 3,750 375260 - 470 3,750 to 12,500** 375 to 1,250**Above 470 12,500 1,250________________________________________________** linear interpolations

Page 11: WIRELESS MADE SIMPLE - University of Rochester

The frequencies from 902 to 928MHz are allocatedfor a wide variety of unlicensed applications. UnderPart 15 and Part 18 a wide variety of narrow band,spread spectrum and Industrial/Scientific/Medical(ISM) devices are allowed legal operation. In mostinstances, users of modules manufactured by Linxwill seek certification under Part 15.249.

WHAT MUST I DO TO BE UNLICENSED?Part 15 requirements for many bands aresomewhat obscure and difficult to interpret.Thankfully, the regulations of Part 15.249 are verystraightforward.

Comply with allowed power output, harmonic andspurious requirements.

Devices operating under Part 15.249 are allowed amaximum fundamental field strength of 50,000microvolts and harmonics of 500 microvoltsmeasured at three meters. All spurious radiationshall be attenuated to the lesser of 50dB below thefundamental or to 200 microvolts below 960MHz or500 microvolts above. Linx modules are inherentlydesigned to meet these requirements, but it isimportant to note that external factors can affect themodule’s compliance. The RF level radiated intofree space is dependent not only on raw outputpower but also on the type of antenna employed.Most transmitter modules, including thosemanufactured by Linx, have an output level that issufficient to produce a radiated RF level that is non-compliant. The transmitter is purposely set highbecause many designers may wish to utilizeinefficient antenna styles for cost or cosmeticreasons. If the module is matched to a highlyefficient antenna or one that exhibits gain charac-teristics, such as a full whip or yagi, the outputpower may need to be reduced externally by anattenuation pad. For further details, review Linxapplication note #00150.

On the other hand, a badly matched antenna canbe equally damaging. Consider, for example, anantenna that has a high Standing Wave Ratio(SWR) at the fundamental frequency and a lowSWR at a harmonic frequency. This misplacedantenna efficiency may cause the harmonic powerto rise to an unacceptable level. Harmonics can

WIRELESS MADE SIMPLE ®

INTRODUCTIONThis application note is designed to give the readera basic understanding of the technical and legalissues that apply to the operation of RF devices inthe 902MHz to 928MHz band. Since the alloweduse of frequencies varies considerably worldwide, itshould be recognized that this resource documentis intended for designers planning to operate in theUnited States under the rules of CFR47 Part 15.

When working with RF, a clear distinction mustalways be made between what is technicallypossible and what is legally acceptable. Sinceconsideration of technical issues serves littlepurpose if the chosen frequency cannot be legallyused for your intended purpose, let us considerissues of legality first.

LEGAL CONSIDERATIONSIn the United States, the Federal CommunicationsCommission (FCC) is responsible for the regulationof all RF devices. These regulations are containedin the Code of Federal Regulations (CFR), Title 47.Title 47 is made up of numerous volumes, however,all regulations applicable to operation in the 902 to928MHz band are contained in volume 0-19. It isstrongly recommended that you obtain a full copy ofthe code from your local government bookstore, theGovernment Printing office in Washington(http://bookstore.gpo.gov/) or the FCC web site at:

http://wireless.fcc.gov/rules.html

WHAT IS UNLICENSED OPERATION?Here in the United States, the FCC requires anydevice that intentionally radiates RF energy to betested for compliance with FCC rules. Certainbands within the RF spectrum are available for“Unlicensed” operation. The term “Unlicensed” isoften misunderstood. The manufacturer of aproduct designed for unlicensed operation is notexempt from the certification procedure. Indeed,both the transmitter and receiver must be tested bya qualified testing laboratory and an FCC IDnumber obtained before the product can be legallysold. Once this has been done, however, the enduser of the product can operate it without obtaininga license for its use.

APPLICATION NOTE AN-00126Considerations For OperationWithin the 902-928MHz Band

Page 12: WIRELESS MADE SIMPLE - University of Rochester

also be affected by noise present in the transmitterpower supply. This noise can cause oscillatorinstability and subsequent spurs and harmonicevents.

While these issues of legality may appearformidable, they are generally not. By choosing acorrect operational frequency and using a pre-madeRF module, a product designer’s burden is greatlyreduced. With proper attention to such basics asgood layout, clean supply lines, and a properlymatched antenna, RF success is a nearly painlessprocess.

Now that you have a basic overview of legal issues,let us consider the actual technical issues ofoperation in these frequencies.

BENEFITS OF OPERATION WITHIN THE902-928MHZ BANDFirst is freedom. The band is free of the tight FCCrestrictions that limit the applications for which otherbands can be used. In the 902-928MHz band,virtually any analog or data signal can be sentwithout restrictions on content or duration.

Second, higher legal output power yields longertransmission distances than many other bands.

Third, the propagation of frequencies in the900MHz range is better than at higher frequencies,such as 2.4GHz. Therefore, lower output power isneeded to attain any particular distance. Since lessoutput power is needed, transmitter powerconsumption is reduced.

Fourth is antenna compactness. A useful by-product of higher frequency is shorter wavelength.This allows a 1/4-wave antenna in the 900MHzrange to be typically less than 3.25 inches in length,allowing for easy concealment in compact portableproducts.

DRAWBACKS TO THE 902-928MHZ BANDFirst, the lack of restriction on the band has causedit to become increasingly popular and, thus,congested. Many products that transmit continuousdata at high rates are now migrating to higherfrequencies, but the popularity of the band makes itlikely to remain crowded.

Second, higher level interferers. In addition to itsallocation for narrow-band devices the 902-928MHzfrequency range is also allocated for, andsurrounded by, potentially higher-level interferers,such as spread spectrum devices. Linx modules

employ a variety of techniques to minimize thepossible impact to a user from such interference,including SAW filtration, uncommon frequencyallocation, channel qualification and constantcarrier modulation techniques.

Third is difficulty of export. Most countries outsidethe US do not allow similar operation in the 900MHzband, so it is usually impractical to export a devicethat operates in this range. Fortunately, nearbyfrequencies are being standardized in large marketareas such as Europe. Linx will offer pin- andfunction-compatible products allowingaccommodation of both domestic and exportrequirements with just a change of modules andantennas.

SUMMARYThe 902-928MHz band is ideal for instances whereanalog or digital signals prohibited in other bandsneed to be sent. In addition, it should also be givenconsideration for all applications where highperformance analog or digital transmissions arerequired.

SECTION 15.249OOppeerraattiioonn wwiitthhiinn tthhee bbaannddss 990022 -- 992288 MMHHzz,, 22440000 --22448833..55 MMHHzz,, 55772255 -- 55887755 MMHHzz,, aanndd 2244..00 -- 2244..2255GGHHzz..

(a) Except as provided in paragraph (b) of thissection, the field strength of emissions fromintentional radiators operated within these

frequency bands shall comply with the following:

(b) Fixed, point-to-point operation as referred to inthis paragraph shall be limited to systemsemploying a fixed transmitter transmitting to a fixedremote location. Point-to-multipoint systems,omnidirectional applications, and multiple co-located intentional radiators transmitting the sameinformation are not allowed. Fixed, point-to-pointoperation is permitted in the 24.05-24.25 GHz bandsubject to the following conditions:

(1) The field strength of emissions in this band shallnot exceed 2500 millivolts/meter.

AN-00126Considerations For Operation Within the 902-928MHz Band Page 2

Fundamental Field Strength of Field Strength ofFrequency Fundamental Harmonics

(millivolts/meter) (microvolts/meter)_________________________________________________902 - 928MHz 2,250 2252400 - 2483.5MHz 1,250 1255725 - 5875MHz 1,250 to 3,750** 125 to 375**24.0 - 24.25GHz 3,750 375

Page 13: WIRELESS MADE SIMPLE - University of Rochester

(2) The frequency tolerance of the carrier signalshall be maintained within + 0.001% of theoperating frequency over a temperature variation of-20 degrees to +50 degrees C at normal supplyvoltage, and for a variation in the primary supplyvoltage from 85% to 115% of the rated supplyvoltage at a temperature of 20 degrees C. Forbattery operated equipment, the equipment testsshall be performed using a new battery.

(3) Antenna gain must be at least 33 dBi.Alternatively, the main lobe beamwidth must notexceed 3.5 degrees. The beamwidth limit shallapply to both the azimuth and elevation planes. Atantenna gains over 33 dBi or beamwidths narrowerthan 3.5 degrees, power must be reduced to ensurethat the field strength does not exceed 2500millivolts/meter.

(c) Field strength limits are specified at a distance of3 meters.

(d) Emissions radiated outside of the specifiedfrequency bands, except for harmonics, shall beattenuated by at least 50 dB below the level of thefundamental or to the general radiated emissionlimits in Section 15.209, whichever is the lesserattenuation.

(e) As shown in Section 15.35(b), for frequenciesabove 1000 MHz, the above field strength limits inparagraphs (a) and (b) of this section are based onaverage limits. However, the peak field strength ofany emission shall not exceed the maximumpermitted average limits specified above by morethan 20 dB under any condition of modulation. Forpoint-to-point operation under paragraph (b) of thissection, the peak field strength shall not exceed2500 millivolts/meter at 3 meters along the antennaazimuth.

(f) Parties considering the manufacture,importation, marketing or operation of equipmentunder this section should also note the requirementin Section 15.37(d).

AN-00126Considerations For Operation Within the 902-928MHz Band Page 3

Page 14: WIRELESS MADE SIMPLE - University of Rochester

data with the control signal.” As an example, itwould be acceptable for a low tire pressure warningsystem to send the tire pressure when it transmitsan alarm signal, but it would not be acceptable forthe same system to transmit the tire pressurewithout the alarm. While the band remainsinappropriate for continuous data transfer, thisregulatory change does allow some exciting optionsfor periodic data to accompany control andcommand signals.

FCC representatives have stressed that this is notintended to be a loophole for the sake of sendingdata only. If there is no intention to use the controlsignal, the FCC would have to question whether theproduct is properly classified as a controltransmitter. It does, however, open up some excitingopportunities, especially for bi-directional links.

BI-DIRECTIONAL OPERATIONApplications coming under the restrictions of FCCPart 15.231 have generally been implemented assimplex (one-direction) links. With the increasingavailability of low-cost transceiver solutions, suchas the Linx LT Series, bi-directional links are now apractical alternative. Bi-directional communicationopens a whole new world of opportunity fordesigners. Security can be enhanced,transmissions sequenced and coordinated,confirmations received, and many other significantadvantages realized.

Since Part 15.231 has not generally been applied totransceivers, clarification was needed as to how thisregulation would be applied to bi-directional links.With this in mind, Linx initiated dialog with seniorFCC personnel. These FCC officials demonstratedoutstanding responsiveness, and from thosediscussions came the following understanding.

A simple way to look at Part 12.231 as it pertains totransceiver operation is to think of the transceiveras a separate transmitter and receiver. If theapplication is legally allowable in each direction, it islikely to meet with approval.

For example, a car owner presses a button tolock their vehicle. This is a manual event and,under Part 15.231 rules, the transmission maycontinue for as long as the user holds the button.

WIRELESS MADE SIMPLE ®

INTRODUCTIONIn designing products that incorporate RF, it isalways important to consider not only technicalissues, but also legal factors. While an RF stagemay be capable of meeting functional objectives, itsoperation may not be legally allowable in thecountry of intended operation. For operation withinthe United States, the Federal CommunicationsCommission (FCC) is responsible for the regulationof all RF devices. These rules are made up ofnumerous volumes, and unlicensed operation in thefrequencies from 260 to 470MHz is governed byPart 15, Section 231. This application note isintended to provide an overview of two distinctissues related to compliance under this section.

• The change in stance with respect to datatransmissions for devices intending to complywith this portion of the code; and

• How bi-directional devices such astransceivers are viewed by the code. Thepreceding item also plays an important role.

For more information on Part 15.231, please reviewLinx Application Note AN-00125: "Considerationsfor Operation within the 260 to 470MHz Band."

TRANSMISSION OF DATAThe overriding intention of the FCC with respect totransmissions occurring under Part 15 in this bandis that they must be periodic in nature. UnderSection 15.231(a)-(d), the restrictions on remotecontrol operation were implemented to limit theproliferation of equipment (i.e., to reduce thenumber of possible radiators in the field). Untilrecently, the Commission was adamant that no datatransmissions of any type were permitted, and onlyremote control signals were allowed. That is nolonger the case.

Data is now permitted, provided (as stated in15.231(a)) it is sent with a control signal. NTIA, theregulatory agency for the Federal Governmentspectrum used by the majority of 15.231transmitters, objected to allowing any datatransmissions. Because of this, the FCC stated that“[t]he net result of the changes we are adopting isthat operation under Section 15.231(a) will continueto be limited to devices that transmit a controlsignal, but such devices will be permitted to transmit

APPLICATION NOTE AN-00128Data and Bi-directional

Transmissions under Part 15.231

Page 15: WIRELESS MADE SIMPLE - University of Rochester

AN-00128Data and Bi-directional Transmissions under Part 15.231 Page 2

Once released, however, the transmission mustcease within five seconds. The transceiver on boardthe automobile receives the signal, and once theincoming transmission ceases, it sends aconfirming transmission. Since this confirmingtransmission is activated automatically, it mustcease within five seconds of activation. Theconfirming transmission activates a LED onboardthe user's keyfob to provide visual indication thatthe door is locked. At the same time, the vehicle cansend all kinds of ancillary data (i.e., time,temperature, tread wear, coordinates, and so on).But note that this must be in relation to theconfirming signal, whose purpose is to controlsomething, in this case, a LED indicator.

Now let's consider a more automated event. Thevehicle owner goes to the mall and parks their car.While the owner is inside the mall, the vehicle isstruck by a shopping cart. The vehicle then initiatesa transmission to the user. Since the transmissionis automatically activated, it is required to ceasewithin five seconds of activation. At the other end,the user's keyfob buzzes and vibrates to alert thedriver of the bad news. Since the transmission fromthe vehicle is remotely controlling something (LED,buzzer etc.) at the driver's end, data (such as thetime and force of impact, or even the estimated costof repairs) may also accompany the control signal.

SUMMARYApplications that call for the continuoustransmission of data are not legally appropriate foroperation under FCC Part 15.231. Periodic data isnow allowed under section A-D, but must alwaysaccompany a legitimate control or commandfunction. Paragraph E remains an option for thoseunable to meet this requirement. The legality of atransceiver is considered from the standpoint of aseparated transmitter and receiver. Automatictransmissions confirming an initial transmission areacceptable, but must control something, and ceasewithin five seconds.

Disclaimer

This document is intended as an informational courtesy. The legalityand appropriateness of your design should be reviewed with the FCCor a qualified FCC testing facility. No legal representation is made,warranty extended, or obligation incurred from the contents of thisdocument.

CFR Part 15, Section 231 is listed here for yourconvenient reference. Since it is subject to revision,the latest version should be obtained from the FCC.

SECTION 15.231Periodic operation in the band 40.66 - 40.70MHz andabove 70MHz.

(a) The provisions of this Section are restricted to periodicoperation within the band 40.66 - 40.70MHz and above 70MHz.Except as shown in paragraph (e) of this Section, theintentional radiator is restricted to the transmission of a controlsignal such as those used with alarm systems, door openers,remote switches, etc. Continuous transmissions, voice, videoand the radio control of toys are not permitted. Data ispermitted to be sent with a control signal. The followingconditions shall be met to comply with the provisions for thisperiodic operation:

(1) A manually operated transmitter shall employ a switch thatwill automatically deactivate the transmitter within not morethan 5 seconds of being released.

(2) A transmitter activated automatically shall ceasetransmission within 5 seconds after activation.

(3) Periodic transmissions at regular predetermined intervalsare not permitted. However, polling or supervisiontransmissions, including data, to determine system integrity oftransmitters used in security or safety applications are allowedif the total duration of transmissions does not exceed more thantwo seconds per hour for each transmitter. There is no limit onthe number of individual transmissions, provided the totaltransmission time does not exceed two seconds per hour.

(4) Intentional radiators which are employed for radio controlpurposes during emergencies involving fire, security, andsafety of life, when activated to signal an alarm, may operateduring the pendency of the alarm condition.

(b) In addition to the provisions of Section 15.205, the fieldstrength of emissions from intentional radiators operated underthis Section shall not exceed the following:

[Where F is the frequency in MHz, the formulas for calculatingthe maximum permitted fundamental field strengths are asfollows: for the band 130-174MHz, uV/m at 3 meters =56.81818(F) - 6136.3636; for the band 260-470MHz, uV/m at3 meters = 41.6667(F) - 7083.3333. The maximum permittedunwanted emission level is 20dB below the maximumpermitted fundamental level.]

(1) The above field strength limits are specified at a distance of3 meters. The tighter limits apply at the band edges.

Fundamental Field Strength of Field Strength ofFrequency Fundamental Spurious Emission(MHz) (microvolts/meter) (microvolts/meter)________________________________________________40.66 - 40.70 2,250 22570 - 130 1,250 125130 - 174 1,250 to 3,750** 125 to 375**174 - 260 3,750 375260 - 470 3,750 to 12,500** 375 to 1,250**Above 470 12,500 1,250________________________________________________** linear interpolations

Page 16: WIRELESS MADE SIMPLE - University of Rochester

(2) Intentional radiators operating under the provisions of thisSection shall demonstrate compliance with the limits on thefield strength of emissions, as shown in the above table, basedon the average value of the measured emissions. As analternative, compliance with the limits in the above table maybe based on the use of measurement instrumentation with aCISPR quasi-peak detector. The specific method ofmeasurement employed shall be specified in the application forequipment authorization. If average emission measurementsare employed, the provisions in Section 15.35 for averagingpulsed emissions and for limiting peak emissions apply.Further, compliance with the provisions of Section 15.205 shallbe demonstrated using the measurement instrumentationspecified in that section.

(3) The limits on the field strength of the spurious emissions inthe above table are based on the fundamental frequency of theintentional radiator. Spurious emissions shall be attenuated tothe average (or, alternatively, CISPR quasi-peak) limits shownin this table or to the general limits shown in Section 15.209,whichever limit permits a higher field strength.

(c) The bandwidth of the emission shall be no wider than 0.25%of the center frequency for devices operating above 70MHzand below 900MHz. For devices operating above 900MHz, theemission shall be no wider than 0.5% of the center frequency.Bandwidth is determined at the points 20dB down from themodulated carrier.

(d) For devices operating within the frequency band 40.66 -40.70MHz, the bandwidth of the emission shall be confinedwithin the band edges and the frequency tolerance of thecarrier shall be + 0.01%. This frequency tolerance shall bemaintained for a temperature variation of -20 degrees to +50degrees C at normal supply voltage, and for a variation in theprimary supply voltage from 85% to 115% of the rated supplyvoltage at a temperature of 20 degrees C. For battery operatedequipment, the equipment tests shall be performed using a newbattery.

(e) Intentional radiators may operate at a periodic rateexceeding that specified in paragraph (a) and may beemployed for any type of operation, including operationprohibited in paragraph (a), provided the intentional radiatorcomplies with the provisions of paragraphs (b) through (d) ofthis Section, except the field strength table in paragraph (b) isreplaced by the following:

[Where F is the frequency in MHz, the formulas for calculatingthe maximum permitted fundamental field strengths are asfollows: for the band 130-174MHz, uV/m at 3 meters =22.72727(F) - 2454.545; for the band 260-470MHz, uV/m at 3meters = 16.6667(F) - 2833.3333. The maximum permitted

unwanted emission level is 20dB below the maximumpermitted fundamental level.]

In addition, devices operated under the provisions of thisparagraph shall be provided with a means for automaticallylimiting operation so that the duration of each transmissionshall not be greater than one second and the silent periodbetween transmissions shall be at least 30 times the durationof the transmission but in no case less than 10 seconds.

AN-00128Data and Bi-directional Transmissions under Part 15.231 Page 3

Fundamental Field Strength of Field Strength ofFrequency Fundamental Spurious Emission(MHz) (microvolts/meter) (microvolts/meter)________________________________________________40.66 - 40.70 1,000 10070 - 130 500 50130 - 174 500 to 1,500 ** 50 to 150 **174 - 260 1,500 150260 - 470 1,500 to 5,000 ** 150 to 500 **Above 470 5,000 500________________________________________________** linear interpolations

Page 17: WIRELESS MADE SIMPLE - University of Rochester

In the case of AM data transmission, the modulationsource is a voltage generator that can have onlytwo states: “on” and “off.” When the modulationsource is “on” representing a logic high or a ‘1’ inbinary terms, the carrier amplitude is at itsmaximum, and when the modulation source is “off”representing a logic low or a binary ‘0’, the carrieramplitude is at its minimum. This method of AMmodulation is referred to by multiple designations,among them OOSK (On-Off Shift Keying) OOK(On-Off Keying) and CPCA (Carrier-PresentCarrier-Absent). Linx uses the CPCA designationbecause we feel it most accurately describes themodulation method.

The modulation depth is defined as the difference inoutput power between the “on” and “off” states. Forinstance, if the output power is 0dBm when themodulation source is "on" and -110dBm when themodulation source is "off", then the modulationdepth is 110dB. This is an important parameter ofany CPCA transmitter because it determines thepossible sensitivity of the receiver and, therefore,the ultimate range over which the data link willoperate.

Consider this. A CPCA receiver has a sensitivity of-105dBm. Therefore, the receiver will see anycarrier in its passband with an amplitude that isgreater than -105dBm as an indication of atransmitted "on" condition (or a '1' in binary terms).The modulation depth must be greater in magnitudethan the difference between this sensitivity and theoutput power capability of the transmitter. Forexample, if the transmitter had an output power of0dBm and a modulation depth of 60dB, then thetransmitter would output -60dBm of power in its “off”state. However, the receiver would “see” the carrier

WIRELESS MADE SIMPLE ®

INTRODUCTIONTransmission of data across a noisycommunications channel requires some manner ofseparating the valid data from the backgroundnoise. The most common way to accomplish this isto modulate the data at the transmission side and todemodulate the data on the reception side, so thatthe data coming from the receiver are the same asthe data being presented to the transmitter.

The efficiency of the modulation/demodulationprocess determines the accuracy of the datacoming from the receiver. Therefore, carefulconsideration must be given to the selection of anappropriate modulation-demodulation scheme.

In radio frequency applications there are manytechniques to choose from. Some, such asCarrier-Present Carrier-Absent (CPCA), are verysimple and inexpensive to implement, while others,such Gaussian Minimized Shift Keying (GMSK),allow for very efficient use of bandwidth at high datarates. Other modulation techniques include:

• Frequency Shift Keying (FSK)• Phase Shift Keying (PSK)• Quadrature Modulation• Direct Sequence Spread Spectrum (DSSS)

At Linx Technologies, our product focus is on plug-and-play RF transmitters and receivers that allowengineers to make their products wireless with littleor no RF experience. In addition, our modules haveto be competitively priced to support high volume.As a result, our products are currently based aroundtwo modulation techniques: CPCA and FSK.

The purpose of this application note is to explain theoperation, benefits, drawbacks, and applications ofboth CPCA and FSK.

CARRIER-PRESENT CARRIER-ABSENT(CPCA) MODULATIONAmplitude Modulation (AM) is perhaps the oldesttechnique for impressing intelligence (orinformation) onto an RF carrier. With normalamplitude modulation, the amplitude of a carrierfrequency is raised and lowered in unison with themodulation source. If this source happens to bevoice, then the carrier amplitude will follow theamplitude of the voice input.

ONON

OFFOFF

CarrierCarrier

DataData

Figure 1: CPCA Modulation Envelope

APPLICATION NOTE AN-00130Modulation Techniques For

Low-Cost RF Data Links

Page 18: WIRELESS MADE SIMPLE - University of Rochester

at this power level, and consider it an “on” conditionbecause the power of the carrier is above thesensitivity of the receiver. Therefore, if themodulation depth is not great enough, the carriermay never drop below the sensitivity of thereceiver and the receiver, accordingly, will alwaysindicate an “on” condition.

Another important parameter of a CPCA transmitteris its “on” condition output power. This is power thetransmitter will deliver into a 50-ohm load when themodulation source is “on”. FCC regulations limit thispower, depending on the center frequency andoperational parameters. A direct benefit of CPCAover Frequency Modulation (FM) is that the FCCwill allow higher peak output powers since thecarrier is not always present. For example, with a50% duty cycle, a CPCA transmitter can outputtwice the power of an FM transmitter. For moreinformation, refer to the FCC’s CFR47 Part 15.231.

The most common circuit used to detect a CPCAsignal is the simple diode detector shown in Figure2. The diode, and a subsequent low-pass filter, actsto remove the carrier and leave only the originaldata intact. Amplification is used on the output ofthe diode detector to limit and shape the data backto its original form.

CPCA modulation has many benefits that make itvery practical for some applications.

LLooww CCoossttBy accommodating the inherent inaccuracies ofSAW resonators, CPCA transmitters and receiverscan take advantage of the low cost of a SAW baseddesign.

LLooww PPoowweerr CCoonnssuummppttiioonnWhen the modulation source is off, the transmitterdraws virtually no power. In the “on” condition, aSAW based design typically draws 1/2 to 1/3 the

AN-00130Modulation Techniques For Low-Cost RF Data Links Page 2

power of a synthesized design. For a 50% dutycycle modulation waveform, a CPCA transmittercan draw as little as 2-3mA.

SSmmaallll SSiizzeeCPCA is a very simple modulation technique, andthus requires fewer components to beimplemented.

There are also several limitations of CPCA that thedesigner should consider:

LLooww DDaattaa RRaatteeA typical SAW based CPCA transmitter is limited toless than 10k bits/second. This limitation is a directfunction of the start-up time of the oscillator. SinceSAW resonators have a fairly high loaded Q, theirstart-up time can be as high as 20 microseconds.

PPoooorr NNooiissee IImmmmuunniittyyAny noise in the passband of the receiver that isabove the receiver's sensitivity will interfere withdata transmission. In contrast, this type ofamplitude noise does not affect a properly designedFSK receiver.

CPCA is best used in situations where cost,operating distance, and power efficiency are theoverriding concerns. If the primary requirement isdata rate/integrity, noise performance, orchannelization, then FSK may be a better choice.

FREQUENCY SHIFT KEYING (FSK)MODULATIONFSK is a simplified form of FM. For good noiseperformance and high bandwidth operation, FSK isthe modulation technique of choice.

In true FM, an analog signal is represented with alinear frequency deviation from center. FSK is abinary form of frequency modulation that uses hardshifts between deviant frequencies to represent thedata originally impressed on the carrier. Themagnitude of frequency shift is directly related tothe magnitude of the modulation source voltage.

The modulation source is allowed two states: “on”

CARRIER IN DIODEDETECTOR

RECOVEREDDATA OUT

Figure 2: Diode Detector Circuit

ON

OFF

Carrier

Data

Figure 3: FSK Modulation

Page 19: WIRELESS MADE SIMPLE - University of Rochester

and “off”. When the modulation source is “off”, thecarrier frequency is shifted down from the centerfrequency. When the modulation source is “on”, thecarrier frequency is shifted up from the centerfrequency. The amount that the carrier frequency isshifted is referred to as the frequency deviation.

Unlike CPCA, a carrier is always present with FSKmodulation. This affords the designer severalbenefits. First, the carrier will load the receiver at alltimes providing greatly increased noise immunity.Secondly, the strength (or amplitude) of the carriercan be used to determine the quality of theincoming signal. A Received Signal StrengthIndicator (RSSI) circuit is used for this purpose. Itoutputs a voltage that corresponds to signalstrength, and has a typical dynamic range of 70-90dB.

A drawback of the continuous carrier is that thetransmitter is always drawing power and generatingan output. Therefore, the transmitter will ultimatelyrequire a higher supply current than CPCA-basedsystems. In addition, the output power cannot belegally increased in countries, such as the U.S.,where power measurements are averaged overtime since full output power is always present.

FSK is a Non Return to Zero (NRZ) modulationmethod. This means that the non-modulatedcondition is between the “off” and “on” condition. Inother words, the carrier should never be at thecenter frequency when modulation is present. Thebenefit here is noise immunity. Hysteresis can beapplied to the detector, eliminating the effect ofspurious frequency modulation generated fromsources other than the data stream.

Since FSK relies on frequency change, and notamplitude change, to indicate data states, an FSKreceiver is inherently immune to amplitude noise.This is of great importance in bands that are

extremely crowded and have a high potential fornear-band interference. This increased noiseimmunity suggests a potential for higher data rates.In fact, FSK systems can achieve significantlyhigher data rates than their CPCA counterparts,albeit at the sacrifice of cost and powerconsumption. Data rates up to 100k bits/second arereadily achieved.

Although FSK systems are immune to amplitudenoise, they are very sensitive to frequency noise.That is, unwanted frequency changes caused by in-circuit sources will ultimately cause bit errors in thedata stream. As mentioned previously, simplehysteresis can be applied to the FSK detector toremove some of this noise, but a stable frequencysource must still be used to ensure good noiseimmunity. While SAW resonators work extremelywell for low baud rate applications at lowerfrequencies, their inherent frequency inaccuraciesmake them poorly suited to high performance FSKapplications. Thus, a synthesized source based ona crystal reference must be used.

It is a well-known fact that crystals are superior toSAW resonators with regard to loaded Q andfrequency accuracy. However, crystals cannot beoperated in their fundamental mode at UHF.Instead, a crystal is used with a Phase-Locked-Loop (PLL) to synthesize a high frequency. Whilethis technique is expensive and requires additionalboard space, it is the best method for attaining thetight frequency control necessary to achieve highdata rates and noise immunity. It also affords anadded benefit: channelization.

By using a divide-by-n PLL, the synthesizedfrequency can be set by changing the values of theinternal counters. This allows a user to select frommultiple channels, separated by some nominalfrequency. One transmitter or receiver can thentransmit on many separate channels.

FSK modulation for the transmission of data hasmany features and limitations to consider.

Among the benefits of FSK are:

• Higher data rates• Continuous carrier presence• Better noise immunity• Channelization

Limitations of FSK are:

• Higher cost• Higher power consumption

AN-00130Modulation Techniques For Low-Cost RF Data Links Page 3

"OFF" "ON"

Fo Fc

Fdev=(Fc-Fo)

Figure 4: FSK Modulation States and Frequency Deviation.

Page 20: WIRELESS MADE SIMPLE - University of Rochester

AN-00130Modulation Techniques For Low-Cost RF Data Links Page 4

• Larger size• Lower allowable output power

FSK modulation should be used for performance-oriented applications where data rate, noiseimmunity, and channelization are of primaryconcern.

Page 21: WIRELESS MADE SIMPLE - University of Rochester

WIRELESS MADE SIMPLE ®

INTRODUCTIONMany manufacturers have avoided theincorporation of RF into their products because ofuncertainty over the approval and certificationprocess. With the advent of simple and inexpensivemodular RF devices, such as those made by Linx,many manufacturers are again considering theaddition of an RF stage to their products. While it istrue that RF increases the effort and cost of bringinga product to market, it also can add significantly tothe function and salability of a completed product.When the technical and legal issues of RFimplementation are understood and approached inlogical steps the process becomes relativelypainless.

PURPOSE OF THIS APPLICATION NOTEThis application note gives a brief overview of thelegal issues governing the manufacture and sale ofRF products intended for unlicensed operation inthe United States under CFR 47 Part 15. In theUnited States the Federal CommunicationsCommission (FCC) is responsible for the regulationof all RF devices. The FCC requires any device thatradiates RF energy to be tested for compliance withFCC rules. These rules are contained in the Codeof Federal Regulations (CFR), Title 47. Part 15 isthe section of the code that deals with devices thatemit RF energy and are to be operated without anindividual license. This application note will provideyou with a basic understanding of the stepsinvolved in obtaining a Part 15 certification. Inaddition, it is strongly recommended that you obtaina full copy of the code from your local governmentbookstore, the Government Printing office inWashington (http://bookstore.gpo.gov/) or the FCCweb site at:

http://wireless.fcc.gov/rules.html

WHAT IS PART 15 "UNLICENSED"OPERATION?Certain bands within the RF spectrum are availablefor "unlicensed" operation, and Part 15 governsthese bands. The term "unlicensed" is oftenmisunderstood. The manufacturer of a productdesigned for "unlicensed" operation is not exemptfrom the certification procedure. Indeed, both thetransmitter and receiver must be tested by a

qualified testing laboratory and an FCC ID numberobtained before the product can be legally sold.Once this has been done, however, the end user ofthe product can operate it without obtaining alicense for its use.

WHAT STEPS ARE NECESSARY TOOBTAIN A PART 15 CERTIFICATION?DDeetteerrmmiinnee tthhee ccoorrrreecctt ffrreeqquueennccyy ooff ooppeerraattiioonn..Part 15 governs a broad range of the radiospectrum ranging from below 1MHz to in excess of32GHz. It is broken into individual sections thatgovern the use of specific frequencies and bands.For example, section 15.239 covers the band from902-928MHz. In this frequency range a user isallowed to transmit any analog or digital signal theywish so long as the stipulations governing allowedpower output, harmonics, and occupied bandwidthare met. Other sections are not so accommodating.For example, in the popular 260-470MHz band, theFCC considers not only RF performance issues butalso issues of application, such as what the databeing sent originally consisted of and what itsintended function is.

In order to determine which operational frequency isbest for your product it is necessary to weigh bothtechnical and legal issues. First, you will want tohave a clear understanding of which frequenciesare legally available, and then choose a specificfrequency based on technical issues, such asrange, propagation, antenna length, powerconsumption, and potential interference. (If you arenot familiar with these technical issues you maywish to consult with a Linx application engineer orread additional Linx application notes focusing onthose issues.)

CCaarreeffuullllyy sseelleecctt RRFF aanndd aanntteennnnaa ccoommppoonneennttss..Once a frequency of operation has been selected,the RF section and antenna must be carefullydesigned and optimized to comply with the allowedpower and harmonic limitations imposed by Part 15.If you are using a Linx module this process isgreatly simplified, but it is important to recognizethat the antenna still plays a key factor in theproduct’s legal operation.

APPLICATION NOTE AN-00140The FCC Road: Part 15 From

Concept To Approval

Page 22: WIRELESS MADE SIMPLE - University of Rochester

AN-00140The FCC Road: Part 15 From Concept To Approval Page 2

Most modular RF transmitter products, includingthose manufactured by Linx, have the potential tooutput RF power in excess of Part 15 limits. This isdone so that many designers who utilize inefficientantenna styles, such as a loop-trace or helical forcost or cosmetic reasons, can still achieve close tofull output power. If the module is matched to ahighly efficient antenna, such as a full whip or yagi,the output power may need to be externallyreduced by an attenuation pad. For more details,see application note 00150.

Another consideration in antenna selection is thatPart 15.203 requires the antenna to be permanentlyattached or coupled with a unique or proprietaryconnector. While this requirement leaves a lot ofroom for interpretation, the FCC's intention is that auser not be able to change the output charac-teristics of the device by interchanging the antennawith a higher performance model.

BBuuiilldd pprroodduuccttiioonn--rreeaaddyy pprroottoottyyppeess..Once you have chosen a frequency for operationand suitable RF stage you will want to evolve fromconcept breadboard prototypes to a production-ready model as rapidly as possible.

PPrreessccrreeeenn aanndd ooppttiimmiizzee tthhee pprroodduuccttiioonn--rreeaaddyyuunniittss..Once a RF product is finished, its output power andharmonics should be checked to ensure that the RFstage is both optimized and Part 15 compliant. Thistesting requires a spectrum analyzer and calibratedantennas. If you do not have access to these testinstruments you will want to consider prescreeningservices, such as those offered by Linx. Theprescreening process can result in substantial costsavings over formal lab tests and gives a designerthe chance to maximize product performance.

SSeenndd tthhee pprroodduuccttiioonn--rreeaaddyy pprroodduucctt ttoo aann FFCCCCaauutthhoorriizzeedd tteessttiinngg ffaacciilliittyy..Once your product is in its finished form, exactly asit will be produced, it should be sent to one of themany testing laboratories authorized to conductFCC Part 15 compliance testing. The FCC hasgreatly streamlined the approval process in recentyears. The entire process can now be complete inless than 30 days. In fact, receivers no longerrequire certification just a quick test and aDeclaration Of Conformity (DoC) issued.Transmitter certification is almost as painless since

many labs that are TCB certified are now allowed toissue certifications on behalf of the FCC. Fulltransmitter and receiver testing can cost around$5,000, transmitter only around $3,000, and thereceiver about $2,000. The FCC has authorized theTCBs to issue identity numbers on its behalf so thetesting can usually be done in about a week. Manyof these labs can perform other testing at the sametime, such as Class A/B.

LLaabbeell tthhee pprroodduucctt aanndd mmaarrkkeett iitt..Your certified product must now have an FCCidentification label attached to it. This label must bepermanently attached either directly to the device oron a tag that cannot be removed. The label shallfollow the format required by Part 2.925 and 2.926as well as Part 15.19.

Bringing a product through the approval processinvolves cost, effort and in some cases frustration,but in the end your product will have an excitingnew dimension of function and marketability. Byfollowing the six steps outlined in this applicationnote and reviewing an actual copy of Part 15 youwill be well on your way to RF success. Whilecomplying with the provisions of Part 15 may seemunnecessarily restrictive, such regulations serve toensure the availability of usable RF spectrum forevery product.

For additional information on FCC regulations youmay wish to visit the FCC's web site athttp://www.fcc.gov/oet/ea/. You may also wish tovisit the Linx Technologies web site atwww.linxtechnologies.com where applicablesections of FCC regulations and testing facilities areavailable for review and download.

Federal Communications Commission Office of Engineering and Technology

7435 Oakland Mills RoadColumbia, MD 21046

Phone: (301) 362-3000Fax: (301) 344-2050

E-mail: [email protected] Site: www.fcc.gov/oet/

Page 23: WIRELESS MADE SIMPLE - University of Rochester

(transmitter) and load (antenna) impedances formvoltage dividers to reduce the output power level.The selection of resistors allows the input andoutput of the attenuator to be matched to the sourceand load impedances to prevent unwantedattenuation due to mismatch.

The resistor values can easily be calculated whenthe desired attenuation and input and outputimpedances are known. The chart on the followingpage can be used in place of these calculations todetermine the values of R1 and R2.

Table 1 is normalized to 1-ohm input and outputimpedance and assumes that the attenuation pad ismatching a source and load impedance that areequal.

To understand how to use Table 1, let’s use anexample.

EXAMPLE 1A particular design requires the field strength of thefundamental frequency to be no higher than 250µVolts/meter at 3 meters. The transmitter generatesa field strength of 11,500 µvolts/meter at 3 meters.What values of R1 and R2 will attenuate the outputpower to provide a field strength of 250µVolts/meter?

SOLUTIONFirst, we need to convert the field strength to powermeasured in dBm. To do this, we will use thefollowing equation:

P=E2/R

We know that R=377 ohms, which is the charac-teristic impedance of free space. So, let Pn equalthe power in watts with a field strength of 11,500µVolts/meter and let Pa equal the power with a fieldstrength of 250µVolts/meter.

Pn = 0.0003507mW

Pa = 0.0000001658mW

Use the following formula to convert Pn and Pa todBm:

dBm = 10 * log(Px in mW)

Pn = -35dBm

WIRELESS MADE SIMPLE ®

INTRODUCTIONIn discrete RF design, the output power of atransmitter is usually set specifically for the poweroutput needed to meet operational and certificationrequirements. However, today many engineersprefer to use pre-designed RF modules, such asthose manufactured by Linx, in their designs. TheseRF modules provide a “black box” approach to RFdesign. An engineer simply places a module incircuit, provides an antenna, power, and a serialdata stream and instantly has a wireless data link.

In order to provide the most useful design possible,manufacturers of RF modules will often build theirtransmitters with an output power level in excess ofwhat is allowed by governing agencies for thecustomer’s final product. This is to ensure thatengineers utilizing inefficient (high loss) antennatypes, such as a loop-trace, will still have anadequate level of radiated power to achieve themaximum range. In cases where an engineer haschosen a particularly efficient antenna or whereoutput power must be reduced to meet specificexemption provisions, an external method of powerreduction is employed.

While there are numerous methods of achieving areduction in output, one of the simplest is a T-padattenuator formed from three resistors. The purposeof the attenuator is to give a fixed attenuation whilemaintaining a 50-ohm match between the antennaand the transmitter. Figure 1 shows a T-PAD styleattenuator. In this configuration the 50-ohm source

R1 R1

R2

FROMTRANSMITTER

OUT TO ANTENNA

RF GROUND PLANE

Figure 1: T-PAD Configuration

APPLICATION NOTE AN-00150Use and Design of T-Attenuation Pads

Page 24: WIRELESS MADE SIMPLE - University of Rochester

Pa = -68dBm

To determine the amount of attenuation needed,subtract Pn from Pa:

Atten = Pa - Pn = -33dBm

From the chart we can calculate R1 and R2 for anattenuation of 35dBm. R1 is 0.9650 and R2 is0.0356.

The last step is to normalize R1 and R2 to thecharacteristic impedance of the line:

R1 = 0.9650 * 50 ohms = 48.25 ohms

R2 = 0.0356 * 50 ohms = 1.78 ohms

AN-00150Use and Design of T-Attenuation Pads Page 2

Attenuation R1 R2

1 0.0575 8.668

2 0.1147 4.305

3 0.1708 2.838

4 0.2263 2.097

5 0.2800 1.645

6 0.3323 1.339

7 0.3823 1.117

8 0.4305 0.9458

9 0.4762 0.8118

10 0.5195 0.7032

11 0.5605 0.6120

12 0.5985 0.5362

13 0.6342 0.4712

14 0.6673 0.4155

15 0.6980 0.3668

16 0.7264 0.3238

18 0.7764 0.2559

20 0.8182 0.2020

25 0.8935 0.1127

30 0.9387 0.0633

35 0.9650 0.0356

40 0.9818 0.0200

45 0.9888 0.1120

50 0.9937 0.00633

Table 1: T-PAD Resistor Combinations

Page 25: WIRELESS MADE SIMPLE - University of Rochester

Data is sent synchronously with the LSB sentfirst. The packet consists of a start period (T1),eight data bits, and a stop period (T4). Data issent on the Data Line, while being clocked bythe Clock Line. When the Data Line and theClock Line are both HIGH there will be noloading. As soon as the Data Line goes LOW,while the Clock Line is HIGH (T1), loadingbegins. When the Clock Line goes LOW withthe Data Line (T2), clocking begins. Data isthen sent out on the Data Line, after which theClock Line is then pulsed (T3). Data is recordedby the rising edge of the clock. Clockingcontinues for eight bits, then the Clock andData lines both go HIGH (T4). After theminimum required latch time (5µS), the packetis latched. The HP3 requires 1mS betweenpackets (T0), so after this time, the next packetcan be started. The total minimum timerequired for transmission is 157µS.

THE EXAMPLE

For this example a PIC16F630 processor fromMicrochip was used. Other PICs could be usedwith minor changes to the code.

Only the three Port A pins were used and all ofthe other data I/O pins were tied to ground.The schematic is shown in Figure 2.

WIRELESS MADE SIMPLE ®

INTRODUCTION

The HP3 is the third generation of the popularHP Series transmitters and receivers. All of theHP3 Series modules continue to offer eightparallel selectable channels, but versions arealso available that add serial selection of 100channels. This application note describes howto send the serial data to the HP3 in order toselect the desired channel. It does not detail afinal product, but should provide a starting pointfor development.

This application note details the process ofsending a channel number to the HP3 modulesusing a serial link from a microprocessor. Thecode for this is shown and then it is used in anexample. The software in the example will loadthe HP3 with channel 0 and then increment thechannel number by one each time a button ispressed.

SENDING DATA TO THE HP3

The timing for serial loading the HP3 is shownin Figure 1.

AN

TE

NN

AG

ND

GN

DG

ND

GN

DG

ND

GN

DG

ND

N/C

CS

OC

S1

/ SS

CL

OC

KC

S2

/ SS

DA

TA

PO

WE

R D

OW

NR

SS

IG

ND

/MO

DE

VC

CA

NA

LO

G

DA

TA

OU

T

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

RXM-900-HP3

VDD

RA5

RA4

RA3

RC5

RC4

RC3

VSS

RA0

RA1

RA2

RC0

RC1

RC2

1

PIC16F630

Figure 2: Serial Load Example Schematic

Variable Data

Note 3

Note 2

Note 11 2 3 4 5 6 7 8

T125µs

T2 5µs

T38µs

T45µs

Data

ClockT0

1ms

(T0) Minimum time between packets or prior to data startup...1mS min.(T1) Data-LO/Clock-HI to Data-LO/Clock-LO.............................25µS min.(T2) Clock-LO to Clock-HI...........................................................5µS min.(T3) Clock-HI to Clock-LO...........................................................8µS min.(T4) Data-HI/Clock-HI...................................................................5µS min.Total Packet Time...........................................................................157µS min.

1) Loading begins when clock line is high and data line is taken low. 2) Ensure that edge is fully risen prior to high clock transition.3) Both lines high - triggers automatic latch

Figure 1: Serial Data Timing Table

APPLICATION NOTE AN-00155Serial Load Techniques For

The HP3 Series

Page 26: WIRELESS MADE SIMPLE - University of Rochester

THE CODE

The code for loading a channel into the HP3and for the example described above is listedon the following pages.

The PIC was configured as follows:

All Protection OFF

Brown-Out Detection OFF

Watch-Dog Timer OFF

Power-Up Timer OFF

MCLR Internal

Oscillator Internal

I/O Lines Used:

Port A, line 0 = Data Line (Output)

Port A, line 1 = Clock Line (Output)

Port A, line 2 = Ext. Interrupt (Input)

The HP3 is put into serial mode when the modepin (pin 15) is left open or held high. In thiscondition CS1(pin 11) becomes the serial clockline and CS2 (pin 12) becomes the serial dataline.

Pin 12 of the PIC is connected to a button thatwill trigger the interrupt.

THE PROGRAM

Once the PIC is initialized in code, it will go tosleep until a button press causes an interrupt.At this point it will wake-up, load the firstchannel value of channel 0 into the module,and then return to sleep. Every time the PIC isinterrupted, the channel value being loaded isincremented by one until channel 103 isreached, at which point the channel selectionwill start over at channel 0.

Since channel 100 is the maximum channel,loading channels 101, 102, and 103 will causean error. If an error occurs, the HP3 defaults tochannel 0. Loading these channels ensuresthat the default Load Error is working byswitching to channel 0. This is a convenientdebugging tool since it will varify that there wasserial port activity, but a problem with thetransmission.

Errors are caused when data is corruptedduring transmission, or when a channel valuegreater than the HP3 allows is sent into themodule.

AN-00155Serial Load Techniques for the HP3 Series Page 2

Page 27: WIRELESS MADE SIMPLE - University of Rochester

THE CODE FOR LOADING A CHANNEL

The code listed below will load a channel number into the HP3 module. The channel number is loadedinto a register by the user’s software. This function will then send the value in that register to the HP3.

title "PIC16F630 Synchronous-Serial-Load program"list p=16f630,f=inhx32#include <p16f630.inc>errorlevel -302 ;Keeps bank-select errors from showing on builds__CONFIG _CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_OFF & _WDT_OFF &

_PWRTE_OFF & _INTRC_OSC_NOCLKOUT

;PORT ALLOCATIONS;*************************************************************************************;PORTAdata_ln = d'0'clock_ln = d'1'interrupt = d'2'

;TEMPORARY REGISTER EQUATES;*************************************************************************************ch_num_temp = 40h ;Storage register for temp. channelch_num = 41h ;Stores selected channelcount1 = 42h ;General purpose temp counter registercount2 = 43h ;General purpose temp counter registertemp_count = 44h ;General purpose temp counter register

;START OF PROGRAM ROUTINES;*************************************************************************************

;Reset vector for start-up and BOD resetsorg 0x000goto Start

;Interrupt vector contains interrupt routine.org 0x004bcf intcon,giegoto send_serial

Start ;configure internal oscillatorbsf status,rp0 ;Set file register bank to 1 call 0x3FF ;Retrieve factory calibration valuemovwf osccal ;Update register with factory calibr.

;initialize control registersmovlw b'00000000' ;Sets portC to all outputsmovwf trisCmovlw b'00000100' ;Sets portA to all outputs except RA2movwf trisAmovlw b'01000000' ;Bit-7 = 0 to enable portA pull-up resistors, &movwf option_reg ;---bit-6 = 1 to set RA2/Int on rising edgemovlw b'00000100' ;Enables weak pull-up resistor on RA2 onlymovwf wpua

bcf status,rp0 ;Set file register bank to 0 movlw 07h ;Sets up comparitor to digital outputs

AN-00155Serial Load Techniques for the HP3 Series Page 3

Page 28: WIRELESS MADE SIMPLE - University of Rochester

movwf cmcon

;Initialize values and wait to send dataclrf portAclrf portCclrf ch_num_tempclrf intconbsf portA,data_lnbsf portA,clock_ln

; You must first fill "ch_num_temp" with an 8-bit value; movlw d'?'; movwf ch_num_temp

send_serialmovf ch_num_temp,w ;For testing onlymovwf ch_num ;Register for rotating bits movlw d'8' ;Sets temporary conter for 8 bitsmovwf temp_countbcf portA,data_ln ;Data LOW and Clock HIGH = packet ready (T1)bsf portA,clock_lncall start_delay ;Time delay for packet ready (T1)bcf portA,clock_ln ;Clock goes LOW for start bit (T2)call data_delay

bit_move btfsc ch_num,0 ;Is bit to be sent a '1' or '0'bsf portA,data_ln ;If '1', then set modules data pin to '1'call data_delayrrf ch_num,f ;Moves in next bit. Loads LSB firstbsf portA,clock_ln ;Set modules clock pin '1': (rising edge)call clock_delay ;Settling delay: may be longer or shorter (T3)bcf portA,clock_ln ;Clears modules clock pin for clock pulsebcf portA,data_ln ;Initialize modules data pin to Lowdecfsz temp_count,f ;Have all 8 bits been sent?goto bit_move ;No? Then continue sending

done bsf portA,data_ln ;Yes? Then time to latch packetbsf portA,clock_ln ;Both set = Data Latched (T4)

wait btfsc portA,interrupt ;Wait until button is releasedgoto wait

sleep_loopmovlw b'10010000' ;Sets GIE & RA2/Int, and clears INTFmovwf intconsleep ;Takes 2uS to wake upnop ;Allows interrupt vector to be used (0x004)

;-------------------------------------------------------------------------------------;********Delay = 47uS********start_delay

clrf count1movlw 05h ;Change this value to adjust delay timemovwf count1

loop_1 decfsz count1,fgoto loop_1return

;-------------------------------------------------------------------------------------;********Delay = 9uS*********clock_delay

clrf count2

AN-00155Serial Load Techniques for the HP3 Series Page 4

Page 29: WIRELESS MADE SIMPLE - University of Rochester

movlw 01h ;Change this value to adjust delay timemovwf count2

loop_3 decfsz count2,fgoto loop_3return

;-------------------------------------------------------------------------------;********Delay = 9uS**********data_delay

clrf count2movlw 01h ;Change this value to adjust delay timemovwf count2

loop_2 decfsz count2,fgoto loop_2return

;------------------------------------------------------------------------------------

end

CODE FOR THE EXAMPLE

The code below is the code for the example described earlier. Each time a button is pressed, the PICwill increment the channel number by one, starting with channel 0 and going to channel 103.

title "PIC16F630 Synchronous-Serial-Load program"list p=16f630,f=inhx32#include <p16f630.inc>errorlevel -302 ;Keeps bank-select errors from showing on builds__CONFIG _CP_OFF & _CPD_OFF & _BODEN_OFF & _MCLRE_OFF & _WDT_OFF & _PWRTE_OFF &_INTRC_OSC_NOCLKOUT

;PORT ALLOCATIONS;*************************************************************************************;PORTAdata_ln = d'0'clock_ln = d'1'interrupt = d'2'

;TEMPORARY REGISTER EQUATES;*************************************************************************************ch_num_temp = 40h ;Storage register for temp. channelch_num = 41h ;Stores selected channelcount1 = 42h ;General purpose temp counter registercount2 = 43h ;General purpose temp counter registertemp_count = 44h ;General purpose temp counter register

;START OF PROGRAM ROUTINES;*************************************************************************************

; Timing: (35uS) Start-Up to Send Data Packet; (23uS) T-1; (04uS) T-2 ; (08uS) T-3; (05uS) T-4; (11uS) Wake-Up to Send Data Packet

AN-00155Serial Load Techniques for the HP3 Series Page 5

Page 30: WIRELESS MADE SIMPLE - University of Rochester

;Reset vector for start-up and BOD resetsorg 0x000goto Start

;Interrupt vector contains interrupt routine.org 0x004bcf intcon,giegoto send_serial

Start ;configure internal oscillatorbsf status,rp0 ;Set file register bank to 1 call 0x3FF ;Retrieve factory calibration valuemovwf osccal ;Update register with factory calibr.

;initialize control registersbsf pcon,0 ;This resets the Brown-Out-Detect flagbsf pcon,1 ;This resets the Power-Up-Timer flagmovlw b'00000000' ;Sets portC to all outputsmovwf trisCmovlw b'00000100' ;Sets portA to all outputs except RA2movwf trisAmovlw b'01000000' ;Bit-7 = 0 to enable portA pull-up resistors, &movwf option_reg ;---bit-6 = 1 to set RA2/Int on rising edgemovlw b'00000100' ;Enables weak pull-up resistor on RA2 onlymovwf wpua

bcf status,rp0 ;Set file register bank to 0 movlw 07h ;Sets up comparitor to digital outputs movwf cmcon

;Initialize values and wait to send dataclrf portAclrf portCclrf ch_num_tempclrf intconbsf portA,data_lnbsf portA,clock_lngoto sleep_loop

send_serialmovf ch_num_temp,w ;For testing onlymovwf ch_nummovlw d'8' ;Sets temporary conter for 8 bitsmovwf temp_countbcf portA,data_ln ;Data LOW and Clock HIGH = packet ready (T1)bsf portA,clock_lncall start_delay ;Time delay for packet ready (T1)bcf portA,clock_ln ;Clock goes LOW for start bit (T2)

bit_move btfsc ch_num,0 ;Is bit to be sent a '1' or '0'bsf portA,data_ln ;If '1', then set modules data pin to '1'

rrf ch_num,f ;Moves in next bit. Loads LSB firstbsf portA,clock_ln ;Set modules clock pin '1': (rising edge)call clock_delay ;Settling delay: may be longer or shorter (T3)bcf portA,clock_ln ;Clears modules clock pin for clock pulsebcf portA,data_ln ;Initialize modules data pin to Lowdecfsz temp_count,f ;Have all 8 bits been sent?goto bit_move ;No? Then continue sending

AN-00155Serial Load Techniques for the HP3 Series Page 6

Page 31: WIRELESS MADE SIMPLE - University of Rochester

done bsf portA,data_ln ;Yes? Then time to latch packetbsf portA,clock_ln ;Both set = Data Latched (T4)incf ch_num_temp,f ;Increment channel for next sendmovlw d'104' ;Going to CH.104 allows 3 defaults to CH.0subwf ch_num_temp,w ;Subtract the current ch. number value from the maxbtfsc status,2 ;---possible channels to see if it is time to startclrf ch_num_temp ;---over with channel-0

wait btfsc portA,interrupt ;Wait until button is releasedgoto waitmovlw 0FFh ;200mS debounce delay for button pressmovwf count2 ;Loads count_2 with b'1111 1111'

Cnt2 movlw 0FFhmovwf count1 ;Loads count_1 with b'1111 1111'

Cnt1 decfsz count1,f ;Stay here until count1 is zerogoto Cnt1decfsz count2,f ;Count_1 is empty, so decrement count_2goto Cnt2

sleep_loopmovlw b'10010000' ;Sets GIE & RA2/Int, and clears INTFmovwf intconsleep ;Takes 2uS to wake upnop ;Allows so interrupt vector to be used

;-------------------------------------------------------------------------------start_delay

clrf count1movlw 05hmovwf count1

loop_1 decfsz count1,fgoto loop_1return

;-------------------------------------------------------------------------------clock_delay

clrf count2movlw 01hmovwf count2return

;-------------------------------------------------------------------------------end

AN-00155Serial Load Techniques for the HP3 Series Page 7

Page 32: WIRELESS MADE SIMPLE - University of Rochester

A Maxim Semiconductor MAX232 level converterchip is shown, but any RS232 level converter canbe used. The TX_ID line on the decoder isconnected to one of the RS232 driver inputs on theMAX232. The output is connected to a DB9connector, which can then be connected to a PC.

Sample software to read the ID from the serial portcan be downloaded from the Linx web site. Thissoftware is written in Visual Basic 6 and is wellcommented so that it can be easily included intoapplication software or ported into other formats.

SEND OVER USB

Figure 2 shows the circuit schematic to send the TxID over USB.

The TX_ID line of the decoder is connected to theDATA_IN line of a Linx QS Series USB module,which is then connected to a USB type B jack. TheQS module can then be used to communicate to aPC. This is useful since many current PCs do nothave serial ports.

Sample software to read the ID from the PC can bedownloaded from the Linx website. This software is

INTRODUCTIONThe Linx MS and HS Series of decoders have theability to output a number that uniquely identifiesthe encoder that sent the transmission. This can beused to log access attempts or in any applicationwhere the originating transmitter needs to beknown. This application note will discuss how toread the ID number and make use of it. Samplesoftware is available for download from the Linxweb site and will be described here.

DECODER OPERATIONIn order for the MS and HS decoders to accept atransmission, they must first learn the encoder’sCode Word. When the decoders receive atransmission they will compare the received CodeWord with one that is saved in memory. If a matchis found, then the decoders will reproduce theencoder’s data line states on its data lines.

The decoders can store 40 Code Words and willoutput the number in which the Code Word waslearned as the Tx ID. So, for example, the first CodeWord that is learned will have an ID of ‘1’ that will beoutput as a binary 1 (0000 0001). The second CodeWord will be ‘2’ and its ID will be output as a binary2 (0000 0010) and so forth.

Once a transmission is received and the decoderdetermines that it is valid, it will output the numberin which it was learned. This will happen once; afterreception of the first valid packet. The ID numberwill be output as an eight-bit byte at the baud ratethat is set by the SEL_BAUD lines.

With this simple output, it is an easy task for asoftware routine to assocoate a number with aspecific transmitter.

There are three common methods of reading the ID;with an RS232 serial port, USB, or an embeddedmicrocontroller. The following section will showexamples of all three.

EXAMPLESSEND OVER RS232

Figure 1 shows the circuit schematic to send the TxID over RS232.

1

2

3

4

5

6

7

8

9

DB9M

D6

SEL_BAUD0SEL_BAUD1

LATCHRX_CNTLTX_IDMODE_IND

D5D4D3D2

VCCVCCD1D0

DATA_INLEARN

123

678

10 11121314151617181920

LICAL-DEC-MS001

VC

C

MAX232

C1+V+C1-C2+C2-V-T2OUTR2IN R2OUT

T2INT1IN

R1OUTR1IN

T1OUTGNDVCC

12345678 9

10111213141516

VCC4.7uF

4.7uF

4.7uF

4.7uF

+

+

+

+

VCC

Figure 1: Schematic to Send Tx ID Over RS232

D6D7

GNDLATCHRX_CNTL

MODE_IND

D5D4D3D2

VCCVCC

D1D0

DATA_INLEARN

1

56

10 11121314151617181920

LICAL-DEC-MS001

USBDP

USBDM

GND DSR

DATA_IN

DATA_OUT

RTS

CTS

DTR

TX_IND

VCC

SUSP_IND

RX_IND

485_TX

RI

DCD

1

2

3

4

5

6

7

8 9

10

11

12

13

14

15

16

USB Type BConnector

5V

DAT -

DAT+

GND

GS

HD

GS

HD

1

2

3

4

56

SDM-USB-QS-S

VCC220

220

VC

C

Figure 2: Schematic to Send Tx ID Over USB

WIRELESS MADE SIMPLE ®

APPLICATION NOTE AN-00156Reading The Tx ID From The

MS And HS Decoders

Page 33: WIRELESS MADE SIMPLE - University of Rochester

AN-00156Reading The Tx ID From The MS And HS Decoders Page 2

written in Visual Basic 6 and is well commented sothat it can be easily included into applicationsoftware or ported into other formats. makes use ofthe Direct Drivers provided for the QS module. TheVirtual COM Port drivers can be used with thesoftware for use with a RS232 serial port that wasdescribed in the previous section. This offers thedesigner some flexibility when working on thesystem design. Please see the documentation forthe QS module for details on the module anddrivers.

SEND TO A MICROCONTROLLER

Figure 3 shows the circuit schematic to send the TxID to a microcontroller.

This example makes use of the PIC16F88microcontroller from Microchip and the DMC-16202-LY LCD screen from Optrex. Both of thesecomponents are readily available from electronicsdistributors.

The PIC16F88 was chosen because it had morethan enough I/O pins and a built-in UART. TheUART is specifically made to handle serial data,making it perfect to read the ID from the decoder.The software to control it is also quite simple, justtelling the UART to get data at a certain baud rate.

A UART is not required, though. The controller canbe programmed to sample the state of a line and

watch for the individual bits at the timing determinedby the baud rate. This method works and couldreduce costs by allowing a less expensive controllerto be used, but the software gets much morecomplicated and will not be covered here.

Other microcontrollers with fewer pins, fewerfeatures and a lower cost can be used with minorchanges to the software. It is up to the designer todetermine and make the changes.

The Optrex LCD screen has two lines of sixteencharacters each. It takes data four bits at a timeeach time a control line is pulsed. Another controlline tells the screen if the data is set-up informationor for display. Other LCD screens can be used, butit is up to the designer to modify the software foroperation with them.

The software in this example is written in C and wascompiled using the PIC C compiler from CCS Info.The source code can be downloaded from the LinxTechnologies web site and is well commented, butsome parts may need to be modified for differentdevices.

D6D7SEL_BAUD0SEL_BAUD1GNDGNDLATCHRX_CNTLTX_IDMODE_IND

D5

D3D2

VCC

D1D0

DATA_INLEARN

123456789

10 1112

1415

17181920

LICAL-DEC-MS001

VC

CPIC16F88

123456789

123456789

RA2RA3RA4RA5VssRB0RB1RB2RB3

RA1RA0RA7RA6VDD

RB7RB6RB5RB4

14 13 12 11 10 9 8 7 6 5 4 3 2 1

D7 D6 D5 D4 D3 D2 D1 D0 EN R/W RS Vee Vcc GND

DMC-16202-LY

VCC

VCC

Figure 3: Schematic to Display the Tx ID to a LCD

Page 34: WIRELESS MADE SIMPLE - University of Rochester

The status line byte reflects the states of the statuslines, ‘1’ for on and ‘0’ for off. This represents thecurrent logic states of the outputs, not the commandthat was received, so that the states of latched linesare correctly represented. Line D0 corresponds tobit b0 in the byte, D1 corresponds to b1, and soforth. This allows applications that use anembedded microcontroller to read the transmittedcommands without having to monitor eighthardware lines.

The custom data byte is a 1-byte value that isprogrammed on the transmitting side by the userthrough the SIE. If the option is disabled and nocustom data is sent, this byte will be all high (binary1111 1111).

Appendix A has sample code to read the bytes witha microcontroller and with a PC, using the USBmodule interface as described in the HardwareInterface section.

SERIAL INTERFACE ENGINE (SIE)One of the most powerful features of the MT Seriesis its serial interface engine. The SIE allows theuser to monitor and control the transcoderconfiguration settings through an automatedsystem rather than manually through the hardwarelines. While serial programming is not required forbasic operation, it enables the advanced featuresoffered by the MT, such as Targeted DeviceAddressing and Custom Data transmissions.

The SIE consists of twenty commands grouped intoeight categories. The transcoder outputs anacknowledgement once it has received eachcommand, and then a response of up to fouradditional bytes if required by the command. We willstart with a description of each command and thefeatures or options associated with them.

INTRODUCTIONThe MT Series transcoder is a remote controlencoder and decoder in a single package. It isdesigned for bi-directional remote controlapplications, such as Remote Keyless Entry (RKE)with confirmation. However, the MT Series iscapable of much more thanks to a Serial InterfaceEngine (SIE). While basic operation can beacomplished easily with the hardware control lines,the SIE enables full software control without usingany of the hardware control lines and also enablesseveral advanced features. This application noteprovides details on the advanced features andserial command set of the MT. Sample code isprovided as an example and without any warranty.

SERIAL OUTPUTUpon reception of every valid packet, thetranscoder outputs a serial data stream consistingof a start byte, TX ID byte, status line state byte,custom data byte, and a stop byte. The start byte isalways 0x00 and the stop byte is always 0xFF.

The bytes are output on the SER_IO lineasynchronously, Least Significant Bit (LSB) firstwith one start bit, one stop bit, and no parity at thebaud rate determined by the SEL_BAUD line. Theline follows convention and is high when no data isbeing output (note that this line becomes an inputwhen the transcoder goes to sleep).

The TX ID byte is a number that identifies whichlearned transcoder sent the transmission. Thenumber normally corresponds to the order in whichthe transcoder was learned, so the first transcoderlearned will get number ‘1’ (binary 0000 0001), thesecond will get number ‘2’ (binary 0000 0010), andso on. An exception arises when the memory is full,in which case the memory wraps around and thefirst numbers are overwritten, and if the SIE is usedto write an address to a specific location.

WIRELESS MADE SIMPLE ®

APPLICATION NOTE AN-00157Connecting to the Serial Interface

on the MT Series Transcoders

start stop start stop

SER_IO 00 TX ID STATUS CUSTOM FF

b0 b1 b2 b3 b4 b5 b6 b6b7 b7b0 b1 b2 b3 b4 b5

Figure 1: MT Series Transcoder Serial Output

Page 35: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders Page 2

LOCAL SETTINGS

This command reads and writes the transcoder’slocal 24-bit address and status line input/outputconfiguration. This allows the option for the user toprogram all transcoders with the same address andstatus line configuration, or increment the addressfor each transcoder to utilize the full range ofaddresses.

The Read Local Settings command returns threebytes of the local address and one byterepresenting the input/output states of the statuslines. Line D0 corresponds to bit b0 in the I/O statebyte, D1 corresponds to b1, and so forth. A ‘0’means that the line represented by that bit is set toan output, a ‘1’ means it is an input.

The Write Local Settings command allows the userto write a specific 3-byte address and 1-byte statusline configuration to the transcoder.

NEXT USER ID

This command reads and writes the next availablelocation that will be given to the next user that ismanually learned by the transcoder. The Read NextUser ID command returns the 1-byte ID that will begiven to the next transcoder. The Write Next UserID command allows the user to assign the ID thatwill be given to the next transcoder that is learned.The transcoder will increment the ID from that point,overwriting the following IDs. For example, if thereare 20 users learned and the Write Next User IDcommand is used to set the next user to 15, thenthen next transcoder learned manually will get ID15. The one after that will get ID 16, overwriting theuser that was already there.

SPECIFIC USER

This command reads and writes the address andControl Permissions of a specific device that hasbeen learned in memory. This command can beused to change or remove a device that has beenlost or stolen without having to re-learn all of theother devices in the system.

The Read Specific User command returns the threeaddress bytes and one byte representing the statusline permissions of the ID sent in the command. TheWrite Specific User command writes the addressand permissions to the ID specified in thecommand. To remove an existing user, write 0xFFinto the address and status line values. 0xFF is thedefault value for an empty ID, so it should not beused as a learned user.

TARGET ADDRESS

These commands enable, disable, read, and writethe 24-bit address of the specific transcoder towhich the transmission will be directed. Alltranscoders within range will get the transmission,but only the device with the address that matchesthe target address will take action and respond.This option requires that the addresses of allnecessary system components are known inadvance. There are many different ways of doingthis, so it is up to the designer to determine the bestmethod for their application.

The Read Device Targeting EN command returnsthe current state of the option, (‘0’ is disabled, ‘1’ isenabled, disabled by default). The Write DeviceTargeting EN command allows the user to changethe state of the option. The Read Target Addressreturns the address that is currently targeted. TheWrite Target Address allows the user to write theaddress of the device to be targeted.

CUSTOM DATA VALUE

These commands enable, disable, read, and write acustom data value that is sent with every packet.Care must be used if 0xFF (binary 1111 1111) isused as a legitimate value since this is the defaultoutput of the serial line when this option is disabled.

The Read Custom Data EN command returns thecurrent state of the option, (‘0’ is disabled, ‘1’ isenabled, disabled by default). The Write CustomData EN command allows the user to change thestate of the option. The Read Custom Data Valuereturns the byte that is currently in memory to besent in the transmission. The Write Custom DataValue allows the user to write a new value to thetranscoder.

LATCH MASK

The MT Series has the ability to make each statusline that is set as an output be either latched ormomentary. Momentary means that the line willonly be high for as long as a valid signal is received.Once the signal stops and the transcoder times out,the lines are pulled low.

Latched means the transcoder will pull a data linehigh upon reception of a valid signal and hold it highuntil the signal is received a second time, at whichpoint the transcoder will pull it low. The transcodermust see a break and time out between validtransmissions before it will toggle the outputs.

Page 36: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders

The Read Latch Mask Value command returns abyte corresponding to the current setting of eachline, ‘0’ for momentary or ‘1’ for latched (bit b0 in thebyte corresponds to line D0 and so forth). The WriteLatch Mask command allows the user to write abyte to the transcoder to individually set the statuslines as latched or momentary.

STATUS VALUE

This command reads the current state of the statusline outputs and writes the state of the status lineinputs for automatic transmission of a specifiednumber of packets. The Read Status Outputsreturns a byte that corresponds to the state of thestatus line outputs. The Write Status Line Inputscommand writes a byte that corresponds to thedesired state of the inputs and a byte thatrepresents the number of packets to send. Thetranscoder will automatically send the specifiednumber of packets as soon as the command isreceived.

CONFIRMATION

This command enables and disables the automaticconfirmation. The confirmation is enabled bydefault, but some users may want to disable it toreduce the chance for interference in systems withmultiple transcoders.

The Read Confirmation EN command returns thecurrent state of the option, (‘0’ is disabled, ‘1’ isenabled, disabled by default). The WriteConfirmation EN command allows the user tochange the state of the option.

SERIAL PROGRAMMINGThe data structure sent into and coming out of thetranscoder follows standard serial communicationconvention. Each byte is sent LSB first with onestart bit, one stop bit, and no parity at the baud ratedetermined by the SEL_BAUD line. After the lastcommand byte is received, there will be a 5mSpause while the transcoder processes thecommand, then it outputs the acknowledgementand a response if appropriate. Figure 2 shows theorder and timing of the serial interface.

The MODE_IND line goes high for as long as theSER_IO line is an output, allowing it to be used withRS-232 style handshaking.

Appendix B has sample code for writing commandsto the transcoder and receiving the acknowl-edgement and response.

HARDWARE INTERFACEThe serial interface on the MT Series can beconnected to any device capable of serialcommunication, including microcontrollers, RS-232drivers, and computers. Figure 3 gives an exampleof connecting the MT to the Linx QS Series USBmodule for connection to a computer.

The USB module follows the RS-232 convention ofusing separate lines for data input and data outputwhile the transcoder has a single line for all data.This requires a switch to alternatively connect thetranscoder’s SER_IO line to the data lines on themodule.

Page 3

start stop start stop

CRT_LRN (INPUT)

MODE_IND (OUTPUT)

SER_IO (INPUT/OUTPUT) 00 00 R

SER_IO = INPUT SER_IO = OUTPUT

1msC C C C C C FF 4ms A A A R R R FF

Command Acknowledge/Response

b0 b1 b2 b3 b4 b5 b6 b6b7 b7b0 b1 b2 b3 b4 b5

Figure 2: MT Series Transcoder Serial Programming

Page 37: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders

The RTS line is used to throw the switch as well asto activate the CRT/LRN line placing the transcoderinto Serial Mode. This gives the PC the ability tocontrol when communication is initiated.

The MODE_IND line will go high when thetranscoder is prepared to send data, so the CTSline on the USB module is used to monitor theMODE_IND line. This allows the computer to knowwhen to throw the switch and look for data from thetranscoder.

One point of note is that voltage translation may benecessary if the 5V USB module is used tocommunicate with a transcoder operating at 3V.There are many components and methods forimplementing level shifting, so it is up to thedesigner to determine the best solution for theproduct.

Page 4

USBDPUSBDMGND DSR

DATA_INDATA_OUT

RTS

CTSDTR

TX_IND

VCCSUSP_INDRX_IND

485_TX

RIDCD

123456

78 9

10

111213141516

VCCD6D7CRT/LRNENC_SELSER_IOCONFIRMTR_PDNTR_SELTR_DATA

GNDD5D4D3

LATCHSEL_BAUDMODE_IND

D2D1D0

123456789

10 11121314151617181920

LICAL-TRC-MT

SDM-USB-QS

8

7

6

5

1

2

3

4

V+

NC

NCGND

MAX4544

USB Type BConnector

GND

5V

DAT -

DAT+

GND

GS

HD

GS

HD 1

2

3

4

56

VCC

VCC

Figure 3: MT Series Transcoder Serial Interface to a PC

Page 38: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders

APPENDIX AThis software example is provided as a courtesy in "as is" condition. Linx Technologies makes no guarantee, representation, or warranty, whetherexpress, implied, or statutory, regarding the suitability of the software for use in a specific application. The company shall not, in any circumstances, beliable for special, incidental, or consequential damages, for any reason whatsoever.

VISUAL BASIC CODE

This Visual Studio Visual Basic code uses the Linx SDM-USB-QS USB module to read the serial output of thetranscoder with a PC.

‘Setup the QS module for use.

' Open the device

Call Open_USB_Device_By_Description("LINX SDM-USB-QS-S")

' Reset device

Call Reset_USB_Device()

' Set baud rate to 9600

Call Set_USB_Device_Baud_Rate(FT_BAUD_9600)

' 8 data bits, 1 stop bit, no parity

Call Set_USB_Device_Data_Characteristics(FT_DATA_BITS_8, FT_STOP_BITS_1, FT_PARITY_NONE)

' no flow control

Call Set_USB_Device_Flow_Control(FT_FLOW_NONE, 0, 0)

' 25mS read timeout, 25mS write timeout

Call Set_USB_Device_Timeouts(25, 25)

' RX-buffer size = 9 bytes and TX-buffer size = 8 bytes for max packets size

Call Set_USB_Device_Parameters(9, 8)

' Latency ranges 2-255mS and defaults to 16mS

Call Set_USB_Device_Latency_Timer(2)

'Purge the RX buffer

Call Purge_USB_Device_RxBfr()

'Purge the TX buffer

Call Purge_USB_Device_TxBfr()

'Clear SER_IO & CRT_LRN pin for RXD

Call Set_USB_Device_RTS() 'Output Low

‘Function for monitoring SER_IO data during MT-Receive-Mode.

Public Function RxSerialOutput() As Boolean

Dim n As Integer = 0

Dim TX_ID As Byte = 0

Dim StatusOutputs As Byte = 0

Dim CustomData As Byte = 0

Dim DataReceived As Boolean = False

'If the Mode_Ind is set(HIGH), receive data

If ((Get_USB_Device_Modem_Status() And FT_MODEM_STATUS_CTS) <> FT_MODEM_STATUS_CTS) Then

'Perform Read on expected 5-bytes

n = Read_Data_Bytes(5)

'Make sure all 5 were received

If (n = 5) Then

'Test the Start and Stop bytes

Page 5

Page 39: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders

If (FT_In_Buffer(0) = &H0) And (FT_In_Buffer(4) = &HFF) Then

'Make sure expected UserID is in range

If (FT_In_Buffer(1) > 0) And (FT_In_Buffer(1) < 61) Then

'Assign RX values

TX_ID = FT_In_Buffer(1)

StatusOutputs = FT_In_Buffer(2)

CustomData = FT_In_Buffer(3)

DataReceived = True

End If

End If

End If

'Clear RX buffer for next receive

Call Purge_USB_Device_RxBfr()

'Return true if data was received

RxSerialOutput = DataReceived

End If

End Function

MICROCONTROLLER CODE

This C code can be used by a microcontroller to monitor the serial output of the transcoder.void RxSerialOut_2PC(void)

{

int8 i = 0;

char RxIn[5];

// Get the 5 byte packet from MT RxSerialOut

for(i=0; i<5; i++) RxIn[i] = Get_Byte();

// If start and stop byte are good, send RX data to PC

if((RxIn[0] == 0x00)&&(RxIn[4] == 0xFF)) {

for(i=0; i<5; i++) putc(RxIn[i]);

}

// Clear RxIn buffer

for(i=0; i<5; i++) RxIn[i] = 0;

}

//******************************************************************************

void Put_Byte(int8 Data)

{

// 100us for 9600baud or 30us for 28800baud

int8 BitTm = 100;

// Start bit

output_low(Ser_IO); delay_us(BitTm);

// 8 data bits

output_bit(Ser_IO, bit_test(Data,0)); delay_us(BitTm);

output_bit(Ser_IO, bit_test(Data,1)); delay_us(BitTm);

Page 6

Page 40: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders

output_bit(Ser_IO, bit_test(Data,2)); delay_us(BitTm);

output_bit(Ser_IO, bit_test(Data,3)); delay_us(BitTm);

output_bit(Ser_IO, bit_test(Data,4)); delay_us(BitTm);

output_bit(Ser_IO, bit_test(Data,5)); delay_us(BitTm);

output_bit(Ser_IO, bit_test(Data,6)); delay_us(BitTm);

output_bit(Ser_IO, bit_test(Data,7)); delay_us(BitTm);

// Stop bit

output_high(Ser_IO); delay_us(BitTm);

}

//******************************************************************************

int8 Get_Byte(void)

{

// 100us for 9600baud or 30us for 28800baud

int8 BitTm = 100;

int8 DataByte = 0;

// Wait for Ser_IO to drop for start bit

while(input(Ser_IO)) {}

// Start bit

delay_us(BitTm/2);

// 8 data bits

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,0);

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,1);

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,2);

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,3);

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,4);

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,5);

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,6);

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,7);

// Stop bit

delay_us(BitTm);

// Return received value

return(DataByte);

}

//******************************************************************************

Page 7

Page 41: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders Page 8

APPENDIX BThis software example is provided as a courtesy in "as is" condition. Linx Technologies makes no guarantee, representation, or warranty, whetherexpress, implied, or statutory, regarding the suitability of the software for use in a specific application. The company shall not, in any circumstances, beliable for special, incidental, or consequential damages, for any reason whatsoever.

VISUAL BASIC CODE

This Visual Studio Visual Basic code uses the Linx SDM-USB-QS USB module to write commands to thetranscoder from a PC and to receive the response from the transcoder.

‘Setup the QS module for use.

' Open the device

Call Open_USB_Device_By_Description(GetFTDeviceDescription(0))

' Reset device

Call Reset_USB_Device()

' Set baud rate to 9600

Call Set_USB_Device_Baud_Rate(FT_BAUD_9600)

' 8 data bits, 1 stop bit, no parity

Call Set_USB_Device_Data_Characteristics(FT_DATA_BITS_8, FT_STOP_BITS_1, FT_PARITY_NONE)

' no flow control

Call Set_USB_Device_Flow_Control(FT_FLOW_NONE, 0, 0)

' 25mS read timeout, 25mS write timeout

Call Set_USB_Device_Timeouts(25, 25)

' RX-buffer size = 9 bytes and TX-buffer size = 8 bytes for max packets size

Call Set_USB_Device_Parameters(9, 8)

' Latency ranges 2-255mS and defaults to 16mS

Call Set_USB_Device_Latency_Timer(2)

'Purge the RX buffer

Call Purge_USB_Device_RxBfr()

'Purge the TX buffer

Call Purge_USB_Device_TxBfr()

'Clear SER_IO & CRT_LRN pin for RXD

Call Set_USB_Device_RTS() 'Output Low

‘Function for transmitting packets and receiving confirmation.

Public Function TransferData(ByVal Wr_Cnt As Integer, ByVal Rd_Cnt As Integer) As Boolean

Dim i As Integer = 0

Dim n As Integer = 0

Dim blnACK_Rcvd As Boolean = False

'Purge the QS RX/TX buffers

Call Purge_USB_Device_RxBfr()

Call Purge_USB_Device_TxBfr()

'Set SER_IO & CRT_LRN pin to trigger MT for serial data and set switch to QS-TX-Data pin

Call Clear_USB_Device_RTS() 'Output HIGH

'Allow time(ms) for MT to finish possible RX or PDN modes

Page 42: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders

Sleep(50)

'If Mode_Ind is clear, send the data

If (Get_USB_Device_Modem_Status() And FT_MODEM_STATUS_CTS) Then

Call Write_Data_Bytes(Wr_Cnt)

'Wait for Mode_Ind to go HIGH indicating MT command reception

Do While ((Get_USB_Device_Modem_Status() And FT_MODEM_STATUS_CTS) And (i < 10000))

i += 1

Loop

End If

'Clear SER_IO & CRT_LRN pin to flip switch for QS-RX-Data pin

Call Set_USB_Device_RTS() 'Output LOW

'Make sure Write-Wait loop didn't timeout

If (i < 10000) Then

'Read the QS RX buffer

n = Read_Data_Bytes(Rd_Cnt)

If (n > 4) Then

'Test Start and Stop bytes

If (FT_In_Buffer(0) = 0 And FT_In_Buffer(n - 1) = 255) Then

blnACK_Rcvd = True

End If

End If

End If

'Return true if ACK message was received from MT device

TransferData = blnACK_Rcvd

End Function

‘Functions used to fill the QS TX buffers with each command.

Public Function DoRdLocalSettings() As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H1

FT_Out_Buffer(2) = &H0

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 9) = True Then

DoRdLocalSettings = True

Else

DoRdLocalSettings = False

End If

End Function

Page 9

Page 43: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders

Public Function DoWrLocalSettings(ByVal A1 As Byte, ByVal A2 As Byte, ByVal A3 As Byte, ByVal IO As Byte) As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H2

FT_Out_Buffer(2) = A1

FT_Out_Buffer(3) = A2

FT_Out_Buffer(4) = A3

FT_Out_Buffer(5) = IO

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 5) = True Then

DoWrLocalSettings = True

Else

DoWrLocalSettings = False

End If

End Function

Public Function DoRdNextUserID() As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H11

FT_Out_Buffer(2) = &H0

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 6) = True Then

DoRdNextUserID = True

Else

DoRdNextUserID = False

End If

End Function

Public Function DoWrNextUserID(ByVal ID As Byte) As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H12

FT_Out_Buffer(2) = ID

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 5) = True Then

DoWrNextUserID = True

Page 10

Page 44: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders

Else

DoWrNextUserID = False

End If

End Function

Public Function DoRdSpecificUser(ByVal ID As Byte) As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H21

FT_Out_Buffer(2) = ID

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 9) = True Then

DoRdSpecificUser = True

Else

DoRdSpecificUser = False

End If

End Function

Public Function DoWrSpecificUser(ByVal A1 As Byte, ByVal A2 As Byte, ByVal A3 As Byte, ByVal IO As Byte, ByVal ID AsByte) As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H22

FT_Out_Buffer(2) = A1

FT_Out_Buffer(3) = A2

FT_Out_Buffer(4) = A3

FT_Out_Buffer(5) = IO

FT_Out_Buffer(6) = ID

FT_Out_Buffer(7) = &HFF

If TransferData(8, 5) = True Then

DoWrSpecificUser = True

Else

DoWrSpecificUser = False

End If

End Function

Public Function DoRdTargetAddr() As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H31

FT_Out_Buffer(2) = &H0

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

Page 11

Page 45: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 8) = True Then

DoRdTargetAddr = True

Else

DoRdTargetAddr = False

End If

End Function

Public Function DoWrTargetAddr(ByVal A1 As Byte, ByVal A2 As Byte, ByVal A3 As Byte) As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H32

FT_Out_Buffer(2) = A1

FT_Out_Buffer(3) = A2

FT_Out_Buffer(4) = A3

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 5) = True Then

DoWrTargetAddr = True

Else

DoWrTargetAddr = False

End If

End Function

Public Function DoRdCustomData() As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H41

FT_Out_Buffer(2) = &H0

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 6) = True Then

DoRdCustomData = True

Else

DoRdCustomData = False

End If

End Function

Public Function DoWrCustomData(ByVal CB As Byte) As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H42

Page 12

Page 46: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders

FT_Out_Buffer(2) = CB

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 5) = True Then

DoWrCustomData = True

Else

DoWrCustomData = False

End If

End Function

Public Function DoRdLatchMask() As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H51

FT_Out_Buffer(2) = &H0

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 6) = True Then

DoRdLatchMask = True

Else

DoRdLatchMask = False

End If

End Function

Public Function DoWrLatchMask(ByVal LM As Byte) As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H52

FT_Out_Buffer(2) = LM

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 5) = True Then

DoWrLatchMask = True

Else

DoWrLatchMask = False

End If

End Function

Page 13

Page 47: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders

Public Function DoRdStatusOuputs() As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H61

FT_Out_Buffer(2) = &H0

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 6) = True Then

DoRdStatusOuputs = True

Else

DoRdStatusOuputs = False

End If

End Function

Public Function DoWrStatusInputs(ByVal Data As Byte, ByVal Num As Byte) As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H62

FT_Out_Buffer(2) = Data

FT_Out_Buffer(3) = Num

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 5) = True Then

DoWrStatusInputs = True

Else

DoWrStatusInputs = False

End If

End Function

Public Function DoRdConfirmEn() As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H71

FT_Out_Buffer(2) = &H0

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 6) = True Then

DoRdConfirmEn = True

Page 14

Page 48: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders

Else

DoRdConfirmEn = False

End If

End Function

Public Function DoWrConfirmEn(ByVal CfEn As Byte) As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H72

FT_Out_Buffer(2) = CfEn

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 5) = True Then

DoWrConfirmEn = True

Else

DoWrConfirmEn = False

End If

End Function

Public Function DoRdTargetEn() As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H81

FT_Out_Buffer(2) = &H0

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 6) = True Then

DoRdTargetEn = True

Else

DoRdTargetEn = False

End If

End Function

Public Function DoWrTargetEn(ByVal TgEn As Byte) As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H82

FT_Out_Buffer(2) = TgEn

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

Page 15

Page 49: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders

FT_Out_Buffer(7) = &HFF

If TransferData(8, 5) = True Then

DoWrTargetEn = True

Else

DoWrTargetEn = False

End If

End Function

Public Function DoRdCustomDataEn() As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H91

FT_Out_Buffer(2) = &H0

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 6) = True Then

DoRdCustomDataEn = True

Else

DoRdCustomDataEn = False

End If

End Function

Public Function DoWrCustomDataEn(ByVal CdEn As Byte) As Boolean

FT_Out_Buffer(0) = &H0

FT_Out_Buffer(1) = &H92

FT_Out_Buffer(2) = CdEn

FT_Out_Buffer(3) = &H0

FT_Out_Buffer(4) = &H0

FT_Out_Buffer(5) = &H0

FT_Out_Buffer(6) = &H0

FT_Out_Buffer(7) = &HFF

If TransferData(8, 5) = True Then

DoWrCustomDataEn = True

Else

DoWrCustomDataEn = False

End If

End Function

Page 16

Page 50: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders Page 17

MICROCONTROLLER CODE

This C code can be used by a microcontroller to to write commands to the transcoder and receive the response.

// Constant Arrays

const char RdLocSttngs[8] = {0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char WrLocSttngs[8] = {0x00, 0x02, 0x11, 0x22, 0x33, 0x0F, 0x00, 0xFF};

const char RdNxtUser[8] = {0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char WrNxtUser[8] = {0x00, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char RdSpecUser[8] = {0x00, 0x21, 0x3C, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char WrSpecUser[8] = {0x00, 0x22, 0x12, 0x34, 0x56, 0x78, 0x3C, 0xFF};

const char RdTrgtAddr[8] = {0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char WrTrgtAddr[8] = {0x00, 0x32, 0x11, 0x22, 0x33, 0x00, 0x00, 0xFF};

const char RdCstmData[8] = {0x00, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char WrCstmData[8] = {0x00, 0x42, 0xAA, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char RdLatchMsk[8] = {0x00, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char WrLatchMsk[8] = {0x00, 0x52, 0x55, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char RdStatus_Out[8] = {0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char WrStatus_In[8] = {0x00, 0x62, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char RdCnfrmEN[8] = {0x00, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char WrCnfrmEN[8] = {0x00, 0x72, 0x01, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char RdTrgtngEN[8] = {0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char WrTrgtngEN[8] = {0x00, 0x82, 0x01, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char RdCstmDtaEN[8] = {0x00, 0x91, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF};

const char WrCstmDtaEN[8] = {0x00, 0x92, 0x01, 0x00, 0x00, 0x00, 0x00, 0xFF};

// Variable Arrays

char TxCmdDta[8];

char RxCmdDta[9];

// Constants

const int8 SerIO_IN = 0b11000111;

const int8 SerIO_OUT = 0b11000011;

//******************************************************************************

void ProcessCmd(void)

{

int8 i = 0;

if(input(Cmd_RW)) {

// Determine which write command to send

if (input(Cmd_1)) { for(i=0; i<8; i++) TxCmdDta[i] = WrLocSttngs[i]; }

else if(input(Cmd_2)) { for(i=0; i<8; i++) TxCmdDta[i] = WrSpecUser[i]; }

else if(input(Cmd_3)) { for(i=0; i<8; i++) TxCmdDta[i] = WrTrgtAddr[i]; }

else if(input(Cmd_4)) { for(i=0; i<8; i++) TxCmdDta[i] = WrCstmData[i]; }

else if(input(Cmd_5)) { for(i=0; i<8; i++) TxCmdDta[i] = WrLatchMsk[i]; }

else if(input(Cmd_6)) { for(i=0; i<8; i++) TxCmdDta[i] = WrCnfrmEN[i]; }

Page 51: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders Page 18

else if(input(Cmd_7)) { for(i=0; i<8; i++) TxCmdDta[i] = WrTrgtngEN[i]; }

else if(input(Cmd_8)) { for(i=0; i<8; i++) TxCmdDta[i] = WrCstmDtaEN[i]; }

else { for(i=0; i<8; i++) TxCmdDta[i] = WrNxtUser[i]; }

}

else {

// Determine which read command to send

if (input(Cmd_1)) { for(i=0; i<8; i++) TxCmdDta[i] = RdLocSttngs[i]; }

else if(input(Cmd_2)) { for(i=0; i<8; i++) TxCmdDta[i] = RdSpecUser[i]; }

else if(input(Cmd_3)) { for(i=0; i<8; i++) TxCmdDta[i] = RdTrgtAddr[i]; }

else if(input(Cmd_4)) { for(i=0; i<8; i++) TxCmdDta[i] = RdCstmData[i]; }

else if(input(Cmd_5)) { for(i=0; i<8; i++) TxCmdDta[i] = RdLatchMsk[i]; }

else if(input(Cmd_6)) { for(i=0; i<8; i++) TxCmdDta[i] = RdCnfrmEN[i]; }

else if(input(Cmd_7)) { for(i=0; i<8; i++) TxCmdDta[i] = RdTrgtngEN[i]; }

else if(input(Cmd_8)) { for(i=0; i<8; i++) TxCmdDta[i] = RdCstmDtaEN[i]; }

else { for(i=0; i<8; i++) TxCmdDta[i] = RdNxtUser[i]; }

}

// Make SerIO pin an output

set_tris_a(SerIO_OUT);

// Set both lines HIGH at the same time

output_high(CrtLrn);

output_high(Ser_IO);

// Allow MT time to enter SIE command mode

delay_ms(50);

output_low(CrtLrn);

// Send the command to the MT

for(i=0; i<8; i++) { Put_Byte(TxCmdDta[i]); }

delay_ms(1);

// Make SerIO an input

set_tris_a(SerIO_IN);

delay_ms(4);

// Get the ACK/reply from the MT

for(i=0; i<9; i++) RxCmdDta[i] = Get_Byte();

}

//******************************************************************************

void Put_Byte(int8 Data)

{

// 100us for 9600baud or 30us for 28800baud

int8 BitTm = 100;

// Start bit

output_low(Ser_IO); delay_us(BitTm);

// 8 data bits

output_bit(Ser_IO, bit_test(Data,0)); delay_us(BitTm);

output_bit(Ser_IO, bit_test(Data,1)); delay_us(BitTm);

output_bit(Ser_IO, bit_test(Data,2)); delay_us(BitTm);

output_bit(Ser_IO, bit_test(Data,3)); delay_us(BitTm);

output_bit(Ser_IO, bit_test(Data,4)); delay_us(BitTm);

Page 52: WIRELESS MADE SIMPLE - University of Rochester

AN-00157Connecting to the Serial Interface on the MT Series Transcoders Page 19

output_bit(Ser_IO, bit_test(Data,5)); delay_us(BitTm);

output_bit(Ser_IO, bit_test(Data,6)); delay_us(BitTm);

output_bit(Ser_IO, bit_test(Data,7)); delay_us(BitTm);

// Stop bit

output_high(Ser_IO); delay_us(BitTm);

}

//******************************************************************************

int8 Get_Byte(void)

{

// 100us for 9600baud or 30us for 28800baud

int8 BitTm = 100;

int8 DataByte = 0;

// Wait for Ser_IO to drop for start bit

while(input(Ser_IO)) {}

// Start bit

delay_us(BitTm/2);

// 8 data bits

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,0);

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,1);

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,2);

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,3);

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,4);

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,5);

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,6);

delay_us(BitTm); if(input(Ser_IO)) bit_set(DataByte,7);

// Stop bit

delay_us(BitTm);

// Return received value

return(DataByte);

}

//******************************************************************************

Page 53: WIRELESS MADE SIMPLE - University of Rochester

COMMUNICATION BASICSA communications channel is the path that datatravels from the transmitter to the receiver and ismade up of all of the components required togenerate the data stream, encode it, transmit it(including the propagation path), receive it, decodeit, and interpret it. Figure 1 shows a generic modelof a communications channel.

DDaattaa SSoouurrcceeThe data source can be anything. It could be an A/Dconverter reading a temperature, a file on acomputer hard disk, or a key press on a keypad.Data corruption at this stage in the communicationchannel is unlikely and can usually be traced to abug in the hardware or software of the device.

DDaattaa EEnnccooddiinnggThe data coming from the data source is generallyraw and unprotected. Encoding the data provides astructure, security, and a form of error correctionthat can ensure data integrity. Data corruption atthis stage in the communications channel is unlikelyand can usually be traced to a bug in the hardwareor software of the device.

DDaattaa TTrraannssmmiissssiioonnAll Linx transmitters are fully tested at the factory,however, external factors such as power supplynoise, and improper modulation voltage can corruptthe data stream. A transmitter that is operated asrecommended by its data sheet should notcontribute to data corruption.

DATASOURCE

DATA ENCODING

DATA TRANSMISSION

PROPAGATIONPATH

DATARECEPTION

DATADECODING

DATAINTERPRETATION

Figure 1: Generic Communications Channel

WIRELESS MADE SIMPLE ®

INTRODUCTIONLinx modules are designed to create a robustwireless link for the transfer of data. Since they arewireless devices, they are subject to externalinfluences that are not present in wiredcommunications. These influences are capable ofinterrupting and corrupting the data that is beingsent by the transmitter, causing the output at thereceiver to be incorrect. To correct for this possibleinterference, it is recommended that a designerimplement some sort of noise tolerant protocol. Thegoal of the protocol is to synchronizecommunications between the transmitting andreceiving ends, identify valid data packets, verifythat the data packets are correct, and possibly evencorrect bad data in a packet.

One common misconception is that a digitaladdress can be sent to distinguish one transmitterfrom another, even when multiple transmitters areon at the same time. RF is an analog domain so thedigital content does not matter. One way to thinkabout it is like a crowded room. If only one personis talking, everyone will be able to hear that person.If everyone talks at once, then it becomes difficult tohear any single person. A protocol can help reducenoise in a multiple transmitter system and help thereceiver pick out the valid data in a noisyenvironment.

Except for the encoder/decoder pair, Linx modulesdo not place any constraints on the type or formatof the data being sent. This freedom allows for moreversatility in the types of applications that can usethe modules, but it also places the protocol designburden on the customer. This application note isintended to help the engineers design a suitableprotocol for their application.

To better understand the requirements for such aprotocol, we will first examine all of the potentialsources of data corruption that create the need forthe protocol. To do this we will develop a generalmodel for the communications channel that the datamust go through from the transmitter to the receiver.Using this model, we can account for all of theexternal and internal influences on the data stream.

APPLICATION NOTE AN-00160Considerations For SendingData Over a Wireless Link

Page 54: WIRELESS MADE SIMPLE - University of Rochester

COMMUNICATION BASICS (CONT)PPrrooppaaggaattiioonn PPaatthhThe propagation path is the path that the radiowaves take through free space from the transmitterto the receiver. It is in this stage that data corruptionis most likely to occur. Corruption is most commonlya result of either in-band interference or desensi-tization from unwanted RF sources present in thepropagation path. Interference can manifest itself inmany ways. Low-level interference will producenoise and hashing on the output and reduce thelink’s overall range.

Another type of interference can be caused byhigher-powered devices such as frequency hoppingspread-spectrum devices. Since these devicesmove rapidly from frequency to frequency they willusually cause short, intense losses of information.Such errors are referred to as bursting errors andwill generally be dealt with through protocol.

High-level interference is caused by productssharing the same frequency or from near-bandhigh-power devices. Fortunately, this type ofinterference is less common than those mentionedpreviously, but in severe cases it can prevent alluseful function of the affected device. It is in thesecases that the frequency agility offered by the HP isespecially useful.

Although technically it is not interference, multipathis also a factor to be understood. Multipath is a termused to refer to the signal cancellation effects thatoccur when RF waves arrive at the receiver indifferent phase relationships. This is particularly afactor in interior environments where objectsprovide many different reflection paths. Multipathresults in lowered signal levels at the receiver andthus shorter useful distances for the link.

All of these effects can cause continuous orperiodic data corruption. It must be recognized thatmany bands are widely used, and the potential forconflict with other unwanted sources of RF is veryreal. In a wired application, the propagation path isa wire instead of free space and tends to introducefew, if any, errors into the data stream. Thisfundamental difference between a wired and awireless link requires the need for some type ofdata transfer protocol. Later in this application notewe will discuss how protocol can help deal withthese issues.

DDaattaa RReecceeppttiioonnAll Linx receivers are fully tested at the factory toensure that they function to all of the specificationsset forth in the receiver data guide. There areseveral conditions, though, that can cause datacorruption in the receiver stage. If anothertransmitter turns on with sufficient power, it caninterfere with the desired signal, causing the dataoutput to become noisy. Furthermore, in-bandinterference and de-sensitization can cause thereceiver to corrupt the data stream. And, lastly, thereceiver can corrupt the data stream if the datasource violates the minimum or maximum baud ratespecification of the receiver.

The method of signal modulation also has animpact on the receiver’s ability to capture a signal inthe presence of interference. FM/FSK systems aregenerally superior than AM/OOK systems in thisrespect.

DDaattaa DDeeccooddiinnggThe received data is decrypted and checked forerrors. If implemented, error correction is performedto correct any detected mistakes in the data. Datacorruption at this stage in the communicationschannel is unlikely and can usually be traced to ahardware or software bug.

DDaattaa IInntteerrpprreettaattiioonnData interpretation is usually accomplished insoftware and involves doing something useful withthe information that was received. Data corruptionat this stage channel is unlikely and can usually betraced to a hardware or software bug.

WHAT IS A PROTOCOL?Every time two people communicate, there isalways a potential for misunderstanding. In somecases, the risk is acceptable. Other times, such asduring negotiations, misunderstanding can causesevere repercussions (such as war). When theaccuracy of communications is vital, rules forcommunication are established prior to negotiationsto ensure that both sides are "speaking the samelanguage". These rules are referred to as protocols.Since the communications between the transmitterand receiver can be corrupted, a protocol isabsolutely required to ensure that the receiver can"understand" the data from the transmitter and alsodetermine if the data that was received is correct orif there are any errors.

AN-00160Considerations for Sending Data Over a Wireless Link Page 2

Page 55: WIRELESS MADE SIMPLE - University of Rochester

PROTOCOL DESIGN CONSIDERATIONSPPaacckkeettiizzaattiioonnA protocol will generally cut the main data intosmaller pieces that are easier to handle. It will thenwrap the data with special information needed bythe protocol at the reception end to put the databack together. This process is called packetization.At the reception end, the protocol strips the extradata from the packet and reassembles the originaldata. This process is called depacketization.

MMiinniimmuumm OOvveerrhheeaaddA wireless data transfer protocol should be efficient.A protocol must add information to the main data,such as packet identification codes, error checking,encryption, etc. The amount of information addedshould be the minimum amount required to achieveall of the goals of the wireless data transfer.

RReelliiaabblleeA protocol is said to be reliable if it can separategood data from errant data. Reliability is usuallyachieved by embedding some form of errordetection in the data stream. Parity, checksums,and Cyclic Redundancy Checks (CRC) are all formsof error detection codes.

RRoobbuussttA protocol is said to be robust if it can correct errantdata. Robustness is usually achieved byembedding forward error correction codes in thedata stream. There are several methods of forwarderror correction, though the more complete thesystem, the more overhead required.

SSeeccuurreeA protocol is said to be secure if it can preventunauthorized access to the data. Since the data istransferred over a wireless link, anyone with areceiver can see the transmission. Encryption isused to make the data useless to anyone withoutthe correct access code.

UUnniiqquueeA protocol is said to be unique if it can distinguishthe correct transmission in the vicinity of severaltransmitters. This is usually accomplished byplacing address bits in each packet, enabling thereceiver to tell which packets came from the correcttransmitter.

OOppttiimmuumm RRaaddiioo PPeerrffoorrmmaanncceeA wireless protocol should operate in a way thattakes maximum advantage of the transmitter andreceiver while staying within the legal requirementsfor operation.

SSeelleeccttiinngg tthhee FFeeaattuurreess YYoouu RReeaallllyy NNeeeeddThe features listed above are the most importantfeatures of a good protocol. There is going to be acompromise between the error detection, errorcorrection, encryption and overhead. The strongeryou encode your data, the more overhead is goingto be required from your processor to do therequired calculations. This will add time to thetransmissions as the processors encode the datathen decode it on the receiving end. The designershould choose just the features that the projectreally needs and no more. This will strike thebalance between protocol strength and productperformance.

PACKETIZATIONIt is a good idea to structure the data being sent intosmall packets so that errors can be managedwithout affecting large amounts of data. Typically apacket would begin with a start sequence so thatthe receiver can identify the beginning of valid data.This sequence would then be followed by the dataand any error detection or correction information. Astop sequence can end the packet so that thereceiver knows when to stop accepting information.After receiving the stop sequence, the receivermust see a valid start sequence before acceptingany more data. Otherwise the receiver can countthe number of bit it receives or time out after notreceiving valid data for a certain time.

START CODES AND NOISEThe first thing any protocol must be able to do isidentify the difference between noise and valid data.Noise appears as random bytes of information, withno obvious pattern. An ideal noise source has theability to generate any combination of bytes with thesame probability as any other combination of bytes.This property of noise makes it very difficult to finda combination of bytes to signify the start of a validpacket. Fortunately, in the real world, noise is rarelyideal.

AN-00160Considerations for Sending Data Over a Wireless Link Page 3

Page 56: WIRELESS MADE SIMPLE - University of Rochester

WWaakkee--UUpp SSeeqquueennccee

The transmitter has no way of knowing the state ofthe receiver, so the protocol must place the receiverinto a known state prior to sending data. Failure todo this could cause the receiving processor to missthe first few bits of data potentially corrupting theentire packet. The protocol should use a startsequence that begins with two transitions to pull thereceiver out of squelch and into a known state. Theorder of the transitions, either ‘010’ or ‘101’, is up tothe designer.

NNooiissee FFiilltteerrNext there needs to be a way for the receivingprocessor to qualify the start of the packet as validdata and not noise. A good way to implement anoise filter is with bit sampling. The transmitterwould send a high marking period and a lowmarking period of specific lengths determined bythe baud rate and processing power at the receiver.The receiving processor will repeatedly sample thebit, as fast as possible, looking for level changes. Ifno changes are seen within the specified period,then the receiver can accept the data as valid.Using more than two pulses would give a higherprobability that the transmission is valid, but wouldneed more overhead from the processor andrequire a longer transmission length.

The order of the initial wake-up sequence describedabove will determine the order of the sampled bits.For example, if the wake-up sequence is ‘010’, thenthe first sampled bit should be a 1. The order of thepulses doesn't matter, just that at least two bits aremeasured since the probability of random noiseproducing one bit of the correct length may be fairlygood.

The length of the sampled bits will generally dependon the baud rate chosen for the application. Ifpossible, make the sampled bit longer than a bit atthe chosen baud rate to prevent the receiver fromdetecting the start sequence in the middle of thedata. Also, some margin should be built into thefront and back of the pulse. Some transmitters andreceivers can cause pulse stretching or shorteningas a result of start-up times and modulationmethods, so the radios used should be tested todetermine the appropriate margin.

This method must be performed at the bit level,which may not be possible for some applications. Itworks well for removing random noise, but may

pass structured data from other, undesiredtransmitters, so some method for detecting thecorrect data should also be used.

DDiiggiittaall LLooggiicc FFiilltteerrTo remove the chance that an undesired datatransmission will be verified, a digital logic filtershould be implemented. This is a series of bits thatare not likely to appear in the transmitted data butmust appear in the correct position in order for thepacket to be valid. This has the advantage of beingable to be implemented at the byte level, so, forexample, any valid text transmission must bepreceded by one of the ASCII characters. Thismethod is not good for removing random noise.

Combining the two methods described above willhelp to create a robust start sequence that will helpto qualify a valid packet. The designer can combinethem in whatever manner is appropriate for theapplication, though the following order will generallywork the best:

[Wake-Up][Noise Filter][Logic Filter][Data]

The receiver can only hold a specific level for acertain amount of time, resulting in the minimumbaud rate and maximum time between transitionspecifications. If the length of time betweentransmissions exceeds this time, then the dataintegrity cannot be guaranteed and the startsequence should be resent.

ERROR DETECTIONError detection is achieved by performing sometype of analysis on the data prior to transmissionand adding the results of this analysis to the datapacket. Then, the same analysis is performed at thereception end and compared to the resultsembedded in the packet. If the two are different,then the packet is errant. There are three commontypes of error detection: parity check, checksum,and Cyclic Redundancy Check (CRC).

PPaarriittyy CChheecckkThe simplest form of error detection is the paritycheck. A parity check is accomplished by adding allof the '1's in a string of bits. For Even Parity, if thenumber is even, then the parity bit is set, otherwiseit is not. For Odd Parity, if the number is odd, thenthe parity bit is set.

Example 1:

In this example, we will calculate the parity of a byte

AN-00160Considerations for Sending Data Over a Wireless Link Page 4

Page 57: WIRELESS MADE SIMPLE - University of Rochester

that is to be transmitted using Even Parity. Duringtransmission, one of the bits gets reversed. Thereceiver catches this through the parity check at thereception end.

Transmitter:

10101010

There is an even number of '1's, so the parity bit isset and the byte is transmitted as follows:

101010101

Receiver:

001010101

The last bit is not used in the parity calculation sinceit is the parity bit from the transmitter. Calculatingparity on the received byte yields an odd number of'1's and the parity is '0'. Since the receiver's paritycalculation does not match the transmitter'scalculation, the byte is determined to be errant andis thrown out.

The parity check is the easiest to implement, but isalso the most unreliable. It can only catch an oddnumber of errors in the bit stream. If the number oferrors is even, then the parity calculation willincorrectly indicate that the byte is good. Thus,there is 50% chance of the parity check catching anerror, which is less than optimal.

CChheecckkssuummA checksum is calculated based on a series ofbytes by adding the values of the bytes togetherand truncating the result to the desired bit length.For example:

4 data byte 1

109 data byte 2

65 data byte 3

204 data byte 4

126 8-bit checksum

A checksum will catch many more errors than theparity check. However, by simply transposing databytes 2 and 3, the data packet becomes errant, butthe checksum would provide the same result. Thechecksum only gives weight to the value of thebytes, not their order. Thus, errors of orderingcannot be caught with the checksum.

CCyycclliicc RReedduunnddaannccyy CChheecckkThe most popular form of error checking is thecyclic redundancy check (CRC). A CRC is morereliable than the checksum because every bit canindividually contribute to the checksum. This makesit much less likely that multiple errors will canceleach other out.

The idea behind the CRC is fairly straightforwardwhile the math is more complicated. Essentially thedata is considered a large binary number. Thisnumber is divided by another fixed binary number(called the generator) and the remainder is used asthe checksum. This checksum is appended to theend of the data and transmitted. While the individualbits do not affect the quotient very much, they dohave a large affect on the remainder. This is whydivision is much more robust than addition.

The receiver can then do one of two things:

1. Remove the checksum from the receiveddata, recalculate the checksum, and then comparethe received and calculated versions

2. Calculate the checksum for the entirereceived message and see if it comes out to 0.

Both of these methods work, but the second optionis a little cleaner and faster.

Both, the data stream and the fixed number aregenerally described in terms of polynomials and arewritten in the form of aXy, where a is either '1' or '0'and y is the bit position. For example:

10011

would be represented as:

1X4 + 0X3 + 0X2 + 1X1 + 1X0

Since anything times 0 is 0, you can remove all ofthe exponentials with a coefficient of 0 and simplifythe equation.

1X4 + 1X1 + 1X0

This seems inefficient and confusing if thegenerator polynomial is small, but when dealingwith 32-bit polynomials it is actually easier tounderstand.

The generator polynomial is chosen so that it hasthe greatest chance of detecting the kinds of errorsthat are most likely to be found in the real world.This includes one or two bit errors through burstingerrors. Some popular generator polynomials are:

16 bits: (16,12,5,0) [X25 standard]

AN-00160Considerations for Sending Data Over a Wireless Link Page 5

Page 58: WIRELESS MADE SIMPLE - University of Rochester

(16,15,2,0) ["CRC-16"]

32 bits:(32,26,23,22,16,12,11,10,8,7,5,4,2,1,0) [Ethernet]

These polynomials all have a leading '1'. Thismeans that the 16-bit polynomial is actually 17 bitslong with the leading '1' (bit 17) and then the otherbits listed above set. This leading '1' is called theimplicit top bit while the remaining bits are calledactive bits.

There are two ways of performing this operation.The most basic is to feed the data into a shiftregister one bit at a time. This is shown in the figurebelow for an 8-bit generator polynomial.

Since the generator is eight bits long, eight '0's areappended to the end of the data. This data is thenfed into the shift register 1 bit at a time. Every timea '1' comes out the other end, the generatorpolynomial is XORd with what is in the shift register.What is left in the shift register at the end of the datais the checksum.

This is a fairly slow way of computing thechecksum, though it requires very little overhead.The faster way of computing it is using a look-uptable. It turns out that a full byte can be computed ata time. More than that, most of the necessarycalculations can be pre-computed and stored in atable. What happens here is that the registers shiftout a byte and this byte is used to reference alocation in a table of 256 values. The number at thislocation is then XORd with the values in theregisters. This is repeated until all of the data bytesare shifted out. While this method is faster, itrequires the table to be generated and stored inmemory.

This is a glossed over description of a complicatedscheme, but covers the basic idea.

FORWARD ERROR CORRECTIONThe goal of error correction is to embed redundantdata in the packet at the transmitter end so that thereceiver can correct the data if the error detectionmechanism indicates that the data are errant.

AA SSiimmppllee EErrrroorr CCoorrrreeccttiioonn AAllggoorriitthhmmA very simple method of forward error correctionhas been developed at Linx that is suitable for manywireless data links. The data are duplicated twotimes (for a total of 3 copies) in the packet at thetransmission end. At the reception end, the firstcopy of the data in the packet is checked for errors.If there is an error, the two redundant copies of thedata in the packet are used to generate one correctversion of the data.

The correction is achieved by comparing the bits ofeach of the three copies of the data. If two or morebits are set, the corrected version has that bit set:

0 0 0 0 1 0 1 1 copy 1 (errant byte)

1 0 1 0 1 0 1 0 copy 2

1 0 1 1 1 0 1 0 copy 3 (errant copy)

------------------

1 0 1 0 1 0 1 0 corrected byte

Once all of the bytes are corrected, they should beresubmitted to the error checking procedure toverify that the corrected bytes are valid. If they arenot, then the data are uncorrectable. Otherwise thedata can be used.

HHaammmmiinngg CCooddeeHamming codes use a modification of the paritycheck to correct a single errant bit or detect 2 errantbits in a byte and they are used with great successin computer memory applications. In wireless datalinks, though, the noise tends to be bursting and willcorrupt several concurrent bits. Hamming cannotcorrect these types of errors so are probably not thebest choice for use in the 900MHz band wherehigh-power spread spectrum devices can causefrequent interference. It should be good enough forshort-range links, especially remote controlapplications that register a key press. Combinedwith repeated transmission of the packet, Hammingcan make a fairly reliable link.

Implementing Hamming is fairly straightforward. Wewill look at the case of eight data bits in a byte forthis example.

First, all of the bit positions that are powers of twoare marked as the parity bit positions. All of theother bit positions are for the data bits. Forexample, suppose we have the data byte

10100101

Spaces for the parity bits are added in the positions

AN-00160Considerations for Sending Data Over a Wireless Link Page 6

7 6 5 4 3 2 1 0

1 0 1 1 1 0 0 1

OUT

1

BIT NUMBER

DATA

GENERATOR

Figure 2: CRC Shift Register

Page 59: WIRELESS MADE SIMPLE - University of Rochester

that are a power of 2.

The parity is calculated by using modulus arithmetic(XOR logic) on the decimal number for the bitlocation of all of the data bits that are '1'. So in thisexample it would be:

3 XOR 6 XOR 10 XOR 12 = 3 = 0011

This gives us the final code word.

The receiver would then XOR the bit positions of allof the '1's:

1 XOR 2 XOR 3 XOR 6 XOR 10 XOR 12 = 0

Since the result is 0 there are no errors. Nowsuppose position 6 was switched duringtransmission, making the word:

The receiver calculates the parity as:

1 XOR 2 XOR 3 XOR 10 XOR 12 = 6

So position 6 is in error. This bit is flipped and thebyte is corrected. The receiver then removes theparity bits and the data is recovered.

If more than 2 data bits are wrong and the bytecannot be corrected and must be discarded. Moredata and parity bits can be used, but the (12,8) codeshown above is a good compromise between codeintegrity and overhead.

MMaanncchheesstteerr EEnnccooddiinnggManchester encoding is a way of combining theclock and the data of a synchronous bit stream intoone serial data stream. In this method, the bits aretransmitted as a level change in the middle of thedata bit. A data '1' is transmitted as a 0 to 1transition, and a data '0' is transmitted as a '1' to '0'transition. This is essentially an exclusive NORbetween the clock and the data as seen in Figure 3.

This is advantageous because regardless of whathappens at the bit edges, there will always be alevel change at the center of each bit, so a series of'1's or '0's will not result in the receiver seeing just aDC level. It also helps the receiver synchronize withthe transmitter by having a level change atpredictable intervals. The down side is that thefrequent level changes require more bandwidththan the original signal. So for a given data rate, theclock can operate at the maximum rate, but the datawill be half that rate. An advantage pertaining toLinx AM RF modules is that a 50% duty cycle willdraw less current than a higher duty cycle, and thatthe output power, which is averaged over time, maybe increased and still comply with FCC limits.

RReeeedd--SSoolloommoonn EEnnccooddiinnggReed-Solomon codes have the capability ofidentifying and correcting strings of errant bits. Theyare used in everything from satellite transmission toCD players to compensate for interference andphysical deformities (i.e. a scratch on a CD). Turbocodes are a way of encoding the data twice to allowfor more error correction power. These codes arevery math intensive and are generally overkill forthe applications using Linx modules, so they will notbe discussed in detail here.

EEnnccrryyppttiioonnEncryption is used to scramble a message in sucha way that anyone without the correct key will not beable to decipher the message and understand thecontent. This is done based on very complexmathematical equations that can only be solved inone way using a number called a key.

The key is known at the transmitter and receiver,but is not transmitted and is kept secret sincewithout the key, the transmission cannot bedecrypted. Due to the variety, sophistication, andmathematical complexity of encryption methods, itis often best to utilize encoder and decoder chips,such as those offered by Linx for on-offapplications. For data applications, a methodsuitable to the processing resources should bechosen.

AN-00160Considerations for Sending Data Over a Wireless Link Page 7

1 0 1 1 1 10 0

CLOCK

DATA

NCHESTER

ENCODED

DATA

Figure 3: Manchester Encoding

Position 12 11 10 9 8 7 6 5 4 3 2 1Bit 1 0 1 0 0 0 1 0 0 1 1 1

Position 12 11 10 9 8 7 6 5 4 3 2 1Bit 1 0 1 0 0 0 0 0 0 1 1 1

Position 12 11 10 9 8 7 6 5 4 3 2 1Bit 1 0 1 0 ? 0 1 0 ? 1 ? ?

Page 60: WIRELESS MADE SIMPLE - University of Rochester

CREATING A SERIAL LINK TO THE MODULESThere are several ways of creating a serial link toLinx RF modules. The modules themselves do notrequire any programming or do anything to the data,but act like a virtual wire and will simply send alongwhatever is presented to them. This means that thedata source will do all of the protocol generation, setthe baud rate, etc. Typically the data source will beone of two things, either a PC or a microcontroller.

Interfacing to a PC will happen one of two ways;through a RS232 serial port or through USB. TheRS232 specification uses large positive andnegative voltage swings to send data over longdistances. These voltage levels can damage the RFmodules, so a level converter, such as a MAX232,must be used to reduce the voltages to levelsappropriate for digital logic. These converters arecommon in industry and are made bymanufacturers such as Maxim Semiconductor,National Semiconductor, and Sipex.

Since most new computers do not have serial ports,especially laptops, Linx has developed a USBmodule. This module can interface to a PC via aUSB cable and the RF module via a PCB trace.

In either case, application software running on thetransmitter PC would generate the packetaccording to whatever protocol was used and sendthe data to the transmitter, and the receiving PCwould receive the data and decode it according tothe same protocol.

Using a microcontroller provides some morechallenges, but offers a great deal of flexibility. Themicrocontroller would create the packet and thensend the data to the RF module, then receive it anddecode it. Microcontrollers with a built in UART cansend data to the RF module via a Print statement(or similar depending on the programming languageused) and can receive from it via a Get statementand the UART will perform all of the necessaryfunctions. The actual operation may vary based onthe type of microcontroller used.

Controllers without a UART can do what is called"Bit Banging" to an output line. This is when anoutput line is toggled for a specific time to send a bitat a specific baud rate. For example, to send a '1' at

AN-00160Considerations for Sending Data Over a Wireless Link Page 8

Transmitter

Receiver

ANT

NC PDNRSSI

DATA

AREFNC

NCNC

NCNC

12345678 9

10111213141516

VCC

RXM-916-ES

4.7uF+

VCCVCC

4.7uF

+

4.7uF +

4.7uF+

4.7uF+

MAX23216

VCC15

GND1413

R1IN12

R1OUT11

T1IN10

T2IN9

R2OUT8

R2IN

7T2OUTV-

5C2-

4C2+

3C1-

2V+

1C1+

162738495

4.7uF+

VCCVCC

4.7uF

+

4.7uF +

4.7uF+

4.7uF+

MAX23216

VCC15

GND14

T1OUT13

R1IN1211

T1INT2IN

98R2IN

7T2OUT

6V-

5C2-

43

C1-

2V+

1C1+

ANT

GND

PDN

/CLKDATA

GNDLOW V DET

/CLK SEL

910

TXM-916-ES1

5 678

VCC

162738495

Figure 4: ES Series RF Modules and MAX232

ANT

GND

PDN

/CLKDATA

GNDLOW V DET

/CLK SEL

910

TXM-916-ES1

5 678

USBDPUSBDMGND DSR

DATA_INDATA_OUT

RTSCTSDTR

TX_IND

VCCSUSP_INDRX_IND

485_TX

RIDCD

12345678 9

10111213141516

ConnectorGND

GS

HD

GS

HD 4

56

SDM-USB-QS-S

VCC

VCC 220

ANTGNDNC PDN

RSSIDATA

AUDIOAREF

NCNC

GNDVCCNC

NC

NCNC

12345678 9

10111213141516

VCC

USBDPUSBDMGND DSR

DATA_INDATA_OUT

RTSCTSDTR

TX_IND

VCCSUSP_INDRX_IND

485_TX

RIDCD

12345678 9

10111213141516

5V

GS

HD

GS

HD

56

SDM-USB-QS-S

RXM-916-ES

VCC 220

USB Type BConnector

Transmitter

Receiver

Figure 5: ES Series RF Modules and QS Series USB Module

Page 61: WIRELESS MADE SIMPLE - University of Rochester

2400bps, the microcontroller will pull the line high,wait 417uS, and pull the line low. This would bedone for each bit in the packet. The wait time canchange to vary the baud rate.

One thing that the RF modules cannot do istransmit actual voltage levels since there is nophysical connection to a common reference point. Acommon reason to do this would be to send sensortelemetry. Sensors often represent pressure,temperature, flow, acceleration, etc. as a voltagelevel. Since the modules will not be able pass thisvoltage it must be represented by either afrequency (analog) or by a number (digital)

A voltage to frequency converter may be used tosend the level information in an analog form or amicrocontroller with an Analog-to-Digital Converter(ADC) can be used to convert the level to a digitalnumber. A microcontroller is most commonly usedsince it can be more accurate and many productsneed to have some intelligence on the boardanyway.

The ADC will convert the analog voltage level to adigital number that can then be packetized and sentto the RF module. Another nice feature about usingthe controller is that the controller can convert theADC number into a number that represents what isbeing measured. Since the sensor, voltage, andADC value are all typically linear in relation, theprocessor can use linear interpolation to come upwith the temperature or pressure that wasmeasured rather than just send the ADC value. Thereceiving controller would then be able to displaythe actual measurement, which would be easier tounderstand than the ADC value.

PUTTING IT ALL TOGETHERThe designer has a great deal of freedom whencreating a protocol, so it can be tailored to meet therequirements and resources of a given application.There is no magic sequence that will work for allapplications since each project will have differentbaud rates, processing speeds, and availableoverhead, so it is up to the designer to decide whatwill work best for the project and write it intosoftware. While there are many other methods ofencoding and decoding transmissions, thosecovered here are common and should give thedesigner a good starting point for the developmentof their own protocol.

AN-00160Considerations for Sending Data Over a Wireless Link Page 9

Page 62: WIRELESS MADE SIMPLE - University of Rochester

IntroductionThe SDM-USB-QS drivers allow application software to interface with the module using calls to a DLL.The drivers take care of all of the USB protocol and timing freeing the user from the complicatedfirmware development. The architecture of the drivers consists of a Windows WDM driver that com-municates with the device via the Windows USB Stack and a DLL that interfaces the ApplicationSoftware (written in C, VC++, C++ Builder, Delphi, Visual Basic etc.) to the WDM driver. This guidedocuments the interface functions and gives examples of how to use them in the application software.

There are two groups of functions. First are the standard interface functions. The standard interfaceprovides a simple, easy to use, set of functions to access the USB module. Second is the EEPROMinterface, which allows the application software to read and program the various fields in the on-boardEEPROM, including a user defined area that can be used for application specific purposes.

The examples of the calls will be shown in Visual Basic and C with Appendix A showing the headersand definitions for Visual Basic and Appendix B showing the same for C.

Standard Interface FunctionsThe standard interface functions are a series of calls made to a Dynamic Link Library (dll) that allowan application to access the module. These functions are easier to use than WIN32 API calls and offeraccess to features in the module for which there are no API calls.

A typical system would start with the FT_LISTDEVICES call. This call returns information about all ofthe modules currently connected to the bus. This allows the application software to choose whichmodule to communicate with. Before the module can be accessed it must be opened with FT_OPENor FT_OPENEX. These functions return a numeric handle that the rest of the functions use to identi-fy the individual modules. Once opened, the device communications settings can be controlled. Theseinclude functions to set the baud rate (FT_SetBaudRate), set the data characteristics, such as wordlength, stop bits and parity (FT_SetDataCharacteristics), set hardware or software handshaking(FT_SetFlowControl), set modem control signals (FT_SetDTR, FT_ClrDTR, FT_SetRTS, FT_ClrRTS),get modem status (FT_GetModemStatus), set special characters such as event and error characters(FT_SetChars), and set receive and transmit timeouts (FT_SetTimeouts). Additional functions areavailable to reset the device (FT_ResetDevice), purge receive and transmit buffers (FT_Purge), getthe receive queue status (FT_GetQueueStatus), get the device status (FT_GetStatus), set and resetthe break condition (FT_SetBreakOn, FT_SetBreakOff), and set conditions for event notification(FT_SetEventNotification). I/O is performed using FT_Read and FT_Write. Once communications arecompleted, the device is closed using FT_Close.

The rest of this section will discuss these functions in detail.

APPLICATION NOTE AN-00200SDM-USB-QS-S Programmer’s

GuideWIRELESS MADE SIMPLE ®

Page 63: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

Table of Contents

Introduction................................................................................................... 1

Standard Interface FunctionsFT_ListDevices............................................................................................. 3FT_Open....................................................................................................... 5FT_OpenEx...................................................................................................6FT_Close.......................................................................................................7FT_Read....................................................................................................... 8FT_Write....................................................................................................... 10FT_SetBaudRate.......................................................................................... 11FT_SetDataCharacteristics........................................................................... 12FT_SetFlowControl....................................................................................... 13FT_SetDTR................................................................................................... 14FT_ClrDTR....................................................................................................15FT_SetRTS................................................................................................... 16FT_ClrRTS.................................................................................................... 17FT_GetModemStatus....................................................................................18FT_SetChars.................................................................................................20FT_Purge...................................................................................................... 21FT_SetTimeouts............................................................................................22FT_GetQueueStatus..................................................................................... 23FT_SetBreakOn............................................................................................ 24FT_SetBreakOff............................................................................................ 25FT_GetStatus................................................................................................26FT_SetEventNotification............................................................................... 27FT_ResetDevice........................................................................................... 29FT_ResetPort................................................................................................30FT_StopInTask..............................................................................................31FT_RestartInTask......................................................................................... 32FT_SetResetPipeRetryCount........................................................................33

EEPROM Interface FunctionsFT_EE_UASize............................................................................................. 34FT_EE_UARead........................................................................................... 35FT_EE_UAWrite............................................................................................36FT_EE_Read................................................................................................ 37FT_EE_Program........................................................................................... 39FT_EraseEE..................................................................................................41

Header FilesQS Series Visual Basic Header File............................................................. 42QS Series C Header File.............................................................................. 45

Page 2

Page 64: WIRELESS MADE SIMPLE - University of Rochester

AN-00100SDM-USB-QS Programmer’s Guide

FT_ListDevices (Arg1, Arg2, Flags)

This function can be used to return several kinds of information. First, it can be used to return thenumber of devices currently connected to the bus by setting Flags to LIST_NUMBER_ONLY. In thiscase Arg1 holds the number of devices connected to the bus and Arg2 is null. The function returnsOK if successful or an error code if there is a problem.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnArg1 long Holds the number of devices connected to the busArg2 vbNullString Null StringFlags long Constant. See the appendicies for the definitions

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnArg1 pvoid A pointer to a dword that holds the numberArg2 Null NullFlags dword Constant. See the appendicies for the definitions

This function can also be used to return the device description or serial number by setting Flags toLIST_BY_INDEX ORd with either OPEN_BY_DESCRIPTION or OPEN_BY_SERIAL_NUMBERrespectively. In this case Arg1 is an integer to hold the index of the device and Arg2 is a string tohold the returned information. Indexes are zero-based and the error code DEVICE_NOT_FOUND isreturned for an invalid index.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnArg1 integer Holds the index number of the desired deviceArg2 string String that holds the serial number or descriptionFlags long Constant. See the appendicies for the definitions

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnArg1 dword Holds the index number of the desired deviceArg2 char A pointer to a buffer to contain the appropriate stringFlags dword Constant. See the appendicies for the definitions

EExxaammpplleessThe following Visual Basic code demonstrates how to get the number of devices connected to thebus.

Dim lngStatus As LongDim lngNumDevices As Long

lngStatus = FT_GetNumDevices (lngNumDevices, vbNullString, LIST_NUMBER_ONLY)If lngStatus = OK Then

‘The function was successful, the number of devices connected is in lngNumDevicesElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

Page 3

Page 65: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

This example shows how to get the description and serial number of the first device on the bus.

Dim intIndex As IntegerDim strDescription As String * 256Dim strSerialNumber As String * 256

intIndex = 0' Get the device descriptionlngStatus = FT_ListDevices (intIndex, strDescription, LIST_BY_INDEX Or OPEN_BY_DESCRIPTION)If lngStatus = OK Then

‘The function was successful, the description is in strDescriptionElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

' Get the device serial numberlngStatus = FT_ListDevices (intIndex, strSerialNumber, LIST_BY_INDEX Or OPEN_BY_SERIAL_NUMBER)If lngStatus = OK Then

‘The function was successful, the serial number is in strSerialNumberElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

Note that incrementing index will access the next device on the bus. If multiple devices will be con-nected, ListDevices can first be used to return the number of devices, then this number used to setthe exit condition of a loop. The loop can increment the index and return the information for eachdevice in turn. Following is the C code to perform the same routines as above.

ULONG Status; DWORD NumDevices;

Status = FT_ListDevices (&numDevs, NULL, LIST_NUMBER_ONLY); if (Status == OK) {

// The function was successful, the number of devices connected is in NumDevices} else {

// The function failed. The error code can be reviewed and appropriate corrective action taken}

DWORD devIndex = 0; char Description[256]; char SerialNumber[256];

Status = FT_ListDevices ((PVOID)devIndex, Description, LIST_BY_INDEX | OPEN_BY_DESCRIPTION); if (Status == OK) {

// The function was successful, the description is in Description} else {

// The function failed. The error code can be reviewed and appropriate corrective action taken}

Status = FT_ListDevices ((PVOID)devIndex, SerialNumber, LIST_BY_INDEX | OPEN_BY_SERIAL_NUMBER); if (Status == OK) {

// The function was successful, the serial number is in SerialNumber} else {

// The function failed. The error code can be reviewed and appropriate corrective action taken}

Page 4

Page 66: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_Open (Device, Handle)

This function opens a device and returns a numeric handle that is used by the other functions toidentify the device. Device is the index number of the device to be opened and Handle is a numberthat the function returns to uniquely identify the device so that other functions can access it. Sincethe index number of the device is used to open it so there is no ability to open a specific nameddevice, but FT_OPEN_EX can open a device using the description or serial number. If the functionexecutes successfully then it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnDevice integer Index number of the device to be openedHandle long A number that uniquely identifies the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnDevice integer Index number of the device to be openedHandle pvoid A pointer to a number that uniquely identifies the device

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As Long

lngStatus = FT_Open (0, lngHandle);If lngStatus = OK Then

‘The function was successful, the handle of device 0 is in lngHandleElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;

Status = FT_Open (0, &Handle); if (Status == OK) {

// The function was successful, the handle of device 0 is in Handle } else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 5

Page 67: WIRELESS MADE SIMPLE - University of Rochester

AN-00100SDM-USB-QS Programmer’s Guide

FT_OpenEx (Arg1, Flags, Handle)

This function will open a specific device using either a serial number or description and return anumeric handle that is used by other functions to access the device. Arg1 will be a string that con-tains either the serial number or description of the device to be opened. Flags is eitherOPEN_BY_SERIAL_NUMBER or OPEN_BY_DESCRIPTION and determines whether the serialnumber or description is used. Handle is a number that the function returns to uniquely identify thedevice so that other functions can access it. If the function executes successfully then it will returnOK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnArg1 string String of the description or serial numberFlags integer Constant. See the appendicies for the definitionsHandle long A number that uniquely identifies the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnArg1 pvoid A pointer to a null terminated stringFlags integer Constant. See the appendicies for the definitionsHandle pvoid A pointer to a number that uniquely identifies the device

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As LongDim strSerialNumber As String * 256

lngStatus = FT_OpenEx (strSerialNumber, OPEN_BY_SERIAL_NUMBER, lngHandle)If lngStatus = OK Then

‘The function was successful, the device’s handle is in lngHandleElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;

Status = FT_OpenEx ("LT000001", OPEN_BY_SERIAL_NUMBER, &Handle); if (Status == OK) {

// The function was successful, the device with serial number LT000001 is open and the handle is in Handle} else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 6

Page 68: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_Close (Handle)

This function closes communication with an open device identified by Handle. If the function exe-cutes successfully then it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the device

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As Long

lngStatus = FT_Close (lngHandle)If lngStatus = OK Then

‘The function was successful, the device is closedElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;

Status = FT_Close (&Handle); if (Status == OK) {

// The function was successful, the device is closed} else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 7

Page 69: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_Read (Handle, Buffer, BytesToRead, BytesReturned)

This function reads the data available from the device. Handle is a number returned by FT_Open orFT_OpenEx, Buffer is a string or character array that receives the data read from the device,BytesToRead is the number of bytes the function should read, and BytesReturned is the actual num-ber of bytes that were read. If the function executes successfully then it will return OK otherwise itwill return an error code.

This function does not return until BytesToRead bytes have been read into the buffer. This cancause an application to hang while waiting for the function to return. There are two ways to avoidthis. The first is to get the number of bytes in the device’s receive queue by calling FT_GetStatus orFT_GetQueueStatus, and passing this to FT_Read as BytesToRead so that the function reads thedevice and returns immediately.

The second way is by specifying a timeout in a previous call to FT_SetTimeouts. FT_Read returnswhen the timer expires or when BytesToRead bytes have been read, whichever occurs first. If thetimeout occurred, FT_Read reads the available data into the buffer and returns OK.

An application should use the function return value and BytesReturned to check the buffer. If thereturn value is OK and BytesReturned is equal to BytesToRead then FT_Read has completed suc-cessfully. If the return value is OK and BytesReturned is less than BytesToRead then a timeout hasoccurred and the read has been only partially completed. Note that if a timeout occurred and nodata was read, the return value is still OK.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceBuffer string String to hold the data read from the deviceBytesToRead long The number of bytes to read from the deviceBytesReturned long The number of bytes that were read from the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceBuffer lpvoid A pointer to a char array to hold the data read from the deviceBytesToRead dword The number of bytes to read from the deviceBytesReturned lpdword A pointer to a dword that gets the number of bytes read

EExxaammpplleessThe following Visual Basic code demonstrates this function. FT_GetStatus is called and the numberof bytes available in the device is checked. If it is greater than zero, then FT_Read is called to getthe data.

Dim lngHandle As LongDim lngStatus As LongDim lngBytesRead As LongDim strReadBuffer As String * 256Dim lngRXBytes As LongDim lngTXBytes As LongDim lngEvents As Long

Page 8

Page 70: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

If FT_GetStatus (lngHandle, lngRXBytes, lngTXBytes, lngEvents) = OK ThenIf lngRXBytes > 0 Then

lngStatus = FT_Read (lngHandle, strReadBuffer, lngRXBytes, lngBytesRead)If (lngStatus = OK) Then

‘The function was successful, the data is in strReadBuffer and lngBytesRead has the number of bytes read Else

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

End IfEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;DWORD Event; DWORD RxBytes; DWORD TxBytes; DWORD BytesReceived; char RxBuffer[256];

FT_GetStatus (ftHandle, &RxBytes, &TxBytes, &Event); if (RxBytes > 0) {

Status = FT_Read (Handle, RxBuffer, RxBytes, &BytesReceived); if (Status == OK) {

// The function was successful, the data is in RxBuffer and BytesReceived has the number of bytes read } else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

}

Page 9

Page 71: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_Write (Handle, Buffer, BytesToWrite, BytesWritten)

This function writes BytesToWrite bytes of Buffer to the device described by Handle and returnsBytesWritten as the number of bytes that it actually wrote. If the function executes successfully thenit will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceBuffer string String to hold the data to be written to the deviceBytesToWrite long The number of bytes to write to the deviceBytesWritten long The number of bytes that were written to the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceBuffer lpvoid A pointer to a char array to hold the data read from the deviceBytesToWrite dword The number of bytes to read from the deviceBytesWritten lpdword A pointer to a dword that gets the number of bytes read

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As LongDim strWriteBuffer As StringDim lngBytesWritten As LongDim lngBytesToWrite As Long

lngBytesToWrite = 1 'Sets the number of bytes to write to 1

lngStatus = FT_Write (lngHandle, strWriteBuffer, lngBytesToWrite, lngBytesWritten)If lngStatus <> OK Then

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status; DWORD BytesToWrite; DWORD BytesWritten; char WriteBuffer[256];char *Buff;

Buff = WriteBuffer;BytesToWrite = 1; // Sets the number of bytes to write to 1

Status = FT_Write (Handle, Buff, BytesToWrite, &BytesWritten); if (Status != OK) {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 10

Page 72: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_SetBaudRate (Handle, BaudRate)

This function sets the baud rate of the device described by Handle to BaudRate. If the function exe-cutes successfully then it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceBaudRate single The baud rate in bits per second

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceBaudRate dword The baud rate in bits per second

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As LongDim sngBaudRate As Single

sngBaudRate = 9600 '9600bps baud

lngStatus = FT_SetBaudRate (lngHandle, sngBaudRate)If lngStatus = OK Then

‘The function was successful, the baud rate is set to sngBaudRateElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status; DWORD BaudRate;

BaudRate = 9600;Status = FT_SetBaudRate (Handle, BaudRate);if (Status == OK) {

// The function was successful, the baud rate is set to BaudRate } else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 11

Page 73: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_SetDataCharacteristics (Handle, WordLength, StopBits, Parity)

This function sets the data characteristics for the device described by Handle. It will set the streamto have WordLength number of bits in each word, StopBits number of stop bits, and Parity parity.WordLength must be either BITS_8 or BITS_7. StopBits must be either STOP_BITS_1 orSTOP_BITS_2. Parity can be PARITY_NONE, PARITY_ODD, PARITY_EVEN, PARITY_MARK, orPARITY_SPACE. All of these variables are defined in the header files in the appendicies. If thefunction executes successfully then it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceWordLength integer A number representing the number of bits in each wordStopBits integer A number representing the number of stop bits in each wordParity integer A number representing the type of parity used in each word

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceWordLength uchar A number representing the number of bits in each wordStopBits uchar A number representing the number of stop bits in each wordParity uchar A number representing the type of parity used in each word

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As LongDim intStops As Integer = STOP_BITS_1Dim intParity As Integer = PARITY_NONEDim intDataBits As Integer = BITS_8

lngStatus = FT_SetDataCharacteristics (lngHandle, intDataBits, intStops, intParity)If lngStatus = OK Then

‘The function was successful, the data is set to intDataBits data bits, intStops stop bits, and intParity parityElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;UCHAR WordLength = BITS_8;UCHAR StopBits = STOP_BITS_1;UCHAR Parity = PARITY_NONE;

Status = FT_SetDataCharacteristics (Handle, WordLength, StopBits, Parity);if (Status == OK) {

// The function was successful, the data is set to WordLength data bits, StopBits stop bits, and Parity parity } else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 12

Page 74: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_SetFlowControl (Handle, FlowControl, Xon, Xoff)

This function will set the flow control for the device described by Handle. FlowControl must beFLOW_NONE, FLOW_RTS_CTS, FLOW_DTR_DSR, or FLOW_XON_XOFF. All of these variablesare defined in the header files in the appendicies. Xon is the character used to signal XON, and Xoffis the character used to signal XOFF. These are only used if FlowControl is set toFLOW_XON_XOFF, otherwise they are set to zero or null. If the function executes successfully thenit will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceFlowControl single A number representing the type of flow controlXon string A character that signals XONXoff string A character that signals XOFF

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceFlowControl ushort A number representing the type of flow controlXon uchar A character that signals XONXoff uchar A character that signals XOFF

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As Long

lngStatus = FT_SetFlowControl (lngHandle, FLOW_NONE, 0, 0)If lngStatus = OK Then

‘The function was successful, the flow control is set to FlowControl and the XON and XOFF characters are set Else

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;USHORT FlowControl = FT_FLOW_NONE;UCHAR XonChar = 0;UCHAR XoffChar = 0;

Status = FT_SetFlowControl (Handle, FlowControl, XonChar, XoffChar);if (Status == OK) {

// The function was successful, the flow control is set to FlowControl and the XON and XOFF characters are set } else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 13

Page 75: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_SetDTR (Handle)

This function sets the Data Terminal Ready control line. This can be used for handshaking when theflow control is set to FLOW_DTR_DSR, or it can be used to control external circuitry. If the functionexecutes successfully then it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the device

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As Long

lngStatus = FT_SetDTR (lngHandle)If lngStatus = OK Then

‘The function was successful, the DTR line is set Else

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;

Status = FT_SetDTR (Handle);if (Status == OK) {

// The function was successful, the DTR line is set } else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 14

Page 76: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_ClrDTR (Handle)

This function clears the Data Terminal Ready control line. This can be used for handshaking whenthe flow control is set to FLOW_DTR_DSR, or it can be used to control external circuitry. If the func-tion executes successfully then it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the device

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As Long

lngStatus = FT_ClrDTR (lngHandle)If lngStatus = OK Then

‘The function was successful, the DTR line is cleared Else

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;

Status = FT_ClrDTR (Handle);if (Status == OK) {

// The function was successful, the DTR line is cleared } else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 15

Page 77: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_SetRTS (Handle)

This function sets the Request To Send control line. This can be used for handshaking when theflow control is set to FLOW_RTS_CTS, or it can be used to control external circuitry. If the functionexecutes successfully then it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the device

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As Long

lngStatus = FT_SetRTS (lngHandle)If lngStatus = OK Then

‘The function was successful, the RTS line is set Else

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;

Status = FT_SetRTS (Handle);if (Status == OK) {

// The function was successful, the RTS line is set } else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 16

Page 78: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_ClrRTS (Handle)

This function clears the Request To Send control line. This can be used for handshaking when theflow control is set to FLOW_RTS_CTS, or it can be used to control external circuitry. If the functionexecutes successfully then it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the device

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As Long

lngStatus = FT_ClrRTS (lngHandle)If lngStatus = OK Then

‘The function was successful, the RTS line is cleared Else

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;

Status = FT_ClrRTS (Handle);if (Status == OK) {

// The function was successful, the RTS line is cleared } else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 17

Page 79: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_GetModemStatus (Handle, ModemStatus)

This function is used to determine the state of the input control lines, CTS, DSR, RI, and CDC. If thefunction executes successfully then it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceModemStatus long A variable that receives a number representing the modem status

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceModemStatus lpdword A pointer to a dword variable that receives the modem status

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As LongDim lngModemStatus As Long

lngStatus = FT_GetModemStatus (lngHandle, lngModemStatus)If (lngModemStatus And MODEM_STATUS_CTS) = MODEM_STATUS_CTS Then

‘CTS is highElse

‘CTS is lowEnd IfIf (lngModemStatus And MODEM_STATUS_DSR) = MODEM_STATUS_DSR Then

‘DSR is highElse

‘DSR is lowEnd IfIf (lngModemStatus And MODEM_STATUS_DCD) = MODEM_STATUS_DCD Then

‘DCD is highElse

‘DCD is lowEnd IfIf (lngModemStatus And MODEM_STATUS_RI) = MODEM_STATUS_RI Then

‘RI is highElse

‘RI is lowEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;DWORD ModemStatus;

Status = FT_GetModemStatus (Handle, &ModemStatus);if ((ModemStatus & MODEM_STATUS_CTS) == MODEM_STATUS_CTS) {

// CTS is high } else {

// CTS is low

Page 18

Page 80: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

} if ((ModemStatus & MODEM_STATUS_DSR) == MODEM_STATUS_DSR) {

// DSR is high } else {

// DSR is low } if ((ModemStatus & MODEM_STATUS_DCD) == MODEM_STATUS_DCD) {

// DCD is high } else {

// DCD is low } if ((ModemStatus & MODEM_STATUS_RI) == MODEM_STATUS_RI) {

// RI is high } else {

// RI is low }

Page 19

Page 81: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_SetChars (Handle, EventCh, EventChEn, ErrorCh, ErrorChEn )

This function sets the special characters for the device. If the function executes successfully then itwill return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceEventCh string Event characterEventChEn string 0 if the event character is disabled, non-zero otherwiseErrorCh string Error characterErrorChEn string 0 if the error character is disabled, non-zero otherwise

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceEventCh uchar Event characterEventChEn uchar 0 if the event character is disabled, non-zero otherwiseErrorCh uchar Error characterErrorChEn uchar 0 if the error character is disabled, non-zero otherwise

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As LongDim strEventCh As StringDim strEventChEn As StringDim strErrorCh As StringDim strErrorChEn As String

lngStatus = FT_SetChars (lngHandle, strEventCh, strEventChEn, strErrorCh, strErrorChEn)If lngStatus = OK Then

‘The function was successful, the RTS line is cleared Else

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;UCHAR EventCh;UCHAR EventChEn;UCHAR ErrorCh;UCHAR ErrorChEn;

Status = FT_SetChars (Handle, EventCh, EventChEn, ErrorCh, ErrorChEn); if (Status == OK) {

// The function was successful, } else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 20

Page 82: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_Purge (ftHandle, Mask)

This function purges receive and transmit buffers in the device. If the function executes successfullythen it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceMask long Any combination of PURGE_RX and PURGE_TX

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceMask dword Any combination of PURGE_RX and PURGE_TX

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As LongDim lngMask As Long

lngMask = PURGE_RX Or PURGE_TX

lngStatus = FT_Purge (lngHandle, lngMask)If lngStatus = OK Then

‘The function was successful, the receive and transmit buffers have been clearedElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;DWORD Mask;

Mask = PURGE_RX | PURGE_TX;

Status = FT_Purge (Handle, Mask);if (Status == OK) {

// The function was successful, the receive and transmit buffers have been cleared } else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 21

Page 83: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_SetTimeouts (Handle, ReadTimeout, WriteTimeout)

This function sets the read and write timeouts for the device. If the function executes successfullythen it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceReadTimeout long Read timeout in millisecondsWriteTimeout long Write timeout in milliseconds

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceReadTimeout dword Read timeout in millisecondsWriteTimeout dword Write timeout in milliseconds

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As Long

lngStatus = FT_SetTimeouts (lngHandle, 5000, 1000)If lngStatus = OK Then

‘The function was successful, the read timeout is set to 5 seconds and the write timeout is set to 1 secondElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;

Status = FT_SetTimeouts (Handle, 5000, 1000); if (Status == OK) {

// The function was successful, the read timeout is set to 5 seconds and the write timeout is set to 1 second } else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 22

Page 84: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_GetQueueStatus (Handle, AmountInRxQueue )

This function gets the number of characters currently in the receive queue and places the value inAmountInRxQueue. This function can be called and the value in AmountInRxQueue can be passedto FT_Read as BytesToRead so that the Read function will read the receive buffer and return imme-diately. If the function executes successfully then it will return OK otherwise it will return an errorcode.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceAmountInRxQueue long Receives the number of characters in the receive queue

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceAmountInRxQueue lpdword A pointer to a dword that gets the number of characters available

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As LongDim lngAnountInRxQueue as Long

lngStatus = FT_GetQueueStatus (lngHandle, lngAnountInRxQueue)If lngStatus = OK Then

‘The function was successful, the number of characters in the receive queue is in lngAnountInRxQueueElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;DWORD AnountInRxQueue;

Status = FT_GetQueueStatus (Handle, &AnountInRxQueue); if (Status == OK) {

// The function was successful, the number of characters in the receive queue is in AnountInRxQueue } else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 23

Page 85: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_SetBreakOn (Handle)

This function sets the break condition for the device. If the function executes successfully then it willreturn OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the device

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As Long

lngStatus = FT_SetBreakOn (lngHandle)If lngStatus = OK Then

‘The function was successful, the break condition is setElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;

Status = FT_SetBreakOn (Handle); if (Status == OK) {

// The function was successful, the break condition is set } else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 24

Page 86: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_SetBreakOff (Handle)

This function resets the break condition for the device. If the function executes successfully then itwill return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the device

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As Long

lngStatus = FT_SetBreakOff (lngHandle)If lngStatus = OK Then

‘The function was successful, the break condition is resetElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;

Status = FT_SetBreakOff (Handle); if (Status == OK) {

// The function was successful, the break condition is reset } else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 25

Page 87: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_GetStatus (Handle, AmountInRxQueue, AmountInTxQueue, EventStatus)

This function gets the status of the device. AmountInRxQueue gets the number of characters in thereceive queue, AmountInTxQueue gets the number of characters in the transmit queue, andEventStatus gets a combination of EVENT_RXCHAR if a character is received andEVENT_MODEM_STATUS if the modem lines change states. If the function executes successfullythen it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceAmountInRxQueue long Gets the number of bytes in the receive queueAmountInTxQueue long Gets the number of bytes in the transmit queueEventStatus long Gets a value of an event or returns zero

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceAmountInRxQueue lpdword A pointer to a dword that gets the amount in the receive queueAmountInTxQueue lpdword A pointer to a dword that gets the amount in the transmit queueEventStatus lpdword A pointer to a dword that gets the event status

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As LongDim lngAmountInRxQueue As LongDim lngAmountInTxQueue As LongDim lngEventStatus As Long

lngStatus = FT_GetStatus (lngHandle, lngAmountInRxQueue, lngAmountInTxQueue, lngEventStatus)If lngStatus = OK Then

‘The function was successfulElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;DWORD AmountInRxQueue;DWORD AmountInTxQueue;DWORD EventStatus;

Status = FT_GetStatus (Handle, &AmountInRxQueue, &AmountInTxQueue, &EventStatus); if (Status == OK) {

// The function was successful} else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 26

Page 88: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_SetEventNotification (Handle, EventMask, Arg)

This function will set the events that the device should look for. EventMask is any combination ofEVENT_RXCHAR and EVENT_MODEM_STATUS. EVENT_RXCHAR will cause the event to be setwhen a character has been received, and EVENT_MODEM_STATUS will cause the event to be setwhen the modem lines change. Arg is the handle of an event that has been created by the applica-tion. This function can be used by an application to set up conditions that allow a thread to blockuntil one of the conditions is met. Typically, an application will create an event, call this function,then block on the event. When the conditions are met, the event is set, and the application threadunblocked. If the function executes successfully then it will return OK otherwise it will return an errorcode.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceEventMask long Bit map describing the conditions that cause the event to be setArg long The handle of an event

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceEventMask dword Bit map describing the conditions that cause the event to be setArg pvoid The handle of an event

EExxaammpplleessThe following Visual Basic code demonstrates this function. First, an event is created and the func-tion is called.

Const INFINITE As Long = 1000 '&HFFFFFFFFDim lngHandle As LongDim lngStatus As LongDim lngEventMask As LongDim lngEvent As LongDim lngModemStatus As Long

lngEvent = CreateEvent (0, False, False, "")lngEventMask = EVENT_RXCHAR Or EVENT_MODEM_STATUSlngStatus = FT_SetEventNotification (lngHandle, lngEventMask, lngEvent)

'This will wait for the event to trigger and release the objectlngStatus = WaitForSingleObject (lngEvent, INFINITE)

‘Call FT_GetModemStatus to determine what caused the eventlngStatus = FT_GetModemStatus (lngHandle, lngModemStatus)If (lngModemStatus And MODEM_STATUS_CTS) = MODEM_STATUS_CTS Then

‘CTS is highElse

‘CTS is lowEnd IfIf (lngModemStatus And MODEM_STATUS_DSR) = MODEM_STATUS_DSR Then

‘DSR is highElse

‘DSR is low

Page 27

Page 89: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

End IfIf (lngModemStatus And MODEM_STATUS_DCD) = MODEM_STATUS_DCD Then

‘DCD is highElse

‘DCD is lowEnd IfIf (lngModemStatus And MODEM_STATUS_RI) = MODEM_STATUS_RI Then

‘RI is highElse

‘RI is lowEnd If

The following C code demonstrates this function. First, an event is created and the function is called.

#define INFINITE 1000PVOID Handle; ULONG Status;PVOID Event; DWORD EventMask;DWORD ModemStatus;

Event = CreateEvent (NULL, false, false, "" ); EventMask = EVENT_RXCHAR | EVENT_MODEM_STATUS; Status = FT_SetEventNotification (Handle, EventMask, Event);

// This will wait for the event to trigger and release the objectWaitForSingleObject (Event, INFINITE);

// Call FT_GetModemStatus to determine what caused the eventStatus = FT_GetModemStatus (Handle, &ModemStatus);if ((ModemStatus & MODEM_STATUS_CTS) == MODEM_STATUS_CTS) {

// CTS is high } else {

// CTS is low } if ((ModemStatus & MODEM_STATUS_DSR) == MODEM_STATUS_DSR) {

// DSR is high } else {

// DSR is low } if ((ModemStatus & MODEM_STATUS_DCD) == MODEM_STATUS_DCD) {

// DCD is high } else {

// DCD is low } if ((ModemStatus & MODEM_STATUS_RI) == MODEM_STATUS_RI) {

// RI is high } else {

// RI is low }

Page 28

Page 90: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_ResetDevice (Handle)

This function will reset the device described by Handle. If the function executes successfully then itwill return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the device

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As Long

lngStatus = FT_ResetDevice (lngHandle)If lngStatus = OK Then

‘The function was successful, the device is resetElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;

Status = FT_ResetDevice (Handle); if (Status == OK) {

// The function was successful, the device is reset} else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 29

Page 91: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_ResetPort (Handle)

This function will send a reset command to the port in an attempt to recover the port after a failure.If the function executes successfully then it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the device

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As Long

lngStatus = FT_ResetPort (lngHandle)If lngStatus = OK Then

‘The function was successful, the port is resetElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;

Status = FT_ResetPort (Handle); if (Status == OK) {

// The function was successful, the port is reset} else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 30

Page 92: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_StopInTask (Handle)

This function is used to put the driver's IN task (read) into a wait state. It can be used in situationswhere data is being received continuously so that the device can be purged without more data beingreceived. It is used together with FT_RestartInTask, which sets the IN task running again. If thefunction executes successfully then it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the device

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As Long

DolngStatus = FT_StopInTask (lngHandle)

Loop While lngStatus <> OK

‘Do something, for example purge the device

DolngStatus = FT_RestartInTask (lngHandle)

Loop While lngStatus <> OK

The following C code demonstrates this function.

PVOID Handle; ULONG Status;

do {Status = FT_StopInTask (Handle);

} while (Status != OK);

// Do something, for example purge device

do {Status = FT_RestartInTask (Handle);

} while (Status != OK);

Page 31

Page 93: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_RestartInTask (Handle)

This function is used to restart the driver's IN task (read) after it has been stopped by a call toFT_StopInTask. If the function executes successfully then it will return OK otherwise it will return anerror code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the device

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As Long

DolngStatus = FT_StopInTask (lngHandle)

Loop While lngStatus <> OK

‘Do something, for example purge device

DolngStatus = FT_RestartInTask (lngHandle)

Loop While lngStatus <> OK

The following C code demonstrates this function.

PVOID Handle; ULONG Status;

do {Status = FT_StopInTask (Handle);

} while (Status != OK);

// Do something, for example purge device

do {Status = FT_RestartInTask (Handle);

} while (Status != OK);

Page 32

Page 94: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_SetResetPipeRetryCount (Handle, Count)

This function is used to set the ResetPipeRetryCount. ResetPipeRetryCount controls the maximumnumber of times that the driver tries to reset a pipe on which an error has occurred.ResetPipeRequestRetryCount defaults to 50. It may be necessary to increase this value in noisyenvironments where a lot of USB errors occur. If the function executes successfully then it will returnOK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceCount long Contains the maximum number of times to try to reset the pipe

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceCount dword Contains the maximum number of times to try to reset the pipe

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As LongDim lngRetryCount As Long

lngRetryCount = 100lngStatus = FT_SetResetPipeRetryCount (lngHandle, lngRetryCount)If lngStatus = OK Then

‘The function was successful, ResetPipeRetryCount is set to 100Else

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;DWORD RetryCount;

RetryCount = 100;Status = FT_SetResetPipeRetryCount (Handle, RetryCount);if (Status == OK) {

// The function was successful, ResetPipeRetryCount is set to 100}else {

// The function failed. The error code can be reviewed and appropriate corrective action taken}

Page 33

Page 95: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

EEPROM Interface FunctionsThe EEPROM interface functions allow the application to access the on-board EEPROM. This can beuseful in production to allow the programming of the device description as a part of the final produc-tion test. In addition, the application can use the free area to store a small amount of information.

FT_EE_UASize (Handle, Size)

This function determines the size of the User Area in the EEPROM and returns the number of bytesfree in Size. This is the largest amount of data that can be stored in the EEPROM by the application.If the function executes successfully then it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceSize long A variable that gets the size of the free area in bytes

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceSize lpdword A pointer to a variable that gets the size of the free area in bytes

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As LongDim lngSize As Long

lngStatus = FT_EE_UASize (lngHandle, lngSize)If lngStatus = OK Then

‘The function was successful, Size contains the number of bytes free in the EEPROMElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;DWORD Size;

Status = FT_EE_UASize (Handle, &Size); if (Status == OK) {

// The function was successful, Size contains the number of bytes free in the EEPROM}else {

// The function failed. The error code can be reviewed and appropriate corrective action taken}

Page 34

Page 96: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_EE_UARead (Handle, Data, DataLen, BytesRead)

This function will read the data in the User Area on the EEPROM. Data contains the data that wasread by the function, DataLen is the size of the string or character array that receives the data, andBytesRead is the actual number of bytes that were read. If DataLen is less than the size of the UA,then only DataLen bytes are read into the buffer. Otherwise, the entire UA is read into the buffer. Ifthe function executes successfully then it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceData string A buffer that holds the data from the User AreaDataLen long A variable that holds the number of bytes to be read from the UABytesRead long A variable that holde the actual number of bytes read from the UA

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceData puchar A pointer to a buffer that holds the data from the User AreaDataLen dword A variable that holds the number of bytes to be read from the UABytesRead lpdword A pointer to a variable that receives teh number of bytes read

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As LongDim strData As String * 64Dim lngDataLen As LongDim lngBytesRead As Long

lngDataLen = 64lngStatus = FT_EE_UARead (lngHandle, strData, lngDataLen, lngBytesRead)If lngStatus = OK Then

‘The function was successful, strData holds lngBytesRead bytes of data read from the UA on the EEPROMElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;CHAR Data[64];DWORD DataLen;DWORD BytesRead;

DataLen = 64;Status = FT_EE_UARead (Handle, Data, DataLen, &BytesRead); if (Status == OK) {

// The function was successful, Data holds BytesRead bytes of data read from the UA on the EEPROM }else {

// The function failed. The error code can be reviewed and appropriate corrective action taken}

Page 35

Page 97: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_EE_UAWrite (Handle, Data, DataLen)

This function will write the information contained in Data to the User Area in the EEPROM. DataLencontains the amount of data to be written. If the function executes successfully then it will return OKotherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceData string A buffer that holds the data from the User AreaDataLen long A variable that holds the number of bytes to be read from the UA

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceData puchar A pointer to a buffer that holds the data from the User AreaDataLen dword A variable that holds the number of bytes to be read from the UA

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As LongDim strData As String * 64Dim lngDataLen As Long

lngDataLen = 64lngStatus = FT_EE_UAWrite (lngHandle, strData, lngDataLen)If lngStatus = OK Then

‘The function was successful, the UA on the EEPROM contains strDataElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;CHAR Data[64];DWORD DataLen;

DataLen = 64;Status = FT_EE_UAWrite (Handle, &Data, DataLen); if (Status == OK) {

// The function was successful, the UA on the EEPROM contains Data }else {

// The function failed. The error code can be reviewed and appropriate corrective action taken}

Page 36

Page 98: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_EE_Read (Handle, Data)

This function will read the contents of the programmed section of the EEPROM and place the infor-mation into data structure Data. The type definition for Data is included in the header files at the endof this document. The function does not perform any checks on buffer sizes, so the buffers passedin the PROGRAM_DATA structure must be big enough to accommodate their respective strings(including null terminators). The sizes shown in the following example are more than adequate andcan be rounded down if necessary. The restriction is that the Manufacturer string length plus theDescription string length is less than or equal to 40 characters. If the function executes successfullythen it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceData structure A structure of type PROGRAM_DATA

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceData structure A pointer to a structure of type PROGRAM_DATA

EExxaammpplleessUsing this function in Visual Basic becomes complicated because the PROGRAM_DATA structurecontains only POINTERS to bytearrays. This means that the variables Manufacturer,ManufacturerID, Description and SerialNumber are passed as POINTERS to the locations of bytear-rays. Each Byte in these arrays will be filled with one character of the whole string. Visual Basic sup-ports getting the addresses of pointers, however the functions to do so are undocumented. For moreinformation on how to get pointers to variables in Visual Basic, see Microsoft Knowledge BaseArticle Q199824. The function used in this example is VarPtr, which returns the address of a vari-able. The following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As LongDim EEData As PROGRAM_DATA

'Bytearrays as "string-containers":Dim bManufacturer(32) As ByteDim bManufacturerID(16) As ByteDim bDescription(64) As ByteDim bSerialNumber(16) As Byte

'Use an undocumented function to return a pointerEEData.Manufacturer = VarPtr (bManufacturer(0))EEData.ManufacturerId = VarPtr (bManufacturerID(0))EEData.Description = VarPtr (bDescription(0))EEData.SerialNumber = VarPtr (bSerialNumber(0))

lngStatus = FT_EE_Read (lngHandle, EEData)If lngStatus = OK Then

‘The function was successful, the information in the EEPROM is in EEData‘Convert the resulting bytearrays to strings (NULL-characters at the end are cut off)strManufacturer = StrConv (bManufacturer, vbUnicode)strManufacturer = Left (strManufacturer, InStr (strManufacturer, Chr(0)) - 1)

Page 37

Page 99: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

strManufacturerID = StrConv (bManufacturerID, vbUnicode)strManufacturerID = Left (strManufacturerID, InStr (strManufacturerID, Chr(0)) - 1)

strDescription = StrConv (bDescription, vbUnicode)strDescription = Left (strDescription, InStr (strDescription, Chr(0)) - 1)

strSerialNumber = StrConv (bSerialNumber, vbUnicode)strSerialNumber = Left (strSerialNumber, InStr (strSerialNumber, Chr(0)) - 1)

Else‘The function failed. The error code can be reviewed and appropriate corrective action taken

End If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;PROGRAM_DATA EEData;char ManufacturerBuf[32]; char ManufacturerIdBuf[16]; char DescriptionBuf[64]; char SerialNumberBuf[16];

EEData.Manufacturer = ManufacturerBuf; EEData.ManufacturerId = ManufacturerIdBuf; EEData.Description = DescriptionBuf; EEData.SerialNumber = SerialNumberBuf;

Status = FT_EE_Read (Handle, &EEData); if (Status == OK) {

// The function was successful, the information in the EEPROM is in EEData }else {

// The function failed. The error code can be reviewed and appropriate corrective action taken}

Page 38

Page 100: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_EE_Program (Handle, Data)

This function will write the contents of structure Data to the EEPROM. The type definition for Data isincluded in the header files at the end of this document. If the SerialNumber field inPROGRAM_DATA is NULL, or SerialNumber points to a NULL string, a serial number based on theManufacturerId and the current date and time will be generated. If the function executes successfullythen it will return OK otherwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the deviceData structure A structure of type PROGRAM_DATA

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the deviceData structure A pointer to a structure of type PROGRAM_DATA

EExxaammpplleessUsing this function in Visual Basic becomes complicated because the PROGRAM_DATA structurecontains only POINTERS to bytearrays. This means that the variables Manufacturer,ManufacturerID, Description and SerialNumber are passed as POINTERS to the locations of bytear-rays. Each Byte in these arrays will be filled with one character of the whole string. Visual Basic sup-ports getting the addresses of pointers, however the functions to do so are undocumented. For moreinformation on how to get pointers to variables in Visual Basic, see Microsoft Knowledge BaseArticle Q199824. The function used in this example is VarPtr, which returns the address of a vari-able. The following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As LongDim EEData As PROGRAM_DATADim strManufacturer As StringDim strManufacturerID As StringDim strDescription As StringDim strSerialNumber As String

'Declare byte arrays as "string-containers":Dim bManufacturer(32) As ByteDim bManufacturerID(16) As ByteDim bDescription(64) As ByteDim bSerialNumber(16) As Byte

'Load the stringsstrManufacturer = "Linx Technologies"strManufacturerID = "LT"strDescription = "LINX SDM-USB-QS-S"strSerialNumber = ""

'Load the EEData structure with the default dataEEData.VendorId = 0x0403EEData.ProductId = 0xF448EEData.MaxPower = 100EEData.PnP = 1EEData.SelfPowered = 0

Page 39

Page 101: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

EEData.RemoteWakeup = 1EEData.Rev4 = TRUEEEData.IsoIn = TRUEEEData.IsoOut = TRUEEEData.PullDownEnable = TRUEEEData.SerNumEnable = FALSEEEData.USBVersionEnable = FALSEEEData.USBVersion = 0

'Use an undocumented function to return a pointerEEData.Manufacturer = VarPtr(bManufacturer(0))EEData.ManufacturerId = VarPtr(bManufacturerID(0))EEData.Description = VarPtr(bDescription(0))EEData.SerialNumber = VarPtr(bSerialNumber(0))

'Convert the strings to byte arraysStringToByteArray (strManufacturer, bManufacturer)StringToByteArray (strManufacturerID, bManufacturerID)StringToByteArray (strDescription, bDescription)StringToByteArray (strSerialNumber, bSerialNumber)

'Now write the complete set of EEPROM datalngStatus = FT_EE_Program (lngHandle, EEData)If lngStatus = OK Then

‘The function was successful, the information in the EEPROM is in EEDataElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

‘This function will convert a string to a byte arrayPrivate Sub StringToByteArray (strString, bByteArray)Dim lngN As Long'Fill bByteArray with "0":For lngN = 0 To UBound (bByteArray)

bByteArray (lngN) = 0NextFor lngN = 1 To Len(strString)

bByteArray(lngN - 1) = Asc(Mid(strString, lngN, 1))NextEnd Sub

The following C code demonstrates this function.

PVOID Handle; ULONG Status;PROGRAM_DATA EEData;

// Load the EEData structure with the default dataEEData = {0x0403, 0xF449, "Linx Technologies", "LT", "LINX SDM-USB-QS-S", "", 44, 1, 0, 1, TRUE, TRUE, TRUE,TRUE, FALSE, FALSE, 0}

Status = FT_EE_Program (Handle, &EEData); if (Status == OK) {

// The function was successful, the information in EEData is in the EEPROM}else {

// The function failed. The error code can be reviewed and appropriate corrective action taken}

Page 40

Page 102: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

FT_EraseEE (Handle)

This function will erase the EEPROM. If the function executes successfully then it will return OK oth-erwise it will return an error code.

VViissuuaall BBaassiiccPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle long A number that uniquely identifies the device

CCPPaarraammeetteerr TTyyppee DDeessccrriippttiioonnHandle pvoid A pointer to a number that uniquely identifies the device

EExxaammpplleessThe following Visual Basic code demonstrates this function.

Dim lngHandle As LongDim lngStatus As Long

lngStatus = FT_EraseEE (lngHandle)If lngStatus = OK Then

‘The function was successful, the EEPROM has been erasedElse

‘The function failed. The error code can be reviewed and appropriate corrective action takenEnd If

The following C code demonstrates this function.

PVOID Handle; ULONG Status;

Status = FT_EraseEE (Handle); if (Status == OK) {

// The function was successful, the EEPROM has been erased} else {

// The function failed. The error code can be reviewed and appropriate corrective action taken }

Page 41

Page 103: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

Appendix AQS Series Visual Basic Header FileThis appendix contains the Visual Basic header file that contains all of the function and constant def-initions covered in this guide. This text can be copied and pasted into a module in the user’s VisualBasic project.'****************************************************************************************************************************************************************************' Function declarations'****************************************************************************************************************************************************************************Public Declare Function FT_ListDevices Lib "FTD2XX.DLL" (ByVal arg1 As Long, ByVal arg2 As String, ByVal dwFlags As Long) As LongPublic Declare Function FT_Open Lib "FTD2XX.DLL" (ByVal intDeviceNumber As Integer, ByRef lngHandle As Long) As LongPublic Declare Function FT_OpenEx Lib "FTD2XX.DLL" (ByVal arg1 As String, ByVal arg2 As Long, ByRef lngHandle As Long) As LongPublic Declare Function FT_Close Lib "FTD2XX.DLL" (ByVal lngHandle As Long) As LongPublic Declare Function FT_Read Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByVal lpszBuffer As String, ByVal lngBufferSize As Long,_

ByRef lngBytesReturned As Long) As LongPublic Declare Function FT_Write Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByVal lpszBuffer As String, ByVal lngBufferSize As Long,_

ByRef lngBytesWritten As Long) As LongPublic Declare Function FT_SetBaudRate Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByVal lngBaudRate As Long) As LongPublic Declare Function FT_SetDataCharacteristics Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByVal byWordLength As Byte,_

ByVal byStopBits As Byte, ByVal byParity As Byte) As LongPublic Declare Function FT_SetFlowControl Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByVal intFlowControl As Integer, ByVal byXonChar As Byte,_

ByVal byXoffChar As Byte) As LongPublic Declare Function FT_SetDtr Lib "FTD2XX.DLL" (ByVal lngHandle As Long) As LongPublic Declare Function FT_ClrDtr Lib "FTD2XX.DLL" (ByVal lngHandle As Long) As LongPublic Declare Function FT_SetRts Lib "FTD2XX.DLL" (ByVal lngHandle As Long) As LongPublic Declare Function FT_ClrRts Lib "FTD2XX.DLL" (ByVal lngHandle As Long) As LongPublic Declare Function FT_GetModemStatus Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByRef lngModemStatus As Long) As LongPublic Declare Function FT_SetChars Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByVal byEventChar As Byte, ByVal byEventCharEnabled As Byte,_

ByVal byErrorChar As Byte, ByVal byErrorCharEnabled As Byte) As LongPublic Declare Function FT_Purge Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByVal lngMask As Long) As LongPublic Declare Function FT_SetTimeouts Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByVal lngReadTimeout As Long,_

ByVal lngWriteTimeout As Long) As LongPublic Declare Function FT_GetQueueStatus Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByRef lngRXBytes As Long) As LongPublic Declare Function FT_SetBreakOn Lib "FTD2XX.DLL" (ByVal lngHandle As Long) As LongPublic Declare Function FT_SetBreakOff Lib "FTD2XX.DLL" (ByVal lngHandle As Long) As LongPublic Declare Function FT_GetStatus Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByRef lngRXBytes As Long, ByRef lngTXBytes As Long,_

ByRef lngEventsDWord As Long) As LongPublic Declare Function FT_ResetDevice Lib "FTD2XX.DLL" (ByVal lngHandle As Long) As Long

' New FunctionsPublic Declare Function FT_SetEventNotification Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByVal dwEventMask As Long, ByVal Arg As Long)_

As LongPublic Declare Function FT_ResetPort Lib "FTD2XX.DLL" (ByVal lngHandle As Long) As LongPublic Declare Function FT_RestartInTask Lib "FTD2XX.DLL" (ByVal lngHandle As Long) As LongPublic Declare Function FT_StopInTask Lib "FTD2XX.DLL" (ByVal lngHandle As Long) As LongPublic Declare Function FT_SetResetPipeRetryCount Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByVal lngCount As Long) As Long

'****************************************************************************************************************************************************************************' EEPROM programming function declarations'****************************************************************************************************************************************************************************Public Declare Function FT_EE_Program Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByRef lpData As PROGRAM_DATA) As LongPublic Declare Function FT_EE_Read Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByRef lpData As PROGRAM_DATA) As LongPublic Declare Function FT_EE_UARead Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByVal pucData As String, ByVal dwDataLen As Long,_

ByRef lpdwBytesRead As Long) As LongPublic Declare Function FT_EE_UAWrite Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByVal pucData As String, ByVal dwDataLen As Long) As LongPublic Declare Function FT_EE_UASize Lib "FTD2XX.DLL" (ByVal lngHandle As Long, ByRef lpdwSize As Long) As LongPublic Declare Function FT_EraseEE Lib "FTD2XX.DLL" (ByVal lngHandle As Long) As Long

'****************************************************************************************************************************************************************************' Supporting functions for conversion from C to Visual Basic'****************************************************************************************************************************************************************************' Used instead of FT_ListDevices to get the number of devices on the busPublic Declare Function FT_GetNumDevices Lib "FTD2XX.DLL" Alias "FT_ListDevices" (ByRef arg1 As Long, ByVal arg2 As String,_

ByVal dwFlags As Long) As Long

'****************************************************************************************************************************************************************************' Constant Declarations'****************************************************************************************************************************************************************************

Page 42

Page 104: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide' Return codesPublic Const OK = 0Public Const INVALID_HANDLE = 1Public Const DEVICE_NOT_FOUND = 2Public Const DEVICE_NOT_OPENED = 3Public Const IO_ERROR = 4Public Const INSUFFICIENT_RESOURCES = 5Public Const INVALID_PARAMETER = 6Public Const INVALID_BAUD_RATE = 7

Public Const DEVICE_NOT_OPENED_FOR_ERASE = 8Public Const DEVICE_NOT_OPENED_FOR_WRITE = 9Public Const FAILED_TO_WRITE_DEVICE = 10Public Const EEPROM_READ_FAILED = 11Public Const EEPROM_WRITE_FAILED = 12Public Const EEPROM_ERASE_FAILED = 13Public Const EEPROM_NOT_PRESENT = 14Public Const EEPROM_NOT_PROGRAMMED = 15Public Const INVALID_ARGS = 16Public Const OTHER_ERROR = 17

' Flow ControlPublic Const FLOW_NONE = &H0Public Const FLOW_RTS_CTS = &H100Public Const FLOW_DTR_DSR = &H200Public Const FLOW_XON_XOFF = &H400

' Purge rx and tx buffersPublic Const PURGE_RX = 1Public Const PURGE_TX = 2

' Flags for FT_OpenExPublic Const OPEN_BY_SERIAL_NUMBER = 1Public Const OPEN_BY_DESCRIPTION = 2

' Flags for FT_ListDevicesPublic Const LIST_BY_NUMBER_ONLY = &H80000000Public Const LIST_BY_INDEX = &H40000000Public Const LIST_ALL = &H20000000

' Modem StatusPublic Const MODEM_STATUS_CTS = &H10Public Const MODEM_STATUS_DSR = &H20Public Const MODEM_STATUS_RI = &H40Public Const MODEM_STATUS_DCD = &H80

' Event MasksPublic Const EVENT_RXCHAR = 1Public Const EVENT_MODEM_STATUS = 2

' Baud RatesPublic Const BAUD_300 = 300Public Const BAUD_600 = 600Public Const BAUD_1200 = 1200Public Const BAUD_2400 = 2400Public Const BAUD_4800 = 4800Public Const BAUD_9600 = 9600Public Const BAUD_14400 = 14400Public Const BAUD_19200 = 19200Public Const BAUD_38400 = 38400Public Const BAUD_57600 = 57600Public Const BAUD_115200 = 115200Public Const BAUD_230400 = 230400Public Const BAUD_460800 = 460800Public Const BAUD_921600 = 921600

' Word LengthsPublic Const BITS_8 = 8Public Const BITS_7 = 7Public Const BITS_6 = 6

Page 43

Page 105: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s GuidePublic Const BITS_5 = 5

' Stop BitsPublic Const STOP_BITS_1 = 0Public Const STOP_BITS_1_5 = 1Public Const STOP_BITS_2 = 2

' ParityPublic Const PARITY_NONE = 0Public Const PARITY_ODD = 1Public Const PARITY_EVEN = 2Public Const PARITY_MARK = 3Public Const PARITY_SPACE = 4

' Type declaration for EEPROM programmingPublic Type PROGRAM_DATA

VendorId As Integer '0x0403ProductId As Integer '0xF448Manufacturer As Long '32 "Linx Technologies"ManufacturerId As Long '16 "LT"Description As Long '64 "LINX SDM-USB-QS-S"SerialNumber As Long '16 "LT000001" if fixed, or NULLMaxPower As Integer '0 < MaxPower <= 500PNP As Integer '0 = disabled, 1 = enabledSelfPowered As Integer '0 = bus powered, 1 = self poweredRemoteWakeup As Integer '0 = not capable, 1 = capable' Rev4 extensions:Rev4 As Byte 'true if Rev4 chip, false otherwiseIsoIn As Byte 'true if in endpoint is isochronousIsoOut As Byte 'true if out endpoint is isochronousPullDownEnable As Byte 'true if pull down enabledSerNumEnable As Byte 'true if serial number to be usedUSBVersionEnable As Byte 'true if chip uses USBVersionUSBVersion As Integer 'BCD (0x0200 => USB2)

End Type

Page 44

Page 106: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide

Appendix BQS Series C Header FileThis appendix contains the C header file that contains all of the function and constant definitions cov-ered in this guide. This text can be copied and pasted into a module in the user’s C project.#ifndef FTD2XX_H #define FTD2XX_H

// The following ifdef block is the standard way of creating macros // which make exporting from a DLL simpler. All files within this DLL // are compiled with the FTD2XX_EXPORTS symbol defined on the command line. // This symbol should not be defined on any project that uses this DLL. // This way any other project whose source files include this file see // FTD2XX_API functions as being imported from a DLL, whereas this DLL // sees symbols defined with this macro as being exported.

#ifdef FTD2XX_EXPORTS #define FTD2XX_API __declspec(dllexport) #else #define FTD2XX_API __declspec(dllimport) #endif

typedef PVOID HANDLE; typedef ULONG STATUS;

//***************************************************************************************************************************************************************************//Function declarations//***************************************************************************************************************************************************************************FTD2XX_API STATUS WINAPI FT_ListDevices (PVOID pArg1, PVOID pArg2, DWORD Flags); FTD2XX_API STATUS WINAPI FT_Open (int deviceNumber, HANDLE *pHandle);FTD2XX_API STATUS WINAPI FT_OpenEx (PVOID pArg1, DWORD Flags, HANDLE *pHandle);FTD2XX_API STATUS WINAPI FT_Close (HANDLE Handle);FTD2XX_API STATUS WINAPI FT_Read (HANDLE Handle, LPVOID lpBuffer, DWORD nBufferSize, LPDWORD lpBytesReturned);FTD2XX_API STATUS WINAPI FT_Write (HANDLE Handle, LPVOID lpBuffer, DWORD nBufferSize, LPDWORD lpBytesWritten);FTD2XX_API STATUS WINAPI FT_SetBaudRate (HANDLE Handle, ULONG BaudRate);FTD2XX_API STATUS WINAPI FT_SetDataCharacteristics (HANDLE Handle, UCHAR WordLength, UCHAR StopBits, UCHAR Parity);FTD2XX_API STATUS WINAPI FT_SetFlowControl (HANDLE Handle, USHORT FlowControl, UCHAR XonChar, UCHAR XoffChar);FTD2XX_API STATUS WINAPI FT_SetDtr (HANDLE Handle);FTD2XX_API STATUS WINAPI FT_ClrDtr (HANDLE Handle);FTD2XX_API STATUS WINAPI FT_SetRts (HANDLE Handle);FTD2XX_API STATUS WINAPI FT_ClrRts (HANDLE Handle);FTD2XX_API STATUS WINAPI FT_GetModemStatus (HANDLE Handle, ULONG *pModemStatus);FTD2XX_API STATUS WINAPI FT_SetChars (HANDLE Handle, UCHAR EventChar, UCHAR EventCharEnabled, UCHAR ErrorChar, UCHAR

ErrorCharEnabled);FTD2XX_API STATUS WINAPI FT_Purge (HANDLE Handle, ULONG Mask);FTD2XX_API STATUS WINAPI FT_SetTimeouts (HANDLE Handle, ULONG ReadTimeout, ULONG WriteTimeout);FTD2XX_API STATUS WINAPI FT_GetQueueStatus (HANDLE Handle, DWORD *dwRxBytes);FTD2XX_API STATUS WINAPI FT_SetBreakOn (HANDLE Handle);FTD2XX_API STATUS WINAPI FT_SetBreakOff (HANDLE Handle);FTD2XX_API STATUS WINAPI FT_GetStatus (HANDLE Handle, DWORD *dwRxBytes, DWORD *dwTxBytes, DWORD *dwEventDWord);FTD2XX_API STATUS WINAPI FT_ResetDevice (HANDLE Handle);

FTD2XX_API STATUS WINAPI FT_SetEventNotification (HANDLE Handle, DWORD Mask, PVOID Param);FTD2XX_API STATUS WINAPI FT_ResetPort (HANDLE Handle);FTD2XX_API STATUS WINAPI FT_RestartInTask (HANDLE Handle);FTD2XX_API STATUS WINAPI FT_StopInTask (HANDLE Handle);FTD2XX_API STATUS WINAPI FT_SetResetPipeRetryCount (HANDLE Handle, DWORD dwCount);

//***************************************************************************************************************************************************************************//EEPROM function declarations//***************************************************************************************************************************************************************************FTD2XX_API STATUS WINAPI FT_EE_Program (HANDLE Handle, PPROGRAM_DATA pData);FTD2XX_API STATUS WINAPI FT_EE_Read (HANDLE Handle, PPROGRAM_DATA pData);FTD2XX_API STATUS WINAPI FT_EE_UARead (HANDLE Handle, PUCHAR pucData, DWORD dwDataLen, LPDWORD lpdwBytesRead);FTD2XX_API STATUS WINAPI FT_EE_UAWrite (HANDLE Handle, PUCHAR pucData, DWORD dwDataLen);FTD2XX_API STATUS WINAPI FT_EE_UASize (HANDLE Handle, LPDWORD lpdwSize);FTD2XX_API STATUS WINAPI FT_EraseEE (HANDLE Handle);

Page 45

Page 107: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide//***************************************************************************************************************************************************************************//Constant Declarations//***************************************************************************************************************************************************************************'//Return codesenum {

OK, INVALID_HANDLE, DEVICE_NOT_FOUND, DEVICE_NOT_OPENED, IO_ERROR, INSUFFICIENT_RESOURCES, INVALID_PARAMETER, INVALID_BAUD_RATE,

DEVICE_NOT_OPENED_FOR_ERASE, DEVICE_NOT_OPENED_FOR_WRITE, FAILED_TO_WRITE_DEVICE, EEPROM_READ_FAILED, EEPROM_WRITE_FAILED, EEPROM_ERASE_FAILED, EEPROM_NOT_PRESENT, EEPROM_NOT_PROGRAMMED, INVALID_ARGS, OTHER_ERROR

};

// Flow Control #define FLOW_NONE 0x0000 #define FLOW_RTS_CTS 0x0100 #define FLOW_DTR_DSR 0x0200 #define FLOW_XON_XOFF 0x0400

// Purge rx and tx buffers#define PURGE_RX 1#define PURGE_TX 2

// FT_OpenEx Flags#define OPEN_BY_SERIAL_NUMBER 1#define OPEN_BY_DESCRIPTION 2

// FT_ListDevices Flags (used in conjunction with FT_OpenEx Flags)#define LIST_NUMBER_ONLY 0x80000000#define LIST_BY_INDEX 0x40000000#define LIST_ALL 0x20000000#define LIST_MASK (LIST_NUMBER_ONLY | LIST_BY_INDEX | LIST_ALL)

// Modem Status#define MODEM_STATUS_CTS &H10#define MODEM_STATUS_DSR &H20#define MODEM_STATUS_RI &H40#define MODEM_STATUS_DCD &H80

// Event Masks#define EVENT_RXCHAR 1#define EVENT_MODEM_STATUS 2

// Baud Rates#define BAUD_300 300#define BAUD_600 600#define BAUD_1200 1200#define BAUD_2400 2400#define BAUD_4800 4800#define BAUD_9600 9600#define BAUD_14400 14400#define BAUD_19200 19200#define BAUD_38400 38400#define BAUD_57600 57600#define BAUD_115200 115200#define BAUD_230400 230400#define BAUD_460800 460800

Page 46

Page 108: WIRELESS MADE SIMPLE - University of Rochester

AN-00200SDM-USB-QS Programmer’s Guide#define BAUD_921600 921600

// Word Lengths#define BITS_8 (UCHAR) 8#define BITS_7 (UCHAR) 7#define BITS_6 (UCHAR) 6#define BITS_5 (UCHAR) 5

// Stop Bits#define STOP_BITS_1 (UCHAR) 0#define STOP_BITS_1_5 (UCHAR) 1#define STOP_BITS_2 (UCHAR) 2

// Parity#define PARITY_NONE (UCHAR) 0#define PARITY_ODD (UCHAR) 1#define PARITY_EVEN (UCHAR) 2#define PARITY_MARK (UCHAR) 3#define PARITY_SPACE (UCHAR) 4

// Type declaration for EEPROM programmingtypedef struct PROGRAM_DATA {

WORD VendorId; // 0x0403WORD ProductId; // 0xF448char *Manufacturer; // 32, "Linx Technologies"char *ManufacturerId; // 16, "LT"char *Description; // 64 "LINX SDM-USB-QS-S"char *SerialNumber; // 16 "LT000001" if fixed, or NULLWORD MaxPower; // 0 < MaxPower <= 500WORD PnP; // 0 = disabled, 1 = enabledWORD SelfPowered; // 0 = bus powered, 1 = self poweredWORD RemoteWakeup; // 0 = not capable, 1 = capable// Rev4 extensionsUCHAR Rev4; // true if Rev4 chip, false otherwiseUCHAR IsoIn; // true if in endpoint is isochronousUCHAR IsoOut; // true if out endpoint is isochronousUCHAR PullDownEnable; // true if pull down enabledUCHAR SerNumEnable; // true if serial number to be usedUCHAR USBVersionEnable; // true if chip uses USBVersionWORD USBVersion; // BCD (0x0200 => USB2)

} PROGRAM_DATA, *PPROGRAM_DATA;

Page 47

Page 109: WIRELESS MADE SIMPLE - University of Rochester

APPLICATION NOTE AN-00201 Installing the SDM-USB-QS-S

Drivers

IntroductionThe Linx SDM-USB-QS-S module requires that device drivers be installed on the host PC before theycan interact. The drivers tell the PC how to talk to the module. The CDM drivers for the QS Seriesmodule actually install two different drivers at the same time, one for communicating directly with themodule from an application via a set of application functions and one that makes the USB module looklike an additional COM port to the PC.

The drivers are available for download from the Linx Technologies web site,www.linxtechnologies.com or www.instantusb.com.

The functions for accessing the USB module directly are described in detail in the Programmer’sGuide, AN-00200, which is also available for download on the Linx web site.

Installing the DriversThe drivers may be downloaded from the Linx web site (www.linxtechnologies.com orwww.instantusb.com) and should be saved onto the hard drive of a PC or onto a floppy disk. They arealso included on the CD that is included with Linx Master Development Systems. When the module isattached to the PC for the first time Windows will automatically detect the device and launch the FoundNew Hardware Wizard, as shown below. Note that the image on the left is from Windows XP and theimage on the right is from Windows Vista.

Windows XP asks if it can search on the internet for an appropriate driver, so select “No, not this time”and click “Next.” On Windows Vistata, click “Locate and install driver software” to begin the driverinstallation and bring up the screen shown below.

WIRELESS MADE SIMPLE ®

Figure 1: Installing the Drivers

Page 110: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

Make sure that the CD with the drivers is in the CD ROM drive. For Windows XP, select “Install thesoftware automatically” and click “Next.” For Windows Vista, click “Next.” If the drivers are not on aCD, then Windows may ask you to browse to the drivers on the hard drive. Browse to the drivers andclick “Next”. Both Windows XP and Windows Vista may show the warning below.

This window is simply a warning that the driver has not gone through Microsoft’s certification processand could potentially pose a problem for the system. The drivers provided for the QS module havebeen independantly tested and should not pose any problems unless modified by the user. Click the“Continue Anyway” or “Install this driver software anyway” button and a finish screen will appear.

Page 2

Figure 2: Installing the Drivers

Figure 3: Installing the Drivers

Page 111: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

Click “Finish” or “Close” and the second installation will begin automatically. This second installationhas the same procedures as the first installation.

For XP, select “No, not this time” and click “Next.” For Vista, click “Next.”

Page 3

Figure 4: Installing the Drivers

Figure 5: Installing the Drivers

Page 112: WIRELESS MADE SIMPLE - University of Rochester

Click “Continue Anyway” or “Install this driver software anyway.”

Click “Finish” or “Close” and the driver installation is complete. A baloon will pop up in the task bar onthe lower right of the screen indicating that the hardware is ready for use.

Uninstalling the DriversUninstalling the drivers is acomplished through the Windows Device Manager. To open the DeviceManager, click on the Start button and select Control Panel. Select System from the Control Panel listand select the Hardware tab. Click the Device Manager button to open the Device Manager window.

AN-00201Installing the SDM-USB-QS-S Drivers Page 4

Figure 7: Installing the Drivers

Figure 6: Installing the Drivers

Figure 8: Installing the Drivers

Page 113: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

The Linx SDM-USM-QS-S module is listed under the Ports and Universal Serial Bus Controllersheadings. The COM port drivers should be uninstalled before the USB drivers. To uninstall the COMport driver, right click on Linx SDM-USM-QS-S listing under the Ports header and select “Uninstall”.

Page 5

Figure 9: Installing the Drivers

Page 114: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

A confirmation box will be displayed to confirm that you want to uninstall the drivers.

Page 6

Figure 10: Installing the Drivers

Page 115: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

Click “OK” and the drivers will be uninstalled. The procedure for uninstalling the USB drivers isidentical.

Page 7

Figure 11: Installing the Drivers

Page 116: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

Legacy DriversThe CDM drivers have replaced both the Direct Drivers and the Virtual COM Port drivers. Thefollowing instructions are included for legacy devices, though new devices should use the new drivers.It should be noted that the Direct Drivers and the Virtual COM Port drivers are not tested for use withWindows Vista or later operating systems.

There are two different drivers for Windows 98, NT, 2000, and XP and one set for Linux. The first setfor Windows are the direct drivers, which offer a set of program functions that allow a customapplication to directly control the module through the USB port. These functions are

The other set of drivers and the set for Linux are Virtual COM Port drivers that make the module looklike an additional serial port to the PC, but they will route the data to the USB port instead of the COMport. These drivers make upgrading legacy devices very easy as no additional software is required,just selection of the appropriate COM port.

Only one set of drivers can be used at a time. This means that only one set of drivers can be installedon the PC or that one set of drivers must be completely uninstalled before another one can be used.

Installing The Direct DriversThe drivers are included with the module’s development system or may be downloaded from the Linxweb site (www.linxtechnologies.com or www.instantusb.com) and should be saved onto the hard driveof a PC or onto a floppy disk. When the module is attached to the PC for the first time Windows willautomatically detect the device and launch the Found New Hardware Wizard, as shown below.

Click “Next” to begin the driver installation and bring up the screen shown below.

Page 8

Figure 12: Installing the Drivers

Page 117: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

This screen will tell Windows to either search for a driver or to let the user select a specific driver.Select “Search for a suitable driver for my device” and click “Next”.

This screen will tell Windows where to look for the drivers. If they were downloaded and saved onto afloppy disk, load that disk into a drive and check the “Floppy Disk Drives” box. If the QS MasterDevelopment Kit software CD is available, load the CD into the CDROM drive and check the “CD-ROMdrives” box. If the drivers were downloaded onto the hard drive, then check “Specify a location”. Click“Next” to continue.

Page 9

Figure 14: Installing the Drivers

Figure 13: Installing the Drivers

Page 118: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

If the “Specify a location” box was checked, then Windows will display the screen in Figure 4. This willallow the user to browse to the location of the drivers on the computer’s hard drive. Once there, click“OK” to continue.

If Windows was able to find the drivers in the selected location, then the screen in Figure 5 will bedisplayed. Click “Next” to install the drivers. Once the installation has completed, the screen below willbe displayed.

Page 10

Figure 16: Installing the Drivers

Figure 15: Installing the Drivers

Page 119: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

Click “Finish” to complete the installation process. This installation was for Windows 2000, butWindows 98, NT and XP will be similar.

Windows XP may return an error window shown in the figure below.

This window is simply a warning that the driver has not gone through Microsoft’s certification processand could potentially pose a problem for the system. The drivers provided for the QS module havebeen independantly tested and should not pose any problems unless modified by the user. Click the“Continue Anyway” button to finish the installation process.

After installing the drivers Windows may ask to be rebooted. Click “NO” and reenumerate the moduleby unpluging the cable and plug it back in. Most communication errors with the QS module can besolved in this way.

Installing The Virtual COM Port DriversThe installation of the Virtual COM Port (VCP) Drivers has two parts. The first part proceeds exactlyas described for the Direct Drivers, but the VCP drivers require the installation of an additional serialport. Immediately after the the first installation concludes, the port installation will begin with the screenbelow.

Page 11

Figure 18: Windows XP Driver Error Window

Figure 17: Installing the Drivers

Page 120: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

This installation will proceed exactly as the first installation and Windows should be directed to thesame file location as before. Once this installation is complete, Windows may ask to be rebooted. USBdevices can be added and removed on the fly, but serial ports cannot. Once the computer has beenrestarted, a new serial port named “USB Serial Port (COMx)” will appear in Windows Device Manager.The x will be a number representing the lowest available COM port number on the computer.

Double click on USB Serial Port in the list to open the Properties window shown below.

Page 12

Figure 20: USB Serial Port In Windows Device Manager

Figure 19: USB Serial Port Installation

Page 121: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

This window allows the COM port settings to be adjusted to suit a particular application. Clicking onthe “Advanced” button will open the Advanced Properties window.

The default settings will usually be sufficient for proper operation, but the values can be changed tooptimize the performance of a specific application. Of particular interest is the ability to change theCOM port number of the module. This is done simply by selecting the desired number from the dropdown list at the top of the window. Be sure to select a port that is currently open otherwise conflictscould occur that potentialy make the computer unstable. If “COM4” were selected from the list and“OK” pressed on both properties windows, then the Device Manager window will now show “USBSerial Port” as COM4.

Page 13

Figure 22: USB Serial Port Advanced Properties

Figure 21: USB Serial Port Properties

Page 122: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

Installing the Linux DriversFirst, download the latest kernel, which at the time of this writing is 2.4.25 from www.kernel.org. It isalso included on the Master Development Kit CD. Untar the kernel.

$ tar xjf linux-2.4.25.tar.bz2

Patch the ftdi_sio driver.

$ cd linux-2.4.25$ patch -p1 </mnt/cdrom/linux/2.4.25-patch

Make sure the ftdi_sio driver is enabled in the kernel config. The option is namedCONFIG_USB_SERIAL_FTDI_SIO and is located here:

USB Support -->

USB Serial Converter Support -->

USB FTDI Single Port Serial Driver

Configure, compile and install kernel as documented in the Kernel-HOWTO(www.tldp.org/HOWTO/Kernel-HOWTO/) then reboot into the new kernel.

Load the ftdi_sio driver

# modprobe ftdi_sio

Plug the device into the USB port. The driver will attach the device to the next available USB serialport, i.e. /dev/ttyUSB0 or /dev/ttyUSB1. If you are using devfs this will be /dev/usb/tts/0. The devicecan now be accessed just like any standard serial port. See the Serial-Programming-HOWTO fordetails (www.tldp.org/HOWTO/Serial-Programming-HOWTO/).

Page 14

Figure 23: USB Serial Port In Windows Device Manager

Page 123: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

Uninstalling The DriversUninstalling the drivers begins the same for the Direct and Virtual COM Port drivers. Select“Add/Remove Programs” from the Windows Control Panel. Scroll down until the listing for the driver isfound. Selecting the driver causes the “Change/Remove” button to be shown, as seen in Figure 13.

Click the “Change/Remove” button to open the uninstaller window.

If the QS module is plugged in, unplug it and click “Continue”. Once the drivers are removed theuninstaller will display that the process is complete.

Click “Finish” to close the window and the USB drivers have been successfully removed. If the VirtualCOM port drivers were used, then the USB Serial Port must also be removed. Select “Add/Remove

Page 15

Figure 25: Uninstaller Window

Figure 26: Uninstaller Window

Figure 24: Add/Remove Programs Window

Page 124: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

Hardware” from the Windows Control Panel to start the Add/Remove Hardware Wizard.

Click “Next”. The next window will tell the wizard what task to perform.

Select “Uninstall/Unplug a device” and click “Next”.

Page 16

Figure 28: Uninstaller Window

Figure 29: Uninstaller Window

Figure 27: Uninstaller Window

Page 125: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

Select “Uninstall a device” and click “Next”.

Check the “Show hidden devices” box and scroll through the list until “USB Serial Port” is found. Selectthis item and click “Next”.

Confirm that you want to remove the serial port by selecting “Yes, I want to uninstall this device” andclick “Next”. The computer will uninstall the USB Serial Port and then display the finished screen.

Page 17

Figure 31: Uninstaller Window

Figure 30: Uninstaller Window

Page 126: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

Click “Finish” to complete the process. At this point the drivers are completely removed.

Modifying The .inf FilesWindows will use the data in the .inf files to load the drivers and to display the device in the WindowsDevice Manager screen. This file can be changed so that Device Manager will show the name of theproduct rather than “LINX SDM-USB-QS-S”. Follow the instructions below for the appropriate drivers.

The Direct Drivers

Open the ftd2xx.inf file with any text editor, such as Notepad, scroll to the bottom of the page, andlocate the [Strings] tag. It will look like the list below:

[Strings]Ftdi="Linx"USB\VID_0403&PID_6001.DeviceDesc="Linx Blank QS Device"USB\VID_0403&PID_F448.DeviceDesc="LINX SDM-USB-QS-S"USB\VID_0403&PID_F449.DeviceDesc="Master Development 2.0"FTD2XX.SvcDesc="Linx USB Drivers"WINUN="Software\Microsoft\Windows\CurrentVersion\Uninstall"DriversDisk="Linx USB Drivers Disk"

The fourth line shown above can be changed from “LINX SDM-USB-QS-S” to the product’s name,which will then be shown in Windows Device Manager. The lines below change the product’s name to“New Widget”:

[Strings]Ftdi="Linx"USB\VID_0403&PID_6001.DeviceDesc="Linx Blank QS Device"USB\VID_0403&PID_F448.DeviceDesc="New Widget"USB\VID_0403&PID_F449.DeviceDesc="Master Development 2.0"FTD2XX.SvcDesc="Linx USB Drivers"WINUN="Software\Microsoft\Windows\CurrentVersion\Uninstall"DriversDisk="Linx USB Drivers Disk"

Save the files and install the drivers as described above. The new product name should now be shownin Windows Device Manager. Do not make any other changes to the files as it could result in systemerrors and instability.

The Virtual COM Port Drivers

The VCP drivers have two .inf files that need to be modified, FTDIBUS.inf and FTDIPORT.inf. First,open the ftdibus.inf file with a text editor, scroll to the bottom of the page, and locate the [Strings] tag.

Page 18

Figure 32: Uninstaller Window

Page 127: WIRELESS MADE SIMPLE - University of Rochester

AN-00201Installing the SDM-USB-QS-S Drivers

It will look like the list below:[Strings]Ftdi="Linx"DriversDisk="Linx USB Drivers Disk"USB\VID_0403&PID_8372.DeviceDesc="USB Serial Converter"USB\VID_0403&PID_6001.DeviceDesc="Linx Blank QS Device"USB\VID_0403&PID_F448.DeviceDesc="Linx SDM-USB-QS-S"USB\VID_0403&PID_F449.DeviceDesc="Master Development 2.0"WINUN="Software\Microsoft\Windows\CurrentVersion\Uninstall"FtdiBus.SvcDesc="USB Serial Converter Driver"

The sixth shown above can be changed from “LINX SDM-USB-QS-S” to the product’s name, whichwill then be shown in Windows Device Manager. The lines below change the product’s name to “NewWidget”:

[Strings]Ftdi="Linx"DriversDisk="Linx USB Drivers Disk"USB\VID_0403&PID_8372.DeviceDesc="USB Serial Converter"USB\VID_0403&PID_6001.DeviceDesc="Linx Blank QS Device"USB\VID_0403&PID_F448.DeviceDesc="New Widget"USB\VID_0403&PID_F449.DeviceDesc="Master Development 2.0"WINUN="Software\Microsoft\Windows\CurrentVersion\Uninstall"FtdiBus.SvcDesc="USB Serial Converter Driver"

Next, open the ftdiport.inf file and find the [Strings] tag:[Strings]FTDI="Linx"DriversDisk="Linx USB Drivers Disk"PortsClassName = "Ports (COM & LPT)"VID_0403&PID_8372.DeviceDesc="USB Serial Port"VID_0403&PID_6001.DeviceDesc="USB Serial Port"VID_0403&PID_F448.DeviceDesc="USB Serial Port"VID_0403&PID_F449.DeviceDesc="USB Serial Port"FtdiPort.SvcDesc="USB Serial Port Driver"SerEnum.SvcDesc="Serenum Filter Driver"

The seventh line above can be altered to display the new name. The lines below change the prodct’sname to “New Widget”:

[Strings]FTDI="Linx"DriversDisk="Linx USB Drivers Disk"PortsClassName = "Ports (COM & LPT)"VID_0403&PID_8372.DeviceDesc="USB Serial Port"VID_0403&PID_6001.DeviceDesc="USB Serial Port"VID_0403&PID_F448.DeviceDesc="New Widget"VID_0403&PID_F449.DeviceDesc="USB Serial Port"FtdiPort.SvcDesc="USB Serial Port Driver"SerEnum.SvcDesc="Serenum Filter Driver"

Save the files and install the drivers as described above. The new product name should now be shownin Windows Device Manager. Do not make any other changes to the files as it could result in systemerrors and instability.

Page 19

Page 128: WIRELESS MADE SIMPLE - University of Rochester

peak power can be achieved during the carrier-present portion of the data stream. For a 50% dutycycle square wave, it can be assumed that thetransmitter will be on half the time, and, therefore,the transmitter can transmit at twice the peak outputpower. In cases where several “1” bits are sent in arow, the duty cycle of the wave form can increasesignificantly, also increasing the average outputpower of the transmitter. If the designer wishes touse the maximum output power available, he/shemust first analyze the potential data streams todetermine the most restrictive duty cycle and thendesign the antenna/attenuator accordingly.

This form of modulation also offers another benefitnot inherent to its FM counterparts: it allows datarates from DC (or 0Hz) up to the maximum data rateof 4,800 bits/second.

Depending on the antenna and the overall codebalance used, the output power of the LC Seriestransmitter can potentially violate FCC regulations.The output power is intentionally set high as werealize the designer will likely use an inefficientantenna to cut cost or save space and may use lowMark-to-Space code ratios. By providing this powermargin, the designer can still realize the maximumoutput power allowed by the FCC using cheap,inefficient antennas or precisely match moreefficient systems using an attenuation pad asdescribed in Application note AN-00150.

DATA IN VS. DATA OUTOne of the most important points for a designer toconsider is how the original data are affected by thetransmission and recovery process. Each TX/RXdesign will cause some modification of the originalsquare wave as it propagates from the transmittercircuitry, through free space, through the receiver,and finally out the receiver’s data output. In thissection, we will examine specifically how data areaffected when transmitted with the LC Series.

Figure 1 shows the RF output vs. a 4,800bps datainput modulated at 3V. The top trace is the time-domain RF output and the bottom trace is themodulation input. From this oscilloscope screen,you can clearly see that there is a finite oscillatorstart-up time. Figure 2 shows the oscillator turn-on

WIRELESS MADE SIMPLE ®

INTRODUCTIONThe LC Series wireless data modules are intendedfor high-volume, low-cost applications. To besuccessful at designing a wireless data link usingthe LC Series modules, all a designer must do isprovide supply voltage, a data stream, and anantenna. All of the RF circuitry is contained in theLC module itself, relieving the designer of any RFengineering burden.

While the application of the module is quitestraightforward, there are certain considerationsthat must be addressed due to the operationalcharacteristics of the module and the legalregulations under which it operates.

OUTPUT POWER AND REGULATORYCONSIDERATIONSLinx Application notes AN-00140 and AN-00125describe the FCC Part 15.231 regulationsgoverning the LC module operation in great detail.This application note assumes that you havealready covered these topics and verified that yourapplication is suitable under the FCC rules or therules of the country in which operation is intended.

The LC Series transmitter is a Carrier-Absent-Carrier-Present (CPCA) modulated transmitter.This special form of amplitude modulation issometimes called On-Off-Keying (OOK) becausethe two binary data states are represented as theconditions of “carrier off” or “carrier on”.

When data input is low, the transmitter fullysuppresses the carrier to <-136dBm. This absenceof carrier indicates to the receiver that a binary 0 isbeing sent.

When the data input transitions to a 1 (or a high) thetransmitter generates a carrier. The receiver thensees this carrier, and translates its presence to a 1on the data output of the receiver.

This method of modulation affords two benefits.First, it allows for some center frequencyinaccuracies, which ultimately leads to simplerdesign and lower cost.

Second, it allows higher output powers per FCCPart 15.231 paragraph (b) subparagraph (2). Byallowing the measurements made for carrierstrength to be averaged over time, a much higher

APPLICATION NOTE AN-00232Considerations For Sending

Data With The LC Series

Page 129: WIRELESS MADE SIMPLE - University of Rochester

time for a single pulse.

Figure 3 is very similar to Figure 1 except that thetransmitter is operated and modulated at 5V insteadof 3V. Under these conditions, the start-up time isshorter.

This start-up delay has two effects. First, it limits themaximum data rate possible to the start-up timeitself. Second, it tends to shorten the data pulse.

The LC Series receiver discriminates a binary 1from a binary 0 by the RF signal level of the carrier.Therefore, the receiver output will not go high untilthe transmitter oscillator has completed its start-upperiod. As a result, the LC Series receiver outputwill transition high a period of time after the datainput, the time being determined by the transmitterstart-up time.

The transmitter will also modify the data stream ona high-to-low transition. Once the data input hastransitioned low, it takes a finite period of time forthe transmitter oscillator to “ring-down”, as shown inFigure 4. This will have the effect of stretching thepulse. This effect, however, is less prominent thanthe shortening effect due to start-up delay.

Like the transmitter, the receiver will also internallymodify the data stream. Figure 5 shows that thereceiver does not transition its data output highimmediately after the transmitter has completed itsstart-up period. Instead, the receiver introduces asignificant delay of 37.2µSec. This adds to thepulse-shortening effect caused by the transmitteroscillator start-up time.

Figure 6 shows the receiver’s typical turn-off time,or the time it takes the receiver to transition its dataoutput low after the transmitter carrier has beencompletely suppressed. This delay of 42.8µSecadds to the pulse-stretching effect due to thetransmitter oscillator ring-down.

Figure 7 shows “data in” vs. “data out” for a4,800bps bit stream with a 20% duty cycle. Thiswould be representative of a data stream with twohigh bits and six low bits. The “data in” trace showsa duty cycle of 20.1%. The overall effects of pulsestretching and shortening explained here cause thedata output duty cycle to be 21.5%.

Figure 8 shows “data in” vs. “data out” for a4,800bps bit stream with an 80% duty cycle. Thiswould be representative of a data stream with sixhigh bits and two low bits. The “data in” trace showsa duty cycle of 79.8%. The overall effects of pulse

AN-00232Considerations For Sending Data With The LC Series Page 2

Figure 3: Oscillator Response at 5V (4.8kbps)

1 200mV/div 2 1.00V/div 100uS/div

2

1

Figure 4: Typical Oscillator Turn-Off Time

1 200mV/div 2 1.00V/div 20uS/div

2

1

Figure 1: Oscillator Response at 3V (4.8kbps)

Figure 2: Typical Oscillator Turn-On Time figure

1 200mV/div 2 1.00V/div 100uS/div

2

1

1 200mV/div 2 1.00V/div 50nS/div

2

1

stretching and shortening explained here cause thedata output duty cycle to be 78.9%.

Thanks to the LC Series architecture, the effects ofpulse shortening and pulse stretching tend tocancel each other and thus have little impact on therecovered data stream. It is important, however,that you keep these effects in mind when encodingand decoding your data stream.

Page 130: WIRELESS MADE SIMPLE - University of Rochester

ENCODING AND DECODINGNow that we understand the effects that the LCSeries transmitters and receivers have on the datastream, we can discuss appropriate encoding anddecoding methods for the LC Series modules.

In order to send data using the LC Series modules,the data must be encoded in a serial stream of ‘1’sand ‘0’s. The method of encoding the data dependson the type of data to be sent.

For instance, if the designer wishes to send thestatus of a couple of push-button switches, then aremote control encoder and decoder would be inorder. These inexpensive chipsets are availablefrom several manufacturers including Linx,Motorola, National, and Holtek. A remote controlencoder, such as the MS Series from Linx, encodesa parallel input from a number of pushbuttons into aserial data stream that can be transmitted with theLC Series modules. The decoder receives thisserial data stream and updates its parallel outputsto represent the status of the pushbuttons at theencoder.

Most remote control encoders generate a simpleserial data stream that can be asynchronouslytransmitted. The Holtek encoder/decoders furtherencode the serial data stream in a pseudo-manchester format. Manchester encodingmaintains a continuous 50% duty cycle in the datastream output regardless of the data it is encoding.It does this by embedding the data clock in the datastream and using phase information to indicate datastates. The benefit of manchester encoding is thatwhen used in conjunction with an LC Seriestransmitter, an FCC legal design can achieve betterrange performance by virtue of a higher potentialpower.

Encoding and decoding can also be performed inmicrocontrollers. The microcontroller can generatethe serial data stream via a UART or by manuallytoggling an I/O pin at a given rate.

The LC Series modules are not capable of sendingclocked data, unless the clock is embedded in thedata stream, as is the case in manchesterencoding. Therefore, LC Series modules are notsuitable for transmitting serial data from an I2C orMicrowire bus.

AN-00232Considerations For Sending Data With The LC Series Page 3

Figure 7: Original vs. Received Data 4,800bps 20% Duty Cycle

1 2.00V/div 2 2.00V/div 100uS/div

1

2

DATA IN

DATA OUT

Figure 8: Original vs. Received Data 4,800bps 80% Duty Cycle

1 2.00V/div 2 50mV/div 20uS/div

1

2

Figure 5: RF In vs. Receiver Response Time

Figure 6: Typical Receiver Turn-Off Time

1 2.00V/div 2 50mV/div 20uS/div

1

2

1 2.00V/div 2 2.00V/div 100uS/div

1

2

Page 131: WIRELESS MADE SIMPLE - University of Rochester

device has lines that cannot be changed, then setthe same lines to “floating” on the other device. Pickthe values you wish to use for each cell that can bechanged, then set the addresses on the transmitterand receiver. The most important thing is that thetransmitter and receiver must match. If theaddresses do not match, then the receiver willignore the transmitter and nothing will happen.

When the addresses match, the transmitter andreceiver will communicate with each other and theycan be successfully used in production. The rest ofthis note will describe how to set the address oneach product.

WIRELESS MADE SIMPLE ®

INTRODUCTIONThe Linx OEM products to date are effectively madewith the KH series transmitter and receiver. The KH,in turn, is made with the LC transmitter and receiverand Holtek encoder and decoder chips. The Holtekchips have ten address lines and eight data lines.The address lines are all tri-state (ground, Vcc, orfloating) giving 310 or 59,049 individual addresses.The line is floating if it is not connected at all. Thisis not possible when used with a microprocessorthat can only pull the lines to Vcc or ground.

The encoder sends a packet with the states of eachof these lines. The decoder then looks at thereceived packet, compares the received addressbits with the current state of its own address lines,and, if they match, reproduces the received databits on its data lines. If the addresses do not match,then the decoder ignores the packet.

SETTING THE ADDRESSESAs stated above, the Holtek ICs have ten addresslines, A0 through A9. The OEM products are notalways able to make use of all of the address lines,so setting the address bits can sometimes be a littleconfusing. This note will look at each product in turnand demonstrate how to set its address.

The chart below shows the possible settings foreach address bit in each of the OEM products andthe KH series. Choose the transmitter and receiveryou wish to use and find them in the chart. Theaddress lines can be set to the values listed in eachcell, but shaded cells cannot be changed. If one

Transmitters Receivers

Address Bit CMD-HHTX CMD-HHCP CMD-HHLR CMD-KEYX TXE-XXX-KH FCTN-DEC1 FCTN-WALL FCTN-RLY4 RXD-XXX-KH

A0 Float, Gnd Float, Gnd Float, Gnd Float, Gnd Float, Gnd, Vcc Float, Gnd, Vcc Float, Gnd Float, Gnd Float, Gnd, Vcc

A1 Float, Gnd Float, Gnd Float, Gnd Float, Gnd Float, Gnd, Vcc Float, Gnd, Vcc Float, Gnd Float, Gnd Float, Gnd, Vcc

A2 Float, Gnd Float, Gnd Float, Gnd Float, Gnd Float, Gnd, Vcc Float, Gnd, Vcc Float, Gnd Float, Gnd Float, Gnd, Vcc

A3 Float, Gnd Float, Gnd Float, Gnd Float, Gnd Float, Gnd, Vcc Float, Gnd, Vcc Float, Gnd Float, Gnd Float, Gnd, Vcc

A4 Float, Gnd Float, Gnd Float, Gnd Float, Gnd Float, Gnd, Vcc Float, Gnd, Vcc Float Float, Gnd Float, Gnd, Vcc

A5 Float, Gnd Float, Gnd Float, Gnd Float, Gnd Float, Gnd, Vcc Float, Gnd, Vcc Float Float, Gnd Float, Gnd, Vcc

A6 Float, Gnd Float, Gnd Float, Gnd Float, Gnd Float, Gnd, Vcc Float, Gnd, Vcc Float Float, Gnd Float, Gnd, Vcc

A7 Float, Gnd Float, Gnd Float, Gnd Float, Gnd Float, Gnd, Vcc Float, Gnd, Vcc Float Float, Gnd Float, Gnd, Vcc

A8 Float Float, Gnd Float, Gnd Float, Gnd Float, Gnd, Vcc Float, Gnd, Vcc Float Float Float, Gnd, Vcc

A9 Float Float, Gnd Float, Gnd Float, Gnd Float, Gnd, Vcc Float Float Float Float, Gnd, Vcc

APPLICATION NOTE AN-00300Addressing Linx OEM Products

Page 132: WIRELESS MADE SIMPLE - University of Rochester

Switch number one is at the top and corresponds toaddress line A0, as shown in the figure. When theswitch is on, the line is connected to ground,otherwise it is floating.

LONG RANGE HANDHELD

To set the address of the CMD-HHLR-*** removethe cover plate on the back of the case to reveal theDIP switch as shown below.

Switch number one is at the top and corresponds toaddress line A0, as shown in the figure. When theswitch is on, the line is connected to ground,otherwise it is floating.

KEYFOB TRANSMITTER

To set the address of the CMD-KEYX-*** open thecase at the seam. Look for the Holtek IC in themiddle of the board above the battery. At the top ofthe chip there are traces that run from the addresslines to ground, as shown in the picture below.

TRANSMITTERS HANDHELD TRANSMITTER

To set the address of the CMD-HHTX-*** removethe screw in the back of the case. Open the caseand look for the DIP switch as shown below.

Switch number one is at the bottom andcorresponds to address line A7, as shown in thefigure. When the switch is on, the pin is connectedto ground, otherwise it is floating. TThhiiss ttrraannssmmiitttteerrddooeess nnoott mmaakkee uussee ooff aaddddrreessss lliinneess AA88 aanndd AA99,, ssootthhee rreecceeiivveerr//ddeeccooddeerr mmuusstt hhaavvee tthheessee lliinneess ffllooaattiinngg..

COMPACT HANDHELD TRANSMITTER

To set the address of the CMD-HHCP-*** removecover plate on the back of the case to reveal theDIP switch as shown below.

ON OFF

A7 = 1A6 = 2A5 = 3A4 = 4A3 = 5A2 = 6A1 = 7A0 = 8

OFF ON

A0 = 1A1 = 2A2 = 3A3 = 4A4 = 5A5 = 6A6 = 7A7 = 8A8 = 9A9 = 10

OFF ON

A0 = 1A1 = 2A2 = 3A3 = 4A4 = 5A5 = 6A6 = 7A7 = 8A8 = 9A9 = 10

Figure 1: CMD-HHTX DIP Switches

Figure 2: CMD-HHCP DIP Switches

Figure 3: CMD-HHLR DIP Switches

AN-00300Addressing Linx OEM Products Page 2

Page 133: WIRELESS MADE SIMPLE - University of Rochester

The number above the trace corresponds to theaddress line, trace 0 to bit A0, etc. To set theaddress, use a hobby knife or razor blade to cut thetraces on the board. If the trace is intact, the line isconnected to ground, otherwise it is floating.

KH SERIES TRANSMITTER

The pin diagram for the TXE-***-KH transmitter isshown below.

The address lines A0 through A9 are shown on thebottom right of the diagram. These lines are tri state(ground, Vcc, or floating) but if this module is beingused with one of the OEM receivers, then the lineswill be either ground or floating. If a KH receiver orLC receiver and decoder chip are being used, thenthe option to use all three states exists, giving 310

or 59,049 individual addresses. When correctlyaddressed, and a data line is pulled high on thetransmitter, the corresponding data line goes highon the receiver. This makes the KH excellent fortransmitting button presses on remote controls.

LC SERIES TX AND A HOLTEK ENCODER

The KH series transmitter is essentially a LCtransmitter that is connected to a Holtek encoderand put into a single package. If desired, thedesigner could purchase these parts separately andconnect them as in the figure below. Theaddressing and data out would work the same asfor the KH transmitter.

RECEIVERS AC FUNCTION MODULE

The DIP switches for the FCTN-WALL-*** arelocated on the side that plugs into the outlet asshown in the picture below.

TThhiiss mmoodduullee oonnllyy uusseess aaddddrreessss lliinneess AA00 tthhrroouugghh AA33ssoo tthhee eennccooddeerr mmuusstt hhaavvee AA44 tthhrroouugghh AA99 ffllooaattiinngg..When the switch is on, the line is connected to

GND/LVLD0D1GNDVCCTED2D3

2423222120191817

ANTGND

A9A8A7A6A5A4

D4 A3D5 A2D6 A1D7 A0

12345678

169151014111312

TOP VIEW

VCC

TXM-xxx-LC

1234

8765

GNDDATAINGNDIADJ/GND

GNDVCCGND

RFOUT

D11

D22

D33

D44

D55

D66

D77

TE8

DOUT9

OSC210

OSC111

GND12

A013

A114

A215

A316

A417

A518

A619

A720

A821

A922

D023

VCC

HT-640/S

VCC

OFF ON

A0 = Addr. 1A1 = Addr. 2A2 = Addr. 3A3 = Addr. 4

Figure 4: CMD-KEYX DIP Switches

Figure 5: KH Series Transmitter Pin-Out

Figure 6: LC Series Transmitter With Holtek Encoder

Figure 7: FCTN-WALL DIP Switches

AN-00300Addressing Linx OEM Products Page 3

Page 134: WIRELESS MADE SIMPLE - University of Rochester

ground, otherwise it is floating. The other fourswitches determine which buttons on thetransmitter control this module. The user guidedescribes this feature in more detail and it isdescribed briefly at the end of this note.

RELAY FUNCTION MODULE

The address switches on the FCTN-RLY4-*** canbe found on one end of the case, as shown on theright side of the picture below.

TThhiiss mmoodduullee ddooeess nnoott mmaakkee uussee ooff aaddddrreessss lliinneess AA88aanndd AA99,, ssoo tthhee ttrraannssmmiitttteerr mmuusstt hhaavvee tthheessee lliinneessffllooaattiinngg.. When the switch is on the line is connectedto ground, otherwise it is floating.

FUNCTIONAL DECODER MODULE

The pin diagram for the FCTN-DEC1-*** is shownbelow.

TThhee ddeeccooddeerr mmoodduullee oonnllyy uusseess 99 ooff tthhee aaddddrreesssslliinneess,, AA00 tthhrroouugghh AA88.. These lines are tri state(ground, Vcc, or floating) so if this module is beingused with one of the OEM transmitters, then thelines will be either ground or floating. If a KHtransmitter or LC transmitter and encoder chip arebeing used, then the option to use all three states

exists, giving 39 or 19,683 individual addresses.When correctly addressed and a data line is pulledhigh on the transmitter, the corresponding data linegoes high on the receiver.

KH RECEIVER

The pin diagram for the RXD-***-KH receiver isshown below.

The address lines A0 through A9 are shown on thebottom right of the diagram. These lines are tri state(ground, Vcc, or floating) but if this module is beingused with one of the OEM transmitters, then thelines will be either ground or floating. If a KHtransmitter or LC transmitter and encoder chip arebeing used, then the option to use all three statesexists, giving 310 or 59,049 individual addresses.When correctly addressed and a data line is pulledhigh on the transmitter, the corresponding data linegoes high on the receiver. This makes the KHexcellent for transmitting button presses on remotecontrols. The output is momentary, going high foronly as long as the button is pressed, so if a latchedoutput is needed then an external circuit ormicrocontroller will need to be used.

LC SERIES RX AND A HOLTEK DECODER

The KH series receiver is essentially a LC receiverthat is connected to a Holtek decoder and put into asingle package. If desired, the designer couldpurchase these parts separately and connect themas in the figure below. The addressing and data outwould work the same as for the KH Receiver.

A7 =

1A

6 = 2

A5 =

3A

4 = 4

A3 =

5A

2 = 6

A1 =

7A

0 = 8

OF

F O

N

NCD0D1GNDVCCPDND2D3D4DATAVTD5

ANTGND

NCNCA9A8A7A6A5A4A3A2

D6 A1D7 A0

123456789

1011

2827262524232221201918171615

121314

TOP VIEW

Figure 8: FCTN-RLY4 DIP Switches

Figure 9: FCTN-DEC1 DIP Switches

Figure 10: KH Series Receiver Pin-Out

AN-00300Addressing Linx OEM Products Page 4

Page 135: WIRELESS MADE SIMPLE - University of Rochester

LR SERIES RX AND A HOLTEK DECODER

The new LR Series receiver can be used with theHoltek decoder to provide a 5 to 10 times rangeincrease over the KH Series receiver or the LCSeries receiver and Holtek decoder combination.The pin-out and connections are the same as theLC-S receiver. The addressing and data out wouldwork the same as for the KH Receiver.

DATA LINE CONNECTIONSAnother important consideration when choosingOEM products is the way each product uses thedata lines. The figure below shows the relationshipbetween the button locations and the encoder datalines for the handheld transmitters.

The figure below shows the relationship betweenthe button locations and the encoder data lines forthe keyfob transmitter.

The Function Relay Module uses one data line toactivate each relay and another one to deactivatethem. This means that the four relays use all eightdata lines as shown in the table below.

The Function Relay Module uses all eight data lineswhen in latched mode and only the data lines thatturn the relays on in momentary mode. This meansthat the keyfob transmitter can only control relays 1and 2 in latched mode and relays 1, 2, and 3 inmomentary mode.

The AC Function Module is also turned on with onedata line and turned off with another. This moduleallows the user to choose which button pairsoperate the module. The top four DIP switches arelabeled “Button 1” through “Button 4” andcorrespond to the data line pairs as shown in thetable below.

D11

D22

D33

D44

D55

D66

D77

VT8

DIN9

OSC210

OSC111

GND12

A013

A114

A215

A316

A417

A518

A619

A720

A821

A922

D023

VCC

HT-658/S

NC1

NC2

NC3

GND

7

DATA8 NC 9

NC 10

NC 11

NC 12

NC 13

NC 14

GND 15

ANT 16

RXM-xxx-LC-S

VCC

VCC

Figure 11: LC Series Receiver With Holtek Decoder

AN-00300Addressing Linx OEM Products Page 5

D11

D22

D33

D44

D55

D66

D77

VT8

DIN9

OSC210

OSC111

GND12

A013

A114

A215

A316

A417

A518

A619

A720

A821

A922

D023

VCC

HT-658/S

NC1

NC2

NC3

GND

7

DATA8 NC 9

NC 10

NC 11

NC 12

NC 13

NC 14

GND 15

ANT 16

RXM-xxx-LR-S

VCC

VCC

Figure 12: LR Series Receiver With Holtek Decoder

D7 D6

D5 D4

D3 D2

D1 D0

Figure 13: Handheld Transmitter Data Line Buttons

D3

D1

D0 D2D4

D3

D1

D4

D3

D1

D0 D2

D3

D1

D4

Figure 14: Keyfob Transmitter Data Line Buttons

Relay Data Lines

Off On

1 D7 D6

2 D5 D4

3 D3 D2

4 D1 D0

Page 136: WIRELESS MADE SIMPLE - University of Rochester

If the DIP switch labeled “Button 1” is set to the“ON” position then data line D6 will turn the moduleon and data line D7 will turn the module off. If theswitches labeled “Button 1” and “Button 2” are bothon, then lines D4 and D6 will turn the module onand lines D5 and D7 will turn it off. Likewise, if all ofthe DIP switches are on, then all of the data lineswill work with the module according to the tableabove.

AN-00300Addressing Linx OEM Products Page 6

DIP SwitchLabel

Data Lines

Off On

“Button 1” D7 D6

“Button 2” D5 D4

“Button 3” D3 D2

“Button 4” D1 D0

Page 137: WIRELESS MADE SIMPLE - University of Rochester

Keeloq and became the sole owner of thetechnology. Today, this product dominates marketsrequiring high security, but fixed-addresstechnologies continue to co-exist because ofseveral advantages, which we will outline later. Theentrance of Linx Technologies into the encoder /decoder market represents another milestonemoment. Let’s take a more in-depth look at how theLinx AirLok solution combines the strengths ofprevious approaches and adds entirely newbenefits as well.

TRANSMISSION METHODSThe method and speed of transmission is animportant, and often overlooked, factor indetermining both the range and responsiveness ofa link. Two of the most common methods ofsending data are Pulse Width Modulation (PWM)and serial bit stream.

PWM is a method of sending data as a series ofpulses of a specific duration or width. A ‘0’ is onewidth and a ‘1’ is a different width. The receiver willstart a timer on the rising edge of the pulse and stopit on the falling edge. It will then interpret this timeas either a ‘1’ or a ‘0’.

A serial bit stream will interpret a ‘1’ as a highvoltage and a ‘0’ as a low voltage. Some systemscan have this inverted, but we will focus only on thismethod for the sake of simplicity. The concept is thesame in either method. The receiver will then lookfor the rising edge of the first bit, wait ½ bit time toget to the center of the bit, then wait 1 bit time tosample each bit in its center. It will monitor thevoltage level of each sample and interpret a highvoltage as a ‘1’ and a low voltage as a ‘0’.

WIRELESS MADE SIMPLE ®

APPLICATION NOTE AN-00310Encoder and Decoder

Comparison

INTRODUCTIONEncoders and decoders are an ideal way of sendingon / off data, such as button presses, to a remotelocation. When a line on the encoder is taken high,it will create a data stream that is sent to thedecoder. The decoder will interpret the data streamand take a corresponding data line high to replicatethe state of the encoder. This document gives anoverview of encoder / decoder ICs and explains thedifferences between Linx encoders and decodersand those offered by other manufacturers.

WHAT IS AN ENCODER / DECODER?Encoders and decoders are designed to transferthe status of an input such as a switch or contactclosure over a wireless link. The encoder encodesthe status of an input(s) into a Pulse WidthModulated (PWM) or serial data stream intended fortransmission via an RF or infrared link. Oncereceived, the decoder decodes, error checks, andanalyzes the transmission. Often, address or IDinformation will be included for uniqueness and / orsecurity. If the transmission is verified, thedecoder’s output lines are set to replicate the statusof the lines on the transmitter.

A BRIEF HISTORY The early days of encoders and decoders weredominated by fixed-address devices such as thoseoffered by Holtek. Who doesn’t remember a car fobor garage door remote with its formidable bank ofDIP switches that were hopefully set to somereasonably unique address (and perhaps changedwhen your neighbors garage opened too!)? Thencame the broad recognition that a transmissioncould be captured and later used to compromisethe system. “Code grabbing,” as the process wascalled, seemed to capture the grim specter of arobber crouching in the bushes waiting for you topress your remote so the transmission could becaptured and used by a thief at a later time.

A solution to this very real, but perhaps over-hyped,threat was provided by Nanoteq of South Africawho developed the Keeloq encoder / decoder,which focused on security and utilized encryption toguard against code cracking or grabbing. InNovember 1995, Microchip Technologies, maker ofthe popular PIC microcontroller, acquired the

Figure 1: Pulse Width Modulated Data Stream

One Zero One Zero

Figure 2: Serial Data Stream

One Zero One Zero

Page 138: WIRELESS MADE SIMPLE - University of Rochester

AN-00310Encoder and Decoder Comparison Page 2

Both methods offer advantages and disadvantages.PWM makes it easier to achieve a lower duty cycle(which will be discussed later), but the serial bitstream is more noise tolerant. This noise toleranceis what makes the serial bit stream a better choicefor wireless communication.

When pulses are sent over a wireless link, theytypically suffer from something called edge jitter.This is when the pulses are stretched or shortenedby the radios used to transmit the data or thewireless environment. It is a common occurrenceand requires that PWM schemes have very widemargins built into their timing. Since the serial bitstream is sampled at the center of each bit, jitter atthe edges will not have any affect on theinterpretation of the bit.

Most of the encoder / decoder ICs offered today useanalog methods, such as PWM, to represent thedigital data. Because RF links introduce jitter andcommonly alter timing, this method is problematicand impacts range and reliability. The bestperformance is yielded when data is sent in serialfashion, which lessens the impact of jitter and bitalteration.

Responsiveness can also be an important factor inmany applications. As used here, responsivenessrefers to the lag time between input and output. Toput it more practically, it is the time between when auser pushes a button and something happens onthe other end. This may be a concern simplybecause of the user’s perception, or a moresignificant factor such as safety. Responsiveness isdetermined by multiple factors, including the speedof the encoder and RF link, the packet size,redundancy and error checking, and decoding /decryption time.

Another commonly overlooked factor is the legalaspect of the data stream’s duty cycle. The FCCallows the transmitter’s output power to beaveraged over 100mS. Many Amplitude Shift Key

(ASK) transmitters work by turning the transmitteron for a ‘1’ and turning it off for a ‘0’. The result isthat a data stream with more ‘0’s will have a loweraverage output power over that 100mS time. Thisallows the output power of the transmitter to beincreased and still be legal. The increase in powerresults in an increase in range and betterperformance within that range. The FCC will allowthe output power of an AM link to be up to 20 timesthe legal limit, provided the data stream average ofhigh bits over the 100mS time frame results in anaverage that meets the legal limit.

Most encoders and decoders will target a 50% dutycycle (equal numbers of ‘0’s and ‘1’s). This isgenerally the best compromise between datavolume and output power.

All Linx encoder and decoders utilize a serial dataprotocol designed for maximum efficiency, andincorporate error detection and balanceoptimization. This allows products based on AirLokdevices to achieve superior range and immunityfrom interference, edge jitter, and other adverseexternal influences.

FEATURE SETSSttaattuuss // DDaattaa LLiinneessAll encoders provide at least one input line, which isnormally connected to a switch or contact. Often itis advantageous to have multiple buttons or even akeypad matrix. All Linx AirLok encoders provideeight data lines for maximum versatility.

AAddddrreessssiinnggMost encoder / decoder ICs provide a mechanismfor ensuring that a transmission is both valid andintended for a specific receiver. This isaccomplished by giving each encoder an addressthat can, in some cases, uniquely identify it.Creating the address has typically been done in oneof two ways.

Low-security devices usually have an address setmanually with a DIP switch or cut traces. The usermust set the address on the encoder and thedecoder the same in order for them tocommunicate. These address lines frequentlycause the user confusion when trying to match atransmitter to a receiver. Given that there must beextra hardware easily accessible by the user, thereare a limited number of lines (8 to 10 typically),which offers a limited number of addresses.

Figure 3: Edge Jitter

Margin forEdge Jitter

Minimum Pulse Width

Expected Pulse Width

Maximum Pulse Width

Serial data sampledonce in center of bit

Page 139: WIRELESS MADE SIMPLE - University of Rochester

AN-00310Encoder and Decoder Comparison Page 3

The second way, typically used by the higher-security devices, is to “seed” each encoder with anaddress during the manufacturing process. Thesedevices can have large numbers (32 or 64 bitstypically) making each encoder unique, but it is anadditional step in the manufacturing process andrequires special programmers to load the numberinto each encoder. While an improvement overmanual switches, they impose limitations of theirown. The transmitter and receiver can becomedesynchronized and creating relationships andassociations among groups of transmitters andreceivers is difficult or impossible.

By combining unprecedented ease of use with highsecurity, the Linx AirLok product line offers the bestof all worlds. The MS Series uses a large address(24 bits), that is created in the encoder by a randomnumber generator that is activated by simply takingone of the lines high. The large number of bitsmeans that there is a great deal of uniqueness andsecurity. The random number generator allows theencoder address to be set with the press of abutton, eliminating the need for a programmer. Theaddress is learned by the decoder by the press ofanother button. This makes creating a uniqueassociation by the user or manufacturer fast andstraightforward.

PPeerrmmiissssiioonnss aanndd AAssssoocciiaattiioonnssIt is often useful to create various relationships andpermissions between system components. At thispoint, it will become clear why Linx AirLok ICsrepresent a milestone in encoder / decoderdevelopment, since they are the first parts to allowa user or manufacturer to create groups andrelationships. Here are two practical examples.

This example demonstrates the value ofpermissions: A three-car garage houses Dad’sCorvette, Mom’s Mercedes, and Son’s Yugo. Withmost competitive products, any user’s keyfob couldopen any garage door as long as the addressesmatch. In a Linx AirLok system, the keyfobs couldeasily be configured by the user to open onlycertain doors (guess which one Son gets to open!)

This example illustrates the value of grouping.Imagine a remote control designed for use in awoodshop. One button could turn on a vacuum, onean air cleaner, and another a light. Yet anotherbutton could then be user configured to turn on allof them with a single touch.

As you can see, Linx AirLok’s user permission andassociation capabilities open the door to a wholenew range of possible product features.

OOrriiggiinnaattiioonn IIDDAnother unique and important feature of Linx AirLokdecoders is their ability to identify the transmittingencoder. In conventional designs, all encodedtransmissions are either recognized or deniedbased on the address. If, for example, someonepushed a button in a nurse call system, there wouldbe no way to know which patient sent the signal. Inan AirLok-based system, the transmitter’s unique IDwould be available from the decoder.

SSeeccuurriittyyThe success of the Microchip Keeloq line illustratesthe significant concern many manufacturers havefor security. Even in applications where a high levelof security is not necesssary, the marketing appealis often undeniable.

It is important to distinguish between security anduniqueness. A part offering a large number ofaddresses will have increased uniqueness,meaning there will be little potential for two devicesin proximity unintentionally having the sameaddress.

Security might be thought of as the mechanismswhereby an encoder / decoder relationship isprotected against attack. Typically, the encoding ofeach transmission changes based on complexmathematical algorithms. This makes it extremelydifficult to predict what the next code will be and isdesigned to prevent someone from replicating atransmission. The larger the key and block cipher,the more codes are possible, and the lower theprobability that the correct one can be found withoutknowledge of the algorithm and initial conditions.

If an application is not concerned with the potentialfor malicious grabbing of a transmission, but needsto ensure that there is little chance of two devices inproximity having the same address, the Linx MSSeries is an ideal choice. The MS offers over 16million possible addresses that are pseudo-randomly generated without awkward DIP switchesor cut traces. This address is fixed and the same foreach transmission.

For applications requiring high security, the HSSeries combines the feature set of the MS Serieswith a level of security unprecedented in the market.

Page 140: WIRELESS MADE SIMPLE - University of Rochester

AN-00310Encoder and Decoder Comparison

An in-depth comparison with the popular Keeloq isbeyond the scope of this document. In brief, Keeloquses a 64-bit key, 32-bit block, one-dimensionalalgorithm while the HS Series utilizes an 80-bit key,64-bit block algorithm with a random key generatedby the user. The code for Keeloq will change witheach transmission. The code for the HS will changecontinuously during each transmission.

DDeevveellooppmmeenntt SSyysstteemmssDevelopment systems are generally intended toquickly illustrate the capability and correctapplication of encoder and decoder ICs.Usefulness varies depending on the manufacturer,but a well thought out system can be of significanthelp in utilizing the product in a design. Linx MasterDevelopment Systems contain all of the toolsnecessary to fully explore the capabilities of Linx’snew AirLok Series encoders and decoders.

The Master Development System features pre-assembled evaluation boards complete with LinxRF modules, which allow the encoder and decoderto be quickly tested in a wireless environment.Demonstration software and an on-board USBinterface allow connection to a PC. When ready tobegin development, a large prototyping area withbreakout headers and a regulated power supplyallows for the addition of application-specificcircuitry.

SUMMARYIt is our belief that when objectively compared toother available solutions, Linx Encoder / DecoderICs will be found to offer:

Greater Ease of Use and Setup

Greatest Flexibility

Superior Feature Set

Highest Security

Whatever your product choice, we trust thisapplication note provided information useful to yoursuccess.

Page 4

AAddvvaannttaaggeess ☺High number of button inputsHighly unique (MS)Highest security available on the market (HS)Eliminates manual address settingsAllows for associative relationshipsCannot unsynchronizeSerial data outputEncoder ID is output by the decoderLatched or momentary outputs (MS)External transmitter and receiver control lines

DDiissaaddvvaannttaaggeess Slightly higher cost for some basic applicationsSecurity vulnerabilities (MS only)

AAddvvaannttaaggeess ☺High number of button inputs

DDiissaaddvvaannttaaggeess Low-security fixed codeConfusing manual addressingLow number of addressesPWM data outputHigh security vulnerabilities

Manual Address Decoders

“Rolling Code” DecodersAAddvvaannttaaggeess ☺Highly secureEliminates manual address settings

DDiissaaddvvaannttaaggeess Low number of button inputsEncoder and decoder can become unsynchronizedDifficult or impossible to create relationshipsSecurity vulnerabilities

Linx AirLok Decoders

Page 141: WIRELESS MADE SIMPLE - University of Rochester

contains the same frequency as the original currentin the transmitting antenna.

A receiving antenna should capture as much of theintended signal as possible and as little as possibleof other off-frequency signals. Its maximumperformance should be at the frequency or in theband for which the receiver was designed. Theefficiency of the receiver’s antenna is critical tomaximizing range performance. Unlike thetransmitter antenna, where legal operation maymandate a reduction in efficiency, the receiver’santenna should be optimized as much as ispractical.

UNDERSTANDING TRANSMISSION LINESA transmission line is any medium wherebycontained RF energy is transferred from one placeto another. Many times a transmission line isreferred to as “a length of shielded wire” or a “pieceof coax”. While technically correct, such casualreferences often indicate a lack of understandingand respect for the complex interaction ofresistance, capacitance, and inductance that ispresent in a transmission line.

The diameter and spacing of the conductors as wellas the dielectric constant of the materialssurrounding and separating the conductors plays acritical role in determining the transmission line’sproperties. One of the most important of theseproperties is called characteristic impedance.Characteristic impedance is the value in ohms atwhich the voltage-to-current ratio is constant alongthe transmission line. All Linx modules are intendedto be utilized with transmission lines having acharacteristic impedance of 50 ohms.

In order to achieve the maximum transfer of RFenergy from the transmission line into the antenna,the characteristic impedance of the line and the

WIRELESS MADE SIMPLE ®

INTRODUCTIONThis application note is intended for designers whoare incorporating RF into Part 15-compliantdesigns. It is designed to give the reader a basicunderstanding of an antenna’s function, operationalcharacteristics, and evaluation techniques. It willalso briefly touch on design considerations for thethree most common low-power antenna styles, thewhip, helical and loop trace.

WHAT IS AN ANTENNA?A RF antenna is defined as a component thatfacilitates the transfer of a guided wave into, andthe reception from, free space. In function, theantenna is essentially a transducer that convertsalternating currents into electromagnetic fields orvice versa. The physical components that make upan antenna’s structure are called elements. From acoat hanger to a tuned Yagi, there are literallyhundreds of antenna styles and variations that maybe employed.

Receive and transmit antennas are very alike incharacteristics and in many cases are virtual mirrorimages of each other. However, in many Part 15applications it is often advantageous to selectdifferent characteristics for the transmitter andreceiver antennas. For this reason, we will addresseach separately.

THE TRANSMITTER ANTENNAThe transmitter antenna allows RF energy to beefficiently radiated from the output stage into freespace. In many modular and discrete transmitterdesigns the transmitter’s output power ispurposefully set higher than the legal limit. Thisallows a designer to utilize an inefficient antenna toachieve size, cost, or cosmetic objectives and stillradiate the maximum allowed output power. Sincegain is easily realized at the transmitter, its antennacan generally be less efficient than the antennaused on the receiver.

THE RECEIVER ANTENNAThe receiving antenna intercepts the electro-magnetic waves radiated from the transmittingantenna. When these waves impinge upon thereceiving antenna, they induce a small voltage in it.This voltage causes a weak current to flow, which

Outer Insulator

Braid

Inner Insulator

Inner Conductor

Figure 1: Typical Transmission Line

APPLICATION NOTE AN-00500Antennas: Design,

Application, and Performance

Page 142: WIRELESS MADE SIMPLE - University of Rochester

antenna at frequency should be as close aspossible. When this is the case the transmissionline and antenna are said to be matched. When atransmission line is terminated into an antenna thatdiffers from its characteristic impedance, amismatch will exist. This means that all of the RFenergy is not transferred from the transmission lineinto the antenna. The energy that cannot betransferred into the antenna is reflected back on thetransmission line. Since this energy is not reflectedinto space, it represents a loss. The ratio betweenthe forward wave and the reflected wave is knownas the Standing Wave Ratio (SWR). The ratiobetween the sum of the forward voltage and thereflected voltage is commonly called the VoltageStanding Wave Ratio (VSWR).

HOW DOES AN ANTENNA WORK?The electric and magnetic fields radiated from anantenna form an electromagnetic field. This field isresponsible for the propagation and reception of RFenergy. To understand an antenna’s functionproperly, an in-depth review of voltage, current, andmagnetic theory would be required. Since this is notin keeping with the basic nature of this applicationnote, a simplistic overview will have to suffice.

Assume for a moment that a coaxial transmissionline was stripped and the shield and centerconductor were bent at right angles to the line asillustrated. Presto, a basic antenna called a half-wave dipole has just been formed.

You may wonder how two pieces of wire originallyintended to contain RF energy are now able toradiate it efficiently into free space. Since the linesare now separated with the ends open, a differencein voltage between the two points now exists. Thisallows formation of an electric field called the (E)field. A magnetic field, called the (H) field, is alsogenerated by current. When RF energy isintroduced onto the antenna element these fieldsalternately build up, reach a peak, and collapse.Together these fields make up electromagneticwaves that are able to radiate into and be receivedfrom free space.

HOW IS ANTENNA LENGTH DETERMINED?An antenna can be considered a complex RLCnetwork. At some frequencies it will appear like aninductive reactance, at others like a capacitivereactance. At a specific frequency both thereactances will be equal in magnitude, but oppositein influence and thus cancel each other. At thisspecific frequency the impedance is purely resistiveand the antenna is said to be resonant.

Maximum antenna efficiency is always obtainedwhen the antenna is at resonance. When anantenna’s length is incorrect, the source will seesomething other than the pure resistance that ispresent at the resonant point. If the antenna is tooshort, capacitive reactance is present; if it is toolong, inductive reactance will be present. Theindicator of resonance is the minimum point in theVSWR curve. In the following example antenna (A)is resonant too low, indicating the antenna isexcessively long, while antenna (C) is resonant attoo high a frequency, indicating the antenna is tooshort. Antenna (B), however, is ideal. Clearly, it iscritical that an antenna is the correct length, buthow is that length determined?

AN-00500Antennas: Design, Application, and Performance Page 2

FIELDS AT RIGHT ANGLES

H

E

Figure 2: E and H Fields Surrounding An Antenna

Figure 3: Basic Antenna

A B C

DESIRED FREQUENCY

Figure 4: Resonance Curves

Page 143: WIRELESS MADE SIMPLE - University of Rochester

HOW IS ANTENNA LENGTH DETERMINED?Every frequency has a certain physical length that itoccupies in space. That length is referred to as thewavelength and is determined by two factors: 1) thefrequency itself and 2) the speed of propagation.The wavelength of the operational frequencydetermines antenna length. Since an antenna has adielectric constant greater than that of free space,the velocity of a wave on the antenna is slower.This, along with several other factors, has ledantenna designers to accept the following formulaas accurate for all practical purposes to determinethe physical length of a 1/4-wave antenna:

While this formula is excellent for getting theantenna’s length close, the true issue is antennaresonance. Depending on physical factors, such asthe size and orientation of the ground plane, nearbyconductors, etc., it may be necessary adjust theantenna’s length in order to reach resonance.

An antenna does not have to be the physical lengthof a full wave in order to operate. Often, for size andimpedance considerations, the antenna will besome fraction of a full wavelength. A half-waveantenna is the shortest resonant length of anantenna. However, shorter wavelengths can beresonant on harmonics. Because of its compactlength, one of the most popular antennas for Part15 applications is the 1/4-wave whip. In thisconfiguration, the antenna element is 1/4 of a fullwavelength. In order to operate effectively the 1/4wave must radiate against a ground plane. Thisplane is commonly formed by a metal case orground area on a PCB. The ground plane acts as acounterpoise that forms the other 1/4-waveelement, creating in essence a half-wave dipole.

ANTENNA MATCHINGAntenna resonance should not be confused withantenna impedance. The difference betweenresonance and impedance is most easilyunderstood by considering the value of VSWR at itslowest point. The lowest point of VSWR indicatesthe antenna is resonant, but the value of that lowpoint is determined by the quality of the matchbetween the antenna and the transmission line it isattached to. This point of attachment is called thefeedpoint. In the diagram below you will notice bothantenna (A) and antenna (B) are resonant,however, antenna (B) exhibits a much lower VSWR.This is because the feedpoint impedance of (B) ismore closely matched to the impedance of thetransmission line. Clearly an antenna must be bothresonant and matched for maximum RF energy tobe propagated into free space.

The point of resonance is largely determined byantenna length, but how is antenna impedancedetermined? When an antenna is at resonance itpresents a purely resistive load. This resistance ismade up of three factors. First, when consideredonly as a conductor, there is loss through the realphysical resistance of the antenna element. This iscalled ohmic resistance loss. The second and mostimportant area of loss is through radiationresistance (Rr). Radiation resistance is the ohmicvalue of a theoretical resistor that, if substituted forthe antenna, would dissipate the same amount ofRF energy as the antenna radiates into space. Thelast source of resistive loss is though the leakageresistance of dielectric elements.

AN-00500Antennas: Design, Application, and Performance Page 3

I

E DIPOLEELEMENT

GROUNDPLANE

VIRTUAL λ/4DIPOLE

λ/4

λ/4

VERTICAL λ/4 GROUNDEDANTENNA (MARCONI)

Figure 5: Dipole Antenna Operation

IE

λ/2

HALF-WAVE DIPOLE ANTENNA (HERTZ)

Match Quality

Antenna A

Antenna B

RESONANCE

Figure 6: Antenna Match Quality

L =234FMHz

234916 = 0.255

0.255 x 12" = 3.06"

Page 144: WIRELESS MADE SIMPLE - University of Rochester

ANTENNA MATCHING (CONTINUED)Since the real and leakage resistances are usuallynegligible, we will focus on radiation resistance. Asmentioned previously, radiation resistance is ahypothetical concept that describes a fictionalresistance that, if substituted in place of theantenna, would dissipate the same power that theantenna radiates into free space. The radiationresistance of an antenna varies along the length ofthe antenna element but our concern is with theresistance at the feedpoint. The radiation resistanceincreases as a conductor lengthens. In general, theradiation resistance for a 1/4 wave vertical is about37 ohms, for a half-wave about 73 ohms.

ANTENNA TUNINGThis is the process whereby the resonant point ofan antenna is adjusted. In most instances this isaccomplished by physically adjusting the antennalength. While simple range tests can be used toblindly tune an antenna a network analyzer is avirtual necessity for serious characterization. Insome cases external inductive or capacitivecomponents may be used to match and bring theantenna to resonance. Such components canintroduce loss. It should be remembered that matchand resonance do not necessarily translate intoeffective propagation.

ANTENNA PERFORMANCEIn addition to broad concepts of antenna functionoutlined in the preceding section, there are specificissues of antenna performance that are equallyimportant to consider. The most important of theseissues are covered in the following section.

RADIATION PATTERNThe term radiation pattern is used to define the wayin which the radio frequency energy is distributed ordirected into free space. The term isotopic antennais commonly used to describe an antenna with a

theoretically perfect radiation pattern. That is onewhich radiates electromagnetic energy equally wellin all directions. Such an antenna is, of course, onlytheoretical and has never actually been built, butthe isotopic model serves as a conceptual standardagainst which “real world” antennas can becompared.

In the real world an antenna will efficiently radiateRF energy in certain directions and poorly in others.The point(s) of greatest efficiency are called peakswhile the areas of no field strength are called nulls.The overall distribution characteristics of theantenna make up the radiation pattern. In manyapplications it is advantageous to have the antennaperform equally well in all directions. In theseinstances a designer would choose an antennastyle with an omni-directional radiation pattern assuch characteristics would be desirable. Ininstances where highly directional antenna charac-teristics are needed an antenna style such as aYagi would be chosen.

AN-00500Antennas: Design, Application, and Performance Page 4

λ

λ

Too Long Series CircuitWith Predominant XL

Too Short

Inductive Current

L

XL > XC

Series CircuitWith Predominant XC

L

C

C

XL < XC

Capacitive Current

Figure 7: Antenna Tuning

1/4 Wave Monopole

Y

Z

X

Y

Z

X

YY

Z

X

1/2 Wave Dipole

L=λ/2Y

Z

X

X

Y

Y

Z

Y

Z

X

Y

Z

X

Y

Z

Y

X

Y

Z

X

Yagi

Isotropic Antenna

Figure 8: Antenna Radiation Patterns

Page 145: WIRELESS MADE SIMPLE - University of Rochester

ANTENNA GAINThe term gain refers to the antenna’s effectiveradiated power compared to the effective radiatedpower of some reference antenna. When theisotopic model is used, the gain will be stated in dBi(meaning gain in dB over isotopic). When gain isbeing compared to a standard dipole, the rating willbe stated in dBd (meaning gain over dipole). Thegenerally accepted variation between isotopic and astandard dipole is 2.2dB. Thus, an antenna rated ashaving 15dBi of gain would indicate the antennahad 15dB of gain over isotopic or 12.8dB of gain ascompared to a standard single-element dipole.

Gain is commonly misinterpreted as an increase inoutput power above unity. Of course, this isimpossible since the radiated power would begreater than the original power introduced to theantenna.

A simple way to understand gain is to think of afocusable light source. Assume the light output isconstant and focused over a wide area. If the lightwere refocused to a spot, it would appear brighterbecause all of the light energy is concentrated intoa small area. Even though the overall light outputhas remained constant, the light will have a gain inlux at the focus point over the original pattern.

In the same way, an antenna that focuses RFenergy into a narrow beam can be said to have gain(at the point of focus) over an antenna that radiatesequally in all directions. In other words, the higheran antenna’s gain the narrower the antenna’spattern and the better its point performance will be.

ANTENNA POLARIZATIONThe effective polarization of an antenna is animportant characteristic. Polarization refers to theorientation of the lines of flux in an electromagneticfield. When an antenna is oriented horizontally withrespect to ground it is said to be horizontallypolarized. Likewise, when it is perpendicular toground it is said to be vertically polarized.

The polarization of an antenna normally parallelsthe active antenna element; thus, a horizontalantenna radiates and best receives fields havinghorizontal polarization while a vertical antenna isbest with vertically polarized fields. If the transmitterand receiver’s antennas are not oriented in thesame polarization, a certain amount of power will belost. In many applications there is little control overthe antenna orientation; however, to achievemaximum range the antennas should be orientedwith like polarization whenever possible. In the VHFand UHF spectrums horizontal polarization willgenerally provide better noise immunity and lessfading than a vertical polarization.

ANTENNA EFFICIENCYNot all of the power delivered into the antennaelement is radiated into space. Some power isdissipated by the antenna and some is immediatelyabsorbed by surrounding materials.

Forward power- the power originally applied to theantenna input.

Reflected power- a portion of the forward powerreflected back toward the amplifier due to amismatch at the antenna port.

Net power- the power applied to the antenna thatactually transitions into free space is called the netpower or effective radiated power. Net power isusually calculated by finding the difference betweenthe actual forward and reflected power values.

AN-00500Antennas: Design, Application, and Performance Page 5

Gain

Isotropic

Figure 9: Light Gain

Figure 10: Antenna Gain

OPTIMUM ANTENNA POLARIZATION

H H

H V

V V

BOTHHORIZONTAL

ORIENTATION MIXEDPERPENDICULAR

IN SAME PLANE

BOTHVERTICAL

MAXIMUM RESPONSE

MINIMUM RESPONSE

Figure 11: Antenna Polarization

Page 146: WIRELESS MADE SIMPLE - University of Rochester

MULTIPATH EFFECT

Multipath fading is a form of fading caused bysignals arriving at the receiving antenna in differentphases. This effect is due to the fact that a signalmay travel many different paths before arriving atthe antenna. Some portions of the original signalmay travel to the receiver’s antenna via a direct freespace path. Others, which have been reflected,travel longer paths before arrival. The longer pathtaken by the reflected waves will slightly delay theirarrival time from that of the free space wave. Thiscreates an out-of-phase relationship between thetwo signals. The resulting voltage imposed on thereceiving antenna will vary based on the phaserelationship of all signals arriving at the antenna.While this effect is environmental and not relateddirectly to the antenna, it is still important tounderstand the role multipath may play intheoretical vs. realized antenna performance.

ANTENNAS FOR PART 15 DESIGNSA designer who is specifying an antenna for an FCCPart 15-compliant product faces a number ofchallenges. Since many products engineered forPart 15 compliance are compact and portable, adesigner may have to balance antennaperformance with issues such as packaging andcosmetics. Part 15 also places physical restrictionson the antenna design. Most notable is therequirement that an antenna be permanentlyattached or utilize a unique and proprietaryconnector. This is intended to prevent the end userfrom making modifications that might change aproduct’s performance characteristics.

If you have waded through to this point in the hopeof discovering how to design low-cost, high-performance antennas without experience or testequipment, we are sorry to have to disappoint you.

An antenna’s performance is closely dependent onapplication variables, such as ground plane,proximity to other components, and materialproperties. In order to design and evaluate theperformance of an antenna correctly, several toolsare required. Among the most important are anetwork analyzer, spectrum analyzer, andfrequency source. A network analyzer is particularlyvaluable as it allows the antenna’s resonate points,characteristic impedance, and SWR to beaccurately measured. Without access to theseresources, antenna design is reduced to a hit-and-miss proposition.

If your application does not call for maximum rangeperformance and you are able to utilize an antennastyle such a whip, which can be easily calculated,you may achieve satisfactory performance throughtrial and error methods. For more sophisticatedantenna designs, however, it is always best to usea professionally manufactured antenna, such asthose made by Linx, or to rent some basic level oftest equipment for the design phase.

For those with adequate equipment andmeasurement expertise, a brief design outline ofdesign considerations for the three most popularantenna styles follows.

POPULAR ANTENNA STYLESWWhhiipp SSttyylleeA whip-style antennaprovides exceptionalperformance andstability. A straight whiphas a wide bandwidthand is easily designedand integrated. Manydesigners opt for thereliable performanceand cosmetic appeal ofprofessionally madeantennas, such as those offered by Linx. These“off-the-shelf” whip designs are generally madefrom a wire or cable encapsulated in a rubber orplastic housing. A whip can also be made by cuttinga piece of wire or rod to the appropriate length.Since a full-wave whip is generally quite long and itsimpedance high, most whips are either a 1/4 or 1/2wave. The correct length can be found using theformula in the section entitled “How is AntennaLength Determined?”.

AN-00500Antennas: Design, Application, and Performance Page 6

Multiple paths for a signal to take between transmitter and receiver.

Figure 12: Multipath

Figure 13: Whip Antennas

Page 147: WIRELESS MADE SIMPLE - University of Rochester

HHeelliiccaall SSttyylleeA helical element is awire coil usually woundfrom steel, copper, orbrass. By winding theelement its overallphysical length can begreatly reduced. Theelement may beenclosed inside the antenna housing or exposed forinternal mounting. A helical antenna significantlyreduces the physical size of the antenna, however,this reduction is not without a price. Because ahelical has a high Q factor, its bandwidth is verynarrow and the spacing of the coils has apronounced effect on antenna performance. Theantenna is prone to rapid detuning especially inproximity to objects. A well designed helical canachieve excellent performance while maintaining acompact size.

Helical antenna design is a bit more complex thanthat of a straight antenna. It is possible to calculatethe length of a helical once the diameter, materialtype and coil spacing are known. In most cases,however, it is just as easy to arrive at a designempirically by taking an excessively long coil andtuning it by clipping until it is resonant at the desiredfrequency. The length may then be calculated bythe turns and radius values or simply bystraightening the coil and measuring it.

LLoooopp TTrraaccee SSttyylleeThe last style of antenna wewill discuss is the looptrace. This style is popularin low-cost applicationssince it can be easilyconcealed and adds little tooverall product cost. Theelement is generally printed directly onto theproduct’s PCB and can be made self-resonant orexternally resonated with discrete components. Theactual layout is usually product specific.

Despite its cost advantages, PCB antenna stylesare generally inefficient and useful only for short-range applications. A loop can be very difficult totune and match and is also sensitive to changes inlayout or substrate dielectric constant. This canintroduce consistency issues into the productionprocess. In addition, printed styles are difficult to

engineer, requiring the use of expensiveequipment, including a network analyzer. Animproperly designed loop will have a high SWR atthe desired frequency, which can introduceinstability. For these reasons loops are generallyconfined to low-cost transmitter devices, such asgarage door openers,car alarms, etc.

Linx offers severallow-cost planar andchip antennaalternatives to theo f ten-prob lemat ic“printed” antenna. These tiny antennas mountdirectly to a product’s PCB and provide excellentperformance in light of their compact size.

ATTENUATING OUTPUT POWERIn order to meet Part 15 requirements manydesigners attempt to attenuate their fundamentaloutput power by shortening or lengthening theantenna to shift its point of resonant efficiency awayfrom the fundamental. This is not usually a goodidea for two reasons. First, by raising the SWR andreducing an antenna’s efficiency at your intendedfundamental frequency you have potentiallyincreased the output efficiency at a harmonic.Second, by creating such a mismatch the RF stagemay become unstable. Some Linx products allowpower levels to adjusted via programming or anexternal resistor. In other cases an attenuation T-pad should be used as described in Linx ApplicationNote 00150.

PUTTING IT ALL TOGETHERIn the design process the antenna should beviewed as a critical component in systemperformance. After reviewing this application notewe hope you have a better understanding of thebasic considerations necessary to achieve optimumantenna function. At Linx, our business is to makethe science of RF straightforward so you canconcentrate on profitably bringing your product tomarket. In keeping with this objective Linx offers agrowing line of optimized antenna products. Acomplete listing is available on the Linx web site atwww.linxtechnologies.com.

AN-00500Antennas: Design, Application, and Performance Page 7

Figure 14: Helical Antennas

Figure 15: PCB Antennas

Figure 16: PCB Mount Antennas

Page 148: WIRELESS MADE SIMPLE - University of Rochester

INTRODUCTIONThe antenna is probably the most overlooked part of an RF design. The range, performance, and legality of anRF link are critically dependent upon the antenna. However, it is often left until the end of the design andexpected to fit into whatever space is left, no matter how unfavorable to performance that location may be. Manyof these designs will have to ultimately accept degraded performance or go through multiple redesigns.

The antenna is one of the most complicated aspects of RF design. With so many interdependent variables,application becomes as much art as science. Engineers delving into RF design for the first time can quite easilyconfuse or misinterpret the meaning of antenna specifications and how to apply them. For instance, the gain ofan antenna is very different from the gain of an amplifier. The most common misconception may be that theradiation pattern on a monopole antenna’s data sheet will be that of the antenna on the final product. Inactuality, the radiation pattern for a quarter-wave monopole antenna is so critically dependant on the design andlayout of the product, that manufacturers’ gain specifications and radiation pattern plots have little use exceptto ascertain potential antenna performance.

Since voluminous texts have been written about each of the many antenna styles, it is unnecessary to coverthem all here. This article will focus only on those styles which are commonly used in low-power handheldproducts: dipole and monopole whips. These styles cover a wide range of available antennas, and are amongthe most common to be implemented incorrectly. With that in mind, there are several rules-of-thumb that canbe applied to antenna designs. These rules are less “how to design an antenna” and more “how to design withan antenna.”

ANTENNA FUNDAMENTALSAn antenna is a device that converts electric currents into electromagnetic waves and vice versa. It can beconsidered a complex RLC network. At some frequencies, it will appear as an inductive reactance, at others asa capacitive reactance. At a specific frequency, both of the reactances will be equal in magnitude, but oppositein influence, and thus cancel each other. At this specific frequency, the impedance is purely resistive and theantenna is said to be resonant.

Here is where the physical meets the theoretical. Resonance will occur at whole number multiples or fractionsof the frequency of interest. These frequencies correspond to a wavelength. That wavelength is the requiredantenna length. That length is what must be incorporated into the final product, either embedded inside theenclosure or externally attached to the device.

The frequency of the electromagnetic waves is related to the wavelength by the following equation:

where

f = frequency in Hertz (Hz)

= wavelength in meters (m)

c = speed of light (299,792,458 m/s)

As can be seen by the equation, the higher the frequency, the shorter the wavelength, and the smaller theantenna. For example, the wavelength for 433.92MHz is 0.69m (2.27ft) and the wavelength for 916MHz is0.33m (1.07ft). 433.92MHz is a popular frequency for Remote Keyless Entry (RKE) systems such as carkeyfobs, but obviously there is no way that a 2.27-foot antenna is going to fit into a keyfob.

WIRELESS MADE SIMPLE ®

APPLICATION NOTE AN-00501Understanding Antenna

Specifications and Operation

cfλ =

λ

Page 149: WIRELESS MADE SIMPLE - University of Rochester

Fortunately for everyone who wants to carry their keys in their pocket, there are ways to make the antennasmaller. Since resonance will occur at whole number fractions (1/2, 1/3, 1/4, etc.) of the fundamental frequency,shorter antennas can be used to send and recover the signal. As with everything in engineering, there is a trade-off. Reducing the antenna’s size will have some impact on the efficiency and impedance of the antenna, whichcan affect the final performance of the system.

A half-wave dipole antenna has a length that is one-half of the fundamental wavelength. It is broken into twoquarter-wave lengths called elements. The elements are set at 180° from each other and fed from the middle.This type of antenna is called a center-fed half-wave dipole, and shortens the antenna length by half.

A method for making the antenna even smaller is to use one of the quarter-wave elements of a dipole and allowthe ground plane on the product’s PCB to serve as a counterpoise, in essence, creating the other quarter-waveelement.

Since most devices have a circuit board anyway, using it for half of the antenna can make a lot of sense.Generally, this half of the antenna will be connected to ground and the transmitter or receiver will reference itaccordingly. This style is called a quarter-wave monopole and is the most common antenna on today’s portabledevices.

Another way to reduce the size of the antenna is to coil the element. This is wherethe straight wire is coiled or wrapped around a non-conductive substrate to createwhat is called a helical element. This has the advantage of making the overall lengthshorter, but it will also reduce the antenna’s bandwidth. Just as with an inductor, thetighter the coil, the higher the Q, so the smaller the bandwidth. Where a straightantenna may have a bandwidth of 100MHz, a helical may only have a bandwidth of10MHz. This becomes more pronounced as the frequency gets lower, since the coilstypically get closer together to maintain a specific overall length.

AN-00501Understanding Antenna Specifications and Operation Page 2

IE

λ/2

HALF-WAVE DIPOLE ANTENNA (HERTZ)

Figure 1: A Half-Wave Dipole Antenna

I

E DIPOLEELEMENT

Figure 2: A Quarter-Wave Monopole Antenna

Figure 3: 916MHz (L) and 315MHz (R) Helical Antennas

Page 150: WIRELESS MADE SIMPLE - University of Rochester

AN-00501Understanding Antenna Specifications and Operation

ANTENNA SPECIFICATIONSIf antennas are the least understood RF component, then antenna specifications are the least understood of allRF components. For instance, many designers look for radiated test data without really understanding whatthey are looking at or how it relates to the performance of their product. For this reason, let’s examine the mostcommon antenna specifications.

ImpedanceThe impedance of an antenna is the real resistance and imaginary reactance that appears at the terminals ofthe antenna. Because there are inductive and capacitive elements to an antenna, this will change withfrequency. It will also be affected by objects that are nearby, such as other antennas, the components on acircuit board, and even the user of the device.

An antenna will have two types of resistance associated with it. Radiation resistance converts electrical powerinto radiation. Ohmic resistance is loss on the antenna’s structure that converts electrical power into heat. Theradiation resistance should be much higher than the ohmic resistance, though both are important to theantenna’s efficiency. Generally, the radiation resistance at the terminals of a dipole antenna in free space(isolated from anything conductive) is 73 ohms. A monopole antenna will be half of this, or 36.5 ohms.

The reactance is power that is stored in the near field of the antenna. This reactance combined with the realresistance make up the antenna’s impedance. Both values are affected by objects in the near field and will varydown the antenna’s length. The specifics of this are beyond the scope of this document, but can be found inmost antenna literature.

These values are important because, in any system, maximum power transfer will occur when the source andload impedances match. If they are different, called a mismatch, then some of the power sent to the antennawill be reflected back into the load or lost as heat. This will lower the efficiency of the system, lowering range,increasing power requirements, and shortening battery life.

Industry convention for RF is an impedance of 50 ohms. Most IC manufacturers will have matched theirproducts to 50 ohms or will provide a circuit designed to match their product to a 50-ohm load. Likewise,antenna manufacturers frequently design and characterized antennas at 50 ohms.

VSWRThe Voltage Standing Wave Ratio (VSWR) is a measurement ofhow well an antenna is matched to a source impedance, typically50 ohms. It is calculated by measuring the voltage wave that isheaded toward the load versus the voltage wave that is reflectedback from the load. A perfect match will have a VSWR of 1:1. Thehigher the first number, the worse the match, and the moreinefficient the system. Since a perfect match cannot ever beobtained, some benchmark for performance needs to be set. In thecase of antenna VSWR, this is usually 2:1. At this point, 88.9% ofthe energy sent to the antenna by the transmitter is radiated intofree space and 11.1% is either reflected back into the source or lostas heat on the structure of the antenna. In the other direction,88.9% of the energy recovered by the antenna is transferred intothe receiver. As a side note, since the “:1” is always implied, manydata sheets will remove it and just display the first number.

VSWR is usually displayed graphically versus frequency, as shown in the adjacent figure. The lowest point onthe graph is the antenna’s center frequency. The VSWR at that point denotes how close to 50 ohms the antennagets. The space between the points where the graph crosses the specified VSWR typically defines theantenna’s bandwidth.

Page 3

Match QualityAntenna B

Bandwidth

Antenna A

VS

WR

Frequency

Figure 4: VSWR Graph

Page 151: WIRELESS MADE SIMPLE - University of Rochester

Directivity, Efficiency, and GainTrue antenna performance can only be determined bymeasuring the amount of energy that the antenna radiates intofree space. This is not an easy task given all of the variablesassociated with radiated measurements, but that is for anothertime. When the radiated power is measured around the antenna,a shape emerges called the radiation pattern. This is the mostdirect measurement of an antenna’s actual performance.

Antenna radiation patterns can take many interesting shapes,particularly when presented graphically in their real-world three-dimensional state. The adjoining diagram shows shapes typicalof the most popular antenna types. For a dipole antenna, thepattern looks like a doughnut. For a monopole antenna on aground plane, cut that doughnut in half along the edge and set iton the plane with the antenna sticking up through the middle.The Yagi’s directivity can be clearly seen, although that term andthe value of these types of plots will become even more apparentas directivity, efficiency and gain are discussed.

After the radiated energy surrounding an antenna is measured,the data is often turned into a radiation pattern plot. This plotgraphically presents the way in which the radio frequency energyis distributed or directed by the antenna into free space. Anantenna radiation pattern plot is an important tool, since it allowsrapid visual assessment and comparison of antennas. Theantenna’s radiated performance, and thus the correspondingplot, will be influenced by the test jig or product on which theantenna is mounted. This makes the comparison of plots comingfrom different manufacturers difficult. In addition, the plot for aspecific design will likely vary from that of a reference design.Pattern plots typically consist of a polar coordinate graph, thoughCartesian coordinate graphs are also used. Polar plots areeasier to visualize, as they show the radiated power 360° aroundthe antenna under test. Generally, a logarithmic scale is used,which allows a range of data to be conveniently shown on thesame plot. Two plots are created, one in the horizontal axis andone in the vertical axis. Together, these give a picture of thethree dimensional shape of the radiation pattern, asdemonstrated by Figure 6.

An antenna’s radiation pattern and specifications related to it often need a pointof comparison or reference. Most frequently, a theoretical antenna called anisotropic antenna or isotropic radiator is used for this purpose. The term “iso”means the same, “tropic” means direction. Thus isotropic describes an antennawhich radiates electromagnetic energy the same in all directions. The isotropicantenna and its perfect spherical pattern are only theoretical and do not actuallyexist, but the model serves as a useful conceptual standard against which “realworld” antennas and their specifications can be compared. Now it is time to takea closer look at some of the most important radiated specifications and whatthey mean.

AN-00501Understanding Antenna Specifications and Operation Page 4

1/4-Wave Monopole

Y

Z

X

Y

Z

X

YY

Z

X

1/2-Wave Dipole

Y

Z

X

X

Y

Y

Z

Y

Z

X

Y

Z

X

Y

Z

Y

X

Y

Z

X

Yagi

Figure 5: Example Radiation Patterns

Figure 7: Isotropic Radiation Pattern

-40.0

-30.0

-20.0

-10.0

0.0

10.00

270

180

9090°

270°

180°

Antenna

-40.0

-30.0

-20.0

-10.0

0.0

10.00

270

180

9090°

270°

180°

Antenna

Figure 6: Polar Plots of an Antenna Radiation Pattern

Page 152: WIRELESS MADE SIMPLE - University of Rochester

AN-00501Understanding Antenna Specifications and Operation

There are three radiated specifications that are of primary interest:efficiency, directivity and gain.

Often these terms are talked about in the context of an antenna’s transmittedsignal. It is somewhat easier to visualize these concepts by thinking ofradiated power, but it should be recognized they apply directly to receptionas well.

Efficiency is a measurement of how much energy put into the antennaactually gets radiated into free space rather than lost as heat on theantenna’s structure or reflected back into the source. The antenna’simpedance and VSWR at the center frequency play a big role in thismeasurement.

Directivity measures how much greater an antenna’s peak radiated powerdensity is in a particular direction than for a reference radiator with the samesource power. It is the ratio of the power density in the pattern maximum tothe average power density at a uniform distance from the antenna. In short, it is a comparison of the shape ofthe radiation pattern of the antenna under test to a reference radiation pattern. Most commonly, the referencewould be the perfect spherical pattern of the isotropic model described earlier. The units of this measurementare decibels relative to isotropic, or dBi. A dipole antenna is also sometimes used as a reference, in which casethe units be stated in dBd (meaning decibels relative to dipole). A dipole has a gain of 2.15dB over isotropic ordBi = dBd + 2.15dB. When comparing gains, it is important to note whether the gain is being expressed in dBdor dBi and convert appropriately.

Gain can be a confusing specification. Most engineers are familiar with the term in reference to amplifiers,where gain is a measure of how much an amplifier increases the input signal. But there is a significant differencebetween an amplifier’s gain and an antenna’s gain. The amplifier puts energy into the system, making it anactive device. An antenna cannot put energy into the system, so it is a passive device. Gain is commonlymisinterpreted as an increase in output power above unity. Of course, this is impossible, since the radiatedpower would be greater than the original power introduced to the antenna.

Directivity and gain are closely related. Gain is the directivity of the antenna reduced by the losses on theantenna, such as dielectric, resistance, and VSWR. In other words, it is the product of directivity and efficiency.Gain is the most direct measurement of an antenna’s real performance. As such, it is one of the most importantspecifications.

A simple way to understand directivity or gain is to think of a focusable light source. Assume the light output isconstant and focused over a wide area. If the light is refocused to a spot, it appears brighter because all of thelight energy is concentrated into a small area. Even though the overall light output has remained constant, theconcentrated source will produce an increase in lux at the focus point compared to the wide source. In the sameway, an antenna that focuses RF energy into a narrow beam can be said to have higher directivity (at the pointof focus) than an antenna that radiates equally in all directions. In other words, the higher an antenna’sdirectivity, the narrower the antenna’s pattern and the better its point performance will be.

Page 5

Isotropic Pattern

Directivity

Gain

Figure 8: Directivity and Gain

Figure 9: Light Gain

Page 153: WIRELESS MADE SIMPLE - University of Rochester

Monopole Antenna PerformanceThe performance of a monopole antenna is critically dependant upon the counterpoise used as the other halfof the antenna. This counterpoise can be a solid copper fill on a circuit board or a metal enclosure. Since theRF stage is referenced to the circuit ground, this plane or the enclosure are also connected to ground. The sizeof the ground plane counterpoise as well as its location with reference to the antenna will have a significantimpact upon its VSWR and gain.

Typically, antennas are designed on a counterpoise that is one wavelength in radius. At one wavelength, thecounterpoise will act sufficiently like an infinite plane. This makes for great specifications, but in the real worlda cordless phone will not have a 1-foot radius ground plane for its antenna. This begs the question “whathappens when the ground plane is reduced to something that is more practical for a portable product?” Theanswer is “quite a bit.”

Generally, if the radius of the counterpoise is longer than one wavelength, the performance is close to that ofan infinite counterpoise. If the radius is shorter than one wavelength, the radiation pattern and input impedanceare compromised. Significant performance reductions occur when the radius is a quarter-wave or less.

The following graphs show the performance of a 916MHz antenna that has been tuned to a 4” x 4” ground planecounterpoise. Graph A shows the antenna measured on the 4” x 4” ground plane. Graph B shows the antennameasured on a 26.5” x 26.5” full-wave ground plane. Looking at the VSWR graphs, it can be seen that a largerground plane will lower the resonant frequency and widen the bandwidth. In this case, the wider bandwidthoffsets the drop in frequency so that the VSWR at the intended center frequency is still less than 2.0:1.

Conversely, if the antenna had been tuned to the larger plane then placed on the smaller one, the centerfrequency would have shifted higher and the bandwidth would be smaller. This could result in a VSWR that isout of specification. This effect would be magnified with helical antennas such as those pictured earlier. Helicalantennas are coiled to reduce their size, but that also has the effect of narrowing the bandwidth. A ground planethat is too small could narrow the bandwidth to a point where it would be difficult to maintain the antenna’sperformance over production tolerances and in the presence of external influences.

Regardless of the antenna style chosen, the size of the implemented ground plane should be considered incomparison to the antenna manufacturer’s reference plane and calculated ideals. Whenever possible, actualantenna performance should be measured with tools such as a network analyzer and spectrum analyzer, sinceshifts such as those described above can affect the efficiency of the system, and significantly impact theproduct’s final range. If the antenna is mismatched, the transmitter output power could be increased tocompensate, but at the cost of higher current consumption and shorter battery life. For most receivers, there islittle that can be done to recover the lost sensitivity. In some cases, a Low Noise Amplifier (LNA) can be placedafter the antenna and before the receiver’s front end, but that adds to the cost, current consumption, and size.

AN-00501Understanding Antenna Specifications and Operation Page 6

CENTER 916.000 000MHz SPAN 500.000 000MHz

S11 SWR

1

1: 1.2407 916MHz

Figure 10: A 916MHz Antenna VSWR on (A) a 4” x 4” Ground Plane and (B) a 26.5” x 26.5” Ground Plane

CENTER 916.000 000MHz SPAN 500.000 000MHz

S11 SWR

1

1: 1.7838 916MHzA B

Page 154: WIRELESS MADE SIMPLE - University of Rochester

Not only does the size of the ground plane dictate performance, but also the location of the antenna upon thatground plane. The plots below show the radiation pattern for two 418MHz antennas on a 4” x 4” ground plane.Both have the same elements, but one is mounted in the middle of the plane and one is mounted on the edgewith a right-angle connector. As can be seen from the plots, with the antenna mounted in the middle, the patternis uniform. With the antenna mounted on the edge of the plane, more energy is radiated away from the plane.This will result in the system having a better range in one direction than in another. This may impact theperformance and perceived quality of the final product, so it should be considered early in the design phase.

All of these examples have shown a quarter-wave monopole that is orthogonal to the ground plane. It is alsovery common to have the antenna in the same plane as the ground. Once again, the ground plane becomesthe other element of the antenna system. The figure below shows a 916MHz antenna oriented in this manner.

AN-00501Understanding Antenna Specifications and Operation Page 7

-40.0

-30.0

-20.0

-10.0

0.0

10.00

270

180

9090°

270°

180°

Antenna

-40.0

-30.0

-20.0

-10.0

0.0

10.00

270

180

9090°

270°

180°

Antenna

Figure 11: A 418MHz Antenna Radiation Pattern on a 4” x 4” Ground Plane (A) Centered, (B) Edge Mounted

-40.0

-30.0

-20.0

-10.0

0.0

10.00

270

180

9090°

270°

180°

Antenna

-40.0

-30.0

-20.0

-10.0

0.0

10.00

270

180

9090°

270°

180°

Antenna

A B

-40.0

-30.0

-20.0

-10.0

0.0

10.00

270

180

90

90°

270°

180°

Antenna

-40.0

-30.0

-20.0

-10.0

0.0

10.00

270

180

90

90°

270°

180°

Antenna

Figure 12: A 916MHz Antenna Radiation Pattern in the Plane of a 4” x 4” Ground Plane

Page 155: WIRELESS MADE SIMPLE - University of Rochester

AN-00501Understanding Antenna Specifications and Operation

This orientation is very common in handheld products such as cellular phones. The length of the ground planethat points in the opposite direction from the antenna is critical. Ideally, it would be a quarter-wavelength long,but it can be shorter if the sacrifice in performance can be accepted.

These measurements are good for illustrating concepts, but they are only valid for that specific antenna whenmeasured on that specific board. Since anything placed on the board is in the near field (within one wavelength)of the antenna, it will have an impact on the radiation pattern. Any change in the shape of the board within onewavelength will also have an impact on the pattern, as can be seen by the graphs above.

While manufacturers’ patterns can give a general idea of the antenna’s performance, they often bear noresemblance to the antenna’s performance on the final product. Polar plots are expensive to make and, forthese types of antennas, do not provide much useful information to the customer. This may be why someantenna manufacturers do not list gain specifications or polar plots for monopole antennas.

However, there are many antenna styles for which manufacturers’ gain and radiation patterns are valid. Yagi,parabolic, corner, and horn antennas are all types that do not depend on a ground plane provided by thedesigner. Broadcast antennas for AM/FM radio will often use the Earth as a ground plane (the transmittingtowers at the radio station, not the receivers). Since the Earth is much larger than one wavelength at thesefrequencies, it acts like an infinite ground plane. However, none of these styles would be considered for use ina portable product.

A dipole antenna can also be affected in a similar way by the ground plane, depending on its construction. Somedipole antennas are in the same form factor as whip antennas, but will have a counterpoise as well as theelement inside the sleeve. Typically, the counterpoise will be a metal tube with the antenna element positionedon top. A coax cable is attached to the connector and then runs up inside the tube to connect to the tube andelement, making a center-fed dipole antenna. In the illustration below, the antenna element is a helical to reducethe overall housing length.

A common misconception about antennas with an internal counterpoise is that their characteristics areunaffected by external factors. While it is true that an external ground plane is not required for the antenna tooperate correctly, if you connect one of these antennas to a product that has a ground plane, then you will seethe same shifts as shown in Figure 10. The product’s external plane will add to the antenna’s internalcounterpoise and shift the frequency, gain, and radiation pattern. The performance shift can be minimal, but itshould be recognized that while a dipole does not require a ground plane, it is not immune to external factors.Part of the attractiveness of a dipole is that an external ground plane is not required for the antenna to performwell. The downside is that dipole antennas are usually larger and more expensive since they have to includethe counterpoise internally.

Page 8

Figure 13: A Whip Style Center-Fed Dipole Antenna

Page 156: WIRELESS MADE SIMPLE - University of Rochester

AN-00501Understanding Antenna Specifications and Operation

DESIGNING WITH A QUARTER-WAVE MONOPOLE ANTENNAA comon pitfall for designers new to the wireless arena is the implementation of the ground plane. As statedearlier, the ground plane is the other half of the antenna, so it is critical to the final performance of the product.This means that it is critical to get it right.

The ground plane is a solid copper fill on one layer of the circuit board that is connected to the negative terminalof the battery. This fill not only acts as the antenna’s counterpoise, but is also the ground connection for all ofthe components on the board. The problems arise when components are added and the traces routed toconnect them.

It is a very rare and simple design that does not need to route a trace on more than one layer. Every trace thatgets routed on the same layer as the ground plane can have a significant impact on the RF performance. It isbest to look at the board from the perspective of the antenna connection. The goal is to have a low impedancepath back to the battery or power connection. This is accomplished with wide, unobstructed paths. If the groundplane is cut up with traces, through-hole components, or vias, then it is not going to be able to do its job as anantenna counterpoise. One of the worst things that can happen is for the ground plane to get so cut up that ithas to get connected by jumping back and forth between layers through vias. A via has inductance associatedwith it, which increases its impedance at high frequency. This will result in the ground plane floating somewhereabove ground at RF frequencies, which will reduce the performance of the antenna and, consequently, therange of the product.

When running traces on the ground plane layer, try to present the smallest profile to the antenna, which isnormally the width of the trace. This means running traces away from the antenna rather than across the board.The figure below provides an example.

Page 9

Figure 14: Example PCB Layout

Page 157: WIRELESS MADE SIMPLE - University of Rochester

AN-00501Understanding Antenna Specifications and Operation

This board uses a quarter-wave monopole antenna that is mounted in the same orientation as the ground plane.The top layer is in red, the bottom layer is in blue. Almost all of the bottom layer traces are running away fromthe antenna (up and down) rather than across its resonant path (left and right). The one through-holecomponent, SM1, is also running away from the antenna. Looking at the board from the perspective of theantenna, there are very wide paths from the antenna to the battery, B1. This will mean a good, low-impedanceground connection for all of the RF stage, which will maximize the RF performance.

The ground plane also allows for the implementation of a microstrip line between the RF stage and the antenna.This term refers to a PCB trace running over a ground plane that is designed to serve as a transmission linebetween the module and the antenna. A transmission line is a medium whereby RF energy is transferred fromone place to another with minimal loss. This is a critical factor because the trace leading to the antenna caneffectively contribute to the length of the antenna, changing its resonant frequency. The width of the microstripline is based on the desired characteristic impedance of the line, the thickness of the PCB, and the dielectricconstant of the board material. When implemented correctly, the microstrip line will connect the antenna to theRF stage without affecting the antenna’s resonant frequency or the match to the RF stage.

One other thing that frequently seems to catch designers off guard is that standard connectors, such as SMA,BNC, or MCX, are illegal for use as an antenna connection in the United States for devices falling under somesections of CFR Part 15. The FCC does not want the end user to be able to change the antenna from the onethat was certified with the product. For this reason, the antenna will need to use a non-standard, proprietary, orpermanent connection. Fortunately, the FCC considers reverse-polarity connectors to be non-standard, so theyare commonly used by OEMs for the antenna.

PUTTING IT ALL TOGETHERThe antenna is a critical component to a system’s performance and should be considered early in the designprocess. It should be recognized that specifications on an antenna’s data sheet will not necessarily reflect itsperformance in the final product. This is a result of design-specific factors, such as those discussed here, aswell as differing references, methods of test, and presentation formats among antenna suppliers. With this inmind, allowance must be made for testing and optimizing the antenna as an integral part of the overall designprocess. While it is unlikely an end user will spend much time contemplating the nuances of antennaimplementation, they will certainly appreciate the range and reliability of a well-designed product. The field ofantenna design and application is complex, but by understanding a few ground rules, it is not necessary to bean antenna designer to design with an antenna.

Page 10