<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://hades.mech.northwestern.edu//index.php?action=history&amp;feed=atom&amp;title=USB_communication_with_CCS</id>
	<title>USB communication with CCS - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://hades.mech.northwestern.edu//index.php?action=history&amp;feed=atom&amp;title=USB_communication_with_CCS"/>
	<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_CCS&amp;action=history"/>
	<updated>2026-05-30T09:33:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_CCS&amp;diff=13287&amp;oldid=prev</id>
		<title>Gregory McGlynn at 07:45, 12 May 2009</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_CCS&amp;diff=13287&amp;oldid=prev"/>
		<updated>2009-05-12T07:45:46Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 02:45, 12 May 2009&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 11:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 11:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#fuses CPUDIV1  //This tells the PIC to run at a frequency of 48Mhz / 1 = 48Mhz. It may or may not be necessary.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#fuses CPUDIV1  //This tells the PIC to run at a frequency of 48Mhz / 1 = 48Mhz. It may or may not be necessary.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#include &amp;lt;usb_cdc.h&amp;gt; //Include the&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; CCS&lt;/del&gt; USB library. If you want to see all the functions available look at usb_cdc.h and usb.h.&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#include &amp;lt;usb_cdc.h&amp;gt; //Include the USB&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; CDC&lt;/ins&gt; library. If you want to see all the functions available look at usb_cdc.h and usb.h.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;void main() {&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;void main() {&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Gregory McGlynn</name></author>
	</entry>
	<entry>
		<id>https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_CCS&amp;diff=13286&amp;oldid=prev</id>
		<title>Gregory McGlynn at 07:43, 12 May 2009</title>
		<link rel="alternate" type="text/html" href="https://hades.mech.northwestern.edu//index.php?title=USB_communication_with_CCS&amp;diff=13286&amp;oldid=prev"/>
		<updated>2009-05-12T07:43:48Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;A sample program using CCS&amp;#039;s CDC library is shown below. The program waits for some input and then responds to it. When you first plug in the PIC to the computer, Windows will need to install a driver to talk to it. If you&amp;#039;re running XP or earlier, point it to the directory C:\Program Files\PICC\Drivers, where it will find what it needs. If you&amp;#039;re running Vista the driver may not be there; download [[Image:Cdc_NTXPVista.inf]], save it somewhere, and point Windows to it. Once the driver is installed a virtual COM port will be created (it will be visible in the device manager) and you&amp;#039;ll be able to talk to the PIC in Hyperterminal, Matlab, or anything else that communications over RS232.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#include &amp;lt;18f4550.h&amp;gt; //if your version of the compiler doesn&amp;#039;t support the 4553, you can put the 4550 in your code, which is almost exactly the same.&lt;br /&gt;
#use delay(clock=48000000) //because of tricky fuses a 20Mhz oscillator will make the PIC run at 48Mhz&lt;br /&gt;
#fuses HS, NOWDT, NOLVP, NOPROTECT //standard fuses&lt;br /&gt;
&lt;br /&gt;
//these fuses are critical. they assume a 20Mhz oscillator:&lt;br /&gt;
#fuses PLL5     //The USB module must run at 48Mhz. This tells the PIC to take the oscillator, divide the frequency by 5, then multiply by 12. The result must be 48Mhz. &lt;br /&gt;
#fuses HSPLL    //I&amp;#039;m not exactly sure what this fuses does, but it&amp;#039;s probably necessary.&lt;br /&gt;
#fuses VREGEN   //The USB module must run at 3.3V. This tells the PIC to accomplish this by using an internal voltage regulator.&lt;br /&gt;
#fuses CPUDIV1  //This tells the PIC to run at a frequency of 48Mhz / 1 = 48Mhz. It may or may not be necessary.&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;usb_cdc.h&amp;gt; //Include the CCS USB library. If you want to see all the functions available look at usb_cdc.h and usb.h.&lt;br /&gt;
&lt;br /&gt;
void main() {&lt;br /&gt;
   int c;&lt;br /&gt;
&lt;br /&gt;
   //these lines do some initialization, obviously:&lt;br /&gt;
   usb_cdc_init();&lt;br /&gt;
   usb_init();&lt;br /&gt;
   usb_wait_for_enumeration();   &lt;br /&gt;
&lt;br /&gt;
   while(true) {&lt;br /&gt;
       usb_task(); //handles connections to and disconnections from the computer, registering the PIC with the computer, etc. call this pretty often so that the PIC responds to being plugged in. &lt;br /&gt;
       &lt;br /&gt;
       if(usb_cdc_kbhit()) { //did we get some incoming data? &lt;br /&gt;
           c = usb_cdc_getc(); //get one character of input&lt;br /&gt;
           printf(usb_cdc_putc, &amp;quot;you typed: %c\r\n&amp;quot;, c); //print out a response over usb&lt;br /&gt;
       }&lt;br /&gt;
   }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gregory McGlynn</name></author>
	</entry>
</feed>