<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>comp-e.com &#187; comp-e</title>
	<atom:link href="http://comp-e.com/category/comp-e/feed" rel="self" type="application/rss+xml" />
	<link>http://comp-e.com</link>
	<description>Computer Engineering</description>
	<lastBuildDate>Fri, 13 Nov 2009 06:57:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Image Analysis Using Python</title>
		<link>http://comp-e.com/image-analysis-using-python</link>
		<comments>http://comp-e.com/image-analysis-using-python#comments</comments>
		<pubDate>Fri, 13 Nov 2009 06:57:43 +0000</pubDate>
		<dc:creator>COMP-E</dc:creator>
				<category><![CDATA[comp-e]]></category>

		<guid isPermaLink="false">http://comp-e.com/?p=137</guid>
		<description><![CDATA[/* work inprogress ;p */
While I may be a fan of embedded systems, I have to admit that python has become my new love.  Thought taking into account that you can do sweet Matlab style dsp with it, you can&#8217;t really blame me.  Assuming you have raw data from an image, you can [...]]]></description>
			<content:encoded><![CDATA[<p>/* work inprogress ;p */</p>
<p>While I may be a fan of embedded systems, I have to admit that python has become my new love.  Thought taking into account that you can do sweet Matlab style dsp with it, you can&#8217;t really blame me.  Assuming you have raw data from an image, you can do some awesome stuff with it using python.  You will of course need python 2.6 as well as the numPy module installed.  The techniques I&#8217;m going to discuss are already out there if you look for Matlab references but I thought I&#8217;d bring to light that you can do the same things using python as well.  You will need to go to http://www.pythonware.com/products/pil/ to get the image module.  After installing, I will suggest that you compile your entire python directory. To do that, open the python console and type:</p>
<p>import compileall<br />
compileall.compile_dir(&#8216;C:\python26&#8242;,force = True,maxlevels=20)</p>
<p>Now,lets start off simple by doing some masking. However, you should first create a 100&#215;100 maroonish jpg in mspaint</p>
<p>Open your python console and type the following</p>
<p>from numpy import *<br />
import Image</p>
<p>#import the jpg<br />
im = Image.open(&#8220;test.jpg&#8221;)</p>
<p>#split the image into numpy arrays so we can do all kinds of matrix voodoo on it<br />
[r,g,b] = [array(im.split()[i] for i in range(3)]<br />
image = array([r,g,b])</p>
<p># create a mask and define the region we will want to keep when we mask our image<br />
mask = zeros((13,13),dtype=int) # make a 100&#215;100 integer array of zeros<br />
mask[0:25,0:25] = 0xFF #define the positive mask region noting that RGB has a max value of FF,FF,FF</p>
<p>The upper corner of your image should now be maroon while the rest of your image is white.<br />
test = array[0:3] &#038; mask</p>
]]></content:encoded>
			<wfw:commentRss>http://comp-e.com/image-analysis-using-python/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Verilog Examples For The Spartan 3 / Nexys 2 Boards</title>
		<link>http://comp-e.com/verilog-examples-for-the-spartan-3-nexys-2-boards</link>
		<comments>http://comp-e.com/verilog-examples-for-the-spartan-3-nexys-2-boards#comments</comments>
		<pubDate>Thu, 06 Aug 2009 07:07:19 +0000</pubDate>
		<dc:creator>COMP-E</dc:creator>
				<category><![CDATA[Verilog]]></category>
		<category><![CDATA[comp-e]]></category>
		<category><![CDATA[forum]]></category>
		<category><![CDATA[FPGA]]></category>
		<category><![CDATA[Nexys 2]]></category>
		<category><![CDATA[Spartan3]]></category>
		<category><![CDATA[Xilinx]]></category>

		<guid isPermaLink="false">http://comp-e.com/?p=135</guid>
		<description><![CDATA[Well, I thought I&#8217;d be extra generous since I haven&#8217;t posted in so long, and have uploaded 4 verilog examples for your viewing pleasure.
I have been a bit busy to comment them but I hope that they may be useful still as just coding examples.
Enjoy
Verilog &#8211; 14-bit BCD ( Binary Converted to Decimal)
Verilog &#8211; 4 [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I thought I&#8217;d be extra generous since I haven&#8217;t posted in so long, and have uploaded 4 verilog examples for your viewing pleasure.</p>
<p>I have been a bit busy to comment them but I hope that they may be useful still as just coding examples.</p>
<p>Enjoy</p>
<p><a class="topictitle" title="Posted: Thu Aug 06, 2009 6:59 am" href="../forum/viewtopic.php?f=8&amp;t=41">Verilog &#8211; 14-bit BCD ( Binary Converted to Decimal)</a><br />
<a class="topictitle" title="Posted: Thu Aug 06, 2009 6:57 am" href="../forum/viewtopic.php?f=8&amp;t=40">Verilog &#8211; 4 to 1 and 2 to 1 multiplexor</a><br />
<a class="topictitle" title="Posted: Thu Aug 06, 2009 6:53 am" href="../forum/viewtopic.php?f=8&amp;t=39">Verilog &#8211; Seven Segment Display on Spartan 3 Board</a><br />
<a class="topictitle" title="Posted: Thu Aug 06, 2009 6:50 am" href="../forum/viewtopic.php?f=8&amp;t=38">Verilog &#8211; Simle PB Debounce Code For Spartan 3 Boards</a></p>
<p>- comp-e</p>
]]></content:encoded>
			<wfw:commentRss>http://comp-e.com/verilog-examples-for-the-spartan-3-nexys-2-boards/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pythons in the &#8216;C&#8217;ircus</title>
		<link>http://comp-e.com/pythons-in-the-circus</link>
		<comments>http://comp-e.com/pythons-in-the-circus#comments</comments>
		<pubDate>Thu, 06 Aug 2009 06:39:59 +0000</pubDate>
		<dc:creator>COMP-E</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[comp-e]]></category>
		<category><![CDATA[forum]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[Matlab]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://comp-e.com/?p=131</guid>
		<description><![CDATA[Spiffy code that is.  Stubby has made a few contributions as of late, so check them out.  I will be ragging on him to put his battleship game up, but alas it seems it&#8217;s lacking comments so we&#8217;ll see how long that takes.
I on the other hand, appologize for not tossing up any new coding [...]]]></description>
			<content:encoded><![CDATA[<p>Spiffy code that is.  Stubby has made a few contributions as of late, so check them out.  I will be ragging on him to put his battleship game up, but alas it seems it&#8217;s lacking comments so we&#8217;ll see how long that takes.</p>
<p>I on the other hand, appologize for not tossing up any new coding examples.  As of late I&#8217;ve been rather busy but fear not for I&#8217;ve been dabbling in Python and have some fun stuff to share.  To give a bit of a hint, I&#8217;ve been playing with the Numpy module and have found it incredibly useful as it ties in exceptionally well with Matlab.  I also plan on making a mini program to poll USB for those of you who rely on antiquated RS232 and are left without an easy means of switching over : )</p>
<p>Lastly, I encourage more of you to join and contribute well documented examples to the site.  As always, there are no ads and questions will be answered without the arrogant charm of other such code collaborative sites</p>
]]></content:encoded>
			<wfw:commentRss>http://comp-e.com/pythons-in-the-circus/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating Morse Code Using The HCS08 Microcontroller</title>
		<link>http://comp-e.com/creating-morse-code-using-the-hcs08-microcontroller</link>
		<comments>http://comp-e.com/creating-morse-code-using-the-hcs08-microcontroller#comments</comments>
		<pubDate>Sun, 22 Mar 2009 15:21:51 +0000</pubDate>
		<dc:creator>COMP-E</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Microcontrollers]]></category>
		<category><![CDATA[forum]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[computer engineering]]></category>
		<category><![CDATA[Freescale]]></category>
		<category><![CDATA[microcontroller]]></category>

		<guid isPermaLink="false">http://comp-e.com/?p=125</guid>
		<description><![CDATA[Recently I was faced with the task of sending data out of a HCS08 microcontroller wirelessly.  I had only one pin available to me and decided to effectively create Morse Code so that my receiver could decode the signal without having some sort of reference clock to distinguish the 1&#8217;s and 0&#8217;s.   What took many [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was faced with the task of sending data out of a HCS08 microcontroller wirelessly.  I had only one pin available to me and decided to effectively create Morse Code so that my receiver could decode the signal without having some sort of reference clock to distinguish the 1&#8217;s and 0&#8217;s.   What took many hours to conceptualize and diagram out on the blackboard, turned out to be a very small bit of code.</p>
<p>On the sender side is a simple function written in C that takes a byte and loops through masking each bit.  This masking is done inside an if / else block and the result determines whether or not you are getting a dit or a dash.</p>
<p>Tied to the RF receiver is another MC9S08QG8 which takes in the signal via interrupts and assembles eight interrupts into eight bytes.  It then does a series of bitwise operations on each of the eight bytes in order to reconstruct the original byte.  You will find that a few parts of the code are subject to change (the time for 0&#8217;s and 1&#8217;s can be adjusted and must be adjusted if you plan on implementing PLL or have a different desired data rate).  That byte is then sent to a PC vie RS232 serial port and stored using a free program called RS232 Data Logger from Eltima Software.  The code will be posted shortly under the microcontroller section on the COMP-E forum for you to use and <a title="Wireless Morse Code HCS08" href="http://comp-e.com/forum/viewtopic.php?f=40&amp;t=30">enjoy</a>.</p>
<p>- COMP-E</p>
<p>~ ALERT: This post does not return to main !!!</p>
]]></content:encoded>
			<wfw:commentRss>http://comp-e.com/creating-morse-code-using-the-hcs08-microcontroller/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Javascript Examples</title>
		<link>http://comp-e.com/javascript-examples</link>
		<comments>http://comp-e.com/javascript-examples#comments</comments>
		<pubDate>Sun, 15 Mar 2009 18:48:00 +0000</pubDate>
		<dc:creator>COMP-E</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[forum]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[computer science]]></category>

		<guid isPermaLink="false">http://comp-e.com/?p=121</guid>
		<description><![CDATA[In addition to fixing the forum today, I also decided to post a couple &#8216;fun&#8217; javascript applications that I&#8217;ve made.  I&#8217;m not the best with java script and these two apps are my first attempts.  However, they are functional and kind of cool.  One is magnetic poetry and the other is a javascript scientific calculator [...]]]></description>
			<content:encoded><![CDATA[<p>In addition to fixing the forum today, I also decided to post a couple &#8216;fun&#8217; javascript applications that I&#8217;ve made.  I&#8217;m not the best with java script and these two apps are my first attempts.  However, they are functional and kind of cool.  One is <a title="Javascript Magnetic Poetry" href="http://comp-e.com/forum/viewtopic.php?f=59&amp;t=27">magnetic poetry</a> and the other is a <a title="Javascript Calculator" href="http://comp-e.com/forum/viewtopic.php?f=59&amp;t=26">javascript scientific calculator</a> of sorts.   I&#8217;m not sure how much more I&#8217;ll post for javascript examples, but I encourage you to add your apps or examples to the forum : )</p>
<p>-  COMP-E</p>
]]></content:encoded>
			<wfw:commentRss>http://comp-e.com/javascript-examples/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using SPI EEPROM 25AA512 On An HCS08 Microcontroller</title>
		<link>http://comp-e.com/using-spi-eeprom-25aa512-on-an-hcs08-microcontroller</link>
		<comments>http://comp-e.com/using-spi-eeprom-25aa512-on-an-hcs08-microcontroller#comments</comments>
		<pubDate>Fri, 13 Mar 2009 21:23:21 +0000</pubDate>
		<dc:creator>COMP-E</dc:creator>
				<category><![CDATA[Microcontrollers]]></category>
		<category><![CDATA[comp-e]]></category>
		<category><![CDATA[forum]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[computer engineering]]></category>
		<category><![CDATA[Freescale]]></category>
		<category><![CDATA[microcontroller]]></category>

		<guid isPermaLink="false">http://comp-e.com/?p=102</guid>
		<description><![CDATA[This post will go to the forum eventually.  I need to fight with my hosting people first and get them to bump the limit on the amount of memory PHP can use.  So, for now, you can get all the good stuff here!
EDIT: I fixed the issue.  You can now view this topic on the [...]]]></description>
			<content:encoded><![CDATA[<p>This post will go to the forum eventually.  I need to fight with my hosting people first and get them to bump the limit on the amount of memory PHP can use.  So, for now, you can get all the good stuff here!</p>
<p>EDIT: I fixed the issue.  You can now view this topic on the forum.  Please post your comments there as well. <a title="Using External EEPROM on a HCS08" href="http://comp-e.com/forum/viewtopic.php?f=40&amp;t=25"> &gt;&gt;&gt;&gt;</a></p>
<p>-/-</p>
<p>Most things that use SPI are rather straight forward, a simple MISO, MOSI, and Slave Select and you&#8217;re good to go.  That was not the case in my pursuit to get this EEPROM to work.  It is incredibly finicky and took about a month hooked up to a logic analyzer and multiple revisions to the way instructions interact, before I was finally able to get it up in running.  I hope this code works for you.  The particular chip came from Microchip and you can find the data sheet easily enough by searching 25AA512.  I am including the .c and .h files here.  You will be able to view the entire project along with the .mcp file for which I used the memory end such.  I&#8217;m not ready to post that project yet but it will have &#8216;SWIM&#8217; somewhere in the topic title.</p>
<p>As a side note, make sure that Vcc on the EEPROM is tied to the Vcc of the microcontroller otherwise you will find as I did, that odd bits and data come back on reads instead of what you want!!</p>
<p>You will notice that slave select pin is not used.  Because I only used this one chip, I tied the SS, WP, and HOLD pins to hi/low as per my needs.</p>
<p>- COMP-E</p>
<p>~ XOR would be pleased</p>
<p>The following code was used in SPI1.c</p>
<p><span style="color: #888888;">[code]</span></p>
<pre><span style="color: #ff9900;">**     Settings  :
**          Bean name                                      : SPI1
**          Device                                         : SPI
**          Settings
**            Clock settings
**              Value of Preselection                      : 5
**              Value of Selection                         : 64
**              Frequency                                  : 12.5 kHz
**            Mode Select                                  : Master
**            Clock Polarity                               : active-high
**            Clock Phase                                  : First edge
**            Data shift order                             : MSB first
**            Bidirectional mode                           : Disabled
**            Output enable in Bidirect.                   : no
**            Stop in Wait Mode                            : Disabled
**          Pins
**            SCK pin                                      : PTB2_KBIP6_SPSCK_ADP6
**            SCK pin signal                               :
**            MISO pin allocation                          : Enabled
**            MISO pin                                     : PTB4_MISO
**            MISO pin signal                              :
**            MOSI pin allocation                          : Enabled
**            MOSI pin                                     : PTB3_KBIP7_MOSI_ADP7
**            MOSI pin signal                              :
**            SS pin allocation                            : Disabled
**          Interrupts
**            Interrupt                                    : Vspi
**            Receive and fault interrupt                  : Disabled
**            Transmit Interrupt                           : Disabled
**            ISR name                                     :
**          Initialization
**            Call Init in CPU init. code                  : yes
**            Enable SPI system                            : yes
**     Contents  :
**         Init - void SPI1_Init(void);
**

/* MODULE SPI1. */

#include "SPI1.h"

void SPI1_Init(void)
{
  /* SPIC1: SPIE=0,SPE=1,SPTIE=0,MSTR=1,CPOL=0,CPHA=0,SSOE=0,LSBFE=0 */
  setReg8(SPIC1, 0x50);
  /* SPIC2: ??=0,??=0,??=0,MODFEN=0,BIDIROE=0,??=0,SPISWAI=0,SPC0=0 */
  setReg8(SPIC2, 0x00);
  /* SPIBR: ??=0,SPPR2=1,SPPR1=0,SPPR0=0,??=0,SPR2=1,SPR1=0,SPR0=1 */
  setReg8(SPIBR, 0x45);  // note that specific baud rates were not functional
}                        // I believe I had success with 0x45 and 0x00

<span style="color: #888888;">[/code]</span></span></pre>
<p>This EEPROM specific initialization was key to getting things working.  It was a function in my main file, but probably belongs in the SPI1.c file.</p>
<pre><span style="color: #ff9900;">void powerUpEEprom(void) {

    CS_OFF;
    delay(2);
    SPI1_Init();
    delay(2);

    delay(2);
    CS_OFF;
    delay(1);
    CS_ON;
    delay(1);

    SPI_WREN();
    SPI_WRSR(0x00);

    /* A small bit of test code */
    SPI_WRITE(0x00, 0x00, 0x11);
    delay(10);
    SPI_WRITE(0x00, 0x01, 0x22);
    delay(10);
    SPI_WRITE(0x00, 0x02, 0x33);
    delay(10);
    SPI_WRITE(0x00, 0x03, 0x44);
    delay(10);
    SPI_WRITE(0x00, 0x04, 0x55);
    delay(10);
    testArray[1] = SPI_READ(0x00,0x00);
    delay(10);
    testArray[2] = SPI_READ(0x00,0x01);
    delay(10);
    testArray[3] = SPI_READ(0x00,0x02);
    delay(10);
    testArray[4] = SPI_READ(0x00,0x03);
    delay(10);
    testArray[5] = SPI_READ(0x00,0x04);
    delay(10);
}</span>

EEPROM.h</pre>
<pre>[code]</pre>
<pre><span style="color: #ff9900;">#ifndef __EEPROM_H
#define __EEPROM_H</span></pre>
<pre><span style="color: #ff9900;">#include "Events.h"</span></pre>
<pre><span style="color: #ff9900;">/* EEPROM OP-CODES */</span></pre>
<pre><span style="color: #ff9900;">#define READ    0x03          // Read  from mem array beg. at selected address
#define WRITE   0x02          // Write to mem array beg. at selected address
#define WREN    0x06          // Set   the latch (enable write operations)
#define WRDI    0x04          // Reset the latch (disable write operations)
#define RDSR    0x05          // Read         – STATUS register
#define WRSR    0x01          // Write        – STATUS register
#define PE      0x42          // Page Erase   – erase one page in mem array
#define SE      0xD8          // Sector Erase – erase one sector in mem array
#define CE      0xC7          // Chip Erase   – erase all sectors in mem array
#define RDID    0xAB          //
#define DPD     0xB9          //</span></pre>
<pre><span style="color: #ff9900;">/* Program Constants */</span></pre>
<pre><span style="color: #ff9900;">#define CS_ON     PTBD_PTBD6 = 0
#define CS_OFF    PTBD_PTBD6 = 1
#define DUMMY     0x00</span></pre>
<pre><span style="color: #ff9900;">/* MODULE EEPROM */</span></pre>
<pre><span style="color: #ff9900;">void delay(int);</span></pre>
<pre><span style="color: #ff9900;">/* Set the write enable latch on the chip */
void SPI_WREN(void);</span></pre>
<pre><span style="color: #ff9900;">/* Perform the read status register sequence */
byte SPI_RDSR(void);</span></pre>
<pre><span style="color: #ff9900;">/* Write to status register
*
* Pre: User sends 8 bit value
*
* Post: Status register written to
*/
void SPI_WRSR(byte val);</span></pre>
<pre><span style="color: #ff9900;">/* Generic transmit of single op code in
*   which chip select is toggled
*/
void SPI_trans(byte val);</span></pre>
<pre><span style="color: #ff9900;">/* Perform Read sequence
*
* Pre:  User sends upper and lower address bytes
*
* Post: User recieves value stored at given address
*/
byte SPI_READ(byte upAddr, byte lwAddr);
void Dummy_Read(byte upAddr, byte lwAddr);
/* Perform Write sequence
*
* Pre:   User sends upper and lower address bytes
*        User sends data byte he wishes to have
*             written to the EEPROM
* Post:  Data is written and clocked out of SPID reg
*/
void SPI_WRITE(byte upAddr, byte lwAddr, byte val);</span></pre>
<pre><span style="color: #ff9900;">/* END EEPROM */</span></pre>
<pre><span style="color: #ff9900;">#endif
[/code]</span></pre>
<pre><span style="color: #ff9900;"><span style="color: #888888;">~ Computer Engineering is going to the laundromat and saying, "yeah, i can so pipeline this"

EEPROM.c</span>
[code]</span></pre>
<pre><span style="color: #ff9900;">/* MODULE EEPROM */</span></pre>
<pre><span style="color: #ff9900;">#include "EEPROM.h"
unsigned char readin;
unsigned char garbage;</span></pre>
<pre><span style="color: #ff9900;">/*****************************************************************************+
*                        DELAY FUNCTIONS
*****************************************************************************/</span></pre>
<pre><span style="color: #ff9900;">void delay(int count)
{
int cnt;</span></pre>
<pre><span style="color: #ff9900;">for(cnt = 0; cnt &lt; count; cnt++)
{
int delay1 = 100;         // coarse adjustment
int delay2 = 100;         //  fine adjustment
while(delay1 &gt; 1)
{
--delay1;
while(delay2 &gt;= 1)
{
--delay2;
}
}
}
}</span></pre>
<pre><span style="color: #ff9900;">/*****************************************************************************+
*                        WRITE FUNCTIONS
*****************************************************************************/</span></pre>
<pre><span style="color: #ff9900;">void SPI_trans(byte val)
{
CS_ON;
delay(2);</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));  // Wait until ready to send
SPID = val;           // Send byte value</span></pre>
<pre><span style="color: #ff9900;">delay(2);
CS_OFF;
delay(1);
}</span></pre>
<pre><span style="color: #ff9900;">void SPI_WREN(void)
{
CS_ON;
delay(2);</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = WREN;               // Send byte value</span></pre>
<pre><span style="color: #ff9900;">delay(1);
CS_OFF;
delay(1);
}</span></pre>
<pre><span style="color: #ff9900;">void SPI_WRSR(byte val)
{
CS_ON;
delay(2);</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = WRSR;               // Send byte value</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = val;                // Send byte value</span></pre>
<pre><span style="color: #ff9900;">delay(2);
CS_OFF;
delay(1);
}</span></pre>
<pre><span style="color: #ff9900;">void SPI_WRITE(byte upAddr, byte lwAddr, byte val)
{
SPI_WREN();</span></pre>
<pre><span style="color: #ff9900;">CS_ON;
delay(2);</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = WRITE;              // Send write command</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = upAddr;             // Send upper address</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = lwAddr;             // Send lower address</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = val;                // Send data value</span></pre>
<pre><span style="color: #ff9900;">delay(4);
CS_OFF;
delay(1);
}</span></pre>
<pre><span style="color: #ff9900;">/*****************************************************************************+
*                        READ FUNCTIONS
*****************************************************************************/</span></pre>
<pre><span style="color: #ff9900;">byte SPI_RDSR(void)
{
CS_ON;
delay(2);</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = RDSR;               // Send byte value</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = DUMMY;              // Send byte value
delay(1);
while (!(SPIS &amp; 0x80));    // Wait until ready to send</span></pre>
<pre><span style="color: #ff9900;">delay(4);
CS_OFF;
delay(1);
return SPID;
}</span></pre>
<pre><span style="color: #ff9900;">byte SPI_READ(byte upAddr, byte lwAddr)
{
Dummy_Read(upAddr,lwAddr);
CS_ON;
delay(2);</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = READ;               // Send write command</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = upAddr;             // Send upper address</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = lwAddr;             // Send lower address</span></pre>
<pre><span style="color: #ff9900;">delay(1);
while (!(SPIS &amp; 0x80));    // Wait until ready to send
readin = SPID;             // Dummy read</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = DUMMY;              // Send dummy value</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x80));    // Wait until ready to send
readin = SPID;             // Contains data from memory
delay(5);
CS_OFF;
delay(1);</span></pre>
<pre><span style="color: #ff9900;">return readin;
}</span></pre>
<pre><span style="color: #ff9900;">void Dummy_Read(byte upAddr, byte lwAddr)
{
CS_ON;
delay(2);</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = READ;               // Send write command</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = upAddr;             // Send upper address</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = lwAddr;             // Send lower address</span></pre>
<pre><span style="color: #ff9900;">delay(1);</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x80));    // Wait until ready to send
garbage = SPID;            // Dummy read</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = DUMMY;              // Send dummy value</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x80));    // Wait until ready to send
garbage = SPID;            // Dummy read</span></pre>
<pre><span style="color: #ff9900;">delay(1);</span></pre>
<pre><span style="color: #ff9900;">while (!(SPIS &amp; 0x20));    // Wait until ready to send
SPID = DUMMY;</span></pre>
<pre><span style="color: #ff9900;">delay(5);
CS_OFF;
delay(1);</span></pre>
<pre><span style="color: #ff9900;">}</span></pre>
<pre><span style="color: #ff9900;">/* END EEPROM */</span></pre>
<pre>[/code]</pre>
]]></content:encoded>
			<wfw:commentRss>http://comp-e.com/using-spi-eeprom-25aa512-on-an-hcs08-microcontroller/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calculate Min Max and Average Using Assembly</title>
		<link>http://comp-e.com/calculate-min-max-and-average-using-assembly</link>
		<comments>http://comp-e.com/calculate-min-max-and-average-using-assembly#comments</comments>
		<pubDate>Thu, 12 Mar 2009 22:41:41 +0000</pubDate>
		<dc:creator>COMP-E</dc:creator>
				<category><![CDATA[Assembly]]></category>
		<category><![CDATA[comp-e]]></category>
		<category><![CDATA[forum]]></category>
		<category><![CDATA[CE]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[computer engineering]]></category>
		<category><![CDATA[FPGA]]></category>

		<guid isPermaLink="false">http://comp-e.com/?p=94</guid>
		<description><![CDATA[This assembly program reads in 8, 8-bit numbers and is able to calculate the min, max, and average of those numbers.  The code has been optimized for speed, but if compact code is what you want, by all means use a looping structure.  I should mention that this program is an introduction to assembly and [...]]]></description>
			<content:encoded><![CDATA[<p>This assembly program reads in 8, 8-bit numbers and is able to calculate the min, max, and average of those numbers.  The code has been optimized for speed, but if compact code is what you want, by all means use a looping structure.  I should mention that this program is an introduction to assembly and runs on the 8085 simulator.  I will however, be posting Verilog code that effectively creates the Intel 8085 and which, will also accept a precompiled hex file via RS232!  That will be in a couple months however (time permitting).  For now, enjoy your nice and easy Assembly <a title="COMP-E Forum: Assembly Examples" href="http://comp-e.com/forum/viewtopic.php?f=25&amp;t=3">example</a>.</p>
<p>COMP-E</p>
<p>~ we do it with NAND gates</p>
]]></content:encoded>
			<wfw:commentRss>http://comp-e.com/calculate-min-max-and-average-using-assembly/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Digital Design with Pipeline 6 Bit Registers</title>
		<link>http://comp-e.com/digital-design-with-pipeline-6-bit-registers</link>
		<comments>http://comp-e.com/digital-design-with-pipeline-6-bit-registers#comments</comments>
		<pubDate>Thu, 12 Mar 2009 22:33:55 +0000</pubDate>
		<dc:creator>COMP-E</dc:creator>
				<category><![CDATA[Verilog]]></category>
		<category><![CDATA[comp-e]]></category>
		<category><![CDATA[forum]]></category>
		<category><![CDATA[CE]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[computer engineering]]></category>
		<category><![CDATA[FPGA]]></category>

		<guid isPermaLink="false">http://comp-e.com/?p=91</guid>
		<description><![CDATA[This SLSL / &#8217;sudo verilog&#8217; program implements the digital design of a pipeline having multiple registers, an adder, and multiplication architecture.  The program can easily be re-implemented in Verilog at your discretion.  SLSL is a wonderful language that allows for rapid development of digital designs, which is why many of my programs are [...]]]></description>
			<content:encoded><![CDATA[<p>This SLSL / &#8217;sudo verilog&#8217; program implements the digital design of a pipeline having multiple registers, an adder, and multiplication architecture.  The program can easily be re-implemented in Verilog at your discretion.  SLSL is a wonderful language that allows for rapid development of digital designs, which is why many of my programs are done in it.  Conceptually, you can code from a block diagram to an HDL with it.  Unfortunately SLSL is not available to the public, but it should be quite easy for anyone with a couple Verilog or VHDL programs under their belt to understand.  The code can be found <a title="Digital Design with Pipelined 6 Bit Registers" href="http://comp-e.com/forum/viewtopic.php?f=8&amp;t=18">here</a>.</p>
<p>COMP-E<br />
~a place where computer engineers can play</p>
]]></content:encoded>
			<wfw:commentRss>http://comp-e.com/digital-design-with-pipeline-6-bit-registers/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nexys 2 Spartan 3 FPGA Arrives</title>
		<link>http://comp-e.com/nexys-2-spartan-3-fpga-arrives</link>
		<comments>http://comp-e.com/nexys-2-spartan-3-fpga-arrives#comments</comments>
		<pubDate>Sat, 07 Mar 2009 19:40:22 +0000</pubDate>
		<dc:creator>COMP-E</dc:creator>
				<category><![CDATA[Verilog]]></category>
		<category><![CDATA[comp-e]]></category>
		<category><![CDATA[forum]]></category>
		<category><![CDATA[CE]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[computer engineering]]></category>
		<category><![CDATA[ece]]></category>
		<category><![CDATA[FPGA]]></category>
		<category><![CDATA[Nexys 2]]></category>
		<category><![CDATA[Spartan3]]></category>
		<category><![CDATA[Xilinx]]></category>

		<guid isPermaLink="false">http://comp-e.com/?p=80</guid>
		<description><![CDATA[It took a week to get it from Washington state, but it&#8217;s finally here.  My gorgeous Nexys 2 board I ordered from Digilent.  It uses the Xilinx Spartan 3-e chip and has a lot of nice extra features that the one that Xilinx makes didn&#8217;t have.  Digilent&#8217;s website also has a ton of cool addons [...]]]></description>
			<content:encoded><![CDATA[<p>It took a week to get it from Washington state, but it&#8217;s finally here.  My gorgeous Nexys 2 board I ordered from Digilent.  It uses the Xilinx Spartan 3-e chip and has a lot of nice extra features that the one that Xilinx makes didn&#8217;t have.  Digilent&#8217;s website also has a ton of cool addons for the board which I hope to get when there&#8217;s some money to spare.   I&#8217;m going to start out slow and try and reacquaint myself a bit with verilog.   My intent is to make a simple calculator and then perhaps move to converting my SLSL code for the 8085 over to verilog.  The Nexys 2 board does come with some cool peripherals such as a ps2 port so I may get sidetracked and see what I can do if I hook up an old ball mouse too it.  I&#8217;ll try to keep you all posted here so the RSS grabs it, but check the forum for code postings and photos.  I&#8217;ll try to include links as things crop up.</p>
<p>- COMP-E</p>
]]></content:encoded>
			<wfw:commentRss>http://comp-e.com/nexys-2-spartan-3-fpga-arrives/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Digital Design Implementing 8085</title>
		<link>http://comp-e.com/digital-design-implementing-8085</link>
		<comments>http://comp-e.com/digital-design-implementing-8085#comments</comments>
		<pubDate>Sat, 07 Mar 2009 19:30:37 +0000</pubDate>
		<dc:creator>COMP-E</dc:creator>
				<category><![CDATA[Verilog]]></category>
		<category><![CDATA[comp-e]]></category>
		<category><![CDATA[forum]]></category>
		<category><![CDATA[CE]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[computer engineering]]></category>
		<category><![CDATA[ece]]></category>

		<guid isPermaLink="false">http://comp-e.com/?p=78</guid>
		<description><![CDATA[All op codes are not represented / implemented in this design however adding them should be very straight forward. This digital design utilizes a bus in order to achieve high efficiency and throughput.  The design is scaled back a bit and uses less registers than the actual 8085.  This can be easily modified though.  Additional [...]]]></description>
			<content:encoded><![CDATA[<p>All op codes are not represented / implemented in this design however adding them should be very straight forward. This digital design utilizes a bus in order to achieve high efficiency and throughput.  The design is scaled back a bit and uses less registers than the actual 8085.  This can be easily modified though.  Additional op-codes can also be added. Included in this post is are the .src (source) .fmt (format/debug) files. Note that the &#8216;cpu&#8217; is reading op codes from memory not a .in file!</p>
<p>Click <a title="Creating the 8085 using SLSL" href="http://comp-e.com/forum/viewtopic.php?f=8&amp;t=19">here</a> for the full post including SLSL code.</p>
<p>- COMP-E</p>
]]></content:encoded>
			<wfw:commentRss>http://comp-e.com/digital-design-implementing-8085/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
