<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://pauljmac.com/projects/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Paul</id>
	<title>PaulJMac - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://pauljmac.com/projects/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Paul"/>
	<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=Special:Contributions/Paul"/>
	<updated>2026-04-21T12:39:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=Main_Page&amp;diff=18</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=Main_Page&amp;diff=18"/>
		<updated>2024-12-08T16:10:57Z</updated>

		<summary type="html">&lt;p&gt;Paul: /* Projects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;My name is Paul Mac and I am an electrical engineer in the Tampa / St. Petersburg area in sunny Florida. I use this wiki as a notebook for projects I&#039;ve done in the past or projects I&#039;m currently working on. Below you can see a list of my projects or you can [http://pauljmac.com go back to the home page.]&lt;br /&gt;
&lt;br /&gt;
2024-12-08 - After manually updating this MeidaWiki i&#039;ve left out some minor projects. &lt;br /&gt;
&lt;br /&gt;
== Projects ==&lt;br /&gt;
*[[Omron NB HMI and Allen-Bradley CompactLogix example]] - An example projct interfacing the Omron NB series serial HMIs with a RSLogix 5000 PLC. &lt;br /&gt;
&lt;br /&gt;
*[[Tennis_Ball_Cannon]] - Fully automatic tennis ball cannon.&lt;br /&gt;
&lt;br /&gt;
*[[Fluke_8100_Clock]] - A current work in progress! &lt;br /&gt;
&lt;br /&gt;
*[[TruckTree!]] - A Christmas tree I put in the back of my truck every year. Individually addressable RGB LEDs.&lt;br /&gt;
&lt;br /&gt;
*[[AVR web scraper]] - Using a Lantronix module to gather data from the web using an AVR.&lt;br /&gt;
&lt;br /&gt;
*[[RGB driver]] - RGB PWM driver using ATtiny. &lt;br /&gt;
&lt;br /&gt;
*[[RGB LED Fader]] - Using an ATtiny44 and a 3 chan LED driver IC to make a neat desk ordainment. &lt;br /&gt;
&lt;br /&gt;
*[[Ping Pong Scoreboard]] - A scoreboard for your Ping Pong matches!. &lt;br /&gt;
&lt;br /&gt;
*[[Mails Here!]] - (near)Finished mail notification project. I&#039;m redesigning the base station device still but the mail box device is done and done. Updates to follow...&lt;br /&gt;
&lt;br /&gt;
*[[DBL Flusher]] - A little device that will drive a servo motor to flush a toilet automatically. &lt;br /&gt;
&lt;br /&gt;
*[[Jeopardy PIC buzzer]] - My first real attempt at using a Microchip PIC. Uses a basic PIC16f84a and a simple assembly program to detect which player buzzes in first. Very similar to the reactions game below but only uses a couple TTL chips along with the PIC.&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=Main_Page&amp;diff=17</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=Main_Page&amp;diff=17"/>
		<updated>2024-12-08T16:10:41Z</updated>

		<summary type="html">&lt;p&gt;Paul: /* Projects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;My name is Paul Mac and I am an electrical engineer in the Tampa / St. Petersburg area in sunny Florida. I use this wiki as a notebook for projects I&#039;ve done in the past or projects I&#039;m currently working on. Below you can see a list of my projects or you can [http://pauljmac.com go back to the home page.]&lt;br /&gt;
&lt;br /&gt;
2024-12-08 - After manually updating this MeidaWiki i&#039;ve left out some minor projects. &lt;br /&gt;
&lt;br /&gt;
== Projects ==&lt;br /&gt;
*[[Omron NB HMI and Allen-Bradley CompactLogix example]] - An example projct interfacing the Omron NB series serial HMIs with a RSLogix 5000 PLC. &lt;br /&gt;
&lt;br /&gt;
*[[Tennis_Ball_Cannon]] - Fully automatic tennis ball cannon.&lt;br /&gt;
&lt;br /&gt;
*[[Fluke_8100_Clock]] - A current work in progress! &lt;br /&gt;
&lt;br /&gt;
*[[TruckTree!]] - A Christmas tree I put in the back of my truck every year. Individually addressable RGB LEDs.&lt;br /&gt;
&lt;br /&gt;
*[[AVR web scraper]] - Using a Lantronix module to gather data from the web using an AVR.&lt;br /&gt;
&lt;br /&gt;
*[[RGB driver]] - RGB PWM driver using ATtiny. &lt;br /&gt;
&lt;br /&gt;
*[[RGB LED Fader]] - Using an ATtiny44 and a 3 chan LED driver IC to make a neat desk ordainment. &lt;br /&gt;
&lt;br /&gt;
*[[Ping Pong Scoreboard]] - A scoreboard for your Ping Pong matches!. &lt;br /&gt;
&lt;br /&gt;
*[[Mails Here!]] - (near)Finished mail notification project. I&#039;m redesigning the base station device still but the mail box device is done and done. Updates to follow...&lt;br /&gt;
&lt;br /&gt;
*[[MaxStream Xbee modules bare-bones programing setup]] - These are great little RF modules to use with your projects. Heres a bare-bones setup you can use to program the Xbee or update firmware or whatever. &lt;br /&gt;
&lt;br /&gt;
*[[DBL Flusher]] - A little device that will drive a servo motor to flush a toilet automatically. &lt;br /&gt;
&lt;br /&gt;
*[[Jeopardy PIC buzzer]] - My first real attempt at using a Microchip PIC. Uses a basic PIC16f84a and a simple assembly program to detect which player buzzes in first. Very similar to the reactions game below but only uses a couple TTL chips along with the PIC. &lt;br /&gt;
&lt;br /&gt;
*[http://www.pauljmac.com/projects/uploads/Reactions.ppt Reactions Game] (power point) - One of my very first digital projects. A game called Reactions built using discrete logic. The point is to be the first person to &amp;quot;buzz in&amp;quot; when the light goes active. Whomever has the quickest reactions wins.&lt;br /&gt;
&lt;br /&gt;
*[[Double Wide Shelving]] - Some shelving I built for the garage. Designed completely with Google SketchUp from scratch.&lt;br /&gt;
&lt;br /&gt;
*[[Creative USB interface]] - Using a PIC18f4550 with built in USB to crate a device to easily communicate with a computer&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=Main_Page&amp;diff=16</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=Main_Page&amp;diff=16"/>
		<updated>2024-12-08T16:10:33Z</updated>

		<summary type="html">&lt;p&gt;Paul: /* Projects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;My name is Paul Mac and I am an electrical engineer in the Tampa / St. Petersburg area in sunny Florida. I use this wiki as a notebook for projects I&#039;ve done in the past or projects I&#039;m currently working on. Below you can see a list of my projects or you can [http://pauljmac.com go back to the home page.]&lt;br /&gt;
&lt;br /&gt;
2024-12-08 - After manually updating this MeidaWiki i&#039;ve left out some minor projects. &lt;br /&gt;
&lt;br /&gt;
== Projects ==&lt;br /&gt;
*[[Omron NB HMI and Allen-Bradley CompactLogix example]] - An example projct interfacing the Omron NB series serial HMIs with a RSLogix 5000 PLC. &lt;br /&gt;
&lt;br /&gt;
*[[Tennis_Ball_Cannon]] - Fully automatic tennis ball cannon.&lt;br /&gt;
&lt;br /&gt;
*[[Fluke_8100_Clock]] - A current work in progress! &lt;br /&gt;
&lt;br /&gt;
*[[TruckTree!]] - A Christmas tree I put in the back of my truck every year. Individually addressable RGB LEDs.&lt;br /&gt;
&lt;br /&gt;
*[[AVR web scraper]] - Using a Lantronix module to gather data from the web using an AVR.&lt;br /&gt;
&lt;br /&gt;
*[[RGB driver]] - RGB PWM driver using ATtiny. &lt;br /&gt;
&lt;br /&gt;
*[[RGB LED Fader]] - Using an ATtiny44 and a 3 chan LED driver IC to make a neat desk ordainment. &lt;br /&gt;
&lt;br /&gt;
*[[Ping Pong Scoreboard]] - A scoreboard for your Ping Pong matches!. &lt;br /&gt;
&lt;br /&gt;
*[[Dewalt battery repacking]] - Save some money by repacking your drill batteries yourself. &lt;br /&gt;
&lt;br /&gt;
*[[Mails Here!]] - (near)Finished mail notification project. I&#039;m redesigning the base station device still but the mail box device is done and done. Updates to follow...&lt;br /&gt;
&lt;br /&gt;
*[[MaxStream Xbee modules bare-bones programing setup]] - These are great little RF modules to use with your projects. Heres a bare-bones setup you can use to program the Xbee or update firmware or whatever. &lt;br /&gt;
&lt;br /&gt;
*[[DBL Flusher]] - A little device that will drive a servo motor to flush a toilet automatically. &lt;br /&gt;
&lt;br /&gt;
*[[Jeopardy PIC buzzer]] - My first real attempt at using a Microchip PIC. Uses a basic PIC16f84a and a simple assembly program to detect which player buzzes in first. Very similar to the reactions game below but only uses a couple TTL chips along with the PIC. &lt;br /&gt;
&lt;br /&gt;
*[http://www.pauljmac.com/projects/uploads/Reactions.ppt Reactions Game] (power point) - One of my very first digital projects. A game called Reactions built using discrete logic. The point is to be the first person to &amp;quot;buzz in&amp;quot; when the light goes active. Whomever has the quickest reactions wins.&lt;br /&gt;
&lt;br /&gt;
*[[Double Wide Shelving]] - Some shelving I built for the garage. Designed completely with Google SketchUp from scratch.&lt;br /&gt;
&lt;br /&gt;
*[[Creative USB interface]] - Using a PIC18f4550 with built in USB to crate a device to easily communicate with a computer&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=Main_Page&amp;diff=15</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=Main_Page&amp;diff=15"/>
		<updated>2024-12-08T16:10:18Z</updated>

		<summary type="html">&lt;p&gt;Paul: /* Projects */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;My name is Paul Mac and I am an electrical engineer in the Tampa / St. Petersburg area in sunny Florida. I use this wiki as a notebook for projects I&#039;ve done in the past or projects I&#039;m currently working on. Below you can see a list of my projects or you can [http://pauljmac.com go back to the home page.]&lt;br /&gt;
&lt;br /&gt;
2024-12-08 - After manually updating this MeidaWiki i&#039;ve left out some minor projects. &lt;br /&gt;
&lt;br /&gt;
== Projects ==&lt;br /&gt;
*[[Omron NB HMI and Allen-Bradley CompactLogix example]] - An example projct interfacing the Omron NB series serial HMIs with a RSLogix 5000 PLC. &lt;br /&gt;
&lt;br /&gt;
*[[Tennis_Ball_Cannon]] - Fully automatic tennis ball cannon.&lt;br /&gt;
&lt;br /&gt;
*[[Fluke_8100_Clock]] - A current work in progress! &lt;br /&gt;
&lt;br /&gt;
*[[TruckTree!]] - A Christmas tree I put in the back of my truck every year. Individually addressable RGB LEDs.&lt;br /&gt;
&lt;br /&gt;
*[[AVR web scraper]] - Using a Lantronix module to gather data from the web using an AVR.&lt;br /&gt;
&lt;br /&gt;
*[[RGB driver]] - RGB PWM driver using ATtiny. &lt;br /&gt;
&lt;br /&gt;
*[[RGB LED Fader]] - Using an ATtiny44 and a 3 chan LED driver IC to make a neat desk ordainment. &lt;br /&gt;
&lt;br /&gt;
*[[Show Control board]] - Used to flicker incandescent lights for effect. &lt;br /&gt;
&lt;br /&gt;
*[[Matrix Orbital LCD and AVR]] - Using an Matrix Orbital LCD with an AVR via TWI, good examples of sending out strings.&lt;br /&gt;
&lt;br /&gt;
*[[AVR Dragon buffer board]] - Used to protect the very fragile Dragon programing/debugging device. &lt;br /&gt;
&lt;br /&gt;
*[[Ping Pong Scoreboard]] - A scoreboard for your Ping Pong matches!. &lt;br /&gt;
&lt;br /&gt;
*[[Dewalt battery repacking]] - Save some money by repacking your drill batteries yourself. &lt;br /&gt;
&lt;br /&gt;
*[[Mails Here!]] - (near)Finished mail notification project. I&#039;m redesigning the base station device still but the mail box device is done and done. Updates to follow...&lt;br /&gt;
&lt;br /&gt;
*[[MaxStream Xbee modules bare-bones programing setup]] - These are great little RF modules to use with your projects. Heres a bare-bones setup you can use to program the Xbee or update firmware or whatever. &lt;br /&gt;
&lt;br /&gt;
*[[DBL Flusher]] - A little device that will drive a servo motor to flush a toilet automatically. &lt;br /&gt;
&lt;br /&gt;
*[[Jeopardy PIC buzzer]] - My first real attempt at using a Microchip PIC. Uses a basic PIC16f84a and a simple assembly program to detect which player buzzes in first. Very similar to the reactions game below but only uses a couple TTL chips along with the PIC. &lt;br /&gt;
&lt;br /&gt;
*[http://www.pauljmac.com/projects/uploads/Reactions.ppt Reactions Game] (power point) - One of my very first digital projects. A game called Reactions built using discrete logic. The point is to be the first person to &amp;quot;buzz in&amp;quot; when the light goes active. Whomever has the quickest reactions wins.&lt;br /&gt;
&lt;br /&gt;
*[[Double Wide Shelving]] - Some shelving I built for the garage. Designed completely with Google SketchUp from scratch.&lt;br /&gt;
&lt;br /&gt;
*[[Creative USB interface]] - Using a PIC18f4550 with built in USB to crate a device to easily communicate with a computer&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=Main_Page&amp;diff=14</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=Main_Page&amp;diff=14"/>
		<updated>2024-12-08T16:10:06Z</updated>

		<summary type="html">&lt;p&gt;Paul: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;My name is Paul Mac and I am an electrical engineer in the Tampa / St. Petersburg area in sunny Florida. I use this wiki as a notebook for projects I&#039;ve done in the past or projects I&#039;m currently working on. Below you can see a list of my projects or you can [http://pauljmac.com go back to the home page.]&lt;br /&gt;
&lt;br /&gt;
2024-12-08 - After manually updating this MeidaWiki i&#039;ve left out some minor projects. &lt;br /&gt;
&lt;br /&gt;
== Projects ==&lt;br /&gt;
*[[Omron NB HMI and Allen-Bradley CompactLogix example]] - An example projct interfacing the Omron NB series serial HMIs with a RSLogix 5000 PLC. &lt;br /&gt;
&lt;br /&gt;
*[[Tennis_Ball_Cannon]] - Fully automatic tennis ball cannon.&lt;br /&gt;
&lt;br /&gt;
*[[Fluke_8100_Clock]] - A current work in progress! &lt;br /&gt;
&lt;br /&gt;
*[[TruckTree!]] - A Christmas tree I put in the back of my truck every year. Individually addressable RGB LEDs.&lt;br /&gt;
&lt;br /&gt;
*[[AVR web scraper]] - Using a Lantronix module to gather data from the web using an AVR.&lt;br /&gt;
&lt;br /&gt;
*[[RGB driver]] - RGB PWM driver using ATtiny.&lt;br /&gt;
&lt;br /&gt;
*[[Gerbmerge]] - Quick guide on how to use gerbmerge to put multiple PCBs on a single panel. &lt;br /&gt;
&lt;br /&gt;
*[[vs1002d MP3 player]] - Playing MP3s from a FAT formatted SD card. &lt;br /&gt;
&lt;br /&gt;
*[[RGB LED Fader]] - Using an ATtiny44 and a 3 chan LED driver IC to make a neat desk ordainment. &lt;br /&gt;
&lt;br /&gt;
*[[Show Control board]] - Used to flicker incandescent lights for effect. &lt;br /&gt;
&lt;br /&gt;
*[[Matrix Orbital LCD and AVR]] - Using an Matrix Orbital LCD with an AVR via TWI, good examples of sending out strings.&lt;br /&gt;
&lt;br /&gt;
*[[AVR Dragon buffer board]] - Used to protect the very fragile Dragon programing/debugging device. &lt;br /&gt;
&lt;br /&gt;
*[[Ping Pong Scoreboard]] - A scoreboard for your Ping Pong matches!. &lt;br /&gt;
&lt;br /&gt;
*[[Dewalt battery repacking]] - Save some money by repacking your drill batteries yourself. &lt;br /&gt;
&lt;br /&gt;
*[[Mails Here!]] - (near)Finished mail notification project. I&#039;m redesigning the base station device still but the mail box device is done and done. Updates to follow...&lt;br /&gt;
&lt;br /&gt;
*[[MaxStream Xbee modules bare-bones programing setup]] - These are great little RF modules to use with your projects. Heres a bare-bones setup you can use to program the Xbee or update firmware or whatever. &lt;br /&gt;
&lt;br /&gt;
*[[DBL Flusher]] - A little device that will drive a servo motor to flush a toilet automatically. &lt;br /&gt;
&lt;br /&gt;
*[[Jeopardy PIC buzzer]] - My first real attempt at using a Microchip PIC. Uses a basic PIC16f84a and a simple assembly program to detect which player buzzes in first. Very similar to the reactions game below but only uses a couple TTL chips along with the PIC. &lt;br /&gt;
&lt;br /&gt;
*[http://www.pauljmac.com/projects/uploads/Reactions.ppt Reactions Game] (power point) - One of my very first digital projects. A game called Reactions built using discrete logic. The point is to be the first person to &amp;quot;buzz in&amp;quot; when the light goes active. Whomever has the quickest reactions wins.&lt;br /&gt;
&lt;br /&gt;
*[[Double Wide Shelving]] - Some shelving I built for the garage. Designed completely with Google SketchUp from scratch.&lt;br /&gt;
&lt;br /&gt;
*[[Creative USB interface]] - Using a PIC18f4550 with built in USB to crate a device to easily communicate with a computer&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=AVR_web_scraper&amp;diff=13</id>
		<title>AVR web scraper</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=AVR_web_scraper&amp;diff=13"/>
		<updated>2024-12-08T16:08:27Z</updated>

		<summary type="html">&lt;p&gt;Paul: Created page with &amp;quot;This project is an intro to web scraping using an AVR and lantronix ethernet module.  The idea here is to connect to a web server, scrape a specific page, parse everything on it to find the desired data and do whatever I want with said data.  In my project I am scraping temperature data to display in a (somewhat) fancy wall decoration. Every hour it will get the temperature from the webpage and update the 7 segment display. This was a present I made for my Mom who moved...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project is an intro to web scraping using an AVR and lantronix ethernet module.  The idea here is to connect to a web server, scrape a specific page, parse everything on it to find the desired data and do whatever I want with said data.&lt;br /&gt;
&lt;br /&gt;
In my project I am scraping temperature data to display in a (somewhat) fancy wall decoration. Every hour it will get the temperature from the webpage and update the 7 segment display. This was a present I made for my Mom who moved to NY from FL. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Still to do:&lt;br /&gt;
*Implement error routines in case the scraper page shows an E. Meaning it is unable to retrieve the data from wunderground. &lt;br /&gt;
*Implement a routine to handle a case where the temperature is triple digits, over 99.&lt;br /&gt;
*Implement a routine to handle a case where the temperature is negative. Does not happen to often here in FL. &lt;br /&gt;
&lt;br /&gt;
==modules==&lt;br /&gt;
I used matchport modules because of their wireless capability. Whichever Lantronix module you decide to use you must put it in a specific mode for this application. To put the module in manual mode do the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tellnet to the device ip:9999 TCP&lt;br /&gt;
Select channel. I choose 1&lt;br /&gt;
Enter though everything to accept defaults until you get to to ConnectMode, then enter D4 to configure the module to work with the micro.&lt;br /&gt;
Enter though the rest of the settings for defaults&lt;br /&gt;
When you get to the end save the new configuration&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=code=&lt;br /&gt;
This code is really crude at this point, just a proof of concept really. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#define F_CPU 8000000&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;avr/io.h&amp;gt;&lt;br /&gt;
#include &amp;lt;avr/interrupt.h&amp;gt;&lt;br /&gt;
#include &amp;lt;util/delay.h&amp;gt;&lt;br /&gt;
#include &amp;lt;avr/pgmspace.h&amp;gt; &lt;br /&gt;
&lt;br /&gt;
#define bit_get(p,m) (((p) &amp;amp; (m)) &amp;gt;&amp;gt; m)&lt;br /&gt;
#define bit_set(p,m) ((p) |= (m))&lt;br /&gt;
#define bit_clear(p,m) ((p) &amp;amp;= ~(m))&lt;br /&gt;
#define bit_flip(p,m) ((p) ^= (m))&lt;br /&gt;
#define bit_write(c,p,m) (c ? bit_set(p,m) : bit_clear(p,m))&lt;br /&gt;
#define BIT(x) (0x01 &amp;lt;&amp;lt; (x))&lt;br /&gt;
#define LONGBIT(x) ((unsigned long)0x00000001 &amp;lt;&amp;lt; (x))&lt;br /&gt;
#define BITVAL(y,x) (((x)&amp;gt;&amp;gt;(y)) &amp;amp; 1)&lt;br /&gt;
#define NOP asm(&amp;quot;nop&amp;quot;)&lt;br /&gt;
#define OUT 1&lt;br /&gt;
#define IN 0&lt;br /&gt;
&lt;br /&gt;
volatile uint8_t x=0, state=0, msd, lsd, letter_waiting=0, parse=0, sec=0, min=0;&lt;br /&gt;
volatile char last_received_char=0;&lt;br /&gt;
volatile uint16_t y=0;&lt;br /&gt;
&lt;br /&gt;
//Interrupt vector names: http://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html&lt;br /&gt;
&lt;br /&gt;
ISR(USART_RX_vect){&lt;br /&gt;
	letter_waiting=1;&lt;br /&gt;
	last_received_char=UDR0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ISR(USART_TX_vect){&lt;br /&gt;
	&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ISR(TIMER1_OVF_vect){&lt;br /&gt;
	TCNT1=0xE17C;&lt;br /&gt;
	sec++;&lt;br /&gt;
	if(sec==60){&lt;br /&gt;
		sec=0;&lt;br /&gt;
		min++;&lt;br /&gt;
		if(min==60){&lt;br /&gt;
			state=2;&lt;br /&gt;
			letter_waiting=1;&lt;br /&gt;
			min=0;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Matchport_Connect(){&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;C&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;7&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;2&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;.&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;2&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;4&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;9&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;.&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;1&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;1&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;9&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;.&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;1&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;5&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;0&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;:&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;8&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;0&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;\n&#039;;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Matchport_GET(){&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;G&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;E&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;T&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039; &#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;/&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;~&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;p&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;a&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;u&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;l&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;j&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;m&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;a&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;c&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;/&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;c&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;l&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;e&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;a&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;r&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;w&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;a&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;t&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;e&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;r&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;.&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;p&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;h&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;p&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039; &#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;H&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;T&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;T&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;P&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;/&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;1&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;.&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;1&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=0x0a;&lt;br /&gt;
&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;H&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;O&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;S&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;T&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;:&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039; &#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;p&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;a&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;u&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;l&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;j&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;m&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;a&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;c&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;.&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;c&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;o&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=&#039;m&#039;;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=0x0a;&lt;br /&gt;
	while ( !( UCSR0A &amp;amp; (1&amp;lt;&amp;lt;UDRE0)) );&lt;br /&gt;
	UDR0=0x0a;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
char Num_to_code(char num){&lt;br /&gt;
	&lt;br /&gt;
switch (num){&lt;br /&gt;
		case 0:&lt;br /&gt;
			return 0x3f;&lt;br /&gt;
			break;&lt;br /&gt;
		case 1:&lt;br /&gt;
			return 0x06;&lt;br /&gt;
			break;&lt;br /&gt;
		case 2:&lt;br /&gt;
			return 0x5B;&lt;br /&gt;
			break;&lt;br /&gt;
		case 3:&lt;br /&gt;
			return 0x4F;&lt;br /&gt;
			break;&lt;br /&gt;
		case 4:&lt;br /&gt;
			return 0x66;&lt;br /&gt;
			break;&lt;br /&gt;
		case 5:&lt;br /&gt;
			return 0x6D;&lt;br /&gt;
			break;&lt;br /&gt;
		case 6:&lt;br /&gt;
			return 0x7D;&lt;br /&gt;
			break;&lt;br /&gt;
		case 7:&lt;br /&gt;
			return 0x07;&lt;br /&gt;
			break;&lt;br /&gt;
		case 8:&lt;br /&gt;
			return 0x7F;&lt;br /&gt;
			break;&lt;br /&gt;
		case 9:&lt;br /&gt;
			return 0x6F;&lt;br /&gt;
			break;&lt;br /&gt;
		default:&lt;br /&gt;
			return 0;&lt;br /&gt;
			break;&lt;br /&gt;
	}}&lt;br /&gt;
&lt;br /&gt;
void Print_Temp(){&lt;br /&gt;
&lt;br /&gt;
	PORTB = ~(Num_to_code(lsd-48));&lt;br /&gt;
	bit_clear(PORTB, BIT(7));&lt;br /&gt;
	_delay_us(20);&lt;br /&gt;
	bit_set(PORTB, BIT(7));&lt;br /&gt;
&lt;br /&gt;
	_delay_us(50);&lt;br /&gt;
&lt;br /&gt;
	PORTB =( ~(Num_to_code(msd-48)) &amp;amp; 0b01111111);&lt;br /&gt;
//	bit_clear(PORTB, BIT(7));&lt;br /&gt;
&lt;br /&gt;
	bit_set(PORTC,BIT(0)); //turn on MSD common anode&lt;br /&gt;
	_delay_us(30);&lt;br /&gt;
	bit_clear(PORTC,BIT(0)); //turn off MSD common anode&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Clock_Setup(void){&lt;br /&gt;
	CLKPR = 0b10000000;&lt;br /&gt;
	CLKPR = 0x00;&lt;br /&gt;
	//turn off clock /8 so clock is 8Mhz&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Port_Setup(void){&lt;br /&gt;
	PIND = (1&amp;lt;&amp;lt;DDD3)|(1&amp;lt;&amp;lt;DDD2);&lt;br /&gt;
	DDRD= (IN&amp;lt;&amp;lt;DDD3)|(IN&amp;lt;&amp;lt;DDD2)|(OUT&amp;lt;&amp;lt;DDD1)|(IN&amp;lt;&amp;lt;DDD0);&lt;br /&gt;
	bit_set(PORTD,BIT(2));&lt;br /&gt;
	bit_set(PORTD,BIT(3));&lt;br /&gt;
	DDRB=0xFF;&lt;br /&gt;
	DDRC |=  (OUT&amp;lt;&amp;lt;DDC1)|(OUT&amp;lt;&amp;lt;DDC0);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void USART0_Setup(void){&lt;br /&gt;
	UCSR0A = (0 &amp;lt;&amp;lt; U2X0);		//usart double speed&lt;br /&gt;
	UCSR0B = (1 &amp;lt;&amp;lt; RXCIE0)|(0 &amp;lt;&amp;lt; TXCIE0)|(1 &amp;lt;&amp;lt; RXEN0) | (1 &amp;lt;&amp;lt;TXEN0); //rx/tx on. rx/tx ints enabled&lt;br /&gt;
	UCSR0C = (0 &amp;lt;&amp;lt; UCSZ02)|(1 &amp;lt;&amp;lt; UCSZ01)|(1 &amp;lt;&amp;lt; UCSZ00);  //8bit USART&lt;br /&gt;
	UBRR0L = 51;&lt;br /&gt;
	UBRR0H = 0; &lt;br /&gt;
	&lt;br /&gt;
	// the above is for 9600 baud with a clock of 8Mhz&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Timer1_Setup(void){&lt;br /&gt;
	TCNT1=0xE17C;&lt;br /&gt;
	TCCR1B=(1&amp;lt;&amp;lt;CS12)|(0&amp;lt;&amp;lt;CS11)|(1&amp;lt;&amp;lt;CS10);&lt;br /&gt;
	TIMSK1=(1&amp;lt;&amp;lt;TOIE1);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(void){&lt;br /&gt;
	Clock_Setup();&lt;br /&gt;
	Port_Setup();&lt;br /&gt;
	USART0_Setup();&lt;br /&gt;
	Timer1_Setup();&lt;br /&gt;
	sei();&lt;br /&gt;
	for(;;){&lt;br /&gt;
		Print_Temp();&lt;br /&gt;
		if(letter_waiting==1){&lt;br /&gt;
			/*&lt;br /&gt;
			State 0 means unkown, bootup&lt;br /&gt;
			state 1 means the device is idle, disconnected&lt;br /&gt;
			state 2 sets the device to connect to the webserver&lt;br /&gt;
			state 3 means the device is connected to the webserver&lt;br /&gt;
			state 4 sets the device to issue a GET command&lt;br /&gt;
			state 5 means the device is waiting for a responce to the GET&lt;br /&gt;
			state 6 means the device has gotten a responce to the GET and is idle, waiting to get a d/c char&lt;br /&gt;
			*/&lt;br /&gt;
			switch (state){&lt;br /&gt;
				case 0:&lt;br /&gt;
					if(last_received_char==&#039;D&#039;){&lt;br /&gt;
						state=1;&lt;br /&gt;
					}&lt;br /&gt;
					letter_waiting=1;&lt;br /&gt;
					bit_clear(PORTD,BIT(2));&lt;br /&gt;
					break;&lt;br /&gt;
				case 1:&lt;br /&gt;
					state=2;&lt;br /&gt;
					//device is idle here, disconnected&lt;br /&gt;
					break;&lt;br /&gt;
				case 2:&lt;br /&gt;
					Matchport_Connect();&lt;br /&gt;
					state=3;&lt;br /&gt;
					break;&lt;br /&gt;
				case 3:&lt;br /&gt;
					//device is connected to the webserver here&lt;br /&gt;
					if(last_received_char==&#039;C&#039;){&lt;br /&gt;
						state=4;&lt;br /&gt;
					}&lt;br /&gt;
					break;&lt;br /&gt;
				case 4:&lt;br /&gt;
					Matchport_GET();&lt;br /&gt;
					bit_clear(PORTD,BIT(3));&lt;br /&gt;
					state=5;&lt;br /&gt;
				case 5:&lt;br /&gt;
					/*&lt;br /&gt;
					parse 0 means nothing of intrest&lt;br /&gt;
					parse 1 was T recieved&lt;br /&gt;
					parse 2 was : recieved&lt;br /&gt;
					parse 3 was &amp;lt; recieved&lt;br /&gt;
					parse 4 was first digit&lt;br /&gt;
					*/&lt;br /&gt;
					switch (parse){&lt;br /&gt;
						case 0:&lt;br /&gt;
							if(last_received_char==&#039;T&#039;){&lt;br /&gt;
								parse = 1;&lt;br /&gt;
							}&lt;br /&gt;
							else {&lt;br /&gt;
								parse = 0;&lt;br /&gt;
							}&lt;br /&gt;
							letter_waiting=0;&lt;br /&gt;
							break;&lt;br /&gt;
						case 1:&lt;br /&gt;
							if(last_received_char==&#039;:&#039;){&lt;br /&gt;
								parse = 2;&lt;br /&gt;
							}&lt;br /&gt;
							else {&lt;br /&gt;
								parse = 0;&lt;br /&gt;
							}&lt;br /&gt;
							letter_waiting=0;&lt;br /&gt;
							break;&lt;br /&gt;
						case 2:&lt;br /&gt;
							if(last_received_char==&#039;&amp;lt;&#039;){&lt;br /&gt;
								parse = 3;&lt;br /&gt;
							}&lt;br /&gt;
							else {&lt;br /&gt;
								parse = 0;&lt;br /&gt;
							}&lt;br /&gt;
							letter_waiting=0;&lt;br /&gt;
							break;&lt;br /&gt;
						case 3:&lt;br /&gt;
							if(last_received_char==&#039;e&#039;){&lt;br /&gt;
								parse = 0;&lt;br /&gt;
								//RUN TO ERROR RUTINE HERE&lt;br /&gt;
							}&lt;br /&gt;
							else{ //the most signifigant digit&lt;br /&gt;
								msd=last_received_char;&lt;br /&gt;
								parse = 4;&lt;br /&gt;
							}&lt;br /&gt;
							letter_waiting=0;&lt;br /&gt;
							break;&lt;br /&gt;
						case 4:&lt;br /&gt;
							lsd=last_received_char;&lt;br /&gt;
							parse = 0;&lt;br /&gt;
							state=6;&lt;br /&gt;
							letter_waiting=0;&lt;br /&gt;
							break;&lt;br /&gt;
					}&lt;br /&gt;
					break;&lt;br /&gt;
				case 6:&lt;br /&gt;
					if(last_received_char==&#039;D&#039;){&lt;br /&gt;
						letter_waiting=0;&lt;br /&gt;
					}&lt;br /&gt;
					//the transaction is complete. It can sit here untill its time to lookup again.&lt;br /&gt;
					//switch to case 2 when its time to connect again.&lt;br /&gt;
					break;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The code uses a state machine to handle the connection process. The current temp is then muxed to a 7 segment display.&lt;br /&gt;
&lt;br /&gt;
=web files=&lt;br /&gt;
This is the php file on my web server which grabs the data from an XML feed of wunderground. And presents it nicely to the micro. &lt;br /&gt;
&lt;br /&gt;
[http://pauljmac.com/clearwater.php http://pauljmac.com/clearwater.php]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
$url =&lt;br /&gt;
&amp;quot;http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=Clearwater,FL&amp;quot;;&lt;br /&gt;
$xml = @simplexml_load_file($url);&lt;br /&gt;
if ($xml){&lt;br /&gt;
       if ($xml-&amp;gt;display_location-&amp;gt;city != &#039;&#039;){&lt;br /&gt;
echo &amp;quot;T:&amp;lt;&amp;quot;;&lt;br /&gt;
               echo $xml-&amp;gt;temp_f;&lt;br /&gt;
               &lt;br /&gt;
echo&amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
       }&lt;br /&gt;
} else {&lt;br /&gt;
	echo &amp;quot;T:&amp;lt;&amp;quot;;&lt;br /&gt;
       echo &amp;quot;e&amp;quot;;&lt;br /&gt;
       echo &amp;quot;&amp;gt;&amp;quot;;&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Photos=&lt;br /&gt;
I used my fireball V90 CNC router to cut the FL out of MDF. &lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:100 0403 (Medium).JPG| Back of the FL &lt;br /&gt;
Image:100 0407 (Medium).JPG| Front&lt;br /&gt;
Image:100 0408 (Medium).JPG| Front with the temp displayed&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=RGB_driver&amp;diff=12</id>
		<title>RGB driver</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=RGB_driver&amp;diff=12"/>
		<updated>2024-12-08T16:08:03Z</updated>

		<summary type="html">&lt;p&gt;Paul: Created page with &amp;quot;==Abstract== This project was for a Halloween prop wand. A tiny circuit board with a AA battery pack and RGB LED was held in the hand with a ~10&amp;quot; acrylic light pipe to pose as the wand. The wand had 4 modes.   RGB cycle mode - The wand cycled through the RGB color spectrum slowly fading into surrounding colors.   Color lock - Locks the wand onto the currently displayed color.   &amp;quot;Tink&amp;quot; mode - The wand slowly pulsates a tan color, much like what you would picture Tinkerbel...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
This project was for a Halloween prop wand. A tiny circuit board with a AA battery pack and RGB LED was held in the hand with a ~10&amp;quot; acrylic light pipe to pose as the wand. The wand had 4 modes. &lt;br /&gt;
&lt;br /&gt;
RGB cycle mode - The wand cycled through the RGB color spectrum slowly fading into surrounding colors. &lt;br /&gt;
&lt;br /&gt;
Color lock - Locks the wand onto the currently displayed color. &lt;br /&gt;
&lt;br /&gt;
&amp;quot;Tink&amp;quot; mode - The wand slowly pulsates a tan color, much like what you would picture Tinkerbell&#039;s wand doing. &lt;br /&gt;
&lt;br /&gt;
Off - Off!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Video of said wand: [http://www.youtube.com/watch?v=B4l27Mpw3fE http://www.youtube.com/watch?v=B4l27Mpw3fE]&lt;br /&gt;
&lt;br /&gt;
== Parts ==&lt;br /&gt;
Attiny45&lt;br /&gt;
&lt;br /&gt;
RGB LED&lt;br /&gt;
&lt;br /&gt;
NOMO button&lt;br /&gt;
&lt;br /&gt;
2 cell battery pack&lt;br /&gt;
&lt;br /&gt;
Light pipe&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
Currently there is a bug I was unable to trace that causes the light to very quickly go out at what seems to be random intervals. It’s not totally obvious so I let it slide.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;avr/io.h&amp;gt;&lt;br /&gt;
#include &amp;lt;avr/interrupt.h&amp;gt;&lt;br /&gt;
#include &amp;lt;util/delay.h&amp;gt;&lt;br /&gt;
#include &amp;lt;avr/pgmspace.h&amp;gt; &lt;br /&gt;
&lt;br /&gt;
#define bit_get(p,m) ((p) &amp;amp; (m))&lt;br /&gt;
#define bit_set(p,m) ((p) |= (m))&lt;br /&gt;
#define bit_clear(p,m) ((p) &amp;amp;= ~(m))&lt;br /&gt;
#define bit_flip(p,m) ((p) ^= (m))&lt;br /&gt;
#define bit_write(c,p,m) (c ? bit_set(p,m) : bit_clear(p,m))&lt;br /&gt;
#define BIT(x) (0x01 &amp;lt;&amp;lt; (x))&lt;br /&gt;
#define LONGBIT(x) ((unsigned long)0x00000001 &amp;lt;&amp;lt; (x))&lt;br /&gt;
#define NOP asm(&amp;quot;nop&amp;quot;)&lt;br /&gt;
#define OUT 1&lt;br /&gt;
#define IN 0&lt;br /&gt;
#define RED_DEF 2&lt;br /&gt;
#define BLUE_DEF 0&lt;br /&gt;
#define GREEN_DEF 1&lt;br /&gt;
&lt;br /&gt;
#define PRELOAD 0xCE&lt;br /&gt;
&lt;br /&gt;
volatile uint8_t red=0, green=0, blue=0, mode=0, RGB_mode=0, PWM=100, t0_preload=0xCF,&lt;br /&gt;
 last_mode, tink_play=0;&lt;br /&gt;
volatile uint16_t button_cooldown=0;&lt;br /&gt;
&lt;br /&gt;
//this is kind of like a play file&lt;br /&gt;
//the rutine will play though this file in order&lt;br /&gt;
//format is R, G, B in % of light&lt;br /&gt;
static unsigned char file1[] PROGMEM =&lt;br /&gt;
{&lt;br /&gt;
	20,10,0,&lt;br /&gt;
	22,11,0,&lt;br /&gt;
	25,12,0,&lt;br /&gt;
	28,15,0,&lt;br /&gt;
	31,18,0,&lt;br /&gt;
	35,23,0,&lt;br /&gt;
	38,25,0,&lt;br /&gt;
	42,30,0,&lt;br /&gt;
	45,35,0,&lt;br /&gt;
	50,40,0,&lt;br /&gt;
	55,45,0,&lt;br /&gt;
	59,50,0,&lt;br /&gt;
	65,53,0,&lt;br /&gt;
	70,58,0,&lt;br /&gt;
	75,60,0,&lt;br /&gt;
	85,64,0,&lt;br /&gt;
	90,70,0,&lt;br /&gt;
	95,73,0,&lt;br /&gt;
	100,76,0,&lt;br /&gt;
	100,78,0,&lt;br /&gt;
	100,82,0,&lt;br /&gt;
	100,84,0,&lt;br /&gt;
	100,84,0,&lt;br /&gt;
	100,84,0,&lt;br /&gt;
	95,80,0,&lt;br /&gt;
	92,76,0,&lt;br /&gt;
	90,73,0,&lt;br /&gt;
	87,68,0,&lt;br /&gt;
	82,62,0,&lt;br /&gt;
	79,60,0,&lt;br /&gt;
	75,55,0,&lt;br /&gt;
	72,53,0,&lt;br /&gt;
	70,50,0,&lt;br /&gt;
	68,49,0,&lt;br /&gt;
	65,46,0,&lt;br /&gt;
	63,44,0,&lt;br /&gt;
	60,42,0,&lt;br /&gt;
	50,40,0,&lt;br /&gt;
	47,39,0,&lt;br /&gt;
	44,37,0,&lt;br /&gt;
	41,34,0,&lt;br /&gt;
	38,32,0,&lt;br /&gt;
	36,30,0,&lt;br /&gt;
	34,28,0,&lt;br /&gt;
	32,26,0,&lt;br /&gt;
	30,24,0,&lt;br /&gt;
	28,22,0,&lt;br /&gt;
	26,20,0,&lt;br /&gt;
	24,18,0,&lt;br /&gt;
	22,16,0,&lt;br /&gt;
	20,14,0&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ISR(TIMER0_OVF_vect){ //SPECIAL COLOR STUFFF&lt;br /&gt;
	TCNT0=t0_preload;&lt;br /&gt;
	if(mode==1){ //rgb mode&lt;br /&gt;
		switch (RGB_mode){ //0 is red++, 1 is green++, 2 is blue ++;&lt;br /&gt;
			case 0:&lt;br /&gt;
				blue--;&lt;br /&gt;
				red++;&lt;br /&gt;
				if(red==100){&lt;br /&gt;
					RGB_mode=1;&lt;br /&gt;
				}&lt;br /&gt;
				break;&lt;br /&gt;
			case 1:	&lt;br /&gt;
				red--;&lt;br /&gt;
				green++;&lt;br /&gt;
				if(green==100){&lt;br /&gt;
					RGB_mode=2;&lt;br /&gt;
				}&lt;br /&gt;
				break;&lt;br /&gt;
			case 2:&lt;br /&gt;
				green--;&lt;br /&gt;
				blue++;&lt;br /&gt;
				if(blue==100){&lt;br /&gt;
					RGB_mode=0;&lt;br /&gt;
				}&lt;br /&gt;
			default:&lt;br /&gt;
				break;&lt;br /&gt;
			&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	else if(mode==3){ //rgb mode&lt;br /&gt;
		red=pgm_read_byte(&amp;amp;file1[tink_play]);&lt;br /&gt;
		green=pgm_read_byte(&amp;amp;file1[++tink_play]);&lt;br /&gt;
		blue=pgm_read_byte(&amp;amp;file1[++tink_play]);&lt;br /&gt;
		tink_play++;&lt;br /&gt;
		if(tink_play&amp;gt;147){&lt;br /&gt;
			tink_play=0;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
ISR(TIMER1_OVF_vect){ //COLOR UPDATE&lt;br /&gt;
	TCNT1=PRELOAD;&lt;br /&gt;
	if(bit_get(PINB, BIT(3))==0){ //if button pressed&lt;br /&gt;
		if(button_cooldown==0){ &lt;br /&gt;
			mode++;&lt;br /&gt;
			button_cooldown=2000;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	if(button_cooldown &amp;gt; 0){&lt;br /&gt;
		button_cooldown--;&lt;br /&gt;
	}&lt;br /&gt;
	if(PWM==red){&lt;br /&gt;
		bit_set(PORTB, BIT(RED_DEF));&lt;br /&gt;
	}&lt;br /&gt;
	if(PWM==green){&lt;br /&gt;
		bit_set(PORTB, BIT(GREEN_DEF));&lt;br /&gt;
	}&lt;br /&gt;
	if(PWM==blue){&lt;br /&gt;
		bit_set(PORTB, BIT(BLUE_DEF));&lt;br /&gt;
	}&lt;br /&gt;
	PWM--;&lt;br /&gt;
	if (PWM==0){&lt;br /&gt;
		bit_clear(PORTB, BIT(RED_DEF));&lt;br /&gt;
		bit_clear(PORTB, BIT(GREEN_DEF));&lt;br /&gt;
		bit_clear(PORTB, BIT(BLUE_DEF));&lt;br /&gt;
		PWM=100;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void timer0_setup(void){&lt;br /&gt;
	TIMSK|=(1&amp;lt;&amp;lt;TOIE0);&lt;br /&gt;
	TCNT0=t0_preload;&lt;br /&gt;
	TCCR0B=(1&amp;lt;&amp;lt;CS02)|(0&amp;lt;&amp;lt;CS01)|(1&amp;lt;&amp;lt;CS00); // 1024 div&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void timer0_stop(void){&lt;br /&gt;
	bit_clear(TIMSK, (BIT(TOIE0)));&lt;br /&gt;
	TCCR0B=(0&amp;lt;&amp;lt;CS13)|(0&amp;lt;&amp;lt;CS12)|(0&amp;lt;&amp;lt;CS11)|(0&amp;lt;&amp;lt;CS10);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void timer1_setup(void){ //COLOR UPDATE &lt;br /&gt;
	TCNT1=PRELOAD;&lt;br /&gt;
	TIMSK|=(1&amp;lt;&amp;lt;TOIE1);&lt;br /&gt;
	TCCR1=(0&amp;lt;&amp;lt;CS13)|(1&amp;lt;&amp;lt;CS12)|(0&amp;lt;&amp;lt;CS11)|(1&amp;lt;&amp;lt;CS10); //16 dev&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void port_setup(void){&lt;br /&gt;
	DDRB = (IN&amp;lt;&amp;lt;DDB3)|(OUT&amp;lt;&amp;lt;BLUE_DEF)|(OUT&amp;lt;&amp;lt;GREEN_DEF)|(OUT&amp;lt;&amp;lt;RED_DEF);&lt;br /&gt;
	PORTB = (1&amp;lt;&amp;lt;PORTB3); //enable pullup&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
int main(){&lt;br /&gt;
	port_setup();&lt;br /&gt;
	timer1_setup();&lt;br /&gt;
	sei();&lt;br /&gt;
	for(;;){&lt;br /&gt;
		if (mode &amp;gt;= 5){&lt;br /&gt;
			mode=0;&lt;br /&gt;
			last_mode=0;&lt;br /&gt;
		}&lt;br /&gt;
		switch (mode){&lt;br /&gt;
			case 0: //off&lt;br /&gt;
				red=0;&lt;br /&gt;
				green=0;&lt;br /&gt;
				blue=0;&lt;br /&gt;
				break;&lt;br /&gt;
			case 1: //RGB mode&lt;br /&gt;
				if(last_mode == 0){&lt;br /&gt;
					last_mode=mode;&lt;br /&gt;
					blue=100;&lt;br /&gt;
					red=0;&lt;br /&gt;
					green=0;&lt;br /&gt;
					RGB_mode=0;&lt;br /&gt;
					t0_preload=0x00; //&lt;br /&gt;
					NOP;&lt;br /&gt;
					timer0_setup();&lt;br /&gt;
				}&lt;br /&gt;
				break;&lt;br /&gt;
			case 2: //lock&lt;br /&gt;
				if(last_mode == 1){&lt;br /&gt;
					last_mode=mode;&lt;br /&gt;
					timer0_stop();&lt;br /&gt;
				}&lt;br /&gt;
				break;&lt;br /&gt;
			case 3: //tink mode&lt;br /&gt;
				if(last_mode == 2){&lt;br /&gt;
					last_mode=mode;&lt;br /&gt;
					t0_preload=0x00; //&lt;br /&gt;
					timer0_setup();&lt;br /&gt;
				}&lt;br /&gt;
				break;&lt;br /&gt;
			case 4: //white&lt;br /&gt;
				if(last_mode == 3){&lt;br /&gt;
					last_mode=mode;&lt;br /&gt;
					timer0_stop();&lt;br /&gt;
				}&lt;br /&gt;
				red=100;&lt;br /&gt;
				green=100;&lt;br /&gt;
				blue=100;&lt;br /&gt;
				break;&lt;br /&gt;
			default:&lt;br /&gt;
				break;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=TruckTree!&amp;diff=11</id>
		<title>TruckTree!</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=TruckTree!&amp;diff=11"/>
		<updated>2024-12-08T16:07:33Z</updated>

		<summary type="html">&lt;p&gt;Paul: Created page with &amp;quot;This project is for a Christmas tree that I put in the back of my truck each year around that time. It uses a strand (or 2) of individually addressable RGB LEDs. The LEDs have a WS2811 driver IC which communicates using 1 wire serial. This is NOT to be confused with the WS2801 which is a 2 wire serial IC, and quite frankly a lot easier to work with. Luckily though, people like [http://bleaklow.com/ Alan Burlison] have already done the hard work for everyone and have been...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This project is for a Christmas tree that I put in the back of my truck each year around that time. It uses a strand (or 2) of individually addressable RGB LEDs. The LEDs have a WS2811 driver IC which communicates using 1 wire serial. This is NOT to be confused with the WS2801 which is a 2 wire serial IC, and quite frankly a lot easier to work with. Luckily though, people like [http://bleaklow.com/ Alan Burlison] have already done the hard work for everyone and have been nice enough to share. Alan has written a very good AVR driver for the nasty WS2811 chip which covers about 95% of the work. His article on it can be seen [http://bleaklow.com/2012/12/02/driving_the_ws2811_at_800khz_with_a_16mhz_avr.html here]. &lt;br /&gt;
&lt;br /&gt;
My project uses his WS2811.h and would not be possible at all without it. Thanks very much Alan!&lt;br /&gt;
&lt;br /&gt;
=Operation=&lt;br /&gt;
The idea here is to have a nice little tree in your truck that fades slowly randomly R G and B and everything in-between. But when you apply the brakes it will cause the whole tree to fade to red. When the brake are released it will go back to its normal random color stuff.&lt;br /&gt;
&lt;br /&gt;
The brake lights are hooked up to an opto isolator on the board which tell the micro when the brake is applied. &lt;br /&gt;
&lt;br /&gt;
There is a DC to DC converter on the board that will provide power for everything. Be mindful about the current limitations of it. It should be fine for at least 100 LEDs.&lt;br /&gt;
&lt;br /&gt;
These strands of lights are found on ebay. Just search for WS2811. &#039;&#039;&#039;THE MANUFACTURING QUALITY OF THESE LIGHTS IS NOT GREAT&#039;&#039;&#039;. You will most likely have to fix some bad solder joints and/or other things like that. Everything is &amp;quot;potted&amp;quot; so it makes it that much more difficult. Just be ready to do this kind of work.&lt;br /&gt;
&lt;br /&gt;
In hindsight… I have no idea why I chose to use the beefy TI switching regulator. Maybe I had a good reason when I drafted the original schematic some months ago but I can’t remember what it is now.  Maybe I thought it would use more current than it actually does? Yea that’s it… we’ll go with that. The reality is 2 strings does not use that much current and you could probably get away with using a linear regulator with some good heat dissipation.&lt;br /&gt;
&lt;br /&gt;
=Video and Pics=&lt;br /&gt;
http://www.youtube.com/watch?v=dCNIRQI3RAA&lt;br /&gt;
&lt;br /&gt;
[[Image:20130119 181255.jpg|none|thumb|Tree with color!]][[Image:20130119 181305.jpg|none|thumb|Tree all red!]][[Image:DSCF0516.JPG|none|thumb|A completed board. ]]&lt;br /&gt;
&lt;br /&gt;
=Board and schematic=&lt;br /&gt;
[http://pauljmac.com/projects/images/4/4c/Main.pdf Schem]&lt;br /&gt;
&lt;br /&gt;
[http://pauljmac.com/projects/images/9/91/Truck_Tree_PCB.zip Gerbers]&lt;br /&gt;
&lt;br /&gt;
[http://pauljmac.com/projects/images/3/33/TruckTree_Eagle.zip EagleCAD]&lt;br /&gt;
&lt;br /&gt;
[[Image:TruckTree.png]]&lt;br /&gt;
&lt;br /&gt;
=BOM=&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Qty	Value	Part Num	Package	Parts&lt;br /&gt;
3		*	FE08	PORTB, PORTC, PORTD&lt;br /&gt;
1		609-3218-ND	MA03-2	ISP&lt;br /&gt;
4	.1uF	311-1361-1-ND	C0805K	C4, C6, C7, C8&lt;br /&gt;
1	1.4K	RHM1.40KBDCT-ND	R1210	R1&lt;br /&gt;
1	2.2uF	490-1733-1-ND	C0805K	C3&lt;br /&gt;
1	4N25SM	4N25SM-ND	DIL6-SMD	OK1&lt;br /&gt;
1	16MHz	535-10226-1-ND	HC49UP	Q1&lt;br /&gt;
2	18pF	399-9179-1-ND	C0805K	C1, C2&lt;br /&gt;
1	21k	P21.0KCCT-ND	M0805	R2&lt;br /&gt;
1	330uF	338-1790-1-ND	153CLV-0810	C5&lt;br /&gt;
1	ATMEGA88PA	ATMEGA88PA-AU-ND	TQFP32-08	IC1&lt;br /&gt;
1	Brake Signal	WM4201-ND	22-23-2031	BRAKE&lt;br /&gt;
1	PTN78020WAH	296-20515-ND	PTH	DC&lt;br /&gt;
1	Power	WM4201-ND	22-23-2031	POWER&lt;br /&gt;
1	TPPAD1-13Y	*	P1-13Y	INHIB&lt;br /&gt;
1	Tree	WM4201-ND	22-23-2031	TREE&lt;br /&gt;
3	WM2012-ND&lt;br /&gt;
9	WM1114CT-ND	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
I am only posting my edited example file from Alan. You will need to grab the WS2811.h from Alan&#039;s page. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * Copyright 2012 Alan Burlison, alan@bleaklow.com.  All rights reserved.&lt;br /&gt;
 * Use is subject to license terms.&lt;br /&gt;
 */&lt;br /&gt;
/* Fuse settings&lt;br /&gt;
BOOTSZ = 1024W_0C00&lt;br /&gt;
BOOTRST = [ ]&lt;br /&gt;
RSTDISBL = [ ]&lt;br /&gt;
DWEN = [ ]&lt;br /&gt;
SPIEN = [X]&lt;br /&gt;
WDTON = [ ]&lt;br /&gt;
EESAVE = [ ]&lt;br /&gt;
BODLEVEL = DISABLED&lt;br /&gt;
CKDIV8 = [ ]&lt;br /&gt;
CKOUT = [X]&lt;br /&gt;
SUT_CKSEL = EXTXOSC_8MHZ_XX_258CK_14CK_4MS1&lt;br /&gt;
&lt;br /&gt;
EXTENDED = 0xF9 (valid)&lt;br /&gt;
HIGH = 0xDF (valid)&lt;br /&gt;
LOW = 0x8E (valid)&lt;br /&gt;
&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;avr/io.h&amp;gt;&lt;br /&gt;
#include &amp;lt;util/delay.h&amp;gt;&lt;br /&gt;
#include &amp;quot;WS2811.h&amp;quot;&lt;br /&gt;
#include	&amp;lt;stdlib.h&amp;gt; &lt;br /&gt;
&lt;br /&gt;
#define BIT(B)           (0x01 &amp;lt;&amp;lt; (uint8_t)(B))&lt;br /&gt;
#define SET_BIT_HI(V, B) (V) |= (uint8_t)BIT(B)&lt;br /&gt;
#define SET_BIT_LO(V, B) (V) &amp;amp;= (uint8_t)~BIT(B)&lt;br /&gt;
&lt;br /&gt;
#define bit_get(p,m) ((p) &amp;amp; (m))&lt;br /&gt;
#define bit_set(p,m) ((p) |= (m))&lt;br /&gt;
#define bit_clear(p,m) ((p) &amp;amp;= ~(m))&lt;br /&gt;
#define bit_flip(p,m) ((p) ^= (m))&lt;br /&gt;
#define bit_write(c,p,m) (c ? bit_set(p,m) : bit_clear(p,m))&lt;br /&gt;
#define BIT(x) (0x01 &amp;lt;&amp;lt; (x))&lt;br /&gt;
#define LONGBIT(x) ((unsigned long)0x00000001 &amp;lt;&amp;lt; (x))&lt;br /&gt;
&lt;br /&gt;
#define PAUSE  500    // msec&lt;br /&gt;
#define DELAY    10	// msec&lt;br /&gt;
#define CHASE_SPEED    10	// msec&lt;br /&gt;
#define FADE_TO_RED_SPEED 1 // msec&lt;br /&gt;
#define RAND_MAX 0xFF&lt;br /&gt;
#define NUMBER_OF_NODES 100&lt;br /&gt;
#define COLOR_CHANGE_SPEED 1000&lt;br /&gt;
&lt;br /&gt;
volatile uint8_t direction=0, LED_num=0;&lt;br /&gt;
 &lt;br /&gt;
// Define the output function, using pin 0 on port b.&lt;br /&gt;
DEFINE_WS2811_FN(WS2811RGB, PORTC, 0)&lt;br /&gt;
&lt;br /&gt;
RGB_t rgb[NUMBER_OF_NODES];&lt;br /&gt;
volatile uint8_t colorchange=0;&lt;br /&gt;
volatile uint8_t desired_color[NUMBER_OF_NODES][3];&lt;br /&gt;
&lt;br /&gt;
void Blank (void);&lt;br /&gt;
void All_Red (void);&lt;br /&gt;
void Random (void);&lt;br /&gt;
void Chase (void);&lt;br /&gt;
void Random_fader(void);&lt;br /&gt;
void Update_Colors(void);&lt;br /&gt;
&lt;br /&gt;
void main(void){	&lt;br /&gt;
	// Configure pin for output.&lt;br /&gt;
	SET_BIT_HI(DDRC, 0);&lt;br /&gt;
	SET_BIT_LO(PORTC, 0);&lt;br /&gt;
	SET_BIT_LO(DDRC, 1); //an input&lt;br /&gt;
	SET_BIT_HI(PORTC, 1); //enable pull up&lt;br /&gt;
	Blank();&lt;br /&gt;
	for (;;) {&lt;br /&gt;
		WS2811RGB(rgb, ARRAYLEN(rgb)); //call the LED driver&lt;br /&gt;
		_delay_ms(DELAY);&lt;br /&gt;
		if(bit_get(PINC, BIT(1)) == 0 ){ //if 0 then pressed&lt;br /&gt;
			_delay_ms(FADE_TO_RED_SPEED);&lt;br /&gt;
			Fade_to_red();&lt;br /&gt;
		}&lt;br /&gt;
		else{&lt;br /&gt;
			_delay_ms(FADE_TO_RED_SPEED);&lt;br /&gt;
			Update_Colors();&lt;br /&gt;
			Random_fader();&lt;br /&gt;
		}&lt;br /&gt;
		//Chase();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Blank (void){ //blanks the color of all the LEDs&lt;br /&gt;
	 for(int i=0; i&amp;lt;NUMBER_OF_NODES ; i++){&lt;br /&gt;
		 rgb[i].r = 0;&lt;br /&gt;
		 rgb[i].g = 0;&lt;br /&gt;
		 rgb[i].b = 0;&lt;br /&gt;
	 }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void All_Red (void){ //blanks the color of all the LEDs&lt;br /&gt;
	for(int i=0; i&amp;lt;NUMBER_OF_NODES ; i++){&lt;br /&gt;
		rgb[i].r = 255;&lt;br /&gt;
		rgb[i].g = 0;&lt;br /&gt;
		rgb[i].b = 0;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Fade_to_red(void){&lt;br /&gt;
	for(int i=0; i&amp;lt;NUMBER_OF_NODES ; i++){&lt;br /&gt;
		 if (rgb[i].r &amp;lt; 255 ){&lt;br /&gt;
			 rgb[i].r++;&lt;br /&gt;
		 }&lt;br /&gt;
		 if (rgb[i].g &amp;gt; 0 ){&lt;br /&gt;
			 rgb[i].g--;&lt;br /&gt;
		 }&lt;br /&gt;
		 if (rgb[i].b &amp;gt; 0 ){&lt;br /&gt;
			 rgb[i].b--;&lt;br /&gt;
		 }&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Update_Colors(void){&lt;br /&gt;
	static dominant_color;&lt;br /&gt;
	if (colorchange++ == 255){ //its time to change the color&lt;br /&gt;
		for(int i=0; i&amp;lt;NUMBER_OF_NODES ; i++){&lt;br /&gt;
			dominant_color=random() % 3;&lt;br /&gt;
			switch (dominant_color){&lt;br /&gt;
				case 0: //red is dominant color&lt;br /&gt;
				desired_color[i][0] = random();&lt;br /&gt;
				desired_color[i][1] = random() % 95;&lt;br /&gt;
				desired_color[i][2] = random() % 95;&lt;br /&gt;
				break;&lt;br /&gt;
				case 1: //green is dominant color&lt;br /&gt;
				desired_color[i][0] = random() % 95;&lt;br /&gt;
				desired_color[i][1] = random();&lt;br /&gt;
				desired_color[i][2] = random() % 95;&lt;br /&gt;
				break;&lt;br /&gt;
				case 2: //blue is dominant color&lt;br /&gt;
				desired_color[i][0] = random() % 95;&lt;br /&gt;
				desired_color[i][1] = random() % 95;&lt;br /&gt;
				desired_color[i][2] = random();&lt;br /&gt;
				break;&lt;br /&gt;
				default: //white&lt;br /&gt;
				desired_color[i][0] = random();&lt;br /&gt;
				desired_color[i][1] = random();&lt;br /&gt;
				desired_color[i][2] = random();&lt;br /&gt;
				break;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		colorchange=0; //reset colorchange timer&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Random_fader(void){&lt;br /&gt;
	 //adjust the driven LED color to get close to the desired color&lt;br /&gt;
		for(int i=0; i&amp;lt;NUMBER_OF_NODES ; i++){&lt;br /&gt;
			 if (rgb[i].r &amp;gt; desired_color[i][0]){	//if driven color is greater than desired color&lt;br /&gt;
				 rgb[i].r--;						//decrease driven color&lt;br /&gt;
			 }&lt;br /&gt;
			 else if(rgb[i].r &amp;lt; desired_color[i][0]){ //if driven color is less than desired color&lt;br /&gt;
				 rgb[i].r++;						//increase driven color&lt;br /&gt;
			 }&lt;br /&gt;
			 if (rgb[i].g &amp;gt; desired_color[i][1]){	//if driven color is greater than desired color&lt;br /&gt;
				 rgb[i].g--;						//decrease driven color&lt;br /&gt;
			 }&lt;br /&gt;
			 else if(rgb[i].g &amp;lt; desired_color[i][1]){ //if driven color is less than desired color&lt;br /&gt;
				 rgb[i].g++;						//increase driven color&lt;br /&gt;
			 }&lt;br /&gt;
			  if (rgb[i].b &amp;gt; desired_color[i][2]){	//if driven color is greater than desired color&lt;br /&gt;
				 rgb[i].b--;						//decrease driven color&lt;br /&gt;
			 }&lt;br /&gt;
			 else if(rgb[i].g &amp;lt; desired_color[i][2]){ //if driven color is less than desired color&lt;br /&gt;
				 rgb[i].b++;						//increase driven color&lt;br /&gt;
			 }&lt;br /&gt;
		}		&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Random (void){&lt;br /&gt;
	_delay_ms(PAUSE);&lt;br /&gt;
	static dominant_color;&lt;br /&gt;
	for(int i=0; i&amp;lt;NUMBER_OF_NODES ; i++){&lt;br /&gt;
		dominant_color=random() % 3;&lt;br /&gt;
		switch (dominant_color){&lt;br /&gt;
				case 0: //red is dominant color&lt;br /&gt;
					rgb[i].r = random();&lt;br /&gt;
					rgb[i].g = random() % 125;&lt;br /&gt;
					rgb[i].b = random() % 125;&lt;br /&gt;
					break;&lt;br /&gt;
				case 1: //green is dominant color&lt;br /&gt;
					rgb[i].r = random() % 125;&lt;br /&gt;
					rgb[i].g = random();&lt;br /&gt;
					rgb[i].b = random() % 125;&lt;br /&gt;
					break;&lt;br /&gt;
				case 2: //blue is dominant color&lt;br /&gt;
					rgb[i].r = random() % 125;&lt;br /&gt;
					rgb[i].g = random() % 125;&lt;br /&gt;
					rgb[i].b = random();&lt;br /&gt;
					break;&lt;br /&gt;
				default: //white&lt;br /&gt;
					rgb[i].r = random();&lt;br /&gt;
					rgb[i].g = random();&lt;br /&gt;
					rgb[i].b = random();&lt;br /&gt;
					break;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Chase (void){&lt;br /&gt;
	_delay_ms(CHASE_SPEED);&lt;br /&gt;
	static int rand=89;&lt;br /&gt;
	if (direction == 0){ // value of 0 for direction means its increasing&lt;br /&gt;
			if (LED_num &amp;gt; 0){&lt;br /&gt;
				rgb[LED_num-1].r = 0;&lt;br /&gt;
				rgb[LED_num-1].g = 0;&lt;br /&gt;
				rgb[LED_num-1].b = 0;&lt;br /&gt;
			}&lt;br /&gt;
			rgb[LED_num].r =random();&lt;br /&gt;
			rgb[LED_num].g =random();&lt;br /&gt;
			rgb[LED_num].b =random();&lt;br /&gt;
			LED_num++;&lt;br /&gt;
			if (LED_num == NUMBER_OF_NODES)	{&lt;br /&gt;
				direction = 1; //switch directions&lt;br /&gt;
			}&lt;br /&gt;
	}&lt;br /&gt;
	else{ //else value if direction means decreasing&lt;br /&gt;
		if (LED_num &amp;lt; NUMBER_OF_NODES){&lt;br /&gt;
			rgb[LED_num+1].r = 0;&lt;br /&gt;
			rgb[LED_num+1].g = 0;&lt;br /&gt;
			rgb[LED_num+1].b = 0;&lt;br /&gt;
		}&lt;br /&gt;
		rgb[LED_num].r =random();&lt;br /&gt;
		rgb[LED_num].g =random();&lt;br /&gt;
		rgb[LED_num].b = random();&lt;br /&gt;
		LED_num--;&lt;br /&gt;
		if (LED_num == 0)	{&lt;br /&gt;
			direction = 0; //switch directions&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=Tennis_Ball_Cannon&amp;diff=10</id>
		<title>Tennis Ball Cannon</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=Tennis_Ball_Cannon&amp;diff=10"/>
		<updated>2024-12-08T16:07:25Z</updated>

		<summary type="html">&lt;p&gt;Paul: Created page with &amp;quot;This is a fully automatic tennis ball cannon. This was a project I did some years ago for no real reason. I originally make my own PCB to control the cannon. My day job approached me a month ago and asked If I would present something to a local elementary school for the Great American Teach-in Day. I converted this machine to be controlled by a Allen-Bradley CompactLogix PLC for that demonstration. This is that program. It makes use of the new user defined instructions a...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a fully automatic tennis ball cannon. This was a project I did some years ago for no real reason. I originally make my own PCB to control the cannon. My day job approached me a month ago and asked If I would present something to a local elementary school for the Great American Teach-in Day. I converted this machine to be controlled by a Allen-Bradley CompactLogix PLC for that demonstration. This is that program. It makes use of the new user defined instructions and block diagram features available in RSLogix5000. The kids very much enjoyed my presentation that day.&lt;br /&gt;
&lt;br /&gt;
[http://pauljmac.com/projects/images/a/a8/Fire_Control.pdf Fire Control]&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=sJZ1o8XpaZc Youtube Video 1]&lt;br /&gt;
[https://www.youtube.com/watch?v=aIox-FH2yVY Youtube Video 2]&lt;br /&gt;
&lt;br /&gt;
[[Image:1463314 10153495733960587 1270514420 n.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[Image:1455046 10153495733975587 708704026 n.jpg]]&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=Ping_Pong_Scoreboard&amp;diff=9</id>
		<title>Ping Pong Scoreboard</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=Ping_Pong_Scoreboard&amp;diff=9"/>
		<updated>2024-12-08T16:07:16Z</updated>

		<summary type="html">&lt;p&gt;Paul: Created page with &amp;quot;== Updates == &amp;lt;section begin=updates /&amp;gt;*New! Ping Pong Scoreboard! --Paul 13:16, 10 January 2008 (EST)&amp;lt;section end=updates /&amp;gt; &amp;lt;section begin=oldnews /&amp;gt; &amp;lt;section end=oldnews /&amp;gt;  ==Abstract== This device is intended to make score keeping easier and more spectator friendly for the game of ping pong. It consists of 2 double digit 7-0segment displays, 1 display for each player. Each display has 5 LEDs that are used to indicate the player’s current serve. The d...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Updates ==&lt;br /&gt;
&amp;lt;section begin=updates /&amp;gt;*New! Ping Pong Scoreboard! --[[User:Paul|Paul]] 13:16, 10 January 2008 (EST)&amp;lt;section end=updates /&amp;gt;&lt;br /&gt;
&amp;lt;section begin=oldnews /&amp;gt;&lt;br /&gt;
&amp;lt;section end=oldnews /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
This device is intended to make score keeping easier and more spectator friendly for the game of ping pong. It consists of 2 double digit 7-0segment displays, 1 display for each player. Each display has 5 LEDs that are used to indicate the player’s current serve. The device can operate in the old 21 point style game or the new 11 point style game. The game mode is selected using the Game Mode switch.  After selecting the desired game mode the user should reset the board to register the change. The device has a cord that links 3 buttons to the main score board. The 3 buttons are intended to be taped to the underside of one of the player’s court. This allows 1 player to control the score without interfering with the playing field. The 3 buttons are P1 score, P2 Score and Undo. P1 and P2 score are used to give the respective player a point for winning a rally. The Undo button is to correct a miss used button.  The undo is only 1 level deep, meaning it can only undo your last action. The scoreboard will automatically calculate whose serve it is and display it on the LEDs. The scoreboard even works when the game becomes Duce and a player must win by 2 and serve alternates every round. When a player reaches a winning condition the scoreboard will flash indicating the game is over. After a game is over the scoreboard should be reset to continue with a new game.&lt;br /&gt;
&lt;br /&gt;
The PIC I used may seem like a strange selection but honestly the only reason I chose it was because I had extras lying around. Normally I wouldn&#039;t use an IC as expensive as the MAX7221 ($10!) but again I had one lying around.&lt;br /&gt;
&lt;br /&gt;
== Parts ==&lt;br /&gt;
&amp;lt;table border=0 cellpadding=0 cellspacing=0 width=267 style=&#039;border-collapse:&lt;br /&gt;
 collapse;table-layout:fixed;width:200pt&#039;&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=21 style=&#039;height:15.75pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=21 class=xl66 width=203 style=&#039;height:15.75pt;width:152pt&#039;&amp;gt;Part&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl67 width=64 style=&#039;border-left:none;width:48pt&#039;&amp;gt;QTY&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 class=xl71 style=&#039;height:15.0pt;border-top:none&#039;&amp;gt;NO momentary&lt;br /&gt;
  buttons&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl68&amp;gt;4&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 class=xl72 style=&#039;height:15.0pt&#039;&amp;gt;SPST switch&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl68&amp;gt;5&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 class=xl72 style=&#039;height:15.0pt&#039;&amp;gt;10K resistors&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl68&amp;gt;6&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 class=xl72 style=&#039;height:15.0pt&#039;&amp;gt;20MHZ Crystal&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl68&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 class=xl72 style=&#039;height:15.0pt&#039;&amp;gt;27pF ceramic caps&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl68&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 class=xl72 style=&#039;height:15.0pt&#039;&amp;gt;10uF cap&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl68&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 class=xl72 style=&#039;height:15.0pt&#039;&amp;gt;1uF cap&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl68&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 class=xl72 style=&#039;height:15.0pt&#039;&amp;gt;double digit 7-segment&lt;br /&gt;
  displays&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl68&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 class=xl72 style=&#039;height:15.0pt&#039;&amp;gt;LEDs&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl68&amp;gt;10&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 class=xl72 style=&#039;height:15.0pt&#039;&amp;gt;PIC16F872&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl68&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 class=xl72 style=&#039;height:15.0pt&#039;&amp;gt;MAX7221&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl68&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 class=xl72 style=&#039;height:15.0pt&#039;&amp;gt;6 pos male ICSP header&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl68&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 class=xl72 style=&#039;height:15.0pt&#039;&amp;gt;signal diode 1N4148&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl68&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 class=xl72 style=&#039;height:15.0pt&#039;&amp;gt;2n3904 npn&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl68&amp;gt;2&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;mso-height-source:userset;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td rowspan=3 height=61 class=xl73 width=203 style=&#039;border-bottom:1.0pt solid black;&lt;br /&gt;
  height:45.75pt;width:152pt&#039;&amp;gt;current limiting resistor dependent on your&lt;br /&gt;
  7-segment displays&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td rowspan=3 class=xl69 style=&#039;border-bottom:1.0pt solid black&#039;&amp;gt;1&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=21 style=&#039;height:15.75pt&#039;&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;tr height=0 style=&#039;display:none&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td width=203 style=&#039;width:152pt&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=64 style=&#039;width:48pt&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematic ==&lt;br /&gt;
[[Image:PingPongScoreboard.png|500px]]&lt;br /&gt;
&lt;br /&gt;
[http://pauljmac.com/projects/images/e/ec/PingPongSchem.zip EAGLE schem]&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
Full MPLAB project here: [http://pauljmac.com/projects/images/3/35/PingPong1.zip]&lt;br /&gt;
&lt;br /&gt;
Spelling not guaranteed in code. :-)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;    Filename:	    main.asm                                          *&lt;br /&gt;
;    Date: 01/08/08                                                   *&lt;br /&gt;
;    File Version: 1.0                                                *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;    Author: Paul Mac                                                 *&lt;br /&gt;
;            me@pauljmac.com                                          * &lt;br /&gt;
;            http://pauljmac.com                                      *&lt;br /&gt;
;            Copyright Paul Mac 2008. Some Rights Reserved.           *&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;    Files required:  P16872.INC                                      *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;    Notes: This is a program used to keep score of a Ping-Pong game. *&lt;br /&gt;
;   It uses a 16F872 and a MAX7221 7-segment driver with 4 displays.  *&lt;br /&gt;
;   The tracker also keeps score of whose serve it is and can even    *&lt;br /&gt;
;   commutate serve/score while in Duce. The Mode Switch is used to   *&lt;br /&gt;
;   tell the program weather to run an old style 21 point game or a   *&lt;br /&gt;
;   new 11 point style game. The game mode switch is read after a     *&lt;br /&gt;
;   reset. The &amp;quot;main controls&amp;quot; consists of 3 buttons: P1, P2 and Undo *&lt;br /&gt;
;   P1 and P2 is used to increment the scores while undo is, well,    * &lt;br /&gt;
;   UNDO! The undo button is for if you just hit the wrong player     *&lt;br /&gt;
;   button and need to undo it. The undo is only 1 level deep.        *&lt;br /&gt;
;   Meaning you can only undo your last	incorrect score increment.    *&lt;br /&gt;
;   There’s no 3 or 4 undo’s here, it’s not MS word.                  *&lt;br /&gt;
;   When a player reaches the winning point the scoreboard            *	&lt;br /&gt;
;   will flash indicating the games over. Score can continue after    *&lt;br /&gt;
;   a winning game condition, but the score board may do some funky   *&lt;br /&gt;
;   things, as its not intended to still be used after a winning game *&lt;br /&gt;
;   condition. The Scoreboard should be reset after a winning game.   *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
; This work is licensed under the Creative Commons                    *&lt;br /&gt;
; Attribution-Noncommercial-Share Alike 3.0 United States License.    *&lt;br /&gt;
; To view a copy of this license, visit                               *&lt;br /&gt;
; http://creativecommons.org/licenses/by-nc-sa/3.0/us/ or send a      *&lt;br /&gt;
; letter to Creative Commons, 171 Second Street, Suite 300,           *&lt;br /&gt;
; San Francisco, California, 94105, USA.                              *&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	list      p=16f872            ; list directive to define processor&lt;br /&gt;
	#include &amp;lt;p16f872.inc&amp;gt;        ; processor specific variable definitions&lt;br /&gt;
	&lt;br /&gt;
	__CONFIG _CP_OFF &amp;amp; _WDT_OFF &amp;amp; _BODEN_OFF &amp;amp; _PWRTE_ON &amp;amp; _HS_OSC &amp;amp; _WRT_ENABLE_ON &amp;amp; _LVP_OFF &amp;amp; _CPD_OFF&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;***** VARIABLE DEFINITIONS&lt;br /&gt;
	cblock 0x20&lt;br /&gt;
	p1s, p2s, serve, p1score, p2score, u1,u2, displaydelay, displaydelay1, toggle&lt;br /&gt;
	bin, hundreds, tens_and_ones&lt;br /&gt;
	p1button, p2button, undobutton, two, temp, gameover, gameovertoggle, gameovercounter&lt;br /&gt;
	d1,d2,d3&lt;br /&gt;
	endc&lt;br /&gt;
	&lt;br /&gt;
#define	CS	PORTC,7&lt;br /&gt;
#define	SL1	PORTC,2&lt;br /&gt;
#define	SL2	PORTA,5&lt;br /&gt;
#define	P1B	PORTA,0&lt;br /&gt;
#define	P2B	PORTA,1&lt;br /&gt;
#define	UndoB	PORTA,2&lt;br /&gt;
#define	Mode	PORTA,3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
	ORG     0x000             ; processor reset vector&lt;br /&gt;
	clrf    PCLATH            ; ensure page bits are cleared&lt;br /&gt;
 	goto    main              ; go to beginning of program&lt;br /&gt;
&lt;br /&gt;
	ORG 	0x020&lt;br /&gt;
	ORG 	0x020&lt;br /&gt;
main&lt;br /&gt;
	BANKSEL	PORTA&lt;br /&gt;
	clrf	PORTA&lt;br /&gt;
	clrf	PORTB&lt;br /&gt;
	clrf	PORTC&lt;br /&gt;
	BANKSEL	TRISA&lt;br /&gt;
	clrf	TRISA&lt;br /&gt;
	clrf	TRISB&lt;br /&gt;
	clrf	TRISC&lt;br /&gt;
	movlw	b&#039;00000110&#039;		;turnning off analog inputs&lt;br /&gt;
	BANKSEL ADCON1&lt;br /&gt;
	movwf	ADCON1&lt;br /&gt;
	movlw	b&#039;00001111&#039;		;setting buttons to input&lt;br /&gt;
	BANKSEL	TRISA&lt;br /&gt;
	movwf	TRISA&lt;br /&gt;
	movlw	b&#039;11001000&#039;		;the server indicator LEDs&lt;br /&gt;
	movwf	TRISB&lt;br /&gt;
	movlw	b&#039;00010000&#039;&lt;br /&gt;
	movwf	TRISC&lt;br /&gt;
	BANKSEL	p1score&lt;br /&gt;
	clrf	p1score&lt;br /&gt;
	clrf	p2score&lt;br /&gt;
	clrf	p1s&lt;br /&gt;
	clrf	p2s&lt;br /&gt;
	clrf	serve&lt;br /&gt;
	clrf	p1button&lt;br /&gt;
	clrf	p2button&lt;br /&gt;
	clrf	undobutton&lt;br /&gt;
	clrf	gameover&lt;br /&gt;
	banksel	displaydelay1&lt;br /&gt;
	movlw	0xFF&lt;br /&gt;
	movwf	displaydelay1&lt;br /&gt;
	movwf	displaydelay&lt;br /&gt;
	movlw	0x02&lt;br /&gt;
	movwf	two&lt;br /&gt;
	movlw	0x19	;25&lt;br /&gt;
	movwf	gameovercounter&lt;br /&gt;
	banksel	PORTC&lt;br /&gt;
	bsf		CS			;the CS pin for the 7221&lt;br /&gt;
	movlw	0xC0&lt;br /&gt;
	banksel	SSPSTAT&lt;br /&gt;
	movwf	SSPSTAT&lt;br /&gt;
	movlw	0x20		;setup SPI&lt;br /&gt;
	banksel	SSPCON&lt;br /&gt;
	movwf	SSPCON&lt;br /&gt;
	movlw	0x0F		;put the MAX7221 into normal mode&lt;br /&gt;
	BANKSEL	PORTC&lt;br /&gt;
	bcf		CS		;Chip Select the MAX&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	movlw	0x00		;normal mode&lt;br /&gt;
	call 	SendSPI&lt;br /&gt;
	BANKSEL	PORTC&lt;br /&gt;
	bsf		CS		;unchip select the MAX&lt;br /&gt;
	movlw	0x0C		;Shutdown register&lt;br /&gt;
	BANKSEL	PORTC&lt;br /&gt;
	bcf		CS		;&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	movlw	0x01		;normal operation&lt;br /&gt;
	call 	SendSPI&lt;br /&gt;
	BANKSEL	PORTC&lt;br /&gt;
	bsf		CS		;&lt;br /&gt;
	movlw	0x0A		;Intensity register&lt;br /&gt;
	BANKSEL	PORTC&lt;br /&gt;
	bcf		CS		;&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	movlw	0x0F		;Max on&lt;br /&gt;
	call 	SendSPI&lt;br /&gt;
	BANKSEL	PORTC&lt;br /&gt;
	bsf		CS		;&lt;br /&gt;
	movlw	0x0B		;Scan-Limit register&lt;br /&gt;
	BANKSEL	PORTC&lt;br /&gt;
	bcf		CS		;&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	movlw	0x03		;4 digits&lt;br /&gt;
	call 	SendSPI&lt;br /&gt;
	BANKSEL	PORTC&lt;br /&gt;
	bsf		CS		;&lt;br /&gt;
	movlw	0x09		;decode mode register&lt;br /&gt;
	BANKSEL	PORTC&lt;br /&gt;
	bcf		CS		;&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	movlw	0xFF		;all decode&lt;br /&gt;
	call 	SendSPI&lt;br /&gt;
	BANKSEL	PORTC&lt;br /&gt;
	bsf		CS		;&lt;br /&gt;
	call	ClearSegs&lt;br /&gt;
	btfss	Mode			;test the mode switch. if its low its 21 point game, if high 11 point game&lt;br /&gt;
	goto	new_type&lt;br /&gt;
	goto	old_type&lt;br /&gt;
old_type				;begin the 21 point style play. Waiting for the user to select who has first serve.&lt;br /&gt;
	movlw	1&lt;br /&gt;
	BANKSEL	serve&lt;br /&gt;
	movwf	serve&lt;br /&gt;
	call	PollButtons&lt;br /&gt;
	btfsc	p1button,0			;poll the player 1 button&lt;br /&gt;
	goto	loadp1&lt;br /&gt;
	btfsc	p2button,0			;poll the player 2 button&lt;br /&gt;
	goto	loadp2&lt;br /&gt;
	goto	old_type		;loop, lol forgot this the first time	&lt;br /&gt;
PollButtons&lt;br /&gt;
	BANKSEL	PORTA&lt;br /&gt;
	btfss	P1B			;poll the player 1 button&lt;br /&gt;
	call	Player1Button&lt;br /&gt;
	btfss	P2B			;poll the player 2 button&lt;br /&gt;
	call	Player2Button&lt;br /&gt;
	btfss	UndoB&lt;br /&gt;
	call	UndoButton&lt;br /&gt;
	return&lt;br /&gt;
Player1Button&lt;br /&gt;
	btfss	P1B&lt;br /&gt;
	bsf		p1button,0&lt;br /&gt;
Player1Button_Test&lt;br /&gt;
	btfsc	P1B&lt;br /&gt;
	goto	Player1Button_Return&lt;br /&gt;
	goto	Player1Button_Test&lt;br /&gt;
Player1Button_Return&lt;br /&gt;
	call	Twenty_mS_Delay&lt;br /&gt;
	return&lt;br /&gt;
Player2Button&lt;br /&gt;
	btfss	P2B&lt;br /&gt;
	bsf		p2button,0&lt;br /&gt;
Player2Button_Test&lt;br /&gt;
	btfsc	P2B&lt;br /&gt;
	goto	Player2Button_Return&lt;br /&gt;
	goto	Player2Button_Test&lt;br /&gt;
Player2Button_Return&lt;br /&gt;
	call	Twenty_mS_Delay&lt;br /&gt;
	return&lt;br /&gt;
UndoButton&lt;br /&gt;
	btfss	UndoB&lt;br /&gt;
	bsf		undobutton,0&lt;br /&gt;
UndoButton_Test&lt;br /&gt;
	btfsc	UndoB&lt;br /&gt;
	goto	UndoButton_Return&lt;br /&gt;
	goto	UndoButton_Test&lt;br /&gt;
UndoButton_Return&lt;br /&gt;
	call	Twenty_mS_Delay&lt;br /&gt;
	return	&lt;br /&gt;
loadp1&lt;br /&gt;
	bsf		p1s,0			;set p1s bit 0 indicateing they are current server&lt;br /&gt;
	goto	Startold&lt;br /&gt;
loadp2&lt;br /&gt;
	bsf		p2s,0			;set p2s bit 0 indicateing they are current server&lt;br /&gt;
	goto	Startold&lt;br /&gt;
ClearButtons&lt;br /&gt;
	bcf		p1button,0&lt;br /&gt;
	bcf		p2button,0&lt;br /&gt;
	bcf		undobutton,0&lt;br /&gt;
	return&lt;br /&gt;
Startold&lt;br /&gt;
	call 	ClearButtons&lt;br /&gt;
	call	DisplayRoutine&lt;br /&gt;
	call    PollButtons&lt;br /&gt;
	movlw	0x15&lt;br /&gt;
	subwf	p1score,w&lt;br /&gt;
	btfsc	STATUS,Z		;test the Zero flag. It will be set if the score is 21	&lt;br /&gt;
	bsf		gameover,0		;set game over mode&lt;br /&gt;
	movlw	0x15&lt;br /&gt;
	subwf	p2score,w&lt;br /&gt;
	btfsc	STATUS,Z		;test the Zero flag. It will be set if the score is 21		&lt;br /&gt;
	bsf		gameover,0		;set game over mode&lt;br /&gt;
	btfsc	p1button,0			;test p1 button for a p1score++&lt;br /&gt;
	call	Addp1&lt;br /&gt;
	btfsc	p2button,0			;test p2 button for a p2score++&lt;br /&gt;
	call	Addp2&lt;br /&gt;
	btfsc	undobutton,0		;test undo button&lt;br /&gt;
	call 	Undo&lt;br /&gt;
	movlw	0x14				;setup to see if the serve # is more than 20&lt;br /&gt;
	subwf	p1score,w		;subtract 20&lt;br /&gt;
	btfss	STATUS,Z		;test the Zero flag. It will be clear if the serve is less than 20	&lt;br /&gt;
	goto	Startold&lt;br /&gt;
	movlw	0x14				;setup to see if the serve # is more than 20&lt;br /&gt;
	subwf	p2score,w		;subtract 20&lt;br /&gt;
	btfss	STATUS,Z		;test the carry flag. It will be clear if the serve is less than 20	&lt;br /&gt;
	goto	Startold&lt;br /&gt;
	goto	Duce&lt;br /&gt;
Duce&lt;br /&gt;
	call	ClearButtons&lt;br /&gt;
	call    PollButtons&lt;br /&gt;
	btfsc	p1button,0			;test p1 button for a p1score++&lt;br /&gt;
	call	Addp1Duce&lt;br /&gt;
	btfsc	p2button,0			;test p2 button for a p2score++&lt;br /&gt;
	call	Addp2Duce&lt;br /&gt;
	btfsc	undobutton,0		;test undo button&lt;br /&gt;
	call 	UndoDuce&lt;br /&gt;
	call	DisplayRoutine&lt;br /&gt;
	call	TestDuceGameOver&lt;br /&gt;
	goto	Duce	&lt;br /&gt;
UndoDuce&lt;br /&gt;
	call	GameOverOn&lt;br /&gt;
	movfw	p1score			;add p1 and p2 score to see if its 20&lt;br /&gt;
	addwf	p2score,w&lt;br /&gt;
	banksel	temp&lt;br /&gt;
	movwf	temp&lt;br /&gt;
	movlw	0x28&lt;br /&gt;
	subwf	temp,w&lt;br /&gt;
	btfss	STATUS,Z		;test the carry flag. It will be clear if the serve is less than 20	&lt;br /&gt;
	goto	UndoDuce1&lt;br /&gt;
	movlw	0x06&lt;br /&gt;
	movwf	serve&lt;br /&gt;
	banksel	p1s&lt;br /&gt;
	comf	p1s,f&lt;br /&gt;
	comf	p2s,f&lt;br /&gt;
	goto	UndoReturn&lt;br /&gt;
UndoReturn&lt;br /&gt;
	call	ResetToggler&lt;br /&gt;
	bcf		toggle,0&lt;br /&gt;
	btfsc	u1,0			;see if the last point awarded was to p1&lt;br /&gt;
	call	UndoP1Return			;if it was do this &lt;br /&gt;
	btfsc	u2,0			;see if the last point awarded was to p2&lt;br /&gt;
	call	UndoP2Return&lt;br /&gt;
	goto	Startold&lt;br /&gt;
UndoP1Return&lt;br /&gt;
	movlw	b&#039;11001000&#039;&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	andwf	PORTB,f&lt;br /&gt;
	banksel p1score&lt;br /&gt;
	decf	p1score,f		;--p1score&lt;br /&gt;
	decf	serve,f			;--serve&lt;br /&gt;
	btfsc	STATUS,Z		;if Z flag is set that means that serve was at 1 and needs to be reset to 5&lt;br /&gt;
	call	UndoServe&lt;br /&gt;
	bcf		u1,0			;clear the p1 undo register to prevent a loop&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2&lt;br /&gt;
	return&lt;br /&gt;
UndoP2Return&lt;br /&gt;
	movlw	b&#039;11001000&#039;&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	andwf	PORTB,f&lt;br /&gt;
	banksel p1score&lt;br /&gt;
	decf	p2score,f		;--p1score&lt;br /&gt;
	decf	serve,f			;--serve&lt;br /&gt;
	btfsc	STATUS,Z		;if Z flag is set that means that serve was at 1 and needs to be reset to 5&lt;br /&gt;
	call	UndoServe&lt;br /&gt;
	bcf		u2,0			;clear the p1 undo register to prevent a loop&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2&lt;br /&gt;
	return&lt;br /&gt;
UndoDuce1&lt;br /&gt;
	call	ResetToggler&lt;br /&gt;
	bcf		toggle,0&lt;br /&gt;
	btfsc	u1,0			;see if the last point awarded was to p1&lt;br /&gt;
	call	UndoP1Duce		;if it was do this &lt;br /&gt;
	btfsc	u2,0			;see if the last point awarded was to p2&lt;br /&gt;
	call	UndoP2Duce&lt;br /&gt;
	return&lt;br /&gt;
UndoP1Duce&lt;br /&gt;
	movlw	b&#039;11001000&#039;&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	andwf	PORTB,f&lt;br /&gt;
	banksel p1score&lt;br /&gt;
	decf	p1score,f		;--p1score&lt;br /&gt;
	call	UndoServeDuce&lt;br /&gt;
	bcf		u1,0			;clear the p1 undo register to prevent a loop&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2&lt;br /&gt;
	return&lt;br /&gt;
UndoP2Duce&lt;br /&gt;
	movlw	b&#039;11001000&#039;&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	andwf	PORTB,f&lt;br /&gt;
	banksel p2score&lt;br /&gt;
	decf	p2score,f		;--p2score&lt;br /&gt;
	call	UndoServeDuce&lt;br /&gt;
	bcf		u2,0			;clear the p1 undo register to prevent a loop&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2&lt;br /&gt;
	return&lt;br /&gt;
UndoServeDuce&lt;br /&gt;
	comf	p1s,f&lt;br /&gt;
	comf	p2s,f&lt;br /&gt;
	return	&lt;br /&gt;
TestDuceGameOver&lt;br /&gt;
	banksel	p1score&lt;br /&gt;
	movfw	p1score&lt;br /&gt;
	subwf	p2score,w&lt;br /&gt;
	call	TestTwo&lt;br /&gt;
	banksel	p1score	&lt;br /&gt;
	movfw	p2score&lt;br /&gt;
	subwf	p1score,w&lt;br /&gt;
	call	TestTwo&lt;br /&gt;
	return&lt;br /&gt;
TestTwo&lt;br /&gt;
	banksel	two&lt;br /&gt;
	subwf	two,w			;subtract 2 and test X flag&lt;br /&gt;
	btfsc	STATUS,Z		;test the carry flag. It will be clear if the serve is less than 20	&lt;br /&gt;
	bsf		gameover,0&lt;br /&gt;
	return&lt;br /&gt;
Addp1Duce&lt;br /&gt;
	call	ResetToggler&lt;br /&gt;
	bcf		toggle,0&lt;br /&gt;
	bsf		u1,0			;set u1 indicateing that p1 was the last person to reviece a point (for undo button)&lt;br /&gt;
	bcf		u2,0			;clear u2 undo register sence u1 is being set now&lt;br /&gt;
	incf	p1score,f		;incrament p1score&lt;br /&gt;
	comf	p1s,f&lt;br /&gt;
	comf	p2s,f&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2	&lt;br /&gt;
	return					;return to the main game loop&lt;br /&gt;
Addp2Duce&lt;br /&gt;
	call	ResetToggler&lt;br /&gt;
	bcf		toggle,0&lt;br /&gt;
	bsf		u2,0			;set u2 indicateing that p2 was the last person to reviece a point (for undo button)&lt;br /&gt;
	bcf		u1,0			;clear u1 undo register sence u2 is being set now&lt;br /&gt;
	incf	p2score,f		;incrament p1score&lt;br /&gt;
	comf	p1s,f&lt;br /&gt;
	comf	p2s,f&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2&lt;br /&gt;
	return	&lt;br /&gt;
Addp1&lt;br /&gt;
	call	ResetToggler&lt;br /&gt;
	bcf		toggle,0&lt;br /&gt;
	bsf		u1,0			;set u1 indicateing that p1 was the last person to reviece a point (for undo button)&lt;br /&gt;
	bcf		u2,0			;clear u2 undo register sence u1 is being set now&lt;br /&gt;
	incf	p1score,f		;incrament p1score&lt;br /&gt;
	incf	serve,f			;++ serve&lt;br /&gt;
	movlw	0x06			;setup to see if the serve # is more than 5&lt;br /&gt;
	subwf	serve,w			;subtract 6 from Serve&lt;br /&gt;
	btfsc	STATUS,C		;test the carry flag. It will be clear if Serve is less than 6&lt;br /&gt;
	call 	SwitchServe&lt;br /&gt;
	return					;return to the main game loop.	&lt;br /&gt;
Addp2&lt;br /&gt;
	call	ResetToggler&lt;br /&gt;
	bcf		toggle,0&lt;br /&gt;
	bsf		u2,0			;set u2 indicateing that p2 was the last person to reviece a point (for undo button)&lt;br /&gt;
	bcf		u1,0			;clear u1 undo register sence u2 is being set now&lt;br /&gt;
	incf	p2score,f		;incrament p1score&lt;br /&gt;
	incf	serve,f			&lt;br /&gt;
	movlw	0x06			;setup to see if the serve # is more than 5&lt;br /&gt;
	subwf	serve,w			;subtract 6 from Serve&lt;br /&gt;
	btfsc	STATUS,C		;test the carry flag. It will be clear if Serve is less than 6&lt;br /&gt;
	call 	SwitchServe&lt;br /&gt;
	return					;return to the main game loop.&lt;br /&gt;
Undo&lt;br /&gt;
	call	GameOverOn&lt;br /&gt;
	call	ResetToggler&lt;br /&gt;
	bcf		toggle,0&lt;br /&gt;
	btfsc	u1,0			;see if the last point awarded was to p1&lt;br /&gt;
	call	UndoP1			;if it was do this &lt;br /&gt;
	btfsc	u2,0			;see if the last point awarded was to p2&lt;br /&gt;
	call	UndoP2&lt;br /&gt;
	return&lt;br /&gt;
UndoP1&lt;br /&gt;
	movlw	b&#039;11001000&#039;&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	andwf	PORTB,f&lt;br /&gt;
	banksel p1score&lt;br /&gt;
	decf	p1score,f		;--p1score&lt;br /&gt;
	decf	serve,f			;--serve&lt;br /&gt;
	btfsc	STATUS,Z		;if Z flag is set that means that serve was at 1 and needs to be reset to 5&lt;br /&gt;
	call	UndoServe&lt;br /&gt;
	bcf		u1,0			;clear the p1 undo register to prevent a loop&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2&lt;br /&gt;
	return&lt;br /&gt;
UndoP2&lt;br /&gt;
	movlw	b&#039;11001000&#039;&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	andwf	PORTB,f&lt;br /&gt;
	banksel p1score&lt;br /&gt;
	decf	p2score,f		;--p1score&lt;br /&gt;
	decf	serve,f			;--serve&lt;br /&gt;
	btfsc	STATUS,Z		;if Z flag is set that means that serve was at 1 and needs to be reset to 5&lt;br /&gt;
	call	UndoServe&lt;br /&gt;
	bcf		u2,0			;clear the p1 undo register to prevent a loop&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2&lt;br /&gt;
	return&lt;br /&gt;
UndoServe&lt;br /&gt;
	movlw	0x05&lt;br /&gt;
	movwf	serve&lt;br /&gt;
	comf	p1s,f&lt;br /&gt;
	comf	p2s,f&lt;br /&gt;
	return	&lt;br /&gt;
SwitchServe&lt;br /&gt;
	comf	p1s,f			;compliment p1s&lt;br /&gt;
	comf	p2s,f			;compliment p2s&lt;br /&gt;
	bcf		SL1			;turn OFF p1 server leds&lt;br /&gt;
	bcf		SL2			;turn OFF p2 server leds&lt;br /&gt;
	movlw	0x01			;reset the serve register &lt;br /&gt;
	banksel	serve&lt;br /&gt;
	movwf	serve	&lt;br /&gt;
	movlw	b&#039;11001000&#039;&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	andwf	PORTB,f	&lt;br /&gt;
	return	&lt;br /&gt;
DisplayRoutine&lt;br /&gt;
		;counter&lt;br /&gt;
	call	Two_mS_Delay&lt;br /&gt;
	banksel	displaydelay&lt;br /&gt;
	decfsz	displaydelay,f	;dec the display delay counter&lt;br /&gt;
	goto	Skip	&lt;br /&gt;
DisplayDelay1&lt;br /&gt;
	decfsz	displaydelay1,f&lt;br /&gt;
	goto	DisplayDelay1&lt;br /&gt;
	comf	toggle,f&lt;br /&gt;
	goto	Skip&lt;br /&gt;
Skip&lt;br /&gt;
	btfss	toggle,0&lt;br /&gt;
	goto	Normal_LED_Display&lt;br /&gt;
	goto	Toggle_LED_Display	&lt;br /&gt;
ResetToggler&lt;br /&gt;
	banksel	displaydelay1&lt;br /&gt;
	movlw	0xFF&lt;br /&gt;
	movwf	displaydelay1&lt;br /&gt;
	movwf	displaydelay&lt;br /&gt;
	bcf		gameover,0&lt;br /&gt;
	return&lt;br /&gt;
Normal_LED_Display&lt;br /&gt;
	btfsc	p1s,0			;test the p1 serve register, if its clear skip next&lt;br /&gt;
	bsf		SL1			;turn on p1 server leds&lt;br /&gt;
	btfsc	p2s,0			;test p2 serve register, if its clear (it shouldnet be at this point) skip.&lt;br /&gt;
	bsf		SL2			;turn on p2 server leds&lt;br /&gt;
	movlw	HIGH LookupServe	;got to preload the high bites into PCLATH for this lookup to work&lt;br /&gt;
	movwf	PCLATH&lt;br /&gt;
	banksel	serve&lt;br /&gt;
	movfw	serve			;move the current serve # to W&lt;br /&gt;
	call	LookupServe		;lookup the bit pattern&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	iorwf	PORTB,f			;OR the bit pattern with PORTB to display the correct LEDS&lt;br /&gt;
	goto	DisplayScores&lt;br /&gt;
Toggle_LED_Display&lt;br /&gt;
	movlw	b&#039;11001000&#039;		;clear portb before we start this&lt;br /&gt;
	banksel PORTB			;&lt;br /&gt;
	andwf	PORTB,f			;&lt;br /&gt;
	btfsc	p1s,0			;test the p1 serve register, if its clear skip next&lt;br /&gt;
	bsf		SL1			;turn on p1 server leds&lt;br /&gt;
	btfsc	p2s,0			;test p2 serve register, if its clear (it shouldnet be at this point) skip.&lt;br /&gt;
	bsf		SL2			;turn on p2 server leds&lt;br /&gt;
	movlw	HIGH LookupServe	;got to preload the high bites into PCLATH for this lookup to work&lt;br /&gt;
	movwf	PCLATH&lt;br /&gt;
	banksel	serve&lt;br /&gt;
	decf	serve,w			;subtract 1 and put the result in W&lt;br /&gt;
	call	LookupServe		;lookup the bit pattern&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	iorwf	PORTB,f			;OR the bit pattern with PORTB to display the correct LEDS&lt;br /&gt;
	goto	DisplayScores&lt;br /&gt;
DisplayScores&lt;br /&gt;
		;player 1 digits&lt;br /&gt;
	movf	p1score,w		;move p1score to w&lt;br /&gt;
	movwf	bin				;move the p1score to bin for BCD computation&lt;br /&gt;
	call	binary_to_bcd&lt;br /&gt;
	movlw	0x01			;select the first digit to display&lt;br /&gt;
	bcf		CS&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	movf	tens_and_ones,w	;move tens_and_ones to W&lt;br /&gt;
	andlw	b&#039;00001111&#039;		;mask the crap and now ones is in W&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	bsf		CS&lt;br /&gt;
	movlw	0x02			;select the 2nd digit to display&lt;br /&gt;
	bcf		CS&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	swapf	tens_and_ones,w	;swap the nibbles in tens_and_ones and put it in W&lt;br /&gt;
	andlw	b&#039;00001111&#039;		;mask the crap and now tens is in W&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	bsf		CS&lt;br /&gt;
		;Do it all again for player 2 digits&lt;br /&gt;
	movf	p2score,w		;move p1score to w&lt;br /&gt;
	movwf	bin				;move the p1score to bin for BCD computation&lt;br /&gt;
	call	binary_to_bcd&lt;br /&gt;
	movlw	0x03			;select the first digit to display&lt;br /&gt;
	bcf		CS&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	movf	tens_and_ones,w	;move tens_and_ones to W&lt;br /&gt;
	andlw	b&#039;00001111&#039;		;mask the crap and now ones is in W&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	bsf		CS&lt;br /&gt;
	movlw	0x04			;select the 2nd digit to display&lt;br /&gt;
	bcf		CS&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	swapf	tens_and_ones,w	;swap the nibbles in tens_and_ones and put it in W&lt;br /&gt;
	andlw	b&#039;00001111&#039;		;mask the crap and now tens is in W&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	bsf		CS&lt;br /&gt;
	banksel gameover&lt;br /&gt;
	btfss	gameover,0&lt;br /&gt;
	return	;return the call if its not gameover mode&lt;br /&gt;
	call	Twenty_mS_Delay&lt;br /&gt;
	banksel	gameover&lt;br /&gt;
	decfsz	gameovercounter,f&lt;br /&gt;
	return	;return the call after the dec above&lt;br /&gt;
	banksel	gameovertoggle&lt;br /&gt;
	btfsc	gameovertoggle,0&lt;br /&gt;
	goto	GameOverOn&lt;br /&gt;
	goto	GameOverOff&lt;br /&gt;
GameOverOff&lt;br /&gt;
	bsf		gameovertoggle,0	&lt;br /&gt;
	movlw	0x0C		;Shutdown register&lt;br /&gt;
	BANKSEL	PORTC&lt;br /&gt;
	bcf		CS		;&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	movlw	0x00		;shutdown mode&lt;br /&gt;
	call 	SendSPI&lt;br /&gt;
	BANKSEL	PORTC&lt;br /&gt;
	bsf		CS		;&lt;br /&gt;
	movlw	0x19	;25&lt;br /&gt;
	movwf	gameovercounter&lt;br /&gt;
	return&lt;br /&gt;
GameOverOn	&lt;br /&gt;
	bcf		gameovertoggle,0	&lt;br /&gt;
	movlw	0x0C		;Shutdown register&lt;br /&gt;
	BANKSEL	PORTC&lt;br /&gt;
	bcf		CS		;&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	movlw	0x01		;normal mode&lt;br /&gt;
	call 	SendSPI&lt;br /&gt;
	BANKSEL	PORTC&lt;br /&gt;
	bsf		CS		;&lt;br /&gt;
	movlw	0x19	;25&lt;br /&gt;
	movwf	gameovercounter&lt;br /&gt;
	return	&lt;br /&gt;
ClearSegs&lt;br /&gt;
	bcf		CS&lt;br /&gt;
	movlw	0x01			;initilize the 7segs by clearing all the digits&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	movlw	0x00&lt;br /&gt;
	call 	SendSPI&lt;br /&gt;
	bsf		CS&lt;br /&gt;
	bcf		CS&lt;br /&gt;
	movlw 	0x02&lt;br /&gt;
	call 	SendSPI&lt;br /&gt;
	movlw	0x00&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	bsf		CS&lt;br /&gt;
	bcf		CS&lt;br /&gt;
	movlw	0x03&lt;br /&gt;
	call 	SendSPI&lt;br /&gt;
	movlw 	0x00&lt;br /&gt;
	call 	SendSPI&lt;br /&gt;
	bsf		CS&lt;br /&gt;
	bcf		CS&lt;br /&gt;
	movlw	0x04&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	movlw	0x00&lt;br /&gt;
	call	SendSPI&lt;br /&gt;
	bsf		CS&lt;br /&gt;
	return&lt;br /&gt;
SendSPI						;This rutine will hold the MCU untill transmission is over. &lt;br /&gt;
	BANKSEL	SSPBUF			;If you want to load up the SSPBUF and GTFO dont use this.&lt;br /&gt;
	movwf	SSPBUF&lt;br /&gt;
wait1&lt;br /&gt;
	BANKSEL	SSPSTAT&lt;br /&gt;
	btfss	SSPSTAT,BF		;test to make sure its set indicateing the transmission is over&lt;br /&gt;
	goto	wait1			;when its over continue&lt;br /&gt;
	bcf		SSPSTAT,BF		;and clear the intrupt&lt;br /&gt;
	banksel	PORTA			; just get back to bank 0&lt;br /&gt;
	return&lt;br /&gt;
&lt;br /&gt;
;==================================================================&lt;br /&gt;
; 11 point style game&lt;br /&gt;
&lt;br /&gt;
		&lt;br /&gt;
new_type				;begin the 11 point style play. Waiting for the user to select who has first serve.&lt;br /&gt;
	movlw	1&lt;br /&gt;
	BANKSEL	serve&lt;br /&gt;
	movwf	serve&lt;br /&gt;
	call	PollButtons&lt;br /&gt;
	btfsc	p1button,0			;poll the player 1 button&lt;br /&gt;
	goto	loadp1_new&lt;br /&gt;
	btfsc	p2button,0			;poll the player 2 button&lt;br /&gt;
	goto	loadp2_new&lt;br /&gt;
	goto	new_type		;loop, lol forgot this the first time&lt;br /&gt;
loadp1_new&lt;br /&gt;
	bsf		p1s,0			;set p1s bit 0 indicateing they are current server&lt;br /&gt;
	goto	Startnew&lt;br /&gt;
loadp2_new&lt;br /&gt;
	bsf		p2s,0			;set p2s bit 0 indicateing they are current server&lt;br /&gt;
	goto	Startnew		&lt;br /&gt;
Startnew&lt;br /&gt;
	call 	ClearButtons&lt;br /&gt;
	call	DisplayRoutine&lt;br /&gt;
	movlw	0x0B			;11&lt;br /&gt;
	subwf	p1score,w&lt;br /&gt;
	btfsc	STATUS,Z		;test the Zero flag. It will be set if the score is 11	&lt;br /&gt;
	bsf		gameover,0&lt;br /&gt;
	movlw	0x0B			;11&lt;br /&gt;
	subwf	p2score,w&lt;br /&gt;
	btfsc	STATUS,Z		;test the Zero flag. It will be set if the score is 11		&lt;br /&gt;
	bsf		gameover,0	&lt;br /&gt;
	call    PollButtons&lt;br /&gt;
	btfsc	p1button,0			;test p1 button for a p1score++&lt;br /&gt;
	call	Addp1_new&lt;br /&gt;
	btfsc	p2button,0			;test p2 button for a p2score++&lt;br /&gt;
	call	Addp2_new&lt;br /&gt;
	btfsc	undobutton,0			;test undo button&lt;br /&gt;
	call 	Undo_new&lt;br /&gt;
	movlw	0x0A				;setup to see if the serve # is more than 10&lt;br /&gt;
	subwf	p1score,w		;subtract 10&lt;br /&gt;
	btfss	STATUS,Z		;test the Zero flag. It will be clear if the serve is less than 10	&lt;br /&gt;
	goto	Startnew&lt;br /&gt;
	movlw	0x0A				;setup to see if the serve # is more than 10&lt;br /&gt;
	subwf	p2score,w		;subtract 10&lt;br /&gt;
	btfss	STATUS,Z		;test the carry flag. It will be clear if the serve is less than 10	&lt;br /&gt;
	goto	Startnew&lt;br /&gt;
	goto	Duce_new&lt;br /&gt;
Duce_new&lt;br /&gt;
	call	ClearButtons&lt;br /&gt;
	call    PollButtons&lt;br /&gt;
	btfsc	p1button,0			;test p1 button for a p1score++&lt;br /&gt;
	call	Addp1Duce_new&lt;br /&gt;
	btfsc	p2button,0			;test p2 button for a p2score++&lt;br /&gt;
	call	Addp2Duce_new&lt;br /&gt;
	btfsc	undobutton,0		;test undo button&lt;br /&gt;
	call 	UndoDuce_new&lt;br /&gt;
	call	DisplayRoutine&lt;br /&gt;
	call	TestDuceGameOver_new&lt;br /&gt;
	goto	Duce_new&lt;br /&gt;
UndoDuce_new&lt;br /&gt;
	call	GameOverOn&lt;br /&gt;
	movfw	p1score			;add p1 and p2 score to see if its 20&lt;br /&gt;
	addwf	p2score,w&lt;br /&gt;
	banksel	temp&lt;br /&gt;
	movwf	temp&lt;br /&gt;
	movlw	0x14			;20&lt;br /&gt;
	subwf	temp,w&lt;br /&gt;
	btfss	STATUS,Z		;test the carry flag. It will be clear if the serve is less than 20	&lt;br /&gt;
	goto	UndoDuce1_new&lt;br /&gt;
	movlw	0x03&lt;br /&gt;
	movwf	serve&lt;br /&gt;
	banksel	p1s&lt;br /&gt;
	comf	p1s,f&lt;br /&gt;
	comf	p2s,f&lt;br /&gt;
	goto	UndoReturn_new&lt;br /&gt;
UndoReturn_new&lt;br /&gt;
	call	ResetToggler&lt;br /&gt;
	bcf		toggle,0&lt;br /&gt;
	btfsc	u1,0			;see if the last point awarded was to p1&lt;br /&gt;
	call	UndoP1Return_new			;if it was do this &lt;br /&gt;
	btfsc	u2,0			;see if the last point awarded was to p2&lt;br /&gt;
	call	UndoP2Return_new&lt;br /&gt;
	goto	Startnew&lt;br /&gt;
UndoP1Return_new&lt;br /&gt;
	movlw	b&#039;11001000&#039;&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	andwf	PORTB,f&lt;br /&gt;
	banksel p1score&lt;br /&gt;
	decf	p1score,f		;--p1score&lt;br /&gt;
	decf	serve,f			;--serve&lt;br /&gt;
	btfsc	STATUS,Z		;if Z flag is set that means that serve was at 1 and needs to be reset to 2 &lt;br /&gt;
	call	UndoServe_new&lt;br /&gt;
	bcf		u1,0			;clear the p1 undo register to prevent a loop&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2&lt;br /&gt;
	return&lt;br /&gt;
UndoP2Return_new&lt;br /&gt;
	movlw	b&#039;11001000&#039;&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	andwf	PORTB,f&lt;br /&gt;
	banksel p1score&lt;br /&gt;
	decf	p2score,f		;--p1score&lt;br /&gt;
	decf	serve,f			;--serve&lt;br /&gt;
	btfsc	STATUS,Z		;if Z flag is set that means that serve was at 1 and needs to be reset to 5&lt;br /&gt;
	call	UndoServe_new&lt;br /&gt;
	bcf		u2,0			;clear the p1 undo register to prevent a loop&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2&lt;br /&gt;
	return&lt;br /&gt;
UndoDuce1_new&lt;br /&gt;
	call	ResetToggler&lt;br /&gt;
	bcf		toggle,0&lt;br /&gt;
	btfsc	u1,0			;see if the last point awarded was to p1&lt;br /&gt;
	call	UndoP1Duce_new		;if it was do this &lt;br /&gt;
	btfsc	u2,0			;see if the last point awarded was to p2&lt;br /&gt;
	call	UndoP2Duce_new&lt;br /&gt;
	return&lt;br /&gt;
UndoP1Duce_new&lt;br /&gt;
	movlw	b&#039;11001000&#039;&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	andwf	PORTB,f&lt;br /&gt;
	banksel p1score&lt;br /&gt;
	decf	p1score,f		;--p1score&lt;br /&gt;
	call	UndoServeDuce_new&lt;br /&gt;
	bcf		u1,0			;clear the p1 undo register to prevent a loop&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2&lt;br /&gt;
	return&lt;br /&gt;
UndoP2Duce_new&lt;br /&gt;
	movlw	b&#039;11001000&#039;&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	andwf	PORTB,f&lt;br /&gt;
	banksel p2score&lt;br /&gt;
	decf	p2score,f		;--p2score&lt;br /&gt;
	call	UndoServeDuce_new&lt;br /&gt;
	bcf		u2,0			;clear the p1 undo register to prevent a loop&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2&lt;br /&gt;
	return&lt;br /&gt;
UndoServeDuce_new&lt;br /&gt;
	comf	p1s,f&lt;br /&gt;
	comf	p2s,f&lt;br /&gt;
	return&lt;br /&gt;
TestDuceGameOver_new&lt;br /&gt;
	banksel	p1score&lt;br /&gt;
	movfw	p1score&lt;br /&gt;
	subwf	p2score,w&lt;br /&gt;
	call	TestTwo_new&lt;br /&gt;
	banksel	p1score	&lt;br /&gt;
	movfw	p2score&lt;br /&gt;
	subwf	p1score,w&lt;br /&gt;
	call	TestTwo_new&lt;br /&gt;
	return&lt;br /&gt;
TestTwo_new&lt;br /&gt;
	banksel	two&lt;br /&gt;
	subwf	two,w			;subtract 2 and test X flag&lt;br /&gt;
	btfsc	STATUS,Z		;test the carry flag. It will be clear if the serve is less than 20	&lt;br /&gt;
	bsf		gameover,0&lt;br /&gt;
	return&lt;br /&gt;
Addp1Duce_new&lt;br /&gt;
	call	ResetToggler&lt;br /&gt;
	bcf		toggle,0&lt;br /&gt;
	bsf		u1,0			;set u1 indicateing that p1 was the last person to reviece a point (for undo button)&lt;br /&gt;
	bcf		u2,0			;clear u2 undo register sence u1 is being set now&lt;br /&gt;
	incf	p1score,f		;incrament p1score&lt;br /&gt;
	comf	p1s,f&lt;br /&gt;
	comf	p2s,f&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2	&lt;br /&gt;
	return					;return to the main game loop&lt;br /&gt;
Addp2Duce_new&lt;br /&gt;
	call	ResetToggler&lt;br /&gt;
	bcf		toggle,0&lt;br /&gt;
	bsf		u2,0			;set u2 indicateing that p2 was the last person to reviece a point (for undo button)&lt;br /&gt;
	bcf		u1,0			;clear u1 undo register sence u2 is being set now&lt;br /&gt;
	incf	p2score,f		;incrament p1score&lt;br /&gt;
	comf	p1s,f&lt;br /&gt;
	comf	p2s,f&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2&lt;br /&gt;
	return	&lt;br /&gt;
Addp1_new&lt;br /&gt;
	call	ResetToggler&lt;br /&gt;
	bcf		toggle,0&lt;br /&gt;
	bsf		u1,0			;set u1 indicateing that p1 was the last person to reviece a point (for undo button)&lt;br /&gt;
	bcf		u2,0			;clear u2 undo register sence u1 is being set now&lt;br /&gt;
	incf	p1score,f		;incrament p1score&lt;br /&gt;
	incf	serve,f			;++ serve&lt;br /&gt;
	movlw	0x03			;setup to see if the serve # is more than 2&lt;br /&gt;
	subwf	serve,w			;subtract 3 from Serve&lt;br /&gt;
	btfsc	STATUS,C		;test the carry flag. It will be clear if Serve is less than 3&lt;br /&gt;
	call 	SwitchServe_new&lt;br /&gt;
	return					;return to the main game loop.&lt;br /&gt;
Addp2_new&lt;br /&gt;
	call	ResetToggler&lt;br /&gt;
	bcf		toggle,0&lt;br /&gt;
	bsf		u2,0			;set u2 indicateing that p2 was the last person to reviece a point (for undo button)&lt;br /&gt;
	bcf		u1,0			;clear u1 undo register sence u2 is being set now&lt;br /&gt;
	incf	p2score,f		;incrament p1score&lt;br /&gt;
	incf	serve,f			&lt;br /&gt;
	movlw	0x03			;setup to see if the serve # is more than 2&lt;br /&gt;
	subwf	serve,w			;subtract 3 from Serve&lt;br /&gt;
	btfsc	STATUS,C		;test the carry flag. It will be clear if Serve is less than 3&lt;br /&gt;
	call 	SwitchServe_new&lt;br /&gt;
	return					;return to the main game loop.&lt;br /&gt;
Undo_new&lt;br /&gt;
	call	GameOverOn&lt;br /&gt;
	call	ResetToggler&lt;br /&gt;
	bcf		toggle,0&lt;br /&gt;
	btfsc	u1,0			;see if the last point awarded was to p1&lt;br /&gt;
	call	UndoP1_new			;if it was do this &lt;br /&gt;
	btfsc	u2,0			;see if the last point awarded was to p2&lt;br /&gt;
	call	UndoP2_new&lt;br /&gt;
	return&lt;br /&gt;
UndoP1_new&lt;br /&gt;
	movlw	b&#039;11001000&#039;&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	andwf	PORTB,f&lt;br /&gt;
	banksel p1score&lt;br /&gt;
	decf	p1score,f		;--p1score&lt;br /&gt;
	decf	serve,f			;--serve&lt;br /&gt;
	btfsc	STATUS,Z		;if Z flag is set that means that serve was at 1 and needs to be reset to 2&lt;br /&gt;
	call	UndoServe_new&lt;br /&gt;
	bcf		u1,0			;clear the p1 undo register to prevent a loop&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2&lt;br /&gt;
	return&lt;br /&gt;
UndoP2_new&lt;br /&gt;
	movlw	b&#039;11001000&#039;&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	andwf	PORTB,f&lt;br /&gt;
	banksel p1score&lt;br /&gt;
	decf	p2score,f		;--p1score&lt;br /&gt;
	decf	serve,f			;--serve&lt;br /&gt;
	btfsc	STATUS,Z		;if Z flag is set that means that serve was at 1 and needs to be reset to 2&lt;br /&gt;
	call	UndoServe_new&lt;br /&gt;
	bcf		u2,0			;clear the p1 undo register to prevent a loop&lt;br /&gt;
	bcf		SL1&lt;br /&gt;
	bcf		SL2&lt;br /&gt;
	return&lt;br /&gt;
UndoServe_new&lt;br /&gt;
	movlw	0x02&lt;br /&gt;
	movwf	serve&lt;br /&gt;
	comf	p1s,f&lt;br /&gt;
	comf	p2s,f&lt;br /&gt;
	return&lt;br /&gt;
SwitchServe_new&lt;br /&gt;
	comf	p1s,f			;compliment p1s&lt;br /&gt;
	comf	p2s,f			;compliment p2s&lt;br /&gt;
	bcf		SL1			;turn OFF p1 server leds&lt;br /&gt;
	bcf		SL2			;turn OFF p2 server leds&lt;br /&gt;
	movlw	0x01			;reset the serve register &lt;br /&gt;
	banksel	serve&lt;br /&gt;
	movwf	serve	&lt;br /&gt;
	movlw	b&#039;11001000&#039;&lt;br /&gt;
	banksel PORTB&lt;br /&gt;
	andwf	PORTB,f	&lt;br /&gt;
	return	&lt;br /&gt;
	&lt;br /&gt;
;----------------------------------------------------------------&lt;br /&gt;
;end of the good stuff. everything else is routines&lt;br /&gt;
&lt;br /&gt;
binary_to_bcd&lt;br /&gt;
	CLRF	hundreds &lt;br /&gt;
	SWAPF	bin,w 			;w  = A0*16+A1&lt;br /&gt;
	ADDWF	bin,w 			;w  = A0+A1&lt;br /&gt;
	ANDLW	b&#039;00001111&#039; 	;w  = A0+A1 % 16&lt;br /&gt;
	SKPNDC 					;if A0+A1 &amp;gt; 16&lt;br /&gt;
	ADDLW	0x16 			;w  += 16&lt;br /&gt;
	SKPNDC 					;if w % 16 &amp;gt; 10&lt;br /&gt;
	ADDLW	0x06 			;w  += 6&lt;br /&gt;
	ADDLW 	0x06 			;w  += 6&lt;br /&gt;
	SKPDC 					;if w &amp;lt; 10&lt;br /&gt;
	ADDLW	-0x06 			;w  -= 6&lt;br /&gt;
&lt;br /&gt;
	BTFSC	bin,4 &lt;br /&gt;
	ADDLW	0x16 - 1 + 0x6 &lt;br /&gt;
	SKPDC &lt;br /&gt;
	ADDLW	-0x06 &lt;br /&gt;
&lt;br /&gt;
	BTFSC	bin,5 &lt;br /&gt;
	ADDLW	0x30 &lt;br /&gt;
	&lt;br /&gt;
	BTFSC	bin,6 &lt;br /&gt;
	ADDLW	0x60 &lt;br /&gt;
&lt;br /&gt;
	BTFSC	bin,7 &lt;br /&gt;
	ADDLW	0x20 &lt;br /&gt;
&lt;br /&gt;
	ADDLW	0x60 &lt;br /&gt;
	RLF		hundreds,f &lt;br /&gt;
	BTFSS	hundreds, 0 &lt;br /&gt;
	ADDLW 	-0x60 &lt;br /&gt;
&lt;br /&gt;
	MOVWF	tens_and_ones &lt;br /&gt;
	BTFSC	bin,7 &lt;br /&gt;
	INCF	hundreds,f &lt;br /&gt;
	&lt;br /&gt;
	return&lt;br /&gt;
Half_Second_Delay&lt;br /&gt;
			;2499992 cycles&lt;br /&gt;
	movlw	0x15&lt;br /&gt;
	movwf	d1&lt;br /&gt;
	movlw	0x74&lt;br /&gt;
	movwf	d2&lt;br /&gt;
	movlw	0x06&lt;br /&gt;
	movwf	d3&lt;br /&gt;
Half_Second_Delay_0&lt;br /&gt;
	decfsz	d1, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d2, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d3, f&lt;br /&gt;
	goto	Half_Second_Delay_0&lt;br /&gt;
&lt;br /&gt;
			;4 cycles&lt;br /&gt;
	goto	$+1&lt;br /&gt;
	goto	$+1&lt;br /&gt;
&lt;br /&gt;
			;4 cycles (including call)&lt;br /&gt;
	return	&lt;br /&gt;
Twenty_mS_Delay&lt;br /&gt;
			;99993 cycles&lt;br /&gt;
	movlw	0x1E&lt;br /&gt;
	movwf	d1&lt;br /&gt;
	movlw	0x4F&lt;br /&gt;
	movwf	d2&lt;br /&gt;
Twenty_mS_Delay_0&lt;br /&gt;
	decfsz	d1, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d2, f&lt;br /&gt;
	goto	Twenty_mS_Delay_0&lt;br /&gt;
&lt;br /&gt;
			;3 cycles&lt;br /&gt;
	goto	$+1&lt;br /&gt;
	nop&lt;br /&gt;
&lt;br /&gt;
			;4 cycles (including call)&lt;br /&gt;
	return&lt;br /&gt;
&lt;br /&gt;
Two_mS_Delay&lt;br /&gt;
			;9993 cycles&lt;br /&gt;
	movlw	0xCE&lt;br /&gt;
	movwf	d1&lt;br /&gt;
	movlw	0x08&lt;br /&gt;
	movwf	d2&lt;br /&gt;
Two_mS_Delay_0&lt;br /&gt;
	decfsz	d1, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d2, f&lt;br /&gt;
	goto	Two_mS_Delay_0&lt;br /&gt;
&lt;br /&gt;
			;3 cycles&lt;br /&gt;
	goto	$+1&lt;br /&gt;
	nop&lt;br /&gt;
&lt;br /&gt;
			;4 cycles (including call)&lt;br /&gt;
	return&lt;br /&gt;
&lt;br /&gt;
LookupServe:&lt;br /&gt;
	addwf	PCL,f				;add the offset in W to the PC&lt;br /&gt;
	retlw	b&#039;00000000&#039;		;0&lt;br /&gt;
	retlw	b&#039;00000001&#039;		;1&lt;br /&gt;
	retlw	b&#039;00000011&#039;		;2&lt;br /&gt;
	retlw	b&#039;00000111&#039;		;3&lt;br /&gt;
	retlw	b&#039;00010111&#039;		;4&lt;br /&gt;
	retlw	b&#039;00110111&#039;		;5&lt;br /&gt;
&lt;br /&gt;
	END                       ; directive &#039;end of program&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Pictures ==&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:Ping pong 013 -800x600-.JPG|The prototype Ping Pong Scoreboard&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=Omron_NB_HMI_and_Allen-Bradley_CompactLogix_example&amp;diff=8</id>
		<title>Omron NB HMI and Allen-Bradley CompactLogix example</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=Omron_NB_HMI_and_Allen-Bradley_CompactLogix_example&amp;diff=8"/>
		<updated>2024-12-08T16:07:07Z</updated>

		<summary type="html">&lt;p&gt;Paul: Created page with &amp;quot;I had a difficult time with this due to the lack of support from Omron, lack of examples, and questionable documentation for this procedure. Hopefully this will help others who had the same issues as I.   This is a example project showing how to pass variables from the PLC to the HMI over RS232 DF1. It shows how to pass all the supported data types by the HMI; INT, REAL, and BOOL. I am using an Allen-Bradley L31 CompactLogix and a Omron NB7W-TW00B HMI but anyone using a...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I had a difficult time with this due to the lack of support from Omron, lack of examples, and questionable documentation for this procedure. Hopefully this will help others who had the same issues as I. &lt;br /&gt;
&lt;br /&gt;
This is a example project showing how to pass variables from the PLC to the HMI over RS232 DF1. It shows how to pass all the supported data types by the HMI; INT, REAL, and BOOL. I am using an Allen-Bradley L31 CompactLogix and a Omron NB7W-TW00B HMI but anyone using a RSLogix5000 based PLC and a &amp;quot;NB&amp;quot; series Omron HMI will find this useful.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[http://pauljmac.com/projects/images/e/e0/CompactLogix_example.zip CompactLogix_example.zip] - NB-Designer project for this example.&lt;br /&gt;
&lt;br /&gt;
[http://pauljmac.com/projects/images/d/d3/Omron_NB_example.zip Omron_NB_example.zip] - RSLogix5000 example project to pair with the Omron NB HMI.&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=Mails_Here!&amp;diff=7</id>
		<title>Mails Here!</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=Mails_Here!&amp;diff=7"/>
		<updated>2024-12-08T16:06:57Z</updated>

		<summary type="html">&lt;p&gt;Paul: Created page with &amp;quot;== Updates and Status == &amp;lt;section begin=updates /&amp;gt;*After testing and trying many different things I&amp;#039;m afraid that the range on the normal Xbee modules just isn&amp;#039;t strong enough for my application. I will probably be getting some Xbee pro modules soon to try and compensate for this. The device&amp;#039;s operation is just hit and miss with the current setup. Ive tried implementing several solutions to compensate for this but all of which were unacceptable. Im putting this project o...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Updates and Status ==&lt;br /&gt;
&amp;lt;section begin=updates /&amp;gt;*After testing and trying many different things I&#039;m afraid that the range on the normal Xbee modules just isn&#039;t strong enough for my application. I will probably be getting some Xbee pro modules soon to try and compensate for this. The device&#039;s operation is just hit and miss with the current setup. Ive tried implementing several solutions to compensate for this but all of which were unacceptable. Im putting this project on hold until my next Mouser purchase when I can get the better modules. --[[User:Paul|Paul]] 15:13, 6 September 2007 (EDT)&amp;lt;section end=updates /&amp;gt;&lt;br /&gt;
&amp;lt;section begin=oldnews /&amp;gt;&lt;br /&gt;
*I have been working on this project for three days straight and have been making good progress. I finally have something im willing to test in the field and will be doing so for the next week. --[[User:Paul|Paul]] 17:42, 30 August 2007 (EDT)&lt;br /&gt;
*Exciting week! My [[Mails Here!]] board arrived on sat and my new [http://www.aoyue.com/en/ArticleShow.asp?ArticleID=415 Aoyue 2702] soldering station arrived Monday. If im happy with the outcome of this new board ill upload the layout to the [[Mails Here!]] page. I have some work ahead of me now! --[[User:Paul|Paul]] 14:12, 14 August 2007 (EDT)&lt;br /&gt;
*My newly designed boards have finally arrived. I was working on porting the code over to the old PIC to the new one (18f8722 to a 18f2550) when I came across a lot of ways I could do things more efficiently so its ending up like a total rewrite than a port, which is fine. Will post some of the good stuff once I`m happy with it. --[[User:Paul|Paul]] 22:37, 6 July 2007 (EDT)&lt;br /&gt;
&lt;br /&gt;
*I ordered the revision 3 of the PCB. This version includes a Dallas/Maxim DS1305 RTC with super capacitor backup. I wanted to include it sense day one but the whole project being such a large step for me I decided against it until now. Now I will be able to implement a RTC easer as well as a full calender. I cant wait for the boards to arrive so I can get back into it. --[[User:Paul|Paul]] 18:11, 1 August 2007 (EDT)&lt;br /&gt;
&amp;lt;section end=oldnews /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Abstract ==&lt;br /&gt;
Mails Here! is a mail notification system consisting of two parts. The first is a device that is placed in a mail box with a photo sensor, button, and RF transmitter/receiver. When light is detected in the box, the MCU makes a decision at to whether it&#039;s mail being delivered or retrieved based on the following actions and transmits the corresponding signal to the base station. The base station is the second part of the system which consists of an LCD, 4 button navigation panel and an RF transmitter/receiver. When a signal is received from the mailbox device, the MCU inside the base station records the activity and updates the display. The MCU also keeps a log of the previous 7 days which can be displayed on the LCD using the navigation buttons.&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
&lt;br /&gt;
=== Mail box device ===&lt;br /&gt;
After the user powers up the device by installing a 9V battery, a 30 second timer will activate allowing them to place the device in the mailbox. After 30 seconds, the device will go into power saving mode and stay there until light is detected. If the amount of light detected is above the threshold that is set by the potentiometer, the device will wake up and begin a 30 second timer. If the button on the device is pressed within this 30 second time frame, the device will assume its someone retrieving the mail and transmit a &amp;quot;Mail Retrieved&amp;quot; code to the base station. The device then provides a 20 second grade period for the user to close the mail box so the device can reset and await another delivery. If no button is pressed within the 30 second time frame, the device will assume its the mail being delivered and will transmit a &amp;quot;Mail Delivered&amp;quot; code to the base station.&lt;br /&gt;
&lt;br /&gt;
== Parts ==&lt;br /&gt;
&lt;br /&gt;
== Circuits ==&lt;br /&gt;
[[Image:Mailshere mailboxpower Page 3.jpg|none|thumb|Mail box device]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Mailshere mailboxpower Page 4.jpg|none|thumbnail|Mail box device power]]&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
=== Mail box device ===&lt;br /&gt;
I wrote code for the mail box device in assembly. Intended to run on a PIC16F88. &lt;br /&gt;
[http://pauljmac.com/projects/images/b/b8/Mailbox.zip]&lt;br /&gt;
&lt;br /&gt;
The main code:&lt;br /&gt;
&amp;lt;pre&amp;gt;;**********************************************************************&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;    Filename:	    main.asm                                          *&lt;br /&gt;
;    Date:          04/28/07                                          *&lt;br /&gt;
;    File Version:  1.0                                               *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;    Author:        Paul Mac                                          *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;    Files required:    P16F88.INC                                    *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;   Operation: After setup the PIC is put into sleep. A change	      *&lt;br /&gt;
; in the comparator will bring the PIC out of sleep.Light hits the    *&lt;br /&gt;
; photocell the comparator will wakeup the PIC and it will start a 30 *&lt;br /&gt;
; second timer. If the button is pressed within the time limit a      *&lt;br /&gt;
; &amp;quot;mail picked up&amp;quot; routine will be executed. If not after the timer   *&lt;br /&gt;
; is up a &amp;quot;mail delivered&amp;quot; routine will be executed. After both	      *&lt;br /&gt;
; routines the PIC will reset and return to sleep                     *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
&lt;br /&gt;
	list      p=16f88, r=HEX         ; list directive to define processor&lt;br /&gt;
	#include &amp;lt;p16F88.inc&amp;gt;        ; processor specific variable definitions&lt;br /&gt;
&lt;br /&gt;
	errorlevel  -302              ; suppress message 302 from list file&lt;br /&gt;
&lt;br /&gt;
    __CONFIG    _CONFIG1, _CP_OFF &amp;amp; _CCP1_RB0 &amp;amp; _DEBUG_OFF &amp;amp; _WRT_PROTECT_OFF &amp;amp; _CPD_OFF &amp;amp; _LVP_OFF &amp;amp; _BODEN_OFF &amp;amp; _MCLR_ON &amp;amp; _PWRTE_OFF &amp;amp; _WDT_OFF &amp;amp; _INTRC_CLKOUT&lt;br /&gt;
  	__CONFIG    _CONFIG2, _IESO_OFF &amp;amp; _FCMEN_OFF&lt;br /&gt;
&lt;br /&gt;
;***** VARIABLE DEFINITIONS ********************************************&lt;br /&gt;
	cblock	0x20&lt;br /&gt;
	d1,d2,d3,d4&lt;br /&gt;
	txbyte,rxbyte&lt;br /&gt;
	buttonloopdelay, ticker, repeat&lt;br /&gt;
	endc&lt;br /&gt;
w_temp        EQU     0x71        ; variable used for context saving &lt;br /&gt;
status_temp   EQU     0x72        ; variable used for context saving&lt;br /&gt;
pclath_temp   EQU     0x73	 	 ; variable used for context saving&lt;br /&gt;
&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
	ORG     0x000             ; processor reset vector&lt;br /&gt;
	goto    Initialize              ; go to beginning of program&lt;br /&gt;
&lt;br /&gt;
; *** isr ************************************************************&lt;br /&gt;
	ORG     0x004             ; interrupt vector location&lt;br /&gt;
	movwf   w_temp            ; save off current W register contents&lt;br /&gt;
	movf	STATUS,w          ; move STATUS register into W register&lt;br /&gt;
	movwf	status_temp       ; save off contents of STATUS register&lt;br /&gt;
	movf	PCLATH,W	  ; move PCLATH register into W register&lt;br /&gt;
	movwf	pclath_temp       ; save off contents of PCLATH register&lt;br /&gt;
	; ISR here&lt;br /&gt;
	movf    pclath_temp,w     ; retrieve copy of PCLATH register&lt;br /&gt;
	movwf	PCLATH            ; restore pre-isr PCLATH register contents&lt;br /&gt;
	movf    status_temp,w     ; retrieve copy of STATUS register&lt;br /&gt;
	movwf	STATUS            ; restore pre-isr STATUS register contents&lt;br /&gt;
	swapf   w_temp,f&lt;br /&gt;
	swapf   w_temp,w          ; restore pre-isr W register contents&lt;br /&gt;
	retfie                    ; return from interrupt&lt;br /&gt;
&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
Initialize&lt;br /&gt;
    BANKSEL	OSCCON&lt;br /&gt;
    movlw   b&#039;01110000&#039;     ;select 8-MHz INTOSC clock&lt;br /&gt;
    movwf   OSCCON&lt;br /&gt;
Stable&lt;br /&gt;
	BANKSEL	OSCCON  &lt;br /&gt;
	btfss   OSCCON,IOFS     ;INTOSC frequency stable?&lt;br /&gt;
    goto    Stable          ;no, loop&lt;br /&gt;
ADcon   &lt;br /&gt;
	movlw	b&#039;00000110&#039;		;PORTA 1 and 2 are analog inputs&lt;br /&gt;
	BANKSEL	ANSEL&lt;br /&gt;
    movwf   ANSEL           &lt;br /&gt;
Comparator&lt;br /&gt;
	movlw	b&#039;00000101&#039;		;Setup Comparator, C1 disabled, C2 enabled Vin- is RA1 Vin+ is RA2 output is RA4&lt;br /&gt;
	BANKSEL	CMCON	&lt;br /&gt;
	movwf	CMCON&lt;br /&gt;
Ports&lt;br /&gt;
    movlw	b&#039;00000110&#039;		;PORTA RA1 and RA2 are comparator inputs, RA0 is LED output&lt;br /&gt;
    BANKSEL	TRISA&lt;br /&gt;
    movwf	TRISA&lt;br /&gt;
    movlw	b&#039;010000101&#039;	;PORTB RB7:NA RB6:CTS, Input RB5:UartTX, output RB4:RTS, output RB3:Xbee Reset, output RB2:UartRX, Input RB1:Xbee Sleep, Output RB0:Button, Input&lt;br /&gt;
    BANKSEL	TRISB&lt;br /&gt;
    movwf	TRISB&lt;br /&gt;
Uartsetup&lt;br /&gt;
    movlw	d&#039;51&#039;			;set UART to 9.6k baud&lt;br /&gt;
    BANKSEL	SPBRG&lt;br /&gt;
    movwf	SPBRG&lt;br /&gt;
    movlw	b&#039;00100100&#039;		;setup UARTtx for 8bit-Asynchronous high baud&lt;br /&gt;
    BANKSEL	TXSTA&lt;br /&gt;
    movwf	TXSTA&lt;br /&gt;
    movlw	b&#039;10010000&#039;		;setup UARTrx for enable serial port and continuous receive 8bit&lt;br /&gt;
    BANKSEL	RCSTA&lt;br /&gt;
    movwf	RCSTA&lt;br /&gt;
Interrupts&lt;br /&gt;
	movlw	b&#039;01000000&#039;		;Enable PIE and intrupt			&lt;br /&gt;
	BANKSEL	INTCON&lt;br /&gt;
	movwf	INTCON&lt;br /&gt;
	movlw	b&#039;0010000&#039;		;Enable RCIE Ausart receive interrupt&lt;br /&gt;
	BANKSEL	PIE1&lt;br /&gt;
	movwf	PIE1	&lt;br /&gt;
	movlw	b&#039;01000000&#039;		;Enable Comparator Interrupt&lt;br /&gt;
	BANKSEL	PIE2	&lt;br /&gt;
	movwf	PIE2&lt;br /&gt;
GetReady&lt;br /&gt;
	BANKSEL	PORTA&lt;br /&gt;
	BSF		PORTB,3			;Make sure the xbee reset pin is high	&lt;br /&gt;
;    clrf	PORTA&lt;br /&gt;
;    clrf	PORTB&lt;br /&gt;
	call	Delay_20s		;20 second delay till device is active UNCOMMENT WHEN DONE TESTING&lt;br /&gt;
	movlw	&#039;0&#039;&lt;br /&gt;
	call 	Uart_out&lt;br /&gt;
; Program entry *******************************************************&lt;br /&gt;
Main&lt;br /&gt;
	BANKSEL	PORTA&lt;br /&gt;
	bcf		PORTA,0		;turn the button loop light off if its on&lt;br /&gt;
	bsf		PORTB,1		;Put the Xbee to sleep&lt;br /&gt;
	SLEEP				;gooo to sleeppppp&lt;br /&gt;
	nop					;Prefetched before sleep&lt;br /&gt;
	BANKSEL	CMCON&lt;br /&gt;
	btfss 	CMCON,C2OUT&lt;br /&gt;
	goto	Runlight&lt;br /&gt;
	BANKSEL	PIR1&lt;br /&gt;
	btfsc 	PIR1,TXIF&lt;br /&gt;
	goto	RxInt&lt;br /&gt;
	goto	Main&lt;br /&gt;
Runlight&lt;br /&gt;
	movlw   D&#039;6&#039;		;default value is 255 for with a 6 ticker for ~30 second delay&lt;br /&gt;
	BANKSEL ticker&lt;br /&gt;
	movwf	ticker&lt;br /&gt;
	movlw	D&#039;255&#039;		;default value is 255 for with a 6 ticker for ~30 second delay&lt;br /&gt;
	BANKSEL	buttonloopdelay&lt;br /&gt;
	movwf	buttonloopdelay&lt;br /&gt;
Buttonloop&lt;br /&gt;
	BANKSEL	PORTA&lt;br /&gt;
	movlw	b&#039;00000001&#039;		;toggle RA0, AHH YUP, GOOD TO GO&lt;br /&gt;
	xorwf	PORTA,f&lt;br /&gt;
	btfss	PORTB,0			;Test to see if button has been pressed. &lt;br /&gt;
	goto	Pickup			; If so branch&lt;br /&gt;
	call	Buttonloopdelay		;delay 20ms then poll again.&lt;br /&gt;
	BANKSEL	buttonloopdelay&lt;br /&gt;
	decfsz	buttonloopdelay,f	;decrement a 255 count delay&lt;br /&gt;
	goto	Buttonloop&lt;br /&gt;
	decfsz	ticker,f&lt;br /&gt;
	goto 	Buttonloop&lt;br /&gt;
	movlw	&#039;M&#039;			;Tx the MAILS HERE code&lt;br /&gt;
	BANKSEL	txbyte&lt;br /&gt;
	movwf	txbyte&lt;br /&gt;
	call	Uart_out&lt;br /&gt;
	goto	Main&lt;br /&gt;
Pickup&lt;br /&gt;
	movlw	&#039;R&#039;	;Tx the MAILS RETRIEVED code&lt;br /&gt;
	movwf	txbyte&lt;br /&gt;
	call	Uart_out&lt;br /&gt;
;20s delay to let the user gtfo without rerunning the thing&lt;br /&gt;
			;40000000 cycles&lt;br /&gt;
	movlw	0x6D&lt;br /&gt;
	movwf	d1&lt;br /&gt;
	movlw	0x32&lt;br /&gt;
	movwf	d2&lt;br /&gt;
	movlw	0x58&lt;br /&gt;
	movwf	d3&lt;br /&gt;
Delay_0&lt;br /&gt;
	decfsz	d1, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d2, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d3, f&lt;br /&gt;
	goto	Delay_0&lt;br /&gt;
&lt;br /&gt;
	goto	Main&lt;br /&gt;
Uart_out&lt;br /&gt;
	BANKSEL	PORTB&lt;br /&gt;
	bcf		PORTB,1		; wake the xbee up&lt;br /&gt;
CTS&lt;br /&gt;
	btfsc	PORTB,6		; make sure shes up and ready&lt;br /&gt;
	goto	CTS			; If she isent, loop till she is. &lt;br /&gt;
	BANKSEL	PIR1&lt;br /&gt;
WaitTX&lt;br /&gt;
	btfss	PIR1,TXIF	;test to see if the Tx buffer is full&lt;br /&gt;
	goto	WaitTX&lt;br /&gt;
	BANKSEL	txbyte&lt;br /&gt;
	movf	txbyte		;moves the byte to be transmitted to the W reg&lt;br /&gt;
	BANKSEL	TXREG&lt;br /&gt;
	movwf	TXREG		;Tx the sucker&lt;br /&gt;
WaitTX_2&lt;br /&gt;
	call 	Buttonloopdelay		; delay before doing it again&lt;br /&gt;
	btfss	PIR1,TXIF&lt;br /&gt;
	goto	WaitTX_2&lt;br /&gt;
	BANKSEL	txbyte&lt;br /&gt;
	movf	txbyte&lt;br /&gt;
	BANKSEL	TXREG&lt;br /&gt;
	movwf	TXREG&lt;br /&gt;
	return&lt;br /&gt;
RxInt&lt;br /&gt;
	movf	RCREG,w&lt;br /&gt;
	movwf	rxbyte		;put the recived byte in the rxbyte register&lt;br /&gt;
	goto	Main&lt;br /&gt;
Clr_Int					;Clr the intruppt flags&lt;br /&gt;
	clrf	PIR1&lt;br /&gt;
	clrf	PIR2&lt;br /&gt;
	return&lt;br /&gt;
Delay_20s&lt;br /&gt;
			;39999993 cycles&lt;br /&gt;
	movlw	0x6C&lt;br /&gt;
	movwf	d1&lt;br /&gt;
	movlw	0x32&lt;br /&gt;
	movwf	d2&lt;br /&gt;
	movlw	0x58&lt;br /&gt;
	movwf	d3&lt;br /&gt;
Delay_20s_0&lt;br /&gt;
	decfsz	d1, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d2, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d3, f&lt;br /&gt;
	goto	Delay_20s_0&lt;br /&gt;
&lt;br /&gt;
			;3 cycles&lt;br /&gt;
	goto	$+1&lt;br /&gt;
	nop&lt;br /&gt;
&lt;br /&gt;
			;4 cycles (including call)&lt;br /&gt;
	return&lt;br /&gt;
Buttonloopdelay					; 20ms delay with 8Mhz clock&lt;br /&gt;
			;39993 cycles&lt;br /&gt;
	movlw	0x3E&lt;br /&gt;
	movwf	d1&lt;br /&gt;
	movlw	0x20&lt;br /&gt;
	movwf	d2&lt;br /&gt;
Buttonloop_0&lt;br /&gt;
	decfsz	d1, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d2, f&lt;br /&gt;
	goto	Buttonloop_0&lt;br /&gt;
&lt;br /&gt;
			;3 cycles&lt;br /&gt;
	goto	$+1&lt;br /&gt;
	nop&lt;br /&gt;
&lt;br /&gt;
			;4 cycles (including call)&lt;br /&gt;
	return&lt;br /&gt;
; initialize eeprom locations&lt;br /&gt;
&lt;br /&gt;
	ORG	0x2100&lt;br /&gt;
	DE	0x00, 0x01, 0x02, 0x03&lt;br /&gt;
	END                   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Base station ===&lt;br /&gt;
I&#039;m currently rewriting my code for the base station as I port it over to a 18F2550. Will post it when I&#039;m satisfied with it.&lt;br /&gt;
&lt;br /&gt;
== PCB layout ==&lt;br /&gt;
PCB layout of the mailbox device:&lt;br /&gt;
[[Image:MailsHere mailbox board.jpg|none|thumb|Mail box device]]&lt;br /&gt;
&lt;br /&gt;
PCB layout of the base station:&lt;br /&gt;
I have made some changes to the PCB and am waiting for my prototype to arrive to test it before posting it. &lt;br /&gt;
&lt;br /&gt;
== Pictures ==&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:MailsHere2.jpg|The mailbox system tucked away in its weather proof case. &lt;br /&gt;
Image:MailsHere3.jpg|Overview of the mailbox board with its case.&lt;br /&gt;
Image:MailsHere4.jpg|Closeup of the mailbox board with its case. &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=RGB_LED_Fader&amp;diff=6</id>
		<title>RGB LED Fader</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=RGB_LED_Fader&amp;diff=6"/>
		<updated>2024-12-08T16:06:47Z</updated>

		<summary type="html">&lt;p&gt;Paul: Created page with &amp;quot;==Abstract== This is a neat little thing that will generate a very smooth fading RGB LED. I used these little [http://macetech.com/store/index.php?main_page=product_info&amp;amp;cPath=1&amp;amp;products_id=1&amp;amp;zenid=88668e82703841817ce99ebaed27c970 ShiftBright] modules which have the A6281 already mounted along with an RGB LED. I don&amp;#039;t have the ability to solder a 3mm x 3mm QFN myself. == Parts == *[http://www.atmel.com/dyn/products/product_card.asp?part_id=3828 ATtiny44] *[http://www.all...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Abstract==&lt;br /&gt;
This is a neat little thing that will generate a very smooth fading RGB LED. I used these little [http://macetech.com/store/index.php?main_page=product_info&amp;amp;cPath=1&amp;amp;products_id=1&amp;amp;zenid=88668e82703841817ce99ebaed27c970 ShiftBright] modules which have the A6281 already mounted along with an RGB LED. I don&#039;t have the ability to solder a 3mm x 3mm QFN myself.&lt;br /&gt;
== Parts ==&lt;br /&gt;
*[http://www.atmel.com/dyn/products/product_card.asp?part_id=3828 ATtiny44]&lt;br /&gt;
*[http://www.allegromicro.com/en/Products/Part_Numbers/6281/ A6281] 3-Channel Constant Current LED Driver with Programmable PWM Control&lt;br /&gt;
== Code ==&lt;br /&gt;
main.c&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;avr/io.h&amp;gt;&lt;br /&gt;
#include &amp;lt;util/delay.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#define bit_get(p,m) ((p) &amp;amp; (m))&lt;br /&gt;
#define bit_set(p,m) ((p) |= (m))&lt;br /&gt;
#define bit_clear(p,m) ((p) &amp;amp;= ~(m))&lt;br /&gt;
#define bit_flip(p,m) ((p) ^= (m))&lt;br /&gt;
#define bit_write(c,p,m) (c ? bit_set(p,m) : bit_clear(p,m))&lt;br /&gt;
#define BIT(x) (0x01 &amp;lt;&amp;lt; (x))&lt;br /&gt;
#define LONGBIT(x) ((unsigned long)0x00000001 &amp;lt;&amp;lt; (x))&lt;br /&gt;
#define NOP asm(&amp;quot;nop&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
#define E_S bit_set(PORTA,BIT(0));&lt;br /&gt;
#define E_C bit_clear(PORTA,BIT(0)); //OE is active low, this turns lights on&lt;br /&gt;
&lt;br /&gt;
#define L_S bit_set(PORTA,BIT(1));&lt;br /&gt;
#define L_C bit_clear(PORTA,BIT(1));&lt;br /&gt;
&lt;br /&gt;
#define LED_OFF bit_clear(PORTA,BIT(7));&lt;br /&gt;
#define LED_ON bit_set(PORTA,BIT(7));&lt;br /&gt;
&lt;br /&gt;
#define shift USICR|=(1&amp;lt;&amp;lt;USICLK);	//generates a shift in the SPI register&lt;br /&gt;
#define clock USICR|=(1&amp;lt;&amp;lt;USITC);	//generates a clock on the SPI bus &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//PA1 is Latch inout&lt;br /&gt;
//PA0 is Enable output&lt;br /&gt;
&lt;br /&gt;
volatile uint8_t x=0;&lt;br /&gt;
&lt;br /&gt;
void Port_setup(void){&lt;br /&gt;
	DDRA|=(1&amp;lt;&amp;lt;PA7)|(0&amp;lt;&amp;lt;PA6)|(1&amp;lt;&amp;lt;PA5)|(1&amp;lt;&amp;lt;PA4)|(1&amp;lt;&amp;lt;PA1)|(1&amp;lt;&amp;lt;PA0); //seting up the apropriate SPI i/o&#039;s&lt;br /&gt;
	USICR|=(0&amp;lt;&amp;lt;USIWM1)|(1&amp;lt;&amp;lt;USIWM0)|(0&amp;lt;&amp;lt;USICS1)|(0&amp;lt;&amp;lt;USICS0); //SPI mode&lt;br /&gt;
	DDRB|=(0&amp;lt;&amp;lt;PB1);&lt;br /&gt;
	PORTB|=(1&amp;lt;&amp;lt;PORTB0);&lt;br /&gt;
	LED_OFF;&lt;br /&gt;
	&lt;br /&gt;
	E_C;&lt;br /&gt;
	L_C;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void shft8bit(unsigned char val)&lt;br /&gt;
{&lt;br /&gt;
   USIDR = val;&lt;br /&gt;
   USISR = (1&amp;lt;&amp;lt;USIOIF);&lt;br /&gt;
   do {&lt;br /&gt;
      USICR = (1&amp;lt;&amp;lt;USIWM0)|(1&amp;lt;&amp;lt;USICS1)|(1&amp;lt;&amp;lt;USICLK)|(1&amp;lt;&amp;lt;USITC);&lt;br /&gt;
	  _delay_us(40);&lt;br /&gt;
   } while ((USISR &amp;amp; (1&amp;lt;&amp;lt;USIOIF)) == 0);&lt;br /&gt;
} &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void colors(uint16_t red, uint16_t green, uint16_t blue)&lt;br /&gt;
{&lt;br /&gt;
	volatile uint32_t packet=1;&lt;br /&gt;
&lt;br /&gt;
	packet = (packet &amp;lt;&amp;lt; 2)| (blue &amp;amp; 1023);&lt;br /&gt;
	packet = (packet &amp;lt;&amp;lt; 10)| (red &amp;amp; 1023);&lt;br /&gt;
	packet = (packet &amp;lt;&amp;lt; 10)| (green &amp;amp; 1023);&lt;br /&gt;
&lt;br /&gt;
	shft8bit((packet&amp;gt;&amp;gt;24) &amp;amp; 0xff);&lt;br /&gt;
	shft8bit((packet&amp;gt;&amp;gt;16) &amp;amp; 0xff);&lt;br /&gt;
	shft8bit((packet&amp;gt;&amp;gt;8) &amp;amp; 0xff);&lt;br /&gt;
	shft8bit((packet&amp;gt;&amp;gt;0) &amp;amp; 0xff);&lt;br /&gt;
	L_S;&lt;br /&gt;
	_delay_us(40);&lt;br /&gt;
	L_C;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void LED_setup(void)&lt;br /&gt;
{&lt;br /&gt;
	shft8bit(0b11111111);&lt;br /&gt;
	shft8bit(0b11111111);&lt;br /&gt;
	shft8bit(0b11111111);&lt;br /&gt;
	shft8bit(0b00111111);&lt;br /&gt;
	L_S;&lt;br /&gt;
	_delay_us(40);&lt;br /&gt;
	L_C;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Blue(void)&lt;br /&gt;
{&lt;br /&gt;
	// blue&lt;br /&gt;
	shft8bit(0b10111111);&lt;br /&gt;
	shft8bit(0b11110000);&lt;br /&gt;
	shft8bit(0b00000000);&lt;br /&gt;
	shft8bit(0b00000000);&lt;br /&gt;
	L_S;&lt;br /&gt;
	_delay_us(40);&lt;br /&gt;
	L_C;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Red(void)&lt;br /&gt;
{&lt;br /&gt;
	// red		&lt;br /&gt;
	shft8bit(0b10000000);&lt;br /&gt;
	shft8bit(0b00001111);&lt;br /&gt;
	shft8bit(0b11111100);&lt;br /&gt;
	shft8bit(0b00000000);&lt;br /&gt;
	L_S;&lt;br /&gt;
	_delay_us(40);&lt;br /&gt;
	L_C;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Green(void)&lt;br /&gt;
{&lt;br /&gt;
	// green&lt;br /&gt;
	shft8bit(0b10000000);&lt;br /&gt;
	shft8bit(0b00000000);&lt;br /&gt;
	shft8bit(0b00000011);&lt;br /&gt;
	shft8bit(0b11111111);&lt;br /&gt;
	L_S;&lt;br /&gt;
	_delay_us(40);&lt;br /&gt;
	L_C;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Clear(void)&lt;br /&gt;
{&lt;br /&gt;
	// green&lt;br /&gt;
	shft8bit(0b10000000);&lt;br /&gt;
	shft8bit(0b00000000);&lt;br /&gt;
	shft8bit(0b00000000);&lt;br /&gt;
	shft8bit(0b00000000);&lt;br /&gt;
	L_S;&lt;br /&gt;
	_delay_us(40);&lt;br /&gt;
	L_C;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void Delay(void)&lt;br /&gt;
{&lt;br /&gt;
	_delay_ms(40);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main (void)&lt;br /&gt;
{&lt;br /&gt;
	E_S;&lt;br /&gt;
	Delay();&lt;br /&gt;
	Port_setup();&lt;br /&gt;
	LED_setup();&lt;br /&gt;
	Clear();&lt;br /&gt;
	Clear();&lt;br /&gt;
	E_C;&lt;br /&gt;
	LED_ON;&lt;br /&gt;
	for(;;)&lt;br /&gt;
	{	&lt;br /&gt;
		int y=0;&lt;br /&gt;
		for(int i=1023;i&amp;gt;0;i--)&lt;br /&gt;
		{&lt;br /&gt;
			y++;&lt;br /&gt;
			colors(i,y,0);&lt;br /&gt;
			Delay();&lt;br /&gt;
		}&lt;br /&gt;
		y=0;&lt;br /&gt;
		for(int i=1023;i&amp;gt;0;i--)&lt;br /&gt;
		{&lt;br /&gt;
			y++;&lt;br /&gt;
			colors(0,i,y);&lt;br /&gt;
			Delay();&lt;br /&gt;
		}&lt;br /&gt;
		y=0;&lt;br /&gt;
		for(int i=1023;i&amp;gt;0;i--)&lt;br /&gt;
		{&lt;br /&gt;
			y++;&lt;br /&gt;
			colors(y,0,i);&lt;br /&gt;
			Delay();&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=Jeopardy_PIC_buzzer&amp;diff=5</id>
		<title>Jeopardy PIC buzzer</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=Jeopardy_PIC_buzzer&amp;diff=5"/>
		<updated>2024-12-08T16:06:15Z</updated>

		<summary type="html">&lt;p&gt;Paul: Created page with &amp;quot;== Assembly Code == &amp;lt;pre&amp;gt; ; Header --------- 	list	p=16f84a 	__config	h&amp;#039;3ff1&amp;#039; 	radix	hex ; equates -------- portb	equ	0x06	;inputs porta	equ	0x05 ;outputs status	equ	0x03  ; Program -------- 	org 0x00 start	movlw	0xff 	tris	portb	;port b as inputs 	movlw	0x00 	tris	porta ;port a as outputs loop	movlw 0xff	 	movwf	portb 	btfsc	portb,6	;probe portb 6 to see if its down 	goto	loop 	goto poll poll	movlw	0x07 	movwf	porta probe	btfss	portb,0 ;poll player 1 	goto player1 	btfs...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Assembly Code ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
; Header ---------&lt;br /&gt;
	list	p=16f84a&lt;br /&gt;
	__config	h&#039;3ff1&#039;&lt;br /&gt;
	radix	hex&lt;br /&gt;
; equates --------&lt;br /&gt;
portb	equ	0x06	;inputs&lt;br /&gt;
porta	equ	0x05 ;outputs&lt;br /&gt;
status	equ	0x03&lt;br /&gt;
&lt;br /&gt;
; Program --------&lt;br /&gt;
	org 0x00&lt;br /&gt;
start	movlw	0xff&lt;br /&gt;
	tris	portb	;port b as inputs&lt;br /&gt;
	movlw	0x00&lt;br /&gt;
	tris	porta ;port a as outputs&lt;br /&gt;
loop	movlw 0xff	&lt;br /&gt;
	movwf	portb&lt;br /&gt;
	btfsc	portb,6	;probe portb 6 to see if its down&lt;br /&gt;
	goto	loop&lt;br /&gt;
	goto poll&lt;br /&gt;
poll	movlw	0x07&lt;br /&gt;
	movwf	porta&lt;br /&gt;
probe	btfss	portb,0 ;poll player 1&lt;br /&gt;
	goto player1&lt;br /&gt;
	btfss	portb,1 ;poll player 2&lt;br /&gt;
	goto player2&lt;br /&gt;
	btfss	portb,2	;poll player 3&lt;br /&gt;
	goto player3&lt;br /&gt;
	btfss	portb,3 ;poll player 4&lt;br /&gt;
	goto player4&lt;br /&gt;
	btfss	portb,4	;poll player 5&lt;br /&gt;
	goto player5&lt;br /&gt;
	btfss	portb,5	;poll player 6&lt;br /&gt;
	goto player6&lt;br /&gt;
	goto probe&lt;br /&gt;
player1	movlw	0x01&lt;br /&gt;
	movwf	porta&lt;br /&gt;
	return&lt;br /&gt;
player2 movlw	0x02&lt;br /&gt;
	movwf	porta&lt;br /&gt;
	return&lt;br /&gt;
player3	movlw	0x03&lt;br /&gt;
	movwf	porta&lt;br /&gt;
	goto loop&lt;br /&gt;
player4	movlw	0x04&lt;br /&gt;
	movwf	porta&lt;br /&gt;
	return&lt;br /&gt;
player5	movlw	0x05&lt;br /&gt;
	movwf	porta&lt;br /&gt;
	return&lt;br /&gt;
player6	movlw	0x06&lt;br /&gt;
	movwf	porta&lt;br /&gt;
	return&lt;br /&gt;
	end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
Pretty code, yes I realize this. This was my first attempt at using a PIC to actually do something useful. Each contestant got their own input line on the PIC for a total of 6 contestants. An input line was used as a reset button to reset the game. The outputs drove BCD chips to display which contestant buzzed in first.&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=Fluke_8100_Clock&amp;diff=4</id>
		<title>Fluke 8100 Clock</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=Fluke_8100_Clock&amp;diff=4"/>
		<updated>2024-12-08T16:06:04Z</updated>

		<summary type="html">&lt;p&gt;Paul: Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039; This article is not complete! It is still a work in progress!&amp;#039;&amp;#039;&amp;#039;  --Paul 20:27, 14 February 2013 (EST)   I stumbled on this lovely old school Fluke Nixie tube DMM. After waiting for a bit I was able to pick one up cheap, the only problem was it was not working. Well sort of. The DMM did not function but the Nixie display seemed to work fine. The great part about old lab instruments is that the schematics were all public and published in tech manuals.  G...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039; This article is not complete! It is still a work in progress!&#039;&#039;&#039; &lt;br /&gt;
--[[User:Paul|Paul]] 20:27, 14 February 2013 (EST)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I stumbled on this lovely old school Fluke Nixie tube DMM. After waiting for a bit I was able to pick one up cheap, the only problem was it was not working. Well sort of. The DMM did not function but the Nixie display seemed to work fine. The great part about old lab instruments is that the schematics were all public and published in tech manuals.  Good people like [http://www.nixiebunny.com/ David Forbes] have these manuals scanned and posted for people like me so I can avoid having to spend another $25 buying one off ebay.  He has them posted here: [http://www.nixiebunny.com/fluke8100b/fluke8100b.html]&lt;br /&gt;
&lt;br /&gt;
After looking though the schematic and the troubleshooting guide it became clear that there was more wrong with the DMM then I was willing to spend time on fixing. So I got the idea to convert it into a 24 hour clock for my lab. This is that project covering the attempt to fix the meter as well as the conversion to a clock.&lt;br /&gt;
&lt;br /&gt;
=The Investigation=&lt;br /&gt;
&lt;br /&gt;
=The learning experience=&lt;br /&gt;
&lt;br /&gt;
=The conversion=&lt;br /&gt;
After studying the schematics and troubleshooting the and some reverse engineering I figured out how the Nixie display worked. A signal from the sample and hold circuit is fed into a decade MC839 counter which is then fed to a DM7441A BCD decimal decoder driver. The Nixie tubes are muxed off of this driver. The NPN transistors for each of the segments are Q67-70 with the polarization and half digit on some others. My plan is to cut the clock input to the driver and generate my own from a micro while controlling the NPNs with the micro to mux the display.&lt;br /&gt;
&lt;br /&gt;
=The result=&lt;br /&gt;
[[Image:20130126 172928.jpg|none|thumb|LM317 used as for the -18V supply for the DMM.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:20130126 143145.jpg|none|thumb|The replacement transistor that I thought would solve the power supply issue. It didn&#039;t.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:20130126 143124.jpg|none|thumb|The suspect bad transistor removed.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:20130126 143113.jpg|none|thumb|The suspect bad transistor removed from the bottom.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:20130121 110655.jpg|none|thumb|Suspect bad Nixie driving transistors Q69 and Q70 removed.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:20130120 174208.jpg|none|thumb|The board removed from the case and powered up. You can see the test leads hanging off the 7 segment driver.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:20130120 173659.jpg|none|thumb|Test leads soldered to the 7 segment driver.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:20130120 173636.jpg|none|thumb|Legs of the 7 segment driver sniped and test leads soldered to them.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:20130120 155348.jpg|none|thumb|Just working on the bench.]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:20130120 155339.jpg|none|thumb|Working on the bench above.]]&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=DBL_Flusher&amp;diff=3</id>
		<title>DBL Flusher</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=DBL_Flusher&amp;diff=3"/>
		<updated>2024-12-08T16:05:50Z</updated>

		<summary type="html">&lt;p&gt;Paul: Created page with &amp;quot;== Updates == &amp;lt;section begin=updates /&amp;gt;*DBL Flusher project is posted in its completeness. BOM, CODE, HARDWARE, and more is all posted. --Paul 13:58, 7 November 2007 (EST)&amp;lt;section end=updates /&amp;gt; &amp;lt;section begin=oldnews /&amp;gt; *Its been a month of testing and everything looks good. The device is still operating fine. I am working on polishing up the code and adding programmable time delay. But the hardest part is creating a template for the bracket, and its takin...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Updates ==&lt;br /&gt;
&amp;lt;section begin=updates /&amp;gt;*DBL Flusher project is posted in its completeness. BOM, CODE, HARDWARE, and more is all posted. --[[User:Paul|Paul]] 13:58, 7 November 2007 (EST)&amp;lt;section end=updates /&amp;gt;&lt;br /&gt;
&amp;lt;section begin=oldnews /&amp;gt;&lt;br /&gt;
*Its been a month of testing and everything looks good. The device is still operating fine. I am working on polishing up the code and adding programmable time delay. But the hardest part is creating a template for the bracket, and its taking a long time to get that to where I want it to be. I will soon flood the page with all this stuff once I&#039;m satisfied with it. --[[User:Paul|Paul]] 13:18, 1 November 2007 (EDT)&lt;br /&gt;
*Its been over a week with my DBL Flusher installed on the potty and so far so good. I am waiting to see how long the battery lasts to device if any further changes need to be made. --[[User:Paul|Paul]] 17:39, 22 September 2007 (EDT)&lt;br /&gt;
*I have completed the DBL flusher code to my likening. The device is currently installed in my home toilet for testing. Pics and video soon to follow! --[[User:Paul|Paul]] 22:33, 11 September 2007 (EDT)&lt;br /&gt;
*Boards arrived on sat. I got all the stuff on them and they work great. I have some preliminary code that Ive tried out and it works great. More to come later on in the week. --[[User:Paul|Paul]] 11:59, 10 September 2007 (EDT)&lt;br /&gt;
*The PCBs are inbound. I am eager to receive them and get to work! If all goes according to plan (haha!) I feel like I should have a working model by Monday (if i receive them tomorrow).--[[User:Paul|Paul]] 15:15, 6 September 2007 (EDT)&lt;br /&gt;
*I made the first bracket to suspend the servo in the filler tank in the potty. Images have been uploaded. --[[User:Paul|Paul]] 12:36, 21 August 2007 (EDT)&lt;br /&gt;
*I am currently waiting on parts and will soon be ordering the first PCB. This project will be my first attempt at working with SMD components. After bench testing with the parts I will order the PCB. --[[User:Paul|Paul]] 13:17, 16 August 2007 (EDT)&lt;br /&gt;
*Reworked the PCB. The new design uses a different PIC with more I/O. I did all I could to avoid changing the PIC but in the end it seemed like the cheapest method for me to get working prototype. I was short I/O on the 84a and I would have had to do some fancy things to get what I wanted, which meant more components, and more PCB space. The new PIC allows me to implement ICSP easily which makes development so much smoother. Also the new design uses two 2-digit 7-segment displays for a total of 4 digits. Once I&#039;m happy with the BOM I will order the parts and the PCB shortly after. --Paul 17:26, 6 August 2007 (EDT)&lt;br /&gt;
&lt;br /&gt;
*Added a schematic of the [[DBL Flusher]] to the DBL flusher page along with the PCB layout. --[[User:Paul|Paul]] 21:39, 30 July 2007 (EDT)&lt;br /&gt;
&amp;lt;section end=oldnews /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
The DBL Flusher is a device that will automatically flush a toilet. A PIC micro controller is used to control the device. A small control board is placed on top the fill tank of the toilet with a leash to a servo that is inside the tank. A bracket is used to suspend the servo in the proper position inside the tank allowing it to flush the toilet while still allowing manual flushing. The control board has 2 buttons and a 3 digit 7 segment display. 1 button is used to set the number of flushes that will be made while the other starts the automation control. The default number of flushes is 1. When the start button is pressed a count down is started and displayed on the 7 segment display. When the count down reaches 0 the servo is driven to flush the toilet and then resets for the next flush. If only 1 flush was selected the device will go to sleep and wait for the next use. If not the device will reset and flush again. The device will continue doing so until the number of flushes desired is achieved. &lt;br /&gt;
&lt;br /&gt;
== Parts ==&lt;br /&gt;
&amp;lt;table border=0 cellpadding=0 cellspacing=0 width=968 style=&#039;border-collapse:&lt;br /&gt;
 collapse;table-layout:fixed;width:726pt&#039;&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 width=128 style=&#039;height:15.0pt;width:96pt&#039;&amp;gt;Part Decription&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=363 style=&#039;width:272pt&#039;&amp;gt;Part&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=195 style=&#039;width:146pt&#039;&amp;gt;Mouser PN&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65 width=37 style=&#039;width:28pt&#039;&amp;gt;Qty&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 width=53 style=&#039;width:40pt&#039;&amp;gt;Price&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=64 style=&#039;width:48pt&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=64 style=&#039;width:48pt&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=64 style=&#039;width:48pt&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;Servo&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;HiTech HS-322HD&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;*&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;  &amp;lt;/span&amp;gt;395760&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;16.9500&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;7-seg display&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;Kingbright BC56-12GWA&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;604-BC5612GWA&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;2.7300&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;10K 1206 Resistors&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;KOA Speer RK73H2BTTD1002F&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;660-RK73H2BTTD1002F&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;3&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;0.1000&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;4.7K 1206 Resistors&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;KOA Speer RK73H2BTTD4751F&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;  &amp;lt;/span&amp;gt;660-RK73H2BTTD4751F&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;0.1000&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;1K 1206 Resistors&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;KOA Speer RK73H2BTTD1001F&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;660-RK73H2BTTD1001F&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;3&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;0.1000&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;Battery Holder&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;Eagle Plastic Devices, 4 D cells. 12BH144A-GR&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;12BH144A-GR&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;1.8900&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;100Ohm R Network&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;Bourns QSOP 2QSP16-TJ1-101LF&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;652-2QSP16-TJ1-101LF&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;1.6800&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;TSV&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;Vishay DO-214AA 5V TSV SMBJ5.0A-E3/52&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;625-SMBJ5.0A-E3&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;2&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;0.2800&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;MCLR Diode&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;Vishay MELF Switching diode LS4148-GS08&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;78-LS4148&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;0.0600&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;MOSFET&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;Fairchild N type RPP and Servo Sitching SOT-3 NDS335N&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;512-NDS335N&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;2&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;0.3900&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;Headers&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;For ICSP and Servo con 649-68000-436HLF&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;68000-436HLF&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt; &amp;lt;/span&amp;gt;1/4&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;0.1200&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;Crystal&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;Murata SMD ceramic Resonator 4MHz CSTCR4M00G53-R0&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;81-CSTCR4M00G53&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;0.5600&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;Transistors&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;Central Simiconductor NPN SOT-23, 7seg Mux CMPT4401&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;610-CMPT4401&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;3&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;0.2000&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;PIC&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;Microchip PIC MCU16F872 SOIC-28 PIC16F872-I/SO&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;579-PIC16F872-I/SO&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;4.8400&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;Voltage Regulator&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;5V regulator STMicro L7805CV TO-220&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;511-L7805CV&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;0.2400&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;Decoupleing Cap&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;30pF Ceramic Radial 140-50N5-200J-TB-RC&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;140-50N5-200J-TB-RC&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;0.0600&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;Cap&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;1uF Electrolytic Xicon 140-XRL25V1.0-RC&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;140-XRL25V1.0-RC&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;0.0600&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;Cap&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;.1uF Electrolytic Xicon 140-XRL100V0.1-RC&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;140-XRL100V0.1-RC&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;0.0600&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;Red Switch&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;NO MO Red 104-0012-EVX&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;104-0012-EVX&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;0.8700&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;Black Switch&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;NO MO Black 104-0013-EVX&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;104-0013-EVX&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;0.8700&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;PCB&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;Circuit Board&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;15.0000&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;Sheet Metal&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;Sheet metal for the servo bracket with various parts&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl65&amp;gt;1&amp;lt;span style=&#039;mso-spacerun:yes&#039;&amp;gt;    &amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td class=xl66 align=right&amp;gt;10.0000&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=3 class=xl66 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 colspan=8 style=&#039;height:15.0pt;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=20 style=&#039;height:15.0pt&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td height=20 style=&#039;height:15.0pt&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td&amp;gt;* Servo is only avaliable from Jameco&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td colspan=6 style=&#039;mso-ignore:colspan&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
 &amp;lt;tr height=0 style=&#039;display:none&#039;&amp;gt;&lt;br /&gt;
  &amp;lt;td width=128 style=&#039;width:96pt&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=363 style=&#039;width:272pt&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=195 style=&#039;width:146pt&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=37 style=&#039;width:28pt&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=53 style=&#039;width:40pt&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=64 style=&#039;width:48pt&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=64 style=&#039;width:48pt&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
  &amp;lt;td width=64 style=&#039;width:48pt&#039;&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
 &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Code ==&lt;br /&gt;
spelling not guaranteed correct. But hey, it works so it docent matter. Its not like it keeps the names anyway when you disassemble it...&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;    Filename:	    main.asm                                          *&lt;br /&gt;
;    Date:          10/13/07                                          *&lt;br /&gt;
;    File Version:   1.0                                              *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;    Author:       Paul Mac                                           *&lt;br /&gt;
;                                                                     * &lt;br /&gt;
;                                                                     *&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;    Files required:   P16F872.INC                                    *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;    Notes:  RC0 is start button. RC1 is the increment button. Both   *&lt;br /&gt;
;     buttons are idle high.                                          *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;                                                                     *&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
&lt;br /&gt;
	list      p=16f872            ; list directive to define processor&lt;br /&gt;
	#include &amp;lt;p16f872.inc&amp;gt;        ; processor specific variable definitions&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
	__CONFIG _CP_OFF &amp;amp; _WDT_OFF &amp;amp; _BODEN_OFF &amp;amp; _PWRTE_OFF &amp;amp; _XT_OSC &amp;amp; _WRT_ENABLE_OFF &amp;amp; _LVP_OFF &amp;amp; _CPD_OFF&lt;br /&gt;
&lt;br /&gt;
; &#039;__CONFIG&#039; directive is used to embed configuration data within .asm file.&lt;br /&gt;
; The lables following the directive are located in the respective .inc file.&lt;br /&gt;
; See respective data sheet for additional information on configuration word.&lt;br /&gt;
&lt;br /&gt;
ERRORLEVEL -302 ;remove message about using proper bank&lt;br /&gt;
&lt;br /&gt;
ORG 0x2100&lt;br /&gt;
DE	1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	cblock	0x20&lt;br /&gt;
	d1,d2,d3&lt;br /&gt;
	dig1,dig2,dig3&lt;br /&gt;
	sec, loop, flush, i&lt;br /&gt;
	hundreds, tens_and_ones, bin, limit, sleeps, sleepn, counter&lt;br /&gt;
	endc&lt;br /&gt;
;**********************************************************************&lt;br /&gt;
	ORG     0x000		; processor reset vector&lt;br /&gt;
	clrf    PCLATH		; ensure page bits are cleared&lt;br /&gt;
  	goto    Main		; go to beginning of program&lt;br /&gt;
Main&lt;br /&gt;
	clrf	PORTA&lt;br /&gt;
	clrf	PORTB&lt;br /&gt;
	clrf	PORTC&lt;br /&gt;
	movlw	0x06&lt;br /&gt;
	BANKSEL	ADCON1&lt;br /&gt;
	movwf	ADCON1&lt;br /&gt;
	BANKSEL	TRISA				;bank 1&lt;br /&gt;
	clrf	TRISA&lt;br /&gt;
	clrf	TRISB&lt;br /&gt;
	movlw	b&#039;00000011&#039;&lt;br /&gt;
	movwf	TRISC&lt;br /&gt;
	BANKSEL	PORTC&lt;br /&gt;
	movlw	d&#039;1&#039;&lt;br /&gt;
	movwf	flush				; the flush counter&lt;br /&gt;
	movlw	d&#039;3&#039;		&lt;br /&gt;
	movwf	limit				; the max amount of flushes alloud&lt;br /&gt;
	call 	SetupSleep	&lt;br /&gt;
	clrf	sleeps&lt;br /&gt;
	call 	DisplayOn&lt;br /&gt;
Buttons&lt;br /&gt;
	btfsc	sleeps,0&lt;br /&gt;
	call	DisplayOff&lt;br /&gt;
	btfss	PORTC,0			; test start button&lt;br /&gt;
	goto	SetupTimer	&lt;br /&gt;
	btfss	PORTC,1			;test inc button&lt;br /&gt;
	call	Inc&lt;br /&gt;
	movf	flush,w				; call the flush value to display it&lt;br /&gt;
	movwf	bin&lt;br /&gt;
	call	binary_to_bcd&lt;br /&gt;
	movf	tens_and_ones,0			;bring BCD ones and tens into W&lt;br /&gt;
	andlw	b&#039;00001111&#039;				;mask the junk &lt;br /&gt;
	movwf	dig1&lt;br /&gt;
	movf	dig1,0			;move the digi into W to get ready to display it&lt;br /&gt;
	call 	LookupA&lt;br /&gt;
	movwf	PORTA&lt;br /&gt;
	movf	dig1,0&lt;br /&gt;
	call 	LookupB&lt;br /&gt;
	movwf	PORTB&lt;br /&gt;
	call	FourtyMS&lt;br /&gt;
	call	SleepR&lt;br /&gt;
	goto	Buttons&lt;br /&gt;
SetupSleep&lt;br /&gt;
	movlw	d&#039;255&#039;&lt;br /&gt;
	movwf	sleepn			; setup the sleep counter&lt;br /&gt;
	return&lt;br /&gt;
DisplayOff&lt;br /&gt;
	bcf		PORTC,7&lt;br /&gt;
	return&lt;br /&gt;
DisplayOn&lt;br /&gt;
	bsf		PORTC,7&lt;br /&gt;
	return&lt;br /&gt;
SleepR&lt;br /&gt;
	decfsz	sleepn,f			; decrement the sleep counter&lt;br /&gt;
	return&lt;br /&gt;
	movlw	d&#039;1&#039;				;set the sleep var to 1 to put it to sleep when its time&lt;br /&gt;
	movwf	sleeps				&lt;br /&gt;
	return&lt;br /&gt;
Inc&lt;br /&gt;
	clrf	sleeps&lt;br /&gt;
	call 	SetupSleep&lt;br /&gt;
	call 	DisplayOn&lt;br /&gt;
	btfsc	PORTC,1		;test inc button&lt;br /&gt;
	goto	Buttons&lt;br /&gt;
	incf	flush,f		; incriment counter&lt;br /&gt;
	movf	flush,w		;move flush to the W&lt;br /&gt;
	subwf	limit,w		; TEST TO MAK SURE THE INC IS LESS THAN THE LIMIT&lt;br /&gt;
	btfsc	STATUS,Z&lt;br /&gt;
	goto	SetFlush&lt;br /&gt;
	btfss	STATUS,C&lt;br /&gt;
	goto	SetFlush&lt;br /&gt;
Release&lt;br /&gt;
	call 	Debounce	;20mS debounce delay&lt;br /&gt;
	btfsc	PORTC,1		;test inc button&lt;br /&gt;
	return&lt;br /&gt;
	call	FourtyMS&lt;br /&gt;
	goto	Release&lt;br /&gt;
&lt;br /&gt;
SetFlush&lt;br /&gt;
	movlw	d&#039;1&#039;&lt;br /&gt;
	movwf	flush&lt;br /&gt;
	goto	Release&lt;br /&gt;
SetupTimer&lt;br /&gt;
	call 	FourtyMS	;40mS debounce delay&lt;br /&gt;
	call 	FourtyMS	;40mS debounce delay&lt;br /&gt;
	call 	FourtyMS	;40mS debounce delay&lt;br /&gt;
	call 	FourtyMS	;40mS debounce delay&lt;br /&gt;
	movlw	d&#039;120&#039;				; delay seconds&lt;br /&gt;
	movwf	sec&lt;br /&gt;
Start&lt;br /&gt;
	movf	sec,w&lt;br /&gt;
	movwf	bin			; bin is the variable that is BCD&#039;d&lt;br /&gt;
	call	binary_to_bcd&lt;br /&gt;
	movf	hundreds,w&lt;br /&gt;
	movwf	dig3&lt;br /&gt;
	swapf	tens_and_ones,0			; swap the nibbles in BCD and put it in W&lt;br /&gt;
	andlw	b&#039;00001111&#039;		; mask the crap, leaves the clean number in W&lt;br /&gt;
	movwf	dig2			; put it in the 2nd digit holder&lt;br /&gt;
	movf	tens_and_ones,0			;bring BCD back into W&lt;br /&gt;
	andlw	b&#039;00001111&#039;		;mask the crap&lt;br /&gt;
	movwf	dig1&lt;br /&gt;
Print&lt;br /&gt;
	movlw	0xFA				; loop count for 1 sec&lt;br /&gt;
	movwf	loop&lt;br /&gt;
MuxLoop&lt;br /&gt;
	movf	dig3,0			;move the digi into W to get ready to display it&lt;br /&gt;
	call 	LookupA&lt;br /&gt;
	movwf	PORTA&lt;br /&gt;
	movf	dig3,0&lt;br /&gt;
	call 	LookupB&lt;br /&gt;
	movwf	PORTB&lt;br /&gt;
	movlw	b&#039;00100000&#039;			;strobe the 3nd digit&lt;br /&gt;
	movwf	PORTC&lt;br /&gt;
	call 	MuxDelay&lt;br /&gt;
	movf	dig2,0			;move the digi into W to get ready to display it&lt;br /&gt;
	call 	LookupA&lt;br /&gt;
	movwf	PORTA&lt;br /&gt;
	movf	dig2,0&lt;br /&gt;
	call 	LookupB&lt;br /&gt;
	movwf	PORTB&lt;br /&gt;
	movlw	b&#039;01000000&#039;			;strobe the 2nd digit&lt;br /&gt;
	movwf	PORTC&lt;br /&gt;
	call 	MuxDelay&lt;br /&gt;
	movf	dig1,0			;move the digi into W to get ready to display it&lt;br /&gt;
	call 	LookupA&lt;br /&gt;
	movwf	PORTA&lt;br /&gt;
	movf	dig1,0&lt;br /&gt;
	call 	LookupB&lt;br /&gt;
	movwf	PORTB&lt;br /&gt;
	movlw	b&#039;10000000&#039;			;strobe the 1st digit&lt;br /&gt;
	movwf	PORTC&lt;br /&gt;
	call 	MuxDelay&lt;br /&gt;
	btfss	PORTC,0			; test start button for cancelation&lt;br /&gt;
	goto	Cancle&lt;br /&gt;
	decfsz	loop,f				;decrement loop counter, do it 250 times for 1 second&lt;br /&gt;
	goto	MuxLoop&lt;br /&gt;
	decfsz	sec,f				;decrement sec counter, do it however many times&lt;br /&gt;
	goto	Start&lt;br /&gt;
	call	ServoDrive&lt;br /&gt;
	BANKSEL flush&lt;br /&gt;
	decfsz	flush,f&lt;br /&gt;
	goto	SetupTimer&lt;br /&gt;
	goto	Main&lt;br /&gt;
Cancle&lt;br /&gt;
	movlw	b&#039;00011111&#039;&lt;br /&gt;
	andwf	PORTC,f&lt;br /&gt;
	btfss	PORTC,0			; test start button for cancelation&lt;br /&gt;
	goto	Cancle&lt;br /&gt;
	call	FourtyMS&lt;br /&gt;
	call 	Debounce	;20mS debounce delay&lt;br /&gt;
	goto	Main&lt;br /&gt;
ServoDrive&lt;br /&gt;
	call 	Hone&lt;br /&gt;
	call	OneEighty&lt;br /&gt;
	BANKSEL EEADR&lt;br /&gt;
	movlw	0&lt;br /&gt;
	movwf	EEADR&lt;br /&gt;
	BANKSEL	EECON1&lt;br /&gt;
	BCF		EECON1,EEPGD&lt;br /&gt;
	BSF		EECON1,RD&lt;br /&gt;
	BANKSEL EEDATA&lt;br /&gt;
	MOVF	EEDATA,w&lt;br /&gt;
	BANKSEL	counter&lt;br /&gt;
	MOVWF	counter&lt;br /&gt;
	INCF	counter&lt;br /&gt;
&lt;br /&gt;
	BANKSEL EEADR&lt;br /&gt;
	movlw 	0&lt;br /&gt;
	movwf	EEADR&lt;br /&gt;
	BANKSEL	counter&lt;br /&gt;
	movf	counter,w&lt;br /&gt;
	BANKSEL	EEDATA&lt;br /&gt;
	movwf	EEDATA&lt;br /&gt;
	BANKSEL	EECON1&lt;br /&gt;
	BCF		EECON1,EEPGD&lt;br /&gt;
	BSF		EECON1,WREN&lt;br /&gt;
	MOVLW	0x55&lt;br /&gt;
	MOVWF	EECON2&lt;br /&gt;
	MOVLW	0xAA&lt;br /&gt;
	MOVWF	EECON2&lt;br /&gt;
	BSF		EECON1,WR&lt;br /&gt;
	BCF		EECON1,WREN&lt;br /&gt;
&lt;br /&gt;
EEPROMcheck	&lt;br /&gt;
	btfsc	EECON1,WR		&lt;br /&gt;
	goto	EEPROMcheck&lt;br /&gt;
	return&lt;br /&gt;
LookupA&lt;br /&gt;
	addwf	0x02,f&lt;br /&gt;
	retlw	b&#039;00000001&#039;		;0&lt;br /&gt;
	retlw	0x00			;1&lt;br /&gt;
	retlw	b&#039;00000011&#039;		;2&lt;br /&gt;
	retlw	b&#039;00000011&#039;		;3&lt;br /&gt;
	retlw	b&#039;00000010&#039;		;4&lt;br /&gt;
	retlw	b&#039;00000011&#039;		;5&lt;br /&gt;
	retlw	b&#039;00000011&#039;		;6&lt;br /&gt;
	retlw	0x00			;7&lt;br /&gt;
	retlw	b&#039;00000011&#039;		;8&lt;br /&gt;
	retlw	b&#039;00000010&#039;		;9&lt;br /&gt;
LookupB&lt;br /&gt;
	addwf	0x02,f&lt;br /&gt;
	retlw	b&#039;00110111&#039;		;0&lt;br /&gt;
	retlw	b&#039;00000110&#039;		;1&lt;br /&gt;
	retlw	b&#039;00010011&#039;		;2&lt;br /&gt;
	retlw	b&#039;00000111&#039;		;3&lt;br /&gt;
	retlw	b&#039;00100110&#039;		;4&lt;br /&gt;
	retlw	b&#039;00100101&#039;		;5&lt;br /&gt;
	retlw	b&#039;00110100&#039;		;6&lt;br /&gt;
	retlw	b&#039;00000111&#039;		;7&lt;br /&gt;
	retlw	b&#039;00110111&#039;		;8&lt;br /&gt;
	retlw	b&#039;00100111&#039;		;9&lt;br /&gt;
Hone&lt;br /&gt;
	movlw	d&#039;75&#039;&lt;br /&gt;
	movwf	i&lt;br /&gt;
	movlw	b&#039;00001000&#039;			; turn on the FET&lt;br /&gt;
	xorwf	PORTC,f&lt;br /&gt;
Hone0&lt;br /&gt;
	movlw	b&#039;00000100&#039;			; 1ms pulse to put the servo somewhere IDK GOD&lt;br /&gt;
	xorwf	PORTC,f&lt;br /&gt;
	call	ZeroDegre&lt;br /&gt;
	movlw	b&#039;11111011&#039;&lt;br /&gt;
	addwf	PORTC,f&lt;br /&gt;
	call	ZeroDegreR&lt;br /&gt;
	decfsz	i,f					; make the loop happen 5 secdonds worth (250 times)&lt;br /&gt;
	goto	Hone0&lt;br /&gt;
	movlw	b&#039;11110111&#039;			; turn off the FET&lt;br /&gt;
	andwf	PORTC,f&lt;br /&gt;
	return&lt;br /&gt;
OneEighty&lt;br /&gt;
	movlw	d&#039;75&#039;&lt;br /&gt;
	movwf	i&lt;br /&gt;
	movlw	b&#039;00001000&#039;			; turn on the FET&lt;br /&gt;
	xorwf	PORTC,f&lt;br /&gt;
OneEighty0&lt;br /&gt;
	movlw	b&#039;00000100&#039;			; 2ms pulse to put the servo somewhere IDK GOD&lt;br /&gt;
	xorwf	PORTC,f&lt;br /&gt;
	call	OneEightDegre&lt;br /&gt;
	movlw	b&#039;11111011&#039;&lt;br /&gt;
	addwf	PORTC,f&lt;br /&gt;
	call	OneEightDegreR&lt;br /&gt;
	decfsz	i,f					; make the loop happen 5 secdonds worth (250 times)&lt;br /&gt;
	goto	OneEighty0&lt;br /&gt;
	movlw	b&#039;11110111&#039;			; Turn off the FETS&lt;br /&gt;
	andwf	PORTC,f&lt;br /&gt;
	return&lt;br /&gt;
FourtyMS&lt;br /&gt;
			;39993 cycles&lt;br /&gt;
	movlw	0x3E&lt;br /&gt;
	movwf	d1&lt;br /&gt;
	movlw	0x20&lt;br /&gt;
	movwf	d2&lt;br /&gt;
FourtyMS_0&lt;br /&gt;
	decfsz	d1, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d2, f&lt;br /&gt;
	goto	FourtyMS_0&lt;br /&gt;
&lt;br /&gt;
			;3 cycles&lt;br /&gt;
	goto	$+1&lt;br /&gt;
	nop&lt;br /&gt;
&lt;br /&gt;
			;4 cycles (including call)&lt;br /&gt;
	return&lt;br /&gt;
Debounce						;20mS delay&lt;br /&gt;
			;19993 cycles&lt;br /&gt;
	movlw	0x9E&lt;br /&gt;
	movwf	d1&lt;br /&gt;
	movlw	0x10&lt;br /&gt;
	movwf	d2&lt;br /&gt;
Debounce_0&lt;br /&gt;
	decfsz	d1, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d2, f&lt;br /&gt;
	goto	Debounce_0&lt;br /&gt;
&lt;br /&gt;
			;3 cycles&lt;br /&gt;
	goto	$+1&lt;br /&gt;
	nop&lt;br /&gt;
&lt;br /&gt;
			;4 cycles (including call)&lt;br /&gt;
	return&lt;br /&gt;
MuxDelay&lt;br /&gt;
			;1323 cycles&lt;br /&gt;
	movlw	0x08&lt;br /&gt;
	movwf	d1&lt;br /&gt;
	movlw	0x02&lt;br /&gt;
	movwf	d2&lt;br /&gt;
MuxDelay_0&lt;br /&gt;
	decfsz	d1, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d2, f&lt;br /&gt;
	goto	MuxDelay_0&lt;br /&gt;
&lt;br /&gt;
			;4 cycles&lt;br /&gt;
	goto	$+1&lt;br /&gt;
	goto	$+1&lt;br /&gt;
&lt;br /&gt;
			;4 cycles (including call)&lt;br /&gt;
	return&lt;br /&gt;
ZeroDegre&lt;br /&gt;
			;893 cycles&lt;br /&gt;
	movlw	0x73			;B2 is orgional vlaue&lt;br /&gt;
	movwf	d1&lt;br /&gt;
	movlw	0x01&lt;br /&gt;
	movwf	d2&lt;br /&gt;
ZeroDegre_0&lt;br /&gt;
	decfsz	d1, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d2, f&lt;br /&gt;
	goto	ZeroDegre_0&lt;br /&gt;
&lt;br /&gt;
			;3 cycles&lt;br /&gt;
	goto	$+1&lt;br /&gt;
	nop&lt;br /&gt;
&lt;br /&gt;
			;4 cycles (including call)&lt;br /&gt;
	return&lt;br /&gt;
&lt;br /&gt;
ZeroDegreR&lt;br /&gt;
			;19093 cycles&lt;br /&gt;
	movlw	0xEA				;EA is orgional Value&lt;br /&gt;
	movwf	d1&lt;br /&gt;
	movlw	0x0F&lt;br /&gt;
	movwf	d2&lt;br /&gt;
ZeroDegreR_0&lt;br /&gt;
	decfsz	d1, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d2, f&lt;br /&gt;
	goto	ZeroDegreR_0&lt;br /&gt;
&lt;br /&gt;
			;3 cycles&lt;br /&gt;
	goto	$+1&lt;br /&gt;
	nop&lt;br /&gt;
&lt;br /&gt;
			;4 cycles (including call)&lt;br /&gt;
	return&lt;br /&gt;
&lt;br /&gt;
OneEightDegre&lt;br /&gt;
			;2093 cycles&lt;br /&gt;
	movlw	0xC8				; A2 orgional value&lt;br /&gt;
	movwf	d1&lt;br /&gt;
	movlw	0x02&lt;br /&gt;
	movwf	d2&lt;br /&gt;
OneEightDegre_0&lt;br /&gt;
	decfsz	d1, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d2, f&lt;br /&gt;
	goto	OneEightDegre_0&lt;br /&gt;
&lt;br /&gt;
			;3 cycles&lt;br /&gt;
	goto	$+1&lt;br /&gt;
	nop&lt;br /&gt;
&lt;br /&gt;
			;4 cycles (including call)&lt;br /&gt;
	return&lt;br /&gt;
OneEightDegreR&lt;br /&gt;
			;17893 cycles&lt;br /&gt;
	movlw	0xFA&lt;br /&gt;
	movwf	d1&lt;br /&gt;
	movlw	0x0E&lt;br /&gt;
	movwf	d2&lt;br /&gt;
OneEightDegreR_0&lt;br /&gt;
	decfsz	d1, f&lt;br /&gt;
	goto	$+2&lt;br /&gt;
	decfsz	d2, f&lt;br /&gt;
	goto	OneEightDegreR_0&lt;br /&gt;
&lt;br /&gt;
			;3 cycles&lt;br /&gt;
	goto	$+1&lt;br /&gt;
	nop&lt;br /&gt;
&lt;br /&gt;
			;4 cycles (including call)&lt;br /&gt;
	return&lt;br /&gt;
binary_to_bcd&lt;br /&gt;
	CLRF	hundreds &lt;br /&gt;
	SWAPF	bin,w 			;w  = A0*16+A1&lt;br /&gt;
	ADDWF	bin,w 			;w  = A0+A1&lt;br /&gt;
	ANDLW	b&#039;00001111&#039; 	;w  = A0+A1 % 16&lt;br /&gt;
	SKPNDC 					;if A0+A1 &amp;gt; 16&lt;br /&gt;
	ADDLW	0x16 			;w  += 16&lt;br /&gt;
	SKPNDC 					;if w % 16 &amp;gt; 10&lt;br /&gt;
	ADDLW	0x06 			;w  += 6&lt;br /&gt;
	ADDLW 	0x06 			;w  += 6&lt;br /&gt;
	SKPDC 					;if w &amp;lt; 10&lt;br /&gt;
	ADDLW	-0x06 			;w  -= 6&lt;br /&gt;
&lt;br /&gt;
	BTFSC	bin,4 &lt;br /&gt;
	ADDLW	0x16 - 1 + 0x6 &lt;br /&gt;
	SKPDC &lt;br /&gt;
	ADDLW	-0x06 &lt;br /&gt;
&lt;br /&gt;
	BTFSC	bin,5 &lt;br /&gt;
	ADDLW	0x30 &lt;br /&gt;
	&lt;br /&gt;
	BTFSC	bin,6 &lt;br /&gt;
	ADDLW	0x60 &lt;br /&gt;
&lt;br /&gt;
	BTFSC	bin,7 &lt;br /&gt;
	ADDLW	0x20 &lt;br /&gt;
&lt;br /&gt;
	ADDLW	0x60 &lt;br /&gt;
	RLF		hundreds,f &lt;br /&gt;
	BTFSS	hundreds, 0 &lt;br /&gt;
	ADDLW 	-0x60 &lt;br /&gt;
&lt;br /&gt;
	MOVWF	tens_and_ones &lt;br /&gt;
	BTFSC	bin,7 &lt;br /&gt;
	INCF	hundreds,f &lt;br /&gt;
	return&lt;br /&gt;
&lt;br /&gt;
	END                       ; directive &#039;end of program&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Schematic ==&lt;br /&gt;
[[Image:DBLschem.png]]&lt;br /&gt;
&lt;br /&gt;
== Board ==&lt;br /&gt;
[https://www.batchpcb.com/login.php?osCsid=ef6e564f68fd7b680e717a1675aacff4] Batch PCB board. (login required to view/buy)&lt;br /&gt;
&lt;br /&gt;
[[Image:DBLFlusherboard.png]]&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
This is the bracket used to suspend the servo in position in the water tank of the potty. &lt;br /&gt;
&lt;br /&gt;
A 1:1 PDF template of the bracket assembly is here [[Media:Bracket.pdf]]‎&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:DBL flusher bracket.jpg| Top &lt;br /&gt;
Image:DBL flusher bracket1.jpg| Side&lt;br /&gt;
Image:DBL flusher bracket2.jpg| Front&lt;br /&gt;
Image:DBL flusher bracket3.jpg| Front&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Pictures ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Image:DBLFassembled.JPG| Fully assembled DBL Flusher in place. &lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
	<entry>
		<id>https://pauljmac.com/projects/index.php?title=Main_Page&amp;diff=2</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://pauljmac.com/projects/index.php?title=Main_Page&amp;diff=2"/>
		<updated>2024-12-08T16:05:29Z</updated>

		<summary type="html">&lt;p&gt;Paul: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;My name is Paul Mac and I am an electrical engineer in the Tampa / St. Petersburg area in sunny Florida. I use this wiki as a notebook for projects I&#039;ve done in the past or projects I&#039;m currently working on. Below you can see a list of my projects or you can [http://pauljmac.com go back to the home page.]&lt;br /&gt;
&lt;br /&gt;
== Useful Stuff ==&lt;br /&gt;
*[[Common routines]] - C and ASM.&lt;br /&gt;
*[[WinAVR template]] - Template for new WinAVR projects.&lt;br /&gt;
&lt;br /&gt;
== Projects ==&lt;br /&gt;
*[[Omron NB HMI and Allen-Bradley CompactLogix example]] - An example projct interfacing the Omron NB series serial HMIs with a RSLogix 5000 PLC. &lt;br /&gt;
&lt;br /&gt;
*[[Tennis_Ball_Cannon]] - Fully automatic tennis ball cannon.&lt;br /&gt;
&lt;br /&gt;
*[[Fluke_8100_Clock]] - A current work in progress! &lt;br /&gt;
&lt;br /&gt;
*[[TruckTree!]] - A Christmas tree I put in the back of my truck every year. Individually addressable RGB LEDs.&lt;br /&gt;
&lt;br /&gt;
*[[AVR web scraper]] - Using a Lantronix module to gather data from the web using an AVR.&lt;br /&gt;
&lt;br /&gt;
*[[RGB driver]] - RGB PWM driver using ATtiny.&lt;br /&gt;
&lt;br /&gt;
*[[Gerbmerge]] - Quick guide on how to use gerbmerge to put multiple PCBs on a single panel. &lt;br /&gt;
&lt;br /&gt;
*[[vs1002d MP3 player]] - Playing MP3s from a FAT formatted SD card. &lt;br /&gt;
&lt;br /&gt;
*[[RGB LED Fader]] - Using an ATtiny44 and a 3 chan LED driver IC to make a neat desk ordainment. &lt;br /&gt;
&lt;br /&gt;
*[[Show Control board]] - Used to flicker incandescent lights for effect. &lt;br /&gt;
&lt;br /&gt;
*[[Matrix Orbital LCD and AVR]] - Using an Matrix Orbital LCD with an AVR via TWI, good examples of sending out strings.&lt;br /&gt;
&lt;br /&gt;
*[[AVR Dragon buffer board]] - Used to protect the very fragile Dragon programing/debugging device. &lt;br /&gt;
&lt;br /&gt;
*[[Ping Pong Scoreboard]] - A scoreboard for your Ping Pong matches!. &lt;br /&gt;
&lt;br /&gt;
*[[Dewalt battery repacking]] - Save some money by repacking your drill batteries yourself. &lt;br /&gt;
&lt;br /&gt;
*[[Mails Here!]] - (near)Finished mail notification project. I&#039;m redesigning the base station device still but the mail box device is done and done. Updates to follow...&lt;br /&gt;
&lt;br /&gt;
*[[MaxStream Xbee modules bare-bones programing setup]] - These are great little RF modules to use with your projects. Heres a bare-bones setup you can use to program the Xbee or update firmware or whatever. &lt;br /&gt;
&lt;br /&gt;
*[[DBL Flusher]] - A little device that will drive a servo motor to flush a toilet automatically. &lt;br /&gt;
&lt;br /&gt;
*[[Jeopardy PIC buzzer]] - My first real attempt at using a Microchip PIC. Uses a basic PIC16f84a and a simple assembly program to detect which player buzzes in first. Very similar to the reactions game below but only uses a couple TTL chips along with the PIC. &lt;br /&gt;
&lt;br /&gt;
*[http://www.pauljmac.com/projects/uploads/Reactions.ppt Reactions Game] (power point) - One of my very first digital projects. A game called Reactions built using discrete logic. The point is to be the first person to &amp;quot;buzz in&amp;quot; when the light goes active. Whomever has the quickest reactions wins.&lt;br /&gt;
&lt;br /&gt;
*[[Double Wide Shelving]] - Some shelving I built for the garage. Designed completely with Google SketchUp from scratch.&lt;br /&gt;
&lt;br /&gt;
*[[Creative USB interface]] - Using a PIC18f4550 with built in USB to crate a device to easily communicate with a computer&lt;/div&gt;</summary>
		<author><name>Paul</name></author>
	</entry>
</feed>