<?xml version="1.0" encoding="us-ascii"?><InstanceReport xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Version>2.4.0.8</Version><ReportLongName>0016 - Disclosure - 9. Credit Facility</ReportLongName><DisplayLabelColumn>true</DisplayLabelColumn><ShowElementNames>false</ShowElementNames><RoundingOption /><HasEmbeddedReports>false</HasEmbeddedReports><Columns><Column FlagID="0"><Id>1</Id><IsAbstractGroupTitle>false</IsAbstractGroupTitle><LabelSeparator>

</LabelSeparator><CurrencyCode /><FootnoteIndexer /><hasSegments>false</hasSegments><hasScenarios>false</hasScenarios><MCU><KeyName /><CurrencySymbol /><contextRef><ContextID>From2012-07-01to2013-06-30</ContextID><EntitySchema>http://www.sec.gov/CIK</EntitySchema><EntityValue>0000028561</EntityValue><PeriodDisplayName /><PeriodType>duration</PeriodType><PeriodStartDate>2012-07-01T00:00:00</PeriodStartDate><PeriodEndDate>2013-06-30T00:00:00</PeriodEndDate><Segments /><Scenarios /></contextRef><UPS /><CurrencyCode /><OriginalCurrencyCode /></MCU><CurrencySymbol /><Labels><Label Key="CalendarSupplement" Id="0" Label="12 Months Ended" /><Label Key="Calendar" Id="1" Label="Jun. 30, 2013" /></Labels></Column></Columns><Rows><Row FlagID="0"><Id>1</Id><IsAbstractGroupTitle>true</IsAbstractGroupTitle><LabelSeparator>

</LabelSeparator><Level>1</Level><ElementName>us-gaap_DebtDisclosureAbstract</ElementName><ElementPrefix>us-gaap_</ElementPrefix><IsBaseElement>true</IsBaseElement><BalanceType>na</BalanceType><PeriodType>duration</PeriodType><IsReportTitle>false</IsReportTitle><IsSegmentTitle>false</IsSegmentTitle><IsCalendarTitle>false</IsCalendarTitle><IsEquityPrevioslyReportedAsRow>false</IsEquityPrevioslyReportedAsRow><IsEquityAdjustmentRow>false</IsEquityAdjustmentRow><IsBeginningBalance>false</IsBeginningBalance><IsEndingBalance>false</IsEndingBalance><IsReverseSign>false</IsReverseSign><FootnoteIndexer /><Cells><Cell FlagID="0" ContextID="" UnitID=""><Id>1</Id><IsNumeric>false</IsNumeric><IsRatio>false</IsRatio><DisplayZeroAsNone>false</DisplayZeroAsNone><NumericAmount>0</NumericAmount><RoundedNumericAmount>0</RoundedNumericAmount><NonNumbericText /><FootnoteIndexer /><CurrencyCode /><CurrencySymbol /><IsIndependantCurrency>false</IsIndependantCurrency><ShowCurrencySymbol>false</ShowCurrencySymbol><DisplayDateInUSFormat>false</DisplayDateInUSFormat></Cell></Cells><ElementDataType>xbrli:stringItemType</ElementDataType><SimpleDataType>string</SimpleDataType><IsTotalLabel>false</IsTotalLabel><UnitID>0</UnitID><Label>Debt Disclosure [Abstract]</Label></Row><Row FlagID="0"><Id>2</Id><IsAbstractGroupTitle>false</IsAbstractGroupTitle><LabelSeparator>

</LabelSeparator><Level>2</Level><ElementName>us-gaap_ScheduleOfLineOfCreditFacilitiesTextBlock</ElementName><ElementPrefix>us-gaap_</ElementPrefix><IsBaseElement>true</IsBaseElement><BalanceType>na</BalanceType><PeriodType>duration</PeriodType><IsReportTitle>false</IsReportTitle><IsSegmentTitle>false</IsSegmentTitle><IsCalendarTitle>false</IsCalendarTitle><IsEquityPrevioslyReportedAsRow>false</IsEquityPrevioslyReportedAsRow><IsEquityAdjustmentRow>false</IsEquityAdjustmentRow><IsBeginningBalance>false</IsBeginningBalance><IsEndingBalance>false</IsEndingBalance><IsReverseSign>false</IsReverseSign><FootnoteIndexer /><Cells><Cell FlagID="0" ContextID="From2012-07-01to2013-06-30" UnitID=""><Id>1</Id><IsNumeric>false</IsNumeric><IsRatio>false</IsRatio><DisplayZeroAsNone>false</DisplayZeroAsNone><NumericAmount>0</NumericAmount><RoundedNumericAmount>0</RoundedNumericAmount><NonNumbericText>&lt;p style="margin: 0pt; font: 8pt Times New Roman, Times, Serif"&gt;&lt;/p&gt;

&lt;p style="font: 8pt Times New Roman, Times, Serif; margin: 0"&gt;&lt;font style="font: 8pt Times New Roman, Times, Serif"&gt;On April 27,
2009 the Company entered into a $500,000 line of credit (the &amp;#147;Line of Credit&amp;#148;) with TD Bank, NA (the &amp;#147;Bank&amp;#148;).
On November 2, 2011, the Company and the Bank entered into a modification of the Line of Credit, effective as of October 31, 2011,
which reduced the maximum borrowing amount to $375,000, removed the minimum interest rate of 4.25% on outstanding borrowings and
extended the Line of Credit to November 30, 2012. No other terms of the Company&amp;#146;s April 27, 2009 revolving term note to TD
Bank were changed. The Line of Credit provides among other things for an annual interest rate on borrowings equal to the Bank&amp;#146;s
prime rate plus one (1.00) percent and is subject to customary representations, covenants, and default provisions in favor of
the bank. The rate applicable to the line of credit at June 30, 2013 was approximately 4.25 %. Any loans drawn under the Line
of Credit are secured by a first lien on all of the Company&amp;#146;s accounts receivable, machinery, equipment, other personal property
and a Commercial Mortgage Security Agreement on the Company&amp;#146;s real property.&lt;/font&gt;&lt;/p&gt;

&lt;p style="font: 8pt Times New Roman, Times, Serif; margin: 0; text-indent: 0.5in"&gt;&lt;font style="font: 8pt Times New Roman, Times, Serif"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;

&lt;p style="font: 8pt Times New Roman, Times, Serif; margin: 0"&gt;&lt;font style="font: 8pt Times New Roman, Times, Serif"&gt;On November
16, 2012, the Company and the Bank entered into a further modification of the Line of Credit, effective as of November 30, 2012,
which returned the maximum borrowing amount to $500,000 and extended the Line of Credit to November 30, 2013. No other terms of
the Company&amp;#146;s revolving term note to the Bank (previously amended and restated as of October 31, 2011) were changed. During
fiscal 2013 the Company repaid $275,000 it had borrowed in fiscal 2012 under this line of credit. As of June 30, 2013 the Company
had no outstanding debt against the Line of Credit. The Company has previously utilized this line of credit during periods of
increased production requirements and anticipates that it will continue to utilize this credit facility during future periods
of peak production activity.&lt;/font&gt;&lt;/p&gt;



&lt;p style="margin: 0pt; font: 8pt Times New Roman, Times, Serif"&gt;&lt;/p&gt;</NonNumbericText><FootnoteIndexer /><CurrencyCode /><CurrencySymbol /><IsIndependantCurrency>false</IsIndependantCurrency><ShowCurrencySymbol>false</ShowCurrencySymbol><DisplayDateInUSFormat>false</DisplayDateInUSFormat></Cell></Cells><ElementDataType>nonnum:textBlockItemType</ElementDataType><SimpleDataType>na</SimpleDataType><ElementDefenition>Tabular disclosure of short-term or long-term contractual arrangements with lenders, including letters of credit, standby letters of credit, and revolving credit arrangements, under which borrowings can be made up to maximum amount as of any point in time conditional on satisfaction of specified terms before, as of and after the date of drawdowns on the line.</ElementDefenition><ElementReferences>Reference 1: http://www.xbrl.org/2003/role/presentationRef

 -Publisher FASB

 -Name Accounting Standards Codification

 -Topic 235

 -SubTopic 10

 -Section S99

 -Paragraph 1

 -Subparagraph (SX 210.4-08.(e),(f))

 -URI http://asc.fasb.org/extlink&amp;oid=26873400&amp;loc=d3e23780-122690



Reference 2: http://www.xbrl.org/2003/role/presentationRef

 -Publisher SEC

 -Name Regulation S-X (SX)

 -Number 210

 -Section 08

 -Paragraph f

 -Article 4



Reference 3: http://www.xbrl.org/2003/role/presentationRef

 -Publisher FASB

 -Name Accounting Standards Codification

 -Topic 210

 -SubTopic 10

 -Section S99

 -Paragraph 1

 -Subparagraph (SX 210.5-02.19(b),22(b))

 -URI http://asc.fasb.org/extlink&amp;oid=6877327&amp;loc=d3e13212-122682



Reference 4: http://www.xbrl.org/2003/role/presentationRef

 -Publisher SEC

 -Name Regulation S-X (SX)

 -Number 210

 -Section 02

 -Paragraph 19, 22

 -Article 5



</ElementReferences><IsTotalLabel>false</IsTotalLabel><UnitID>0</UnitID><Label>Credit Facility</Label></Row></Rows><Footnotes /><IsEquityReport>false</IsEquityReport><ReportName>9. Credit Facility</ReportName><MonetaryRoundingLevel>UnKnown</MonetaryRoundingLevel><SharesRoundingLevel>UnKnown</SharesRoundingLevel><PerShareRoundingLevel>UnKnown</PerShareRoundingLevel><ExchangeRateRoundingLevel>UnKnown</ExchangeRateRoundingLevel><HasCustomUnits>true</HasCustomUnits><IsEmbedReport>false</IsEmbedReport><IsMultiCurrency>false</IsMultiCurrency><ReportType>Sheet</ReportType><RoleURI>http://deweyelectronics.com/role/CreditFacility</RoleURI><NumberOfCols>1</NumberOfCols><NumberOfRows>2</NumberOfRows></InstanceReport>
