Difference between revisions of "Control Panel Notes"

From SlugWiki
Jump to: navigation, search
Line 1: Line 1:
===Introduction===
+
==Introduction==
 
The 8 devices share a single 8 bit IO port on a PIC microcontroller. The device is selected by a 3 bit wide select line. The devices we speak of here are only for clairity's sake. In the actual control panel, some of the logical devices (such as the seven segment display) have more than 8 bits of IO and some (such a button or LED) have fewer. Another way of thinking about it: there are 64 "virtual" IO lines that are compressed down to 11 (8+3) then reexpanded. A device may use any configuration of IO lines in the 8x8 grid. They are used for the following:
 
The 8 devices share a single 8 bit IO port on a PIC microcontroller. The device is selected by a 3 bit wide select line. The devices we speak of here are only for clairity's sake. In the actual control panel, some of the logical devices (such as the seven segment display) have more than 8 bits of IO and some (such a button or LED) have fewer. Another way of thinking about it: there are 64 "virtual" IO lines that are compressed down to 11 (8+3) then reexpanded. A device may use any configuration of IO lines in the 8x8 grid. They are used for the following:
 
* 5 digit 7 segment LED display
 
* 5 digit 7 segment LED display
Line 9: Line 9:
 
The software is based around the IO Buffer which maps the 64 virtual IO lines to an 8x8 chunk of memory. The timer and interrupt make sure that the buffer remains up to date without the user needing to add code to the main loop or manipulate the IO ports directly.
 
The software is based around the IO Buffer which maps the 64 virtual IO lines to an 8x8 chunk of memory. The timer and interrupt make sure that the buffer remains up to date without the user needing to add code to the main loop or manipulate the IO ports directly.
  
===Software===
+
==Software==
 
The PIC softwaer, written entirely in assembler, is divided into these components:
 
The PIC softwaer, written entirely in assembler, is divided into these components:
 
*IO buffer - multiplexes IO port to create virtual memory-mapped IO lines
 
*IO buffer - multiplexes IO port to create virtual memory-mapped IO lines

Revision as of 04:12, 2 April 2006

Introduction

The 8 devices share a single 8 bit IO port on a PIC microcontroller. The device is selected by a 3 bit wide select line. The devices we speak of here are only for clairity's sake. In the actual control panel, some of the logical devices (such as the seven segment display) have more than 8 bits of IO and some (such a button or LED) have fewer. Another way of thinking about it: there are 64 "virtual" IO lines that are compressed down to 11 (8+3) then reexpanded. A device may use any configuration of IO lines in the 8x8 grid. They are used for the following:

  • 5 digit 7 segment LED display
  • 3 digit BCD thumbwheel
  • 5 playlist buttons (including Push it to the Limit)
  • 2 toggle switches for arming
  • 7 LEDs: 2 for arming, 5 for playlists
  • 2 IO and 1 input for future expansion

The software is based around the IO Buffer which maps the 64 virtual IO lines to an 8x8 chunk of memory. The timer and interrupt make sure that the buffer remains up to date without the user needing to add code to the main loop or manipulate the IO ports directly.

Software

The PIC softwaer, written entirely in assembler, is divided into these components:

  • IO buffer - multiplexes IO port to create virtual memory-mapped IO lines
  • Serial buffer - packs data in the transmit buffer into a 4E Network packet and sends it, buffers recieved data and parses it into the header and data
  • Timer and 7 segment display - times how long it has been since the last time a playlist button was pushed
  • Combination lock - reads the BCD thumbwheels and compares it to a preset combination. The playlist buttons only work if the correct combination was entered.
  • Playlist buttons - pushing one of these buttons sends a message to the Bemix server instructing it to load a certain song, such as Push it to the Limit.
  • Message handler - act on requests coming over the 4E network.

IO Buffer

Constants:

  • DATA_PORT
  • DATA_TRIS
  • SEL_PORT

Public:

  • IOBuffer - an 8 byte chunk of memory that can be written or read (depending on IOBufferTris) that maps to the 64 virtual IO lines.
  • IOBufferTris - an 8 byte chunk of memory used to set the "tris" on each of the virtual 64 IO lines. May be changed at any point in the program. 0=Output, 1=Input.
  • RefreshIOBuffer - the routine that updates IOBuffer and the port.

Private:

  • IOBufferCounter - used to keep track of which device to address.