<!-- kate: tab-width 2; indent-mode xml; -->
<chapter id="pic_programs">
	<title>PIC Programs</title>
	
	<sect1 id="manipulation">
		<title>Manipulation</title>
		
		<para>When you create a FlowCode or a Text document, you'll notice a drop down menu in the toolbar with a rocket icon. From here, you can manipulate your PIC program; changing it to different forms.</para>
		
		<itemizedlist>
			<listitem><para>Convert to &microbe; - This is used only in &flowcode; documents. This is explained further in <xref linkend="flowcode"/>.</para></listitem>
			
			<listitem><para>Convert to Assembly - This can be used in four contexts. When a &flowcode; document is open, it will output the &flowcode; as assembly instructions. When a &microbe; document is open, it will invoke the <command>microbe</command> program distributed with &kappname; to compile the program. Similarly, if a C program is open, it will attempt to compile it via SDCC. When a text document containing PIC hex is open, it will invoke <command>gpdasm</command> to disassemble the hex.</para></listitem>
			
			<listitem><para>Convert to Hex - This can also be used in four contexts. As with Convert to Assembly, this can be used with &flowcode;, &microbe; and C documents. It will also be enabled when an assembly document is open to assemble it via <command>gpasm</command>.</para></listitem>
			
			<listitem><para>Upload to PIC - This assembles the PIC program currently being edited, and uploads it using the programmer that the user has selected.</para></listitem>
		</itemizedlist>
		
		<para>None of these actions require the current document to be saved - very useful for when a quick program is required. For non-PIC targets, the Output Dialog invoked on clicking on one of these actions can either output the result (always text in the above three cases) to a fresh document, or to a file. If the output is saved to file, it also provides options to load the file after creation, and adding the newly created file to the open project (if one is open).</para>
		
		<para>Note that you can make &kappname; always use the same view for displaying the outputed content by selecting the option under General Settings.</para>
	</sect1>
	
	<sect1 id="uploading">
		<title>Uploading</title>
		
		<para>&kappname; uses third-party programmers to upload programs to PICs. A variety of common programmers come predefined. Others can be added via the Settings dialog. See the <ulink url="http://ktechlab.org/pic_programmers.php">&kappname; website</ulink> for more information.</para>
		
		<para>The list of ports is obtained from scanning for serial and parallel ports that are readable and writable. Serial ports are looked for in:
			<itemizedlist>
				<listitem><para>/dev/ttyS<emphasis>[0..7]</emphasis></para></listitem>
				<listitem><para>/dev/tts/<emphasis>[0..7]</emphasis></para></listitem>
				<listitem><para>/dev/ttyUSB<emphasis>[0..7]</emphasis></para></listitem>
				<listitem><para>/dev/usb/tts/<emphasis>[0..7]</emphasis></para></listitem>
			</itemizedlist>
			Parallel ports are looked for in:
			<itemizedlist>
				<listitem><para>/dev/usb/parport<emphasis>[0..7]</emphasis></para></listitem>
				<listitem><para>/dev/usb/parports/<emphasis>[0..7]</emphasis></para></listitem>
			</itemizedlist>
		</para>
	</sect1>
</chapter>
