Professional Documents
Culture Documents
Concept
Project Resources
Available Microchip PIC Assembler Source Code
Schematic, Data Sheets, Pinout
Fully software controlled RS232 reception and transmission for PIC16F8x. The microcontroller echoes every received RS232 character back to the
RS232 terminal window on the host (i.e. the computer). The HyperTerminal program (Win9x, WinXP) is configured to use the standard settings as
shown below.
PCB test board for PIC16F84 PIC16F84 test board with MAX232
using a dot matrix LCD display and a MAX232 for RS232 Test setup using asynchronous RS232 connection (RX on PortB0, TX on
transmission. PortA0). RS232 to USB1.1 connector in the back.
The above program needs additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_rs096.
asm
For those, who are not familiar with interfacing a PIC to the RS232 using a MAX232: RS232-Interface.pdf (9.7 kB)
You can get the pinout and a description of the various keyboard connectors <here>.
[Toc] [Top]
;***************************************************************************
;
; RS232 Test Interface V1.02
; ==========================
;
; written by Peter Luethi, 26.03.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 16.01.2005
;
; V1.02: Fixed copy/paste issue of ISR context store/restore
; (nobody is perfect): Erroneously erased INTCON,INTF
; clearing, resulting in endless ISR calling...
; Re-structured entire ISR and RS232 echo sub-routines
; (11.04.2004)
;
; V1.01: ISR context restore improvements (21.11.1999)
;
; V1.00: Initial release (26.3.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84A
; Clock Frequency: 4.00 MHz XT
; Throughput: 1 MIPS
; Baud Rate: depends on the module included
; Code Size of entire Program: approx. 235 instruction words
; Required Hardware: MAX 232
;
;
; DESCRIPTION:
; ============
; Developed and tested on PIC 16F84A, executeable on all interrupt
; featured PICs.
; Program handles all aspects of RS232
; Transmission (Register TXD) and
; Reception (register RXD) through interrupts (PortB0 IRQ).
; The microcontroller sends feedback of received characters back to
; the terminal window.
;
; Program shows the implementation and function of the modules
; m_bank.asm, m_wait.asm, and m_rs096.asm on the PIC16F84A.
;
;***************************************************************************
PROCESSOR 16F84A
#include "p16f84a.inc"
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
#include "..\..\m_rs096.asm" ; specify desired RS232 module
RSservice
SEND TAB
SEND 'E'
SEND 'c'
SEND 'h'
SEND 'o'
SEND ':'
SEND TAB
movfw RXD ; get RS232 data
SENDw ; transmit across RS232
SEND CR ; Carriage Return
SEND LF ; Line Feed
; end of RS232 service (echo & display)
bcf RSflag ; reset RS232 data reception flag
bsf INTCON,INTE ; re-enable RB0/INT interrupt
RETURN
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
; catch-all
goto ISRend ; unexpected IRQ, terminate execution of ISR
;******************************
;*** RS232 DATA ACQUISITION ***
;******************************
_ISR_RS232
; first, disable interrupt source
bcf INTCON,INTE ; disable RB0/INT interrupt
; second, acquire RS232 data
RECEIVE ; macro of RS232 software reception
bsf RSflag ; enable RS232 data reception flag
goto _ISR_RS232end ; terminate RS232 ISR properly
;***********************************
;*** CLEARING OF INTERRUPT FLAGS ***
;***********************************
; NOTE: Below, I only clear the interrupt flags! This does not
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
MAIN
clrf INTCON ; reset interrupts (disable all)
RS232init ; RS232 initialization
clrf FLAGreg ; initialize all flags
SEND '2'
SEND ''
SEND 'T'
SEND 'e'
SEND 's'
SEND 't'
SEND ''
SEND 'I'
SEND 'n'
SEND 't'
SEND 'e'
SEND 'r'
SEND 'f'
SEND 'a'
SEND 'c'
SEND 'e'
SEND ':'
SEND ''
SEND 'P'
SEND 'I'
SEND 'C'
SEND '1'
SEND '6'
SEND 'F'
SEND '8'
SEND '4'
SEND ''
SEND 'c'
SEND 'o'
SEND 'n'
SEND 'n'
SEND 'e'
SEND 'c'
SEND 't'
SEND 'e'
SEND 'd'
SEND '.'
SEND '.'
SEND '.'
SEND CR ; Carriage Return
SEND LF ; Line Feed
SEND LF ; Line Feed
END
:020000040000FA
:020000007E2858
:080008004F288C0081018316D2
:100010000313C030810508008C008101831603138F
:10002000C030810501308104831203130B110B1DB5
:1000300017288C0B162808009400051008308C0037
:100040002D2014180514141C0510940C2D208C0B55
:10005000212805142D202D2008001D308D00332867
:1000600008308D0033288D0B332808009501732844
:1000700009301C2045301C2063301C2068301C20B7
:100080006F301C203A301C2009301C2015081C2021
:100090000D301C200A301C2013100B1608008B1387
:1000A0008B1B4F289600030E970083010A089800C7
:1000B0008A018313040899008B185F2875280B1296
:1000C00030200618362808308C002D200618951789
:1000D000061C95130C0B950C8C0B65282D20061C0B
:1000E0003628131474280B168B101908840018086E
:1000F0008A00170E8300960E160E09008B018316D8
:1001000003130510061401138312031305148B1037
:100110000B168B1793010D301C200A301C20523017
:100120001C2053301C2032301C2033301C20323035
:100130001C2020301C2054301C2065301C207330C3
:100140001C2074301C2020301C2049301C206E30B4
:100150001C2074301C2065301C2072301C2066303E
:100160001C2061301C2063301C2065301C203A307C
:100170001C2020301C2050301C2049301C204330D3
:100180001C2031301C2036301C2046301C203830DA
:100190001C2034301C2020301C2063301C206F3089
:1001A0001C206E301C206E301C2065301C206330FB
:1001B0001C2074301C2065301C2064301C202E3024
:1001C0001C202E301C202E301C200D301C200A300C
:0C01D0001C200A301C2013183820EB28DB
:02400E00F13F80
:00000001FF
http://www.trash.net/~luethi/microchip/projects/rs232/rs_test/rs_test.hex12/02/2008 17:12:29
Microchip PIC microcontroller assembler modules
I would appreciate to be credited within your project, if you use any of the source code below. If you have an interesting project going on, I'll be glad about
feedback.
The software below comes with no guarantee or warranty except for my good intentions. Further the use of this code implies that the user has a fundamental
understanding of electronics and its risks. I'm not responsible for any harm or damage, caused by inproper use of any of the code below.
Any commercial use of parts or all of this code requires the permission of the author.
General
Standard Modules
Dot Matrix LCD Modules
LCD Display Driver Routines
LCD Display Conversion Routines
RS232 Modules
Notes on Modules
General Recommendations
Known Limitations of MPLAB IDE
Technical Hints
Modules are source code blocks, which can be included in the MAIN PROGRAM by simply adding the command line:
#include "C:/ (...) m_bank.asm"
The code will be inline expanded. All you need is to specify the necessary registers in front of the include statement in the main program, e.g.
#include "..\m_bank.asm"
#include "..\m_wait.asm"
#include "..\m_lcd.asm"
Assembler include files: General macros to ease assembler handling, e.g. macros BANK0, BANK1
V2.00 (17.08.2004)
Bank & page handling: Bank0, Bank1,...
V1.02 (20.08.2004)
Parameterizable wait function, which performs a "busy" wait.
Implemented standard delay (@ 4 MHz):
WAIT 0x01 is equal to 1 unit == 1.02 ms
The assigned standard prescaler for TMR0 is PRESCstd = b'00000001'
#include "..\m_bank.asm"
#include "..\m_wait.asm"
V1.00 (16.02.2003)
Beep function on parameterizable output port.
m_beep.asm CONSTANT BASE = 0x0C ; 16F84 base address of user file registers
#include "..\m_bank.asm"
#include "..\m_beep.asm"
Assembler include files: Display drivers for dot matrix LCD displays. (Hitachi HD44780 compatibles)
Download the PDF schematic to illustrate the connectivity of both 'classes' of LCD driver routines:
Modules m_lcd.asm, m_lcdx.asm, m_lcd_bf.asm, m_lcdxbf.asm: working only on entire ports ([1..7], without [0]),
e.g. PortB[1..7] on PIC16F84,
or PortB[1..7], PortC[1..7], PortD[1..7] on PIC16F77
Modules m_lcde.asm, m_lcde_bf.asm, m_lcdexbf.asm: working on separate, customizable ports,
e.g. PortB[0..2] for control lines & PortA[0..3] for data lines on PIC16F84, PIC16F7x,
or PortC[5..7] for control lines & PortD[0..3] for data lines on PIC16F77, or ...
Note that the data lines have to be on the low nibble of the port.
V2.06 (26.12.2004)
7 wires, 4 bit LCD interface
Based on timing constraints, no busy flag check. So if LCD fails, system is still running stable. Higher reliability, because less
critical system components.
No portable code for higher clock frequencies.
R/W connection to LCD supported for compatibility to m_lcd_bf.asm, but can be put to GND at LCD side => You'll get one
interrupt pin more on the processor side.
#include "..\m_bank.asm"
#include "..\m_wait.asm"
#include "..\m_lcd.asm"
V2.26 (26.12.2004)
7 wires, 4 bit LCD interface
Extended m_lcd.asm with the ability to define your own characters (max. 8) in macro LCDspecialChars. Based on timing
constraints, specifications as m_lcd.asm.
m_lcdx.asm
http://www.trash.net/~luethi/microchip/modules/modules.html (5 of 16)12/02/2008 17:12:31
Microchip PIC microcontroller assembler modules
V3.09 (26.12.2004)
7 wires, 4 bit LCD interface
Extended m_lcd.asm which reads busy flag of LCD (bi-directional communication between controller and LCD)
R/W connection to LCD needed for hand shaking.
Clock independent program code, successfully tested up to 10 MHz on PIC 16F84 and up to 20 MHz on PIC 16C74A!
Gives the best performance, but system fails, if LCD (-connection) fails, because processor is waiting for ready signal from LCD
to send next character. => Deadlock, but should not occur under normal circumstances!
Solution:
Connect an auxilliary 10k resistor from DB7 to GND, so if the LCD is disconnected, the microprocessor will read an inactive
busy flag. (That's needed because of the internal weak pull ups of the microprocessor ports. Maybe also needed if you switch
them off.)
m_lcd_bf.asm
#include "..\m_bank.asm"
#include "..\m_wait.asm"
#include "..\m_lcd_bf.asm"
V3.29 (26.12.2004)
7 wires, 4 bit LCD interface
Basically the same as m_lcd_bf.asm, but with the ability to define your own characters (max. 8) in macro LCDspecialChars. Bi-
m_lcdxbf.asm directional communication, reads busy flag of LCD.
V2.12e (17.08.2004)
7 wires, 4 bit LCD interface
Basically as m_lcd.asm, but with the ability to independently configure LCD control and data lines, i.e. LCD data on low nibble
of any port, LCD command lines on any port bits (even different port).
m_lcde.asm
#include "..\m_bank.asm"
#include "..\m_wait.asm"
#include "..\m_lcde.asm"
V4.03e (17.08.2004)
7 wires, 4 bit LCD interface
Extended m_lcde.asm which reads busy flag of LCD (bi-directional communication between controller and LCD)
#include "..\m_bank.asm"
http://www.trash.net/~luethi/microchip/modules/modules.html (8 of 16)12/02/2008 17:12:31
Microchip PIC microcontroller assembler modules
#include "..\m_wait.asm"
#include "..\m_lcde_bf.asm"
V4.23e (17.08.2004)
7 wires, 4 bit LCD interface
Basically the same as m_lcde_bf.asm, but with the ability to define your own characters (max. 8) in macro LCDspecialChars. Bi-
m_lcdexbf.asm directional communication, reads busy flag of LCD.
V1.02 (20.08.2004)
8 bit binary to decimal conversion routine for LCD output, stringent for any numeric display output or
interaction.
#include "..\m_bank.asm"
#include "..\m_wait.asm"
#include "..\m_lcd.asm"
#include "..\m_lcdv08.asm"
V1.02 (20.08.2004)
16 bit binary to decimal conversion routine for LCD output, stringent for any numeric display output or
interaction.
#include "..\m_bank.asm"
#include "..\m_wait.asm"
#include "..\m_lcd.asm"
#include "..\m_lcdv16.asm"
V1.00 (20.08.2004)
8 bit binary LCD output routine for debugging of registers and bitstreams, e.g. to visualize the binary output of
an A/D converter to check the magnitude of its LSB toggling due to digital quantization and/or noise.
m_lcdb08.asm
#include "..\m_bank.asm"
#include "..\m_wait.asm"
#include "..\m_lcd.asm"
#include "..\m_lcdb08.asm"
V1.00 (20.08.2004)
16 bit binary LCD output routine for debugging of registers and bitstreams, e.g. to visualize the binary output of
an A/D converter to check the magnitude of its LSB toggling due to digital quantization and/or noise.
#include "..\m_bank.asm"
#include "..\m_wait.asm"
#include "..\m_lcd.asm"
#include "..\m_lcdb16.asm"
For external interrupts, such as the RB0/INT pin or PORTB change interrupt, the latency will be three to four instruction cycles. The exact latency depends
on when the interrupt occurs. The latency is the same for both one and two cycle instructions.
(=> see Microchip PIC16/17 Microcontroller Databook.)
For those, who are not familiar with interfacing a PIC to the RS232 using a MAX232 : RS232-Interface.pdf (9.7 kB)
V1.02 (11.04.2004)
Completely software handled RS232 Interface for interrupt featured PICs (PIC16C84, PIC16F84,...).
Specifications: 2400 baud, 8 bit, no parity, 1 stopbit (@ 4 MHz / 1 MIPS)
#include "..\m_bank.asm"
#include "..\m_rs024.asm"
V1.02 (11.04.2004)
m_rs048.asm Functionality as m_rs024.asm
Specifications: 4800 baud, 8 bit, no parity, 1 stopbit (@ 4 MHz / 1 MIPS)
V1.02 (11.04.2004)
m_rs096.asm Functionality as m_rs024.asm
Specifications: 9600 baud, 8 bit, no parity, 1 stopbit (@ 4 MHz / 1 MIPS)
V1.02 (11.04.2004)
m_rs192.asm Functionality as m_rs024.asm
Specifications: 19200 baud, 8 bit, no parity, 1 stopbit (@ 4 MHz / 1 MIPS)
V1.02 (11.04.2004)
Functionality as m_rs024.asm
m_rs7n1.asm
Developed for an old and heavy matrix needle printer with RS232 Interface.
Specifications: 9600 baud, 7 bit, no parity, 1 stopbit (@ 4 MHz / 1 MIPS)
calling occurs.
At the beginning of the ISR, disable the 'global interrupt enable bit' (GIE). In case different interrupt sources have to be served, it may be necessary
to disable also the related 'interrupt source enable bit' (e.g. INTF of RB0/INT pin). See next recommendation
On ISR exit, make sure to reset the interrupt flag of the source, which triggered the interrupt. But perform re-enabling of the corresponding 'interrupt
source enable bit' at the end of the corresponding service routine:
- If the interrupt service is entirely completed within the ISR, re-enabling is suitable at the end of the ISR. This applies only, if disabling of the
interrupt source has been carried out at the beginning of the ISR.
- If parts of the interrupt service are carried out during normal operation, re-enabling the interrupt source is most suitable at the end of the external
code part. In this case, disabling the specific interrupt source at the beginning of the ISR is stringent, otherwise we face lost of data or a system crash
due to return address stack overflow. This method owns a further advantage: A subsequent interrupt already having been triggered before re-
activation and originating from the same source is not omitted and will immediately be served. (This is because the interrupt flag bit gets still set,
when the interrupt is temporarily disabled. When unmasking this interrupt source, the interrupt is immediately triggered.)
Previously MPLAB worked with the old MS DOS 8.3 name convention (so set paths with old notation).
With the recent MPLAB versions beyond 6.30 (I use currently 6.40 and PICstart Plus), it seems they accept also longer file names. That's while my
include files sometimes have strange names. There is also an upper limitation on the amount of characters in an absolute file name including path.
'#include' - commands in the MAIN could be relative (..\..\xyz.asm) or absolute paths (C:\abc\xyz.asm).
'#include' - commands in extern source have to be absolute paths (if extern source is called with relative path).
If you use 'set' instead of 'equ', you can assign different labels to the same register. This is very useful, if you need temporary registers in different
modules. But be careful that you do not write and access the same register alternating in 2 different procedures. This results in nice bugs or possibly
endless loops.
'equ' is exclusive, i.e. it accepts only one label for each register.
If you want to create a 16 bit assembler look-up table very quickly, have a look at the
Automatic Table Generator for MPLAB Assembler.
To specify exact periods (e.g. with busy wait module m_wait.asm), I use quite often the MPLAB stopwatch. This is a very convenient cycle-accurate
timer, which takes both 1 cycle (e.g. incf) and 2 cycle instructions (e.g. goto) as well as special instruction mnemonics (e.g. bnc, subcf) into account.
I just let the simulator run to the wait statement or loop to be measured, reset the stopwatch, and let it again simulate until after the wait statement:
The Stopwatch
having been reset at 'bsf TXport' and run to the 'nop' statement. The latency of the 'WAITX d73,d2'
statement within this setup (4 MHz clock, PIC16F84) turns out to be approximately 150 ms.
[Toc] [Top]
PIC16F84 MAX232
D (Direction seen from controller) D
VDD
VDD
R1 XT1 VSS
C4
16k C3
4.000 MHz 10u
C1 C2 10u
S1 10p VDD 10p
16
2
6
SW-PB VSS VSS
14
U1
C5 13 12
V+
VCC
V-
IC_PIC1 RS232 TXD R1 IN R1 OUT PIC RXD
RS232 8 9 5V
16 15 RS232 DTR R2 IN R2 OUT 5V DTR
VDD
VSS 4n7 OSC1/CLKIN OSC2/CLKOUT 11 14
4 7 PIC TXD T1 IN T1 OUT RS232 RXD
MCLR RB1 5V 10 7 RS232
17 8 5V DSR T2 IN T2 OUT RS232 DSR
C PIC TXD RA0 RB2 1 4 C
GND
18 9 C1+ C2+
RA1 RB3 3 5
5V DSR 1 10 C1 - C2 -
RA2 RB4
2 11
RA3 RB5 C6 MAX232CPE(16) C7
5V DTR 3 12
RA4/T0CKI RB6 10u 10u
VSS
15
6 13
PIC RXD RB0/INT RB7
PIC16F84-04/P(18)
5
VSS
VDD
VDD VSS
VDD
C8
DSR and DTR signals are not used in
100n
B VSS RS232 my RS232 routines, but are drawn for
completion. These signals are necessary C9
B
VSS
(Direction seen from host) for hardware handshaking, whilst my 100n
routines perform no handshaking. The
RS232 DTR MAX232 has two output and two input VSS
RS232 TXD VSS channels, specified to transmit up to 120
kbps depending on the type used.
RS232 RXD
RS232 DSR
1
6
2
7
3
8
4
9
5
Title
PIC-RS232 Interface using MAX232
A A
Written by Date
SUB1 20-Aug-2003
Peter Luethi
DB9 Revision Page
Dietikon, Switzerland 1.01 1 of 1
1 2 3 4
RS-232 CONNECTIONS THAT WORK!
DTE & DCE FAQ
PAGE 1 OF 5
Usually inputs are connected to inputs and outputs to outputs. People don't realize that there are
two types of RS-232 ports, DTE and DCE type, and that the signal names and pin numbers are
the same, but signal flow is opposite! The pin labeled Tx can be input, and Rx the output.
The two ports types are complementary, the Output signals on a DTE port are Inputs to a DCE
port, and Output signals on a DCE port are Inputs to a DTE port. The signal names match each
other and connect pin for pin. Signal flow is in the direction of the arrows. (see figures below)
What devices have DTE type RS-232 ports? A DTE device is "Data Terminal Equipment", this
includes Computers, Serial Printers, PLC's, Video Cameras, Video Recorders, Video Editors, and
most devices which are not used to extend communications. Think COMPUTER for DTE.
What devices have DCE type RS-232 ports? A DCE device is "Data Communications
Equipment", this includes devices intended to plug directly into a DTE port, PDA cables, Modems
and devices that extend communications like a modem, such as RS-422, RS-485, or Fiber Optic
converters or Radio Modems. Think MODEM for DCE
Rule of Thumb: When connecting a DTE device to a DCE device, match the signal names. When
connecting two DTE or two DCE devices together, use a Crossover cable. (TD crosses to RD,
RTS to CTS, DTR to DSR as shown in Modem to Modem connections. (see 9PMMNM) The
cable for two computers (DTE) also simulates modem connections to CD/DSR, so it is commonly
called a "Null Modem" cable. (see 232DTE or 232NM9)
1. Use Rule of Thumb - If the device plugs into the computer serial port and works normally, the
device is wired as DCE (or the connection cable is a crossover type that makes it work as a
DCE). If the device connects to the computer port using a "null modem" crossover cable, it is
wired as DTE.
2. Use RS-232 Line Tester - A quick and easy way to determine the DTE/DCE port type is to
use a RS-232 line tester such as the 9PMTT. The tester can show the signal state of any
active RS-232 data lines using LED's lighting Red or Green. Active data lines are output from
a device, they may be either High or Low.
Just plug the tester into either of the two devices, see which lines are lit, unplug it, then plug it in
to the other device, see which lines are lit. (see figures).
If the same light (TD or RD) is lit, use a crossover cable or null modem connector that swaps the
connections for pins #2 and #3 and other pins as needed.
If the device is "port powered" check the active side, then plug in the port powered device and
see if other (TD or RD) LED is lit. If not, try swapping the leads with a null modem cable, see if
the other LED now lights. If not, you may not have enough voltage on the handshaking lines of
the port to steal power from.
3. Use a DC Voltmeter Technicians with a DC voltmeter can use it to measure the DC level
from signal ground (pin#5 on DB9, pin#7 on DB25) on the connector to pin #2 or pin #3.
When the unit is powered and not sending data, the output line will have a DC voltage of
minus polarity, 3 volts to 11 volts will be typical. The other pin will have little or no voltage.
For example, we measure -11 volts on pin#2 of a DB9 connector and the line is labeled RD
or Rx, then the device is wired as DCE. If we measure the voltage on pin#3, it is DTE.
Measure pin #2 and pin #3 to ground (pin # 5 - DB9) (pin #7 -- DB25) on the on the cable
from the first device, the on the device you want to connect. If the cable and device have
voltage on the same pin, you need to use a crossover or null modem connector that swaps
pins #2 & #3 and the other pins. (For DB9 see model 9PMMNM, for DB25 see 232DTE)
Electrically active handshaking lines will be negative when not asserted or positive when
asserted. (for reference, see line tester figures). Active handshaking lines can be found by
measuring each pin for voltage. Output lines will have voltage. On a DTE, DTR and RTS will
have voltage if used. On a DCE, DSR and CTS will have voltage, and if a modem with CD
(Carrier Detect) and RI (Ring Indicator) these last two will be low until Ring is detected or a
Carrier connection is made. If handshaking lines don't have voltage when the device is
powered on and ready, the device doesn't output them, they may be looped back, RTS to
CTS and DTR to DSR. You can turn off the device power and measure for continuity (zero
ohms) between pins to confirm if they are looped back.
1. Handshaking lines RTS and CTS not interconnected, DTR and DSR not interconnected.
Swap as needed.
2. Programs may use the RTS/CTS connection to check that a device is ready to receive data
and respond. If there is No CTS connection, the program will never send data, but wait a
long time or timeout with an error. The RTS line may need to be looped back to the CTS
input. Data errors can occur if the device actually requires handshaking.
3. Programs may also use the DTR/DSR line connection to check that a cable is connected or
that the device is turned on. If there is No DSR signal, the DTR line may need to be looped
back to the DSR input. Some devices use DTR handshaking.
4. Each signal required for unit operation must be carried through by the isolator, modem or RS-
422 or fiber optic converter. The primary "2 Channels" for RS-232 are Receive & Transmit.
There are 2 data flow control channels, RTS and CTS. If these are missing, data is lost,
characters missing, or files scrambled.
5. Connections to Telephone Modem/FAX modem - Make sure CD & RI lines are connected.
11 n/c
12 n/c
13 n/c
14 n/c
15 n/c
16 n/c
17 n/c
18 n/c
19 n/c
20 DTR Data Terminal Ready
21 n/c
22 RI Ring Indicator
23 n/c
24 n/c
25 n/c
Parallel (PC)
Back to Contents
BASE means the base-address of the connection ( normally 378h for LPT1 and 278h for LPT2 ).
BASE+1 is known as status-register, BASE+2 as control-register.
Above address 0000:0408h there is a WORD-value for each installed parallel-port.
Centronics (Printer)
Back to Contents
14 AUTFD ? Autofeed
15 n/c
16 0V
17 CHASSIS GND
18 +5 V PULL UP +5 V DC (50 mA max)
19 GND Signal Ground
20 GND Signal Ground
21 GND Signal Ground
22 GND Signal Ground
23 GND Signal Ground
24 GND Signal Ground
25 GND Signal Ground
26 GND Signal Ground
27 GND Signal Ground
28 GND Signal Ground
29 GND Signal Ground
30 GNDRESET Reset Ground
31 RESET Reset
32 ERROR Low when offline
33 0V Signal Ground
34 n/c
35 +5 V +5 V DC
Select In (Taking low or high sets printer on line or off line
36 SEL IN
respectively)
PC Gameport / MIDI
Back to Contents
VGA
Back to Contents
SCART
Back to Contents
This website provides you helpful information about Microchip PIC 8 Bit
RISC microcontrollers. Several assembler source code listings are
available for non-commercial use. There are also tools for using your PC
for measuring or regulating electronic applications. I'm working on
several projects, e.g. a precision digital altimeter to use in my radio
controlled airplanes.
I have been working at the AMD Dresden Design Center, Germany on
RTL-based block- and system-level verification and performance analysis
for next-generation HyperTransport chipsets for AMDs x86-64 CPUs.
After having been abroad for nearly 3 years, I am now back in
Switzerland to pursue my Ph.D. thesis in the area of fourth generation
(4G) wireless communication with multi-user MIMO systems at the
Integrated Systems Laboratory of the Swiss Federal Institute of
Technology (ETH Zrich).
Webmaster
no abuse by spam
last updated
02.02.2008 This website is a member of the
since 1.7.1998
[ Previous 5 Sites | Previous | Next | Next 5 Sites | Random Site | List Sites ]
and the
[ Previous 5 Sites | Previous | Next | Next 5 Sites | Random Site | List Sites ]
and the
[ Previous 5 Sites | Previous | Next | Next 5 Sites | Random Site | List Sites ]
;***************************************************************************
;
; Standard Macros for PIC 16XXX V2.00
; ====================================
;
; written by Peter Luethi, 08.01.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 20.08.2004
;
;***************************************************************************
#DEFINE M_BANK_ID dummy
endm
;***************************************************************************
;
; Wait Routine for PIC 16XXX V1.02
; =================================
;
; written by Peter Luethi, 18.01.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 20.08.2004
;
; V1.02: In case of 'WAIT 0x00' or 'WAITX 0x00, 0x0F', the wait
; statement (macro) is ignored, no delay is executed
; (05.06.2004)
; V1.01: Correction of a severe mistake: Programming of the prescaler
; affected the entire OPTION_reg including PORTB pullups and
; INTEDGE configuration. Now only the least significant 6 bits
; of OPTION_reg are configured, the upper 2 bits are preserved.
; (16.02.2003)
; V1.00: Initial release (18.01.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16X84, 16F7X, 16F87X
; Clock: 4.00 MHz XT
; Throughput: 1 MIPS
;
;
; DESCRIPTION:
; ============
; Developed on PIC 16C84, but executeable on all PIC 16X84, 16C7X, etc.
;
; Routine performs a "busy" wait.
; Implemented standard delay (@ 4 MHz):
IFNDEF M_BANK_ID
ERROR "Missing include file: m_bank.asm"
ENDIF
;***************************************************************************
;
; Beep Routine for PIC 16XXX V1.00
; =================================
;
; written by Peter Luethi, 18.01.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 16.02.2003
;
; V1.00: Initial release (18.01.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16XXX
; Clock: 4.00 MHz XT
; Throughput: 1 MIPS
; Required Hardware: Piezo beeper with decoupling capacitor
;
;
; DESCRIPTION:
; ============
; Developed on PIC 16C84, but executeable on all PIC 16X84, 16C7X, ...
;
; Call of implemented procedures with:
; "BEEPinit" initialization to set output port
; "BEEP xxx yyy" normal usage
; "BEEPX xxx yyy zzz" extended usage
; xxx is frequency-related
; yyy is duration according to PRESCbeeb, TMR0
; zzz is user-defined TMR0 prescaler setting
;
; i.e. 3-Tone-Melody: BEEP 0xFF, 0x02
IFNDEF M_BANK_ID
ERROR "Missing include file: m_bank.asm"
ENDIF
IFNDEF BEEPport
ERROR "Define BEEPport in MAIN PROGRAM"
ENDIF
IFNDEF BEEPtris
ERROR "Define BEEPtris in MAIN PROGRAM"
ENDIF
IFNDEF PRESCbeep
#define PRESCbeep b'00000111' ; 65,3 ms per Cycle
ENDIF
BEEPinit macro
bcf BEEPport
BANK1
bcf BEEPtris
BANK0
endm
goto BEEPb
decfsz TEMP2,1 ; repeat subroutine
goto BEEPa
RETURN
I would appreciate to be credited within your project, if you use any of the source code below. If you have an interesting
project going on, I'll be glad about feedback.
The software below comes with no guarantee or warranty except for my good intentions. Further the use of this code implies
that the user has a fundamental understanding of electronics and its risks. I'm not responsible for any harm or damage,
caused by inproper use of any of the code below.
Any commercial use of parts or all of this code requires the permission of the author.
"Design and test of electronic circuits are 1% inspiration and 99% perspiration."
(Freely derived from Thomas Alva Edison's famous phrase: "Genius is 1% inspiration and 99% perspiration.")
PIC Projects
Precision Digital Altimeter
AT Keyboard Interface V1.xx
AT Keyboard Interface V2.xx
AT Keyboard Interface V3.xx
AT Keyboard Box V2.xx
AT Keyboard Interface with Morse Code Support V1.xx
AT Keyboard Interface with Morse Code Support V2.xx
Shows briefly the use of the various RS232 modules (m_rs048, m_rs096, m_rs192). It is more or less the same as the RS232
Communication Test Routine (1), without LCD display. The controller sends approximately every 10 seconds a stand-by
statement to the terminal screen and echoes to every character the device gets. RS232 reception is based on PortB0 interrupt.
[Toc] [Top]
CON1_3 CON2_3
LCD_CON14 LCD_CON14
Dot Matrix LCD Display
(HD44780 compatible)
VDD
Contrast
Contrast
VDD
VDD
R1_3
R/W
R/W
VSS
VSS
RS
RS
D0
D1
D2
D3
D4
D5
D6
D7
D0
D1
D2
D3
D4
D5
D6
D7
10k
E
C C
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
10
11
12
13
14
VSS VSS
1
1 2 3 4
http://www.trash.net/~luethi/microchip/modules/source/m_lcd.asm
;***************************************************************************
;
; LCD INTERFACE V2.06 for PIC 16XXX
; =================================
;
; written by Peter Luethi, 10.01.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 26.12.2004
;
; V2.06: Added new parameters: (26.12.2004)
; - LCDLINENUM: (default: 0x2) # of LCD lines (affects LCDL2/3)
; - LCDTYPE: type of LCD/controller:
; - 0x0: (default) standard LCD (w/ HD44780)
; - 0x1: EA DIP204-4 (w/ KS0073, white chars, blue bg)
; V2.05: Changed LCDinit and constants (24.06.2004)
; V2.04: Clean-up and general improvements, added
; parameter LCDSPEED (10.04.2004)
; V2.03: Improved masking of LCD data outputs,
; reduced code size, added parameter LCDWAIT
; (16.02.2003)
; V2.02: LCDinit coded as macro instead of procedure
; V2.01: LCDinit with "andwf" instead of "movwf"
; V2.00: With constant timing delays (No busy flag check)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16X84, 16F7X, 16F87X
; Clock: 4.00 MHz XT - 10.00 MHz HS Mode (tested)
; Throughput: 1 - 2.5 MIPS
; LCD Transmission Mode: 4 bit on high nibble of LCD port
; (MSB D7-D4)
; LCD Connections: 7 wires (4 data, 3 command),
IFNDEF M_BANK_ID
ERROR "Missing include file: m_bank.asm"
ENDIF
IFNDEF M_WAIT_ID
ERROR "Missing include file: m_wait.asm"
ENDIF
IFNDEF LCDtris
ERROR "Declare LCDtris in MAIN PROGRAM"
ENDIF
IFNDEF LCDport
ERROR "Declare LCDport in MAIN PROGRAM"
ENDIF
IFNDEF BASE
ERROR "Declare BASE (Base address of user file registers) in MAIN PROGRAM"
ENDIF
LCDinit macro
BANK1
movlw b'0000001' ; set to output
andwf LCDtris,f
BANK0
bcf LCD_EN ; clear LCD clock line
bcf LCD_RW ; set write direction
bcf LCD_RS ; clear command/data line
endm
;***************************************************************************
;
; LCD INTERFACE V2.26 for PIC 16XXX
; =================================
;
; written by Peter Luethi, 15.05.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 26.12.2004
;
; V2.26: Added new parameters: (26.12.2004)
; - LCDLINENUM: (default: 0x2) # of LCD lines (affects LCDL2/3)
; - LCDTYPE: type of LCD/controller:
; - 0x0: (default) standard LCD (w/ HD44780)
; - 0x1: EA DIP204-4 (w/ KS0073, white chars, blue bg)
; V2.25: Changed LCDinit and constants (24.06.2004)
; V2.24: Clean-up and general improvements, added
; parameter LCDSPEED (10.04.2004)
; V2.23: Improved masking of LCD data outputs,
; reduced code size, added parameter LCDWAIT
; (16.02.2003)
; V2.22: LCDinit coded as macro instead of procedure
; V2.21: LCDinit with "andwf" instead of "movwf"
; V2.20: Initial release (15.5.1999)
; With constant timing delays (No busy flag check)
; Ability to define your own characters for the LCD
; (=> see macro LCDspecialChars)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16X84, 16F7X, 16F87X
; Clock: 4.00 MHz - 10.00 MHz XT (tested)
; Throughput: 1 - 2.5 MIPS
; ==========================
; CONSTANT LCDLINENUM = 0x02 ; LCD display has two lines (e.g. 2x20)
; CONSTANT LCDTYPE = 0x00 ; standard HD44780 LCD
; CONSTANT LCDSPEED = 0x01 ; affecting LCD_EN 'clock': high speed PIC clock
; CONSTANT LCDWAIT = 0x01 ; for Tosc <= 5 MHz
; CONSTANT LCDCLRWAIT = 0x08 ; wait after LCDCLR until LCD is ready again
;
; To maintain proper timing (setup time, wait time, LCD initialization),
; adjust the parameter LCDWAIT as follows:
; if Tosc <= 5 MHz: LCDWAIT = 0x01
; else LCDWAIT = floor(0.25 * clock frequency[MHz])
; To comply with manufacturer specifications (Enable High Time >= 450 ns),
; add a "nop" to the procedure LCDclk, if using this module with clock
; rates higher than 9 MHz. Therefore, define in your main program:
; CONSTANT LCDSPEED = 0x00 ; clk in [0..9] MHz
; CONSTANT LCDSPEED = 0x01 ; clk in [9..20] MHz, default
;
;
; DECLARATIONS needed in MAIN PROGRAM:
; ====================================
; CONSTANT BASE = 0x0C Base address of user file registers
; LCDtris equ TRISB
; LCDport equ PORTB
;
; LCD port connections: B0: not used, still available for INTB
; B1: D4
; B2: D5
; B3: D6
; B4: D7
; B5: E
; B6: R/W
; B7: RS
;
; REQUIRED MEMORY:
; ================
; 2 registers: @ BASE+2, BASE+3
;
;***************************************************************************
#DEFINE M_LCD_ID dummy
IFNDEF M_BANK_ID
IFNDEF LCDtris
ERROR "Declare LCDtris in MAIN PROGRAM"
ENDIF
IFNDEF LCDport
ERROR "Declare LCDport in MAIN PROGRAM"
ENDIF
IFNDEF BASE
ERROR "Declare BASE (Base address of user file registers) in MAIN PROGRAM"
ENDIF
LCDinit macro
BANK1
movlw b'0000001' ; set to output
andwf LCDtris,f
BANK0
bcf LCD_EN ; clear LCD clock line
bcf LCD_RW ; set write direction
bcf LCD_RS ; clear command/data line
clrLCDport ; reset LCD data lines
WAIT 4*LCDWAIT ; >= 4 ms @ 4 MHz
LCD_CGAdr 0x0D
LCDchar b'00001010'
LCD_CGAdr 0x0E
LCDchar b'00011011'
LCD_CGAdr 0x0F
LCDchar b'00000000'
;***************************************************************************
;
; LCD INTERFACE V3.09 for PIC 16XXX
; =================================
;
; written by Peter Luethi, 15.05.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 26.12.2004
;
; V3.09: Added new parameters: (26.12.2004)
; - LCDLINENUM: (default: 0x2) # of LCD lines (affects LCDL2/3)
; - LCDTYPE: type of LCD/controller:
; - 0x0: (default) standard LCD (w/ HD44780)
; - 0x1: EA DIP204-4 (w/ KS0073, white chars, blue bg)
; - LCDBUSYWAIT: (default: 0x18) wait before LCD busy flag
; is available
; V3.08: Fixed high-speed timing issue in busy flag part
; (24.06.2004)
; V3.07: Changed LCDinit and constants (06.06.2004)
; V3.06: Clean-up and general improvements, added flag
; LCDcflag, removed register LCDtemp2 (10.04.2004)
; V3.05: Added parameter LCDSPEED (04.01.2004)
; V3.04: Improved masking of LCD data outputs,
; reduced code size, added parameter LCDWAIT (16.02.2003)
; V3.03: Replaced LCDtemp3 register used for busy flag with
; define statement: #define LCDbusy FLAGreg,0x06
; V3.02: LCDinit coded as macro instead of procedure
; V3.01: LCDinit with "andwf" instead of "movwf"
; V3.00: Reads busy flag of LCD, minimum waittime,
; 4.00 - 20.00 MHz clock (15.05.1999)
; Clock independent portable code!
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16X84, 16F7X, 16F87X
; Clock: 4.00 MHz XT - 20.00 MHz HS Mode (tested)
; Throughput: 1 - 5 MIPS
; LCD Transmission Mode: 4 bit on high nibble of LCD port
; (MSB D7-D4)
; LCD Connections: 7 wires on any portX (4 data, 3 command)
; X0: unused, X1-X7: D4-D7, E, R/W, RS
; Total: 10 wires
; (4 data, 3 command, 1 Vdd, 1 GND, 1 contrast)
;
;
; ADDITIONAL PROGRAM CODE:
; ========================
; procedure CheckBusy
; procedure LCDbusyloop
;
;
; DESCRIPTION:
; ============
; Developed and tested on PIC 16F84 @ 4 MHz, tested on 16F84 @ 10 MHz
; and 16C74A/16F77 @ 20 MHz, but executeable on all PIC 16XXX.
; Program handles all aspects of setup and display on a dot matrix LCD
; display. Routines are provided to allow display of characters,
; display shifting and clearing, cursor setup, cursor positioning and
; line change.
;
; Program calls module m_wait.asm with implemented standard delay:
; "WAIT 0x01" is equal to 1 Unit == 1.04 ms (@ 4 MHz)
; The assigned standard prescaler for TMR0 is "PRESCstd = b'00000001'"
;
; Call of implemented procedures with:
; "LCDinit" (macro)
; "LCDchar 'c'" display ascii character
; "LCDw" display char in working register
; "LCDcmd xxx" e.g. "LCDcmd LCDCLR"
; "LCD_DDAdr xxx" set cursor to explicit address
; --> REFER TO LCD DOCUMENTATION
; "LCDline x" set cursor to the beginning of line 1/2
;
; To display decimal-values, please include the following binary to
; decimal conversion modules:
IFNDEF M_BANK_ID
ERROR "Missing include file: m_bank.asm"
ENDIF
IFNDEF M_WAIT_ID
ERROR "Missing include file: m_wait.asm"
ENDIF
IFNDEF LCDtris
ERROR "Declare LCDtris in MAIN PROGRAM"
ENDIF
IFNDEF LCDport
ERROR "Declare LCDport in MAIN PROGRAM"
ENDIF
IFNDEF LCDbusy
ERROR "#define LCDbusy FLAGreg,0x00 in MAIN PROGRAM"
ENDIF
IFNDEF LCDcflag
ERROR "#define LCDcflag FLAGreg,0x01 in MAIN PROGRAM"
ENDIF
IFNDEF BASE
ERROR "Declare BASE (Base address of user file registers) in MAIN PROGRAM"
ENDIF
LCDinit macro
BANK1
movlw b'0000001' ; set to output
andwf LCDtris,f
BANK0
bcf LCD_EN ; clear LCD clock line
bcf LCD_RW ; set write direction
bcf LCD_RS ; clear command/data line
clrLCDport ; reset LCD data lines
WAIT 4*LCDWAIT ; >= 4 ms @ 4 MHz
call LCDxmit
call LCDclk
WAIT LCDWAIT ; ~1 ms @ 4 MHz
;***************************************************************************
;
; LCD INTERFACE V3.29 for PIC 16XXX
; =================================
;
; written by Peter Luethi, 15.05.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 26.12.2004
;
; V3.29: Added new parameters: (26.12.2004)
; - LCDLINENUM: (default: 0x2) # of LCD lines (affects LCDL2/3)
; - LCDTYPE: type of LCD/controller:
; - 0x0: (default) standard LCD (w/ HD44780)
; - 0x1: EA DIP204-4 (w/ KS0073, white chars, blue bg)
; - LCDBUSYWAIT: (default: 0x18) wait before LCD busy flag
; is available
; V3.28: Fixed high-speed timing issue in busy flag part
; (24.06.2004)
; V3.27: Changed LCDinit and constants (06.06.2004)
; V3.26: Clean-up and general improvements, added flag
; LCDcflag, removed register LCDtemp2 (10.04.2004)
; V3.25: added parameter LCDSPEED (04.01.2004)
; V3.24: Improved masking of LCD data outputs,
; reduced code size, added parameter LCDWAIT (16.02.2003)
; V3.23: Replaced LCDtemp3 register used for busy flag with
; define statement: #define LCDbusy FLAGreg,0x06
; V3.22: LCDinit coded as macro instead of procedure
; V3.21: LCDinit with "andwf" instead of "movwf"
; V3.20: Reads busy flag of LCD, minimum waittime,
; 4.00 - 20.00 MHz clock (15.05.1999)
; Clock independent portable code!
; Ability to define your own characters for the LCD
; (=> see macro LCDspecialChars)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16X84, 16F7X, 16F87X
; Clock: 4.00 MHz XT - 20.00 MHz HS Mode (tested)
; Throughput: 1 - 5 MIPS
; LCD Transmission Mode: 4 bit on high nibble of LCD port
; (MSB D7-D4)
; LCD Connections: 7 wires on any portX (4 data, 3 command)
; X0: unused, X1-X7: D4-D7, E, R/W, RS
; Total: 10 wires
; (4 data, 3 command, 1 Vdd, 1 GND, 1 contrast)
;
;
; ADDITIONAL PROGRAM CODE:
; ========================
; procedure CheckBusy
; procedure LCDbusyloop
; macro LCD_CGAdr
; macro LCDspecialChars
;
;
; DESCRIPTION:
; ============
; Developed and tested on PIC 16C84 @ 4 MHz, tested on 16F84 @ 10 MHz
; and 16C74A @ 20 MHz, but executeable on all PIC 16XXX.
; Program handles all aspects of setup and display on a dot matrix LCD
; display. Routines are provided to allow display of characters,
; display shifting and clearing, cursor setup, cursor positioning and
; line change.
;
; Program calls module m_wait.asm with implemented standard delay:
; "WAIT 0x01" is equal to 1 Unit == 1.04 ms (@ 4 MHz)
; The assigned standard prescaler for TMR0 is "PRESCstd = b'00000001'"
;
; Call of implemented procedures with:
; "LCDinit" (macro)
; "LCDchar 'c'" display ascii character
; "LCDw" display char in working register
; "LCDcmd xxx" e.g. "LCDcmd LCDCLR"
; "LCD_DDAdr xxx" set cursor to explicit address
; --> REFER TO LCD DOCUMENTATION
; B7: RS
;
; REQUIRED MEMORY:
; ================
; 2 registers: @ BASE+2 - BASE+3
; 2 flags: LCDbusy, LCDcflag
;
;***************************************************************************
#DEFINE M_LCD_ID dummy
IFNDEF M_BANK_ID
ERROR "Missing include file: m_bank.asm"
ENDIF
IFNDEF M_WAIT_ID
ERROR "Missing include file: m_wait.asm"
ENDIF
IFNDEF LCDtris
ERROR "Declare LCDtris in MAIN PROGRAM"
ENDIF
IFNDEF LCDport
ERROR "Declare LCDport in MAIN PROGRAM"
ENDIF
IFNDEF LCDbusy
ERROR "#define LCDbusy FLAGreg,0x00 in MAIN PROGRAM"
ENDIF
IFNDEF LCDcflag
ERROR "#define LCDcflag FLAGreg,0x01 in MAIN PROGRAM"
ENDIF
IFNDEF BASE
ERROR "Declare BASE (Base address of user file registers) in MAIN PROGRAM"
ENDIF
CONSTANT LCDCL = b'00000100' ; entry mode set: cursor moves left, display auto-shift off
CONSTANT LCDCONT = b'00001100' ; display control: display on, cursor off, blinking off
CONSTANT LCDMCL = b'00010000' ; cursor/disp control: move cursor left
CONSTANT LCDMCR = b'00010100' ; cursor/disp control: move cursor right
CONSTANT LCDSL = b'00011000' ; cursor/disp control: shift display content left
CONSTANT LCDSR = b'00011100' ; cursor/disp control: shift display content right
CONSTANT LCD2L = b'00101000' ; function set: 4 bit mode, 2 lines, 5x7 dots
IF (LCDLINENUM == 0x2)
CONSTANT LCDL1 = b'10000000' ; DDRAM address: 0x00, selects line 1 (2xXX LCD)
CONSTANT LCDL2 = b'11000000' ; DDRAM address: 0x40, selects line 2 (2xXX LCD)
CONSTANT LCDL3 = b'10010100' ; (DDRAM address: 0x14, fallback)
CONSTANT LCDL4 = b'11010100' ; (DDRAM address: 0x54, fallback)
ELSE
CONSTANT LCDL1 = b'10000000' ; DDRAM address: 0x00, selects line 1 (4xXX LCD)
CONSTANT LCDL2 = b'10010100' ; DDRAM address: 0x14, selects line 2 (4xXX LCD)
CONSTANT LCDL3 = b'11000000' ; DDRAM address: 0x40, selects line 3 (4xXX LCD)
CONSTANT LCDL4 = b'11010100' ; DDRAM address: 0x54, selects line 4 (4xXX LCD)
ENDIF
; special configuration for EA DIP204-4
CONSTANT LCDEXT = b'00001001' ; extended function set EA DIP204-4
CONSTANT LCD2L_A = b'00101100' ; enter ext. function set: 4 bit mode, 2 lines, 5x7 dots
CONSTANT LCD2L_B = b'00101000' ; exit ext. function set: 4 bit mode, 2 lines, 5x7 dots
LCDinit macro
BANK1
movlw b'0000001' ; set to output
andwf LCDtris,f
BANK0
bcf LCD_EN ; clear LCD clock line
bcf LCD_RW ; set write direction
bcf LCD_RS ; clear command/data line
clrLCDport ; reset LCD data lines
WAIT 4*LCDWAIT ; >= 4 ms @ 4 MHz
LCDchar b'00000100'
LCD_CGAdr 0x03
LCDchar b'00001010'
LCD_CGAdr 0x04
LCDchar b'00010001'
LCD_CGAdr 0x05
LCDchar b'00010001'
LCD_CGAdr 0x06
LCDchar b'00001110'
LCD_CGAdr 0x07
LCDchar b'00000000'
endm
call LCDclk
btfsc LCDbusy ; skip if register flag is not yet cleared
goto _LCDbusy
bcf LCD_RW ; re-apply write direction
BANK1
movlw b'11100001'
andwf LCDtris,f ; set ports to output again
BANK0
RETURN
;***************************************************************************
;
; LCD INTERFACE V2.12e for PIC 16XXX
; ==================================
;
; written by Peter Luethi, 20.01.2003, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 17.08.2004
;
; V2.12e: Added new parameters: (17.08.2004)
; - LCDLINENUM: (default: 0x2) # of LCD lines (affects LCDL2/3)
; - LCDTYPE: type of LCD/controller:
; - 0x0: (default) standard LCD (w/ HD44780)
; - 0x1: EA DIP204-4 (w/ KS0073, white chars, blue bg)
; V2.11e: Changed LCDinit and constants (24.06.2004)
; V2.10e: Clean-up and general improvements, added
; parameter LCDSPEED (10.04.2004)
; V2.03e: Improved masking of LCD data ouputs,
; reduced code size, added parameter LCDWAIT
; (16.02.2003)
; V2.02e: LCDinit coded as macro instead of procedure
; V2.01e: LCDinit with "andwf" instead of "movwf"
; V2.00e: Initial release (20.01.2003)
; With constant timing delays (No busy flag check)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16X84, 16F7X
; Clock: 4.00 MHz XT - 10.00 MHz HS Mode (tested)
; Throughput: 1 - 2.5 MIPS
; LCD Transmission Mode: 4 bit on high nibble of LCD port
; (MSB D7-D4)
IFNDEF M_BANK_ID
ERROR "Missing include file: m_bank.asm"
ENDIF
IFNDEF M_WAIT_ID
ERROR "Missing include file: m_wait.asm"
ENDIF
IFNDEF LCDport
ERROR "Declare LCDport in MAIN PROGRAM"
ENDIF
IFNDEF LCDtris
ERROR "Declare LCDtris in MAIN PROGRAM"
ENDIF
IFNDEF LCD_EN
ERROR "Declare LCD_EN in MAIN PROGRAM"
ENDIF
IFNDEF LCD_ENtris
ERROR "Declare LCD_ENtris in MAIN PROGRAM"
ENDIF
IFNDEF LCD_RS
ERROR "Declare LCD_RS in MAIN PROGRAM"
ENDIF
IFNDEF LCD_RStris
ERROR "Declare LCD_RStris in MAIN PROGRAM"
ENDIF
IFNDEF LCD_RW
ERROR "Declare LCD_RW in MAIN PROGRAM"
ENDIF
IFNDEF LCD_RWtris
ERROR "Declare LCD_RWtris in MAIN PROGRAM"
ENDIF
IFNDEF BASE
ERROR "Declare BASE (Base address of user file registers) in MAIN PROGRAM"
ENDIF
CONSTANT LCD2L_A = b'00101100' ; enter ext. function set: 4 bit mode, 2 lines, 5x7 dots
CONSTANT LCD2L_B = b'00101000' ; exit ext. function set: 4 bit mode, 2 lines, 5x7 dots
LCDinit macro
BANK1
bcf LCD_ENtris ; set command lines to output
bcf LCD_RStris
bcf LCD_RWtris
movlw b'11110000' ; data output on low nibble
andwf LCDtris,f
BANK0
bcf LCD_EN ; clear LCD clock line
bcf LCD_RW ; set write direction
bcf LCD_RS ; clear command/data line
clrLCDport ; reset LCD data lines
WAIT 4*LCDWAIT ; >= 4 ms @ 4 MHz
ELSE
ERROR "Wrong line number specified in LCDline"
ENDIF
ENDIF
ENDIF
ENDIF
endm
; send hi-nibble
movfw LCDtemp ; get data
swapf LCDtemp,w ; swap hi- and lo-nibble, store in w
call LCDxmit ; transmit nibble
call LCDclk
; send lo-nibble
movfw LCDtemp ; get data
call LCDxmit ; transmit nibble
call LCDclk
; reset LCD controls
clrLCDport ; reset LCD data lines
bcf LCD_RS ; reset command/data register
;bcf LCD_RW ; reset to write direction
RETURN
;***************************************************************************
;
; LCD INTERFACE V4.03e for PIC 16XXX
; ==================================
;
; written by Peter Luethi, 09.04.2004, Urdorf, Switzerland
; http://www.electronic-engineering.ch
; last update: 17.08.2004
;
; V4.03e: Added new parameters: (17.08.2004)
; - LCDLINENUM: (default: 0x2) # of LCD lines (affects LCDL2/3)
; - LCDTYPE: type of LCD/controller:
; - 0x0: (default) standard LCD (w/ HD44780)
; - 0x1: EA DIP204-4 (w/ KS0073, white chars, blue bg)
; - LCDBUSYWAIT: (default: 0x18) wait before LCD busy flag
; is available
; V4.02e: Fixed high-speed timing issue in busy flag part
; (24.06.2004)
; V4.01e: Changed LCDinit and constants (06.06.2004)
; V4.00e: Initial release (10.04.2004)
; Added flag LCDcflag, removed register LCDtemp2
; Reads busy flag of LCD, minimum waittime.
; 4.00 - 20.00 MHz clock
; Clock independent portable code!
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16X84, 16F7X
; Clock: 4.00 MHz XT - 20.00 MHz HS Mode (tested)
; Throughput: 1 - 5 MIPS
; LCD Transmission Mode: 4 bit on high nibble of LCD port
; (MSB D7-D4)
; CONSTANT LCDLINENUM = 0x02 ; LCD display has two lines (e.g. 2x20)
; CONSTANT LCDTYPE = 0x00 ; standard HD44780 LCD
; CONSTANT LCDSPEED = 0x01 ; affecting LCD_EN 'clock': high speed PIC clock
; CONSTANT LCDWAIT = 0x01 ; for Tosc <= 5 MHz
; CONSTANT LCDCLRWAIT = 0x08 ; wait after LCDCLR until LCD is ready again
; CONSTANT LCDBUSYWAIT = 0x18 ; wait before LCD busy flag is available
;
; To maintain proper timing (setup time, wait time, LCD initialization),
; adjust the parameter LCDWAIT as follows:
; if Tosc <= 5 MHz: LCDWAIT = 0x01
; else LCDWAIT = floor(0.25 * clock frequency[MHz])
; To comply with manufacturer specifications (Enable High Time >= 450 ns),
; add a "nop" to the procedure LCDclk, if using this module with clock
; rates higher than 9 MHz. Therefore, define in your main program:
; CONSTANT LCDSPEED = 0x00 ; clk in [0..9] MHz
; CONSTANT LCDSPEED = 0x01 ; clk in [9..20] MHz, default
;
;
; DECLARATIONS needed in MAIN PROGRAM:
; ====================================
; CONSTANT BASE = 0x0C Base address of user file registers
; #define LCDbusy FLAGreg,0x06 ; LCD busy flag declared within flag register
; #define LCDcflag FLAGreg,0x07 ; LCD command/data flag
;
; LCDtris equ TRISA ; LCD data on low nibble of portA
; LCDport equ PORTA
; #define LCD_ENtris TRISB,0x01 ; EN on portB,1
; #define LCD_EN PORTB,0x01
; #define LCD_RStris TRISB,0x02 ; RS on portB,2
; #define LCD_RS PORTB,0x02
; #define LCD_RWtris TRISB,0x03 ; RW on portB,3
; #define LCD_RW PORTB,0x03
;
;
; REQUIRED MEMORY:
; ================
; 2 registers: @ BASE+2 - BASE+3
; 2 flags: LCDbusy, LCDcflag
;
;***************************************************************************
#DEFINE M_LCD_ID dummy
IFNDEF M_BANK_ID
ERROR "Missing include file: m_bank.asm"
ENDIF
IFNDEF M_WAIT_ID
ERROR "Missing include file: m_wait.asm"
ENDIF
IFNDEF LCDport
ERROR "Declare LCDport in MAIN PROGRAM"
ENDIF
IFNDEF LCDtris
ERROR "Declare LCDtris in MAIN PROGRAM"
ENDIF
IFNDEF LCD_EN
ERROR "Declare LCD_EN in MAIN PROGRAM"
ENDIF
IFNDEF LCD_ENtris
IFNDEF BASE
ERROR "Declare BASE (Base address of user file registers) in MAIN PROGRAM"
ENDIF
LCDinit macro
BANK1
bcf LCD_ENtris ; set command lines to output
bcf LCD_RStris
bcf LCD_RWtris
movlw b'11110000' ; data output on low nibble
andwf LCDtris,f
BANK0
bcf LCD_EN ; clear LCD clock line
bcf LCD_RW ; set write direction
bcf LCD_RS ; clear command/data line
clrLCDport ; reset LCD data lines
WAIT 4*LCDWAIT ; >= 4 ms @ 4 MHz
call LCDdata
endm
;***************************************************************************
;
; LCD INTERFACE V4.23e for PIC 16XXX
; ==================================
;
; written by Peter Luethi, 09.04.2004, Urdorf, Switzerland
; http://www.electronic-engineering.ch
; last update: 17.08.2004
;
; V4.23e: Added new parameters: (17.08.2004)
; - LCDLINENUM: (default: 0x2) # of LCD lines (affects LCDL2/3)
; - LCDTYPE: type of LCD/controller:
; - 0x0: (default) standard LCD (w/ HD44780)
; - 0x1: EA DIP204-4 (w/ KS0073, white chars, blue bg)
; - LCDBUSYWAIT: (default: 0x18) wait before LCD busy flag
; is available
; V4.22e: Fixed high-speed timing issue in busy flag part
; (24.06.2004)
; V4.21e: Changed LCDinit and constants (06.06.2004)
; V4.20e: Initial release (10.04.2004)
; Reads busy flag of LCD, minimum waittime,
; 4.00 - 20.00 MHz clock
; Clock independent portable code!
; Ability to define your own characters for the LCD
; ( => see macro LCDspecialChars )
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16X84, 16F7X, 16F87X
; Clock: 4.00 MHz XT - 20.00 MHz HS Mode (tested)
; Throughput: 1 - 5 MIPS
; LCD Transmission Mode: 4 bit on high nibble of LCD port
; (MSB D7-D4)
; LCD Connections: 7 wires (4 data, 3 command),
; LCD data on low nibble of any port,
; CONSTANT LCDCLRWAIT = 0x08 ; wait after LCDCLR until LCD is ready again
; CONSTANT LCDBUSYWAIT = 0x18 ; wait before LCD busy flag is available
;
; To maintain proper timing (setup time, wait time, LCD initialization),
; adjust the parameter LCDWAIT as follows:
; if Tosc <= 5 MHz: LCDWAIT = 0x01
; else LCDWAIT = floor(0.25 * clock frequency[MHz])
; To comply with manufacturer specifications (Enable High Time >= 450 ns),
; add a "nop" to the procedure LCDclk, if using this module with clock
; rates higher than 9 MHz. Therefore, define in your main program:
; CONSTANT LCDSPEED = 0x00 ; clk in [0..9] MHz
; CONSTANT LCDSPEED = 0x01 ; clk in [9..20] MHz, default
;
;
; DECLARATIONS needed in MAIN PROGRAM:
; ====================================
; CONSTANT BASE = 0x0C Base address of user file registers
; #define LCDbusy FLAGreg,0x06 ; LCD busy flag declared within flag register
; #define LCDcflag FLAGreg,0x07 ; LCD command/data flag
;
; LCDtris equ TRISA ; LCD data on low nibble of portA
; LCDport equ PORTA
; #define LCD_ENtris TRISB,0x01 ; EN on portB,1
; #define LCD_EN PORTB,0x01
; #define LCD_RStris TRISB,0x02 ; RS on portB,2
; #define LCD_RS PORTB,0x02
; #define LCD_RWtris TRISB,0x03 ; RW on portB,3
; #define LCD_RW PORTB,0x03
;
;
; REQUIRED MEMORY:
; ================
; 2 registers: @ BASE+2 - BASE+3
; 2 flags: LCDbusy, LCDcflag
; needs itself 3 stack levels
;
;***************************************************************************
#DEFINE M_LCD_ID dummy
IFNDEF M_BANK_ID
ERROR "Missing include file: m_bank.asm"
ENDIF
IFNDEF M_WAIT_ID
ERROR "Missing include file: m_wait.asm"
ENDIF
IFNDEF LCDport
ERROR "Declare LCDport in MAIN PROGRAM"
ENDIF
IFNDEF LCDtris
ERROR "Declare LCDtris in MAIN PROGRAM"
ENDIF
IFNDEF LCD_EN
ERROR "Declare LCD_EN in MAIN PROGRAM"
ENDIF
IFNDEF LCD_ENtris
ERROR "Declare LCD_ENtris in MAIN PROGRAM"
ENDIF
IFNDEF LCD_RS
ERROR "Declare LCD_RS in MAIN PROGRAM"
ENDIF
IFNDEF LCD_RStris
ERROR "Declare LCD_RStris in MAIN PROGRAM"
ENDIF
IFNDEF LCD_RW
IFNDEF BASE
ERROR "Declare BASE (Base address of user file registers) in MAIN PROGRAM"
ENDIF
IF (LCDLINENUM == 0x2)
CONSTANT LCDL1 = b'10000000' ; DDRAM address: 0x00, selects line 1 (2xXX LCD)
CONSTANT LCDL2 = b'11000000' ; DDRAM address: 0x40, selects line 2 (2xXX LCD)
CONSTANT LCDL3 = b'10010100' ; (DDRAM address: 0x14, fallback)
CONSTANT LCDL4 = b'11010100' ; (DDRAM address: 0x54, fallback)
ELSE
CONSTANT LCDL1 = b'10000000' ; DDRAM address: 0x00, selects line 1 (4xXX LCD)
CONSTANT LCDL2 = b'10010100' ; DDRAM address: 0x14, selects line 2 (4xXX LCD)
CONSTANT LCDL3 = b'11000000' ; DDRAM address: 0x40, selects line 3 (4xXX LCD)
CONSTANT LCDL4 = b'11010100' ; DDRAM address: 0x54, selects line 4 (4xXX LCD)
ENDIF
; special configuration for EA DIP204-4
CONSTANT LCDEXT = b'00001001' ; extended function set EA DIP204-4
CONSTANT LCD2L_A = b'00101100' ; enter ext. function set: 4 bit mode, 2 lines, 5x7 dots
CONSTANT LCD2L_B = b'00101000' ; exit ext. function set: 4 bit mode, 2 lines, 5x7 dots
LCDinit macro
BANK1
bcf LCD_ENtris ; set command lines to output
bcf LCD_RStris
bcf LCD_RWtris
movlw b'11110000' ; data output on low nibble
andwf LCDtris,f
BANK0
bcf LCD_EN ; clear LCD clock line
bcf LCD_RW ; set write direction
bcf LCD_RS ; clear command/data line
clrLCDport ; reset LCD data lines
WAIT 4*LCDWAIT ; >= 4 ms @ 4 MHz
LCDchar b'00000000'
decfsz LCDtemp2,f
goto _LCDbusyloop ; busy loop
RETURN
;***************************************************************************
;
; BINARY to DECIMAL CONVERSION for LCD Display for PIC 16XXX V1.02
; ================================================================
;
; written by Peter Luethi, 18.01.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 20.08.2004
;
; V1.02: Changed labels such as to be able to use both, m_lcdv08.asm
; and m_lcdv16.asm simultaneously (24.06.2004)
; V1.01: Replaced register with #define statement for flag
; (16.02.2003)
; V1.00: Initial release (18.01.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16XXX
; Decimal Range: 0 - 255 unsigned
; Binary Range: 8 Bit unsigned
;
;
; DESCRIPTION:
; ============
; Developed and tested on PIC 16C84, but executeable on all PICs.
; Evaluates from 8 bit Binary Data in LO the equivalent
; decimal output for the LCD-Display. Preceeding zeros are
; not displayed.
;
; Call of implemented procedure with:
; "LCDval_08", value in LO
;
IFNDEF M_LCD_ID
ERROR "Missing include file: m_lcd.asm or similar"
ENDIF
IFNDEF BASE
ERROR "ModuleError: Declare BASE (Base address of user file registers) in MAIN PROGRAM"
ENDIF
IFNDEF LO
ERROR "ModuleError: Declare LO in MAIN PROGRAM"
ENDIF
IFNDEF LO_TEMP
ERROR "ModuleError: Declare LO_TEMP in MAIN PROGRAM"
ENDIF
IFNDEF BCflag
ERROR "ModuleError: #define BCflag FLAGreg,0x05 (Blank checker) in MAIN PROGRAM"
ENDIF
LCDval_08 macro
call LCDval08
endm
LCDval08
movfw LO
movwf LO_TEMP ; LO -> LO_TEMP
bcf BCflag ; blank checker for preceeding zeros
_VALcnv08
clrf TEMP1 ; counter
movfw TEMP2 ; decrement-value
_V08_1 subwf LO_TEMP,0 ; TEST: LO_TEMP-TEMP2 >= 0 ?
;***************************************************************************
;
; BINARY to DECIMAL CONVERSION for LCD-Display for PIC 16XXX V1.02
; ================================================================
;
; written by Peter Luethi, 21.01.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 20.08.2004
;
; V1.02: Changed labels such as to be able to use both, m_lcdv08.asm
; and m_lcdv16.asm simultaneously (24.06.2004)
; V1.01: Replaced register with #define statement for flag
; (16.02.2003)
; V1.00: Initial release (21.01.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16XXX
; Decimal Range: 0 - 65'535 unsigned
; Binary Range: 16 Bit unsigned
;
;
; DESCRIPTION:
; ============
; Developed and tested on PIC 16C84, but executeable on all PICs.
; Evaluates from 16 bit Binary Data in HI,LO the equivalent
; decimal output for the LCD-Display. Preceeding zeros are
; not displayed.
;
; Call of implemented procedure with:
; "LCDval_16", value in HI & LO
;
IFNDEF M_LCD_ID
ERROR "Missing include file: m_lcd.asm or similar"
ENDIF
IFNDEF BASE
ERROR "ModuleError: Declare BASE (Base address of user file registers) in MAIN PROGRAM"
ENDIF
IFNDEF LO
ERROR "ModuleError: Declare LO in MAIN PROGRAM"
ENDIF
IFNDEF HI
ERROR "ModuleError: Declare HI in MAIN PROGRAM"
ENDIF
IFNDEF LO_TEMP
ERROR "ModuleError: Declare LO_TEMP in MAIN PROGRAM"
ENDIF
IFNDEF HI_TEMP
ERROR "ModuleError: Declare HI_TEMP in MAIN PROGRAM"
ENDIF
IFNDEF BCflag
ERROR "ModuleError: #define BCflag FLAGreg,0x05 (Blank checker) in MAIN PROGRAM"
ENDIF
LCDval_16 macro
call LCDval16
endm
LCDval16
movfw LO ; LO -> LO_TEMP
movwf LO_TEMP
movfw HI ; HI -> HI_TEMP
movwf HI_TEMP
bcf BCflag ; Blank checker for preceeding zeros
_VALcnv16
clrf TEMP1 ; clear counter
_V16_1 movfw TEMP3
subwf HI_TEMP,w ; TEST: HI_TEMP-TEMP3 >= 0 ?
skpc ; skip, if true
goto _V16_LCD ; result negativ, exit
bnz _V16_2 ; test zero, jump if result > 0
movfw TEMP2 ; Precondition: HI-TEST is zero
subwf LO_TEMP,w ; TEST: LO_TEMP-TEMP2 >= 0 ?
skpc ; skip, if true
goto _V16_LCD ; result negativ, exit
_V16_2
movfw TEMP3
subwf HI_TEMP,f ; STORE: HI_TEMP = HI_TEMP - TEMP3
movfw TEMP2
subwf LO_TEMP,f ; STORE: LO_TEMP = LO_TEMP - TEMP2
skpc ; skip, if true
decf HI_TEMP,f ; decrement HI
incf TEMP1,f ; increment counter
;***************************************************************************
;
; 8 Bit Binary Output on LCD Display for PIC 16XXX
; ================================================
;
; written by Peter Luethi, 02.08.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 20.08.2004
;
; V1.00: Initial release (02.08.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16XXX
; Binary Range: 8 Bit
;
;
; DESCRIPTION:
; ============
; Developed on PIC 16C84, but executeable on all PIC 16XXX.
; Displays the 8 bit binary value stored in LO on the
; LCD display in binary format.
; This routine is only used for debugging registers and bit-
; streams.
;
;
; NOTE:
; =====
; Call of implemented procedure with:
; "LCDbin_08", value in LO
;
; LO is not altered or cleared during operation and is
IFNDEF M_LCD_ID
ERROR "Missing include file: m_lcd.asm or similar"
ENDIF
IFNDEF b08_cnt
ERROR "ModuleError: Declare b08_cnt in MAIN PROGRAM"
ENDIF
IFNDEF LO
ERROR "ModuleError: Declare LO in MAIN PROGRAM"
ENDIF
IFNDEF LO_TEMP
ERROR "ModuleError: Declare LO_TEMP in MAIN PROGRAM"
ENDIF
LCDbin_08 macro
call LCDbin08
endm
LCDbin08
movfw LO
movwf LO_TEMP
movlw d'8'
movwf b08_cnt
bin_loop08
movlw '0'
btfsc LO_TEMP,7 ; check if bit is set, skip if cleared
movlw '1'
LCDw ; call LCD sub-routine with data stored in w
rlf LO_TEMP,1
decfsz b08_cnt,1
goto bin_loop08
RETURN
;***************************************************************************
;
; 16 Bit Binary Output on LCD Display for PIC 16XXX
; =================================================
;
; written by Peter Luethi, 02.08.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 20.08.2004
;
; V1.00: Initial release (02.08.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16XXX
; Binary Range: 16 Bit
;
;
; DESCRIPTION:
; ============
; Developed on PIC 16C84, but executeable on all PIC 16XXX.
; Displays the 16 bit binary value stored in HI & LO on the
; LCD display in binary format (consecutive order).
; This routine is only used for debugging registers and bit-
; streams.
;
;
; NOTE:
; =====
; Call of implemented procedure with:
; "LCDbin_16", value in HI & LO
;
; HI & LO are not altered or cleared during operation and are
IFNDEF M_LCD_ID
ERROR "Missing include file: m_lcd.asm or similar"
ENDIF
IFNDEF b16_cnt
ERROR "ModuleError: Declare b16_cnt in MAIN PROGRAM"
ENDIF
IFNDEF LO
ERROR "ModuleError: Declare LO in MAIN PROGRAM"
ENDIF
IFNDEF LO_TEMP
ERROR "ModuleError: Declare LO_TEMP in MAIN PROGRAM"
ENDIF
IFNDEF HI
ERROR "ModuleError: Declare HI in MAIN PROGRAM"
ENDIF
IFNDEF HI_TEMP
LCDbin_16 macro
call LCDbin16
endm
LCDbin16
bsf HI_TEMP,0 ; set flag for first run with HI
movfw HI ; upper 8 bit to display = HI
bin_16 movwf LO_TEMP
movlw d'8'
movwf b16_cnt
bin_loop16
movlw '0'
btfsc LO_TEMP,7 ; check if bit is set, skip if cleared
movlw '1'
LCDw ; call LCD sub-routine with data stored in w
rlf LO_TEMP,1
decfsz b16_cnt,1
goto bin_loop16
;***************************************************************************
;
; RS232 Software Interface for PIC 16XXX
; ======================================
;
; written by Peter Luethi, 23.11.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 14.05.2004
;
; V1.02: Changed error handling to dedicated ISR termination label
; _ISR_RS232error required at the end of the ISR
; (11.04.2004)
; V1.01: Clean-up and improvements (30.12.2000)
; V1.00: Initial release (23.11.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock: 4.00 MHz XT
; Throughput: 1 MIPS
; Serial Rate: 2400 baud, 8 bit, no parity, 1 stopbit
; Required Hardware: RS232 level shifter (MAX232)
;
;
; DESCRIPTION:
; ============
; Developed and tested on PIC 16F84, executeable on all interrupt
; featured PICs.
; Program handles all aspects of
; Transmission (Register TXD) and
; Reception (Register RXD) through interrupt.
;
;
; END
;
; Example code snippet of ISR (to be implemented in main program):
; ----------------------------------------------------------------
; ;***** INTERRUPT SERVICE ROUTINE *****
; ISR <... context save ...>
;
; ;*** determine origin of interrupt ***
; btfsc INTCON,INTF ; check for RB0/INT interrupt
; goto _ISR_RS232 ; if set, there was a keypad stroke
;
; <... check other sources, if any ...>
;
; ; catch-all
; goto ISRend ; unexpected IRQ, terminate execution of ISR
;
; ;*** RS232 DATA ACQUISITION ***
; _ISR_RS232
; ; first, disable interrupt source
; bcf INTCON,INTE ; disable RB0/INT interrupt
; ; second, acquire RS232 data
; RECEIVE ; macro of RS232 software reception
; bsf RSflag ; enable RS232 data reception flag
; goto _ISR_RS232end ; terminate RS232 ISR properly
;
; <... other ISR sources' handling section ...>
;
; ;*** ISR Termination ***
; ; NOTE: Below, I only clear the interrupt flags! This does not
; ; necessarily mean, that the interrupts are already re-enabled.
; ; Basically, interrupt re-enabling is carried out at the end of
; ; the corresponding service routine in normal operation mode.
; ; The flag responsible for the current ISR call has to be cleared
; ; to prevent recursive ISR calls. Other interrupt flags, activated
; ; during execution of this ISR, will immediately be served upon
; ; termination of the current ISR run.
; _ISR_RS232error
; bsf INTCON,INTE ; after error, re-enable IRQ already here
; _ISR_RS232end
; bcf INTCON,INTF ; clear RB0/INT interrupt flag
; goto ISRend ; terminate execution of ISR
;
IFNDEF M_BANK_ID
ERROR "Missing include file: m_bank.asm"
ENDIF
IFNDEF TXport
ERROR "Define TXport in MAIN PROGRAM."
ENDIF
IFNDEF TXtris
ERROR "Define TXtris in MAIN PROGRAM."
ENDIF
IFNDEF BASE
ERROR "Declare BASE (Base address of user file registers) in MAIN PROGRAM"
ENDIF
IFNDEF TXD
ERROR "Declare TXD register in MAIN PROGRAM"
ENDIF
IFNDEF RXD
ERROR "Declare RXD register in MAIN PROGRAM"
ENDIF
RS232init macro
BANK1
bcf TXtris ; set output
bsf RXtris ; set input with weak pull-up
bcf OPTION_REG,INTEDG ; RS232 interrupt on falling edge
BANK0
bsf TXport ; set default state: logical 1
bcf INTCON,INTF ; ensure interrupt flag is cleared
bsf INTCON,INTE ; enable RB0/INT interrupt
bsf INTCON,GIE ; enable global interrupt
endm
SENDw macro
call SENDsub
endm
RECEIVE macro
call SB_Wait ; first wait sub-routine
btfsc RXport
goto _RSerror ; no valid start bit
movlw 0x08
movwf TEMP1 ; number of bits to receive, 9600-8-N-1
_RECa call T_Wait ; inter-baud wait sub-routine
btfsc RXport
bsf RXD,0x07
btfss RXport
bcf RXD,0x07
decfsz TEMP1,w ; skip if TEMP1 == 1
rrf RXD,f ; do this only 7 times
decfsz TEMP1,f
goto _RECa
call T_Wait ; inter-baud wait sub-routine
btfss RXport ; check if stop bit is valid
goto _RSerror ; no valid stop bit
endm
;*** When entering this subroutine, ISR context restore has already consumed some cycles ***
SB_Wait movlw 0x3C ; FOR RECEPTION of start bit
movwf TEMP2 ; total wait cycle : 208 us
goto X_Wait ; (=> sampling in the center of each bit)
goto X_Wait
RETURN
;***************************************************************************
;
; RS232 Software Interface for PIC 16XXX
; ======================================
;
; written by Peter Luethi, 21.11.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 14.05.2004
;
; V1.02: Changed error handling to dedicated ISR termination label
; _ISR_RS232error required at the end of the ISR
; (11.04.2004)
; V1.01: Clean-up and improvements (30.12.2000)
; V1.00: Initial release (21.11.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock: 4.00 MHz XT
; Throughput: 1 MIPS
; Serial Rate: 4800 baud, 8 bit, no parity, 1 stopbit
; Required Hardware: RS232 level shifter (MAX232)
;
;
; DESCRIPTION:
; ============
; Developed and tested on PIC 16F84, executeable on all interrupt
; featured PICs.
; Program handles all aspects of
; Transmission (Register TXD) and
; Reception (Register RXD) through interrupt.
;
;
; END
;
; Example code snippet of ISR (to be implemented in main program):
; ----------------------------------------------------------------
; ;***** INTERRUPT SERVICE ROUTINE *****
; ISR <... context save ...>
;
; ;*** determine origin of interrupt ***
; btfsc INTCON,INTF ; check for RB0/INT interrupt
; goto _ISR_RS232 ; if set, there was a keypad stroke
;
; <... check other sources, if any ...>
;
; ; catch-all
; goto ISRend ; unexpected IRQ, terminate execution of ISR
;
; ;*** RS232 DATA ACQUISITION ***
; _ISR_RS232
; ; first, disable interrupt source
; bcf INTCON,INTE ; disable RB0/INT interrupt
; ; second, acquire RS232 data
; RECEIVE ; macro of RS232 software reception
; bsf RSflag ; enable RS232 data reception flag
; goto _ISR_RS232end ; terminate RS232 ISR properly
;
; <... other ISR sources' handling section ...>
;
; ;*** ISR Termination ***
; ; NOTE: Below, I only clear the interrupt flags! This does not
; ; necessarily mean, that the interrupts are already re-enabled.
; ; Basically, interrupt re-enabling is carried out at the end of
; ; the corresponding service routine in normal operation mode.
; ; The flag responsible for the current ISR call has to be cleared
; ; to prevent recursive ISR calls. Other interrupt flags, activated
; ; during execution of this ISR, will immediately be served upon
; ; termination of the current ISR run.
; _ISR_RS232error
; bsf INTCON,INTE ; after error, re-enable IRQ already here
; _ISR_RS232end
; bcf INTCON,INTF ; clear RB0/INT interrupt flag
; goto ISRend ; terminate execution of ISR
;
IFNDEF M_BANK_ID
ERROR "Missing include file: m_bank.asm"
ENDIF
IFNDEF TXport
ERROR "Define TXport in MAIN PROGRAM."
ENDIF
IFNDEF TXtris
ERROR "Define TXtris in MAIN PROGRAM."
ENDIF
IFNDEF BASE
ERROR "Declare BASE (Base address of user file registers) in MAIN PROGRAM"
ENDIF
IFNDEF TXD
ERROR "Declare TXD register in MAIN PROGRAM"
ENDIF
IFNDEF RXD
ERROR "Declare RXD register in MAIN PROGRAM"
ENDIF
RS232init macro
BANK1
bcf TXtris ; set output
bsf RXtris ; set input with weak pull-up
bcf OPTION_REG,INTEDG ; RS232 interrupt on falling edge
BANK0
bsf TXport ; set default state: logical 1
bcf INTCON,INTF ; ensure interrupt flag is cleared
bsf INTCON,INTE ; enable RB0/INT interrupt
bsf INTCON,GIE ; enable global interrupt
endm
SENDw macro
call SENDsub
endm
RECEIVE macro
call SB_Wait ; first wait sub-routine
btfsc RXport
goto _RSerror ; no valid start bit
movlw 0x08
movwf TEMP1 ; number of bits to receive, 9600-8-N-1
_RECa call T_Wait ; inter-baud wait sub-routine
btfsc RXport
bsf RXD,0x07
btfss RXport
bcf RXD,0x07
decfsz TEMP1,w ; skip if TEMP1 == 1
rrf RXD,f ; do this only 7 times
decfsz TEMP1,f
goto _RECa
call T_Wait ; inter-baud wait sub-routine
btfss RXport ; check if stop bit is valid
goto _RSerror ; no valid stop bit
endm
;*** When entering this subroutine, ISR context restore has already consumed some cycles ***
SB_Wait movlw 0x18 ; FOR RECEPTION of start bit
movwf TEMP2 ; total wait cycle : 104 us
goto X_Wait ; (=> sampling in the center of each bit)
goto X_Wait
RETURN
;***************************************************************************
;
; RS232 Software Interface for PIC 16XXX
; ======================================
;
; written by Peter Luethi, 31.01.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 14.05.2004
;
; V1.02: Changed error handling to dedicated ISR termination label
; _ISR_RS232error required at the end of the ISR
; (11.04.2004)
; V1.01: Clean-up and improvements (30.12.2000)
; V1.00: Initial release (31.01.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock: 4.00 MHz XT
; Throughput: 1 MIPS
; Serial Rate: 9600 baud, 8 bit, no parity, 1 stopbit
; Required Hardware: RS232 level shifter (MAX232)
;
;
; DESCRIPTION:
; ============
; Developed and tested on PIC 16F84, executeable on all interrupt
; featured PICs.
; Program handles all aspects of
; Transmission (Register TXD) and
; Reception (Register RXD) through interrupt.
;
;
; END
;
; Example code snippet of ISR (to be implemented in main program):
; ----------------------------------------------------------------
; ;***** INTERRUPT SERVICE ROUTINE *****
; ISR <... context save ...>
;
; ;*** determine origin of interrupt ***
; btfsc INTCON,INTF ; check for RB0/INT interrupt
; goto _ISR_RS232 ; if set, there was a keypad stroke
;
; <... check other sources, if any ...>
;
; ; catch-all
; goto ISRend ; unexpected IRQ, terminate execution of ISR
;
; ;*** RS232 DATA ACQUISITION ***
; _ISR_RS232
; ; first, disable interrupt source
; bcf INTCON,INTE ; disable RB0/INT interrupt
; ; second, acquire RS232 data
; RECEIVE ; macro of RS232 software reception
; bsf RSflag ; enable RS232 data reception flag
; goto _ISR_RS232end ; terminate RS232 ISR properly
;
; <... other ISR sources' handling section ...>
;
; ;*** ISR Termination ***
; ; NOTE: Below, I only clear the interrupt flags! This does not
; ; necessarily mean, that the interrupts are already re-enabled.
; ; Basically, interrupt re-enabling is carried out at the end of
; ; the corresponding service routine in normal operation mode.
; ; The flag responsible for the current ISR call has to be cleared
; ; to prevent recursive ISR calls. Other interrupt flags, activated
; ; during execution of this ISR, will immediately be served upon
; ; termination of the current ISR run.
; _ISR_RS232error
; bsf INTCON,INTE ; after error, re-enable IRQ already here
; _ISR_RS232end
; bcf INTCON,INTF ; clear RB0/INT interrupt flag
; goto ISRend ; terminate execution of ISR
;
IFNDEF M_BANK_ID
ERROR "Missing include file: m_bank.asm"
ENDIF
IFNDEF TXport
ERROR "Define TXport in MAIN PROGRAM."
ENDIF
IFNDEF TXtris
ERROR "Define TXtris in MAIN PROGRAM."
ENDIF
IFNDEF BASE
ERROR "Declare BASE (Base address of user file registers) in MAIN PROGRAM"
ENDIF
IFNDEF TXD
ERROR "Declare TXD register in MAIN PROGRAM"
ENDIF
IFNDEF RXD
ERROR "Declare RXD register in MAIN PROGRAM"
ENDIF
RS232init macro
BANK1
bcf TXtris ; set output
bsf RXtris ; set input with weak pull-up
bcf OPTION_REG,INTEDG ; RS232 interrupt on falling edge
BANK0
bsf TXport ; set default state: logical 1
bcf INTCON,INTF ; ensure interrupt flag is cleared
bsf INTCON,INTE ; enable RB0/INT interrupt
bsf INTCON,GIE ; enable global interrupt
endm
SENDw macro
call SENDsub
endm
RECEIVE macro
call SB_Wait ; first wait sub-routine
btfsc RXport
goto _RSerror ; no valid start bit
movlw 0x08
movwf TEMP1 ; number of bits to receive, 9600-8-N-1
_RECa call T_Wait ; inter-baud wait sub-routine
btfsc RXport
bsf RXD,0x07
btfss RXport
bcf RXD,0x07
decfsz TEMP1,w ; skip if TEMP1 == 1
rrf RXD,f ; do this only 7 times
decfsz TEMP1,f
goto _RECa
call T_Wait ; inter-baud wait sub-routine
btfss RXport ; check if stop bit is valid
goto _RSerror ; no valid stop bit
endm
;*** When entering this subroutine, ISR context restore has already consumed some cycles ***
SB_Wait movlw 0x08 ; FOR RECEPTION of start bit
movwf TEMP2 ; total wait cycle: 52 us
goto X_Wait ; (=> sampling in the center of each bit)
goto X_Wait
RETURN
;***************************************************************************
;
; RS232 Software Interface for PIC 16XXX
; ======================================
;
; written by Peter Luethi, 21.11.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 14.05.2004
;
; V1.02: Changed error handling to dedicated ISR termination label
; _ISR_RS232error required at the end of the ISR
; (11.04.2004)
; V1.01: Clean-up and improvements (30.12.2000)
; V1.00: Initial release (21.11.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock: 4.00 MHz XT
; Throughput: 1 MIPS
; Serial Rate: 19200 baud, 8 bit, no parity, 1 stopbit
; Required Hardware: RS232 level shifter (MAX232)
;
;
; DESCRIPTION:
; ============
; Developed and tested on PIC 16F84, executeable on all interrupt
; featured PICs.
; Program handles all aspects of
; Transmission (Register TXD) and
; Reception (Register RXD) through interrupt.
;
;
; END
;
; Example code snippet of ISR (to be implemented in main program):
; ----------------------------------------------------------------
; ;***** INTERRUPT SERVICE ROUTINE *****
; ISR <... context save ...>
;
; ;*** determine origin of interrupt ***
; btfsc INTCON,INTF ; check for RB0/INT interrupt
; goto _ISR_RS232 ; if set, there was a keypad stroke
;
; <... check other sources, if any ...>
;
; ; catch-all
; goto ISRend ; unexpected IRQ, terminate execution of ISR
;
; ;*** RS232 DATA ACQUISITION ***
; _ISR_RS232
; ; first, disable interrupt source
; bcf INTCON,INTE ; disable RB0/INT interrupt
; ; second, acquire RS232 data
; RECEIVE ; macro of RS232 software reception
; bsf RSflag ; enable RS232 data reception flag
; goto _ISR_RS232end ; terminate RS232 ISR properly
;
; <... other ISR sources' handling section ...>
;
; ;*** ISR Termination ***
; ; NOTE: Below, I only clear the interrupt flags! This does not
; ; necessarily mean, that the interrupts are already re-enabled.
; ; Basically, interrupt re-enabling is carried out at the end of
; ; the corresponding service routine in normal operation mode.
; ; The flag responsible for the current ISR call has to be cleared
; ; to prevent recursive ISR calls. Other interrupt flags, activated
; ; during execution of this ISR, will immediately be served upon
; ; termination of the current ISR run.
; _ISR_RS232error
; bsf INTCON,INTE ; after error, re-enable IRQ already here
; _ISR_RS232end
; bcf INTCON,INTF ; clear RB0/INT interrupt flag
; goto ISRend ; terminate execution of ISR
;
IFNDEF M_BANK_ID
ERROR "Missing include file: m_bank.asm"
ENDIF
IFNDEF TXport
ERROR "Define TXport in MAIN PROGRAM."
ENDIF
IFNDEF TXtris
ERROR "Define TXtris in MAIN PROGRAM."
ENDIF
IFNDEF BASE
ERROR "Declare BASE (Base address of user file registers) in MAIN PROGRAM"
ENDIF
IFNDEF TXD
ERROR "Declare TXD register in MAIN PROGRAM"
ENDIF
IFNDEF RXD
ERROR "Declare RXD register in MAIN PROGRAM"
ENDIF
RS232init macro
BANK1
bcf TXtris ; set output
bsf RXtris ; set input with weak pull-up
bcf OPTION_REG,INTEDG ; RS232 interrupt on falling edge
BANK0
bsf TXport ; set default state: logical 1
bcf INTCON,INTF ; ensure interrupt flag is cleared
bsf INTCON,INTE ; enable RB0/INT interrupt
bsf INTCON,GIE ; enable global interrupt
endm
SENDw macro
call SENDsub
endm
RECEIVE macro
call SB_Wait ; first wait sub-routine
btfsc RXport
goto _RSerror ; no valid start bit
movlw 0x08
movwf TEMP1 ; number of bits to receive, 9600-8-N-1
_RECa call T_Wait ; inter-baud wait sub-routine
btfsc RXport
bsf RXD,0x07
btfss RXport
bcf RXD,0x07
decfsz TEMP1,w ; skip if TEMP1 == 1
rrf RXD,f ; do this only 7 times
decfsz TEMP1,f
goto _RECa
call T_Wait ; inter-baud wait sub-routine
btfss RXport ; check if stop bit is valid
goto _RSerror ; no valid stop bit
endm
;*** When entering this subroutine, ISR context restore has already consumed some cycles ***
SB_Wait movlw 0x01 ; FOR RECEPTION of start bit
movwf TEMP2 ; total wait cycle : 26 us
goto X_Wait ; (=> sampling in the center of each bit)
goto X_Wait
RETURN
;***************************************************************************
;
; RS232 Software Interface for PIC 16XXX
; ======================================
;
; written by Peter Luethi, 16.04.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 14.05.2004
;
; V1.02: Changed error handling to dedicated ISR termination label
; _ISR_RS232error required at the end of the ISR
; (11.04.2004)
; V1.01: Clean-up and improvements (30.12.2000)
; V1.00: Initial release (16.04.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock: 4.00 MHz XT
; Throughput: 1 MIPS
; Serial Rate: 9600 baud, 7 bit, no parity, 1 stopbit
; Required Hardware: MAX 232
;
;
; DESCRIPTION:
; ============
; Developed and tested on PIC 16F84, executeable on all interrupt
; featured PICs.
; Program handles all aspects of
; Transmission (Register TXD) and
; Reception (Register RXD) through interrupt.
;
;
; END
;
; Example code snippet of ISR (to be implemented in main program):
; ----------------------------------------------------------------
; ;***** INTERRUPT SERVICE ROUTINE *****
; ISR <... context save ...>
;
; ;*** determine origin of interrupt ***
; btfsc INTCON,INTF ; check for RB0/INT interrupt
; goto _ISR_RS232 ; if set, there was a keypad stroke
;
; <... check other sources, if any ...>
;
; ; catch-all
; goto ISRend ; unexpected IRQ, terminate execution of ISR
;
; ;*** RS232 DATA ACQUISITION ***
; _ISR_RS232
; ; first, disable interrupt source
; bcf INTCON,INTE ; disable RB0/INT interrupt
; ; second, acquire RS232 data
; RECEIVE ; macro of RS232 software reception
; bsf RSflag ; enable RS232 data reception flag
; goto _ISR_RS232end ; terminate RS232 ISR properly
;
; <... other ISR sources' handling section ...>
;
; ;*** ISR Termination ***
; ; NOTE: Below, I only clear the interrupt flags! This does not
; ; necessarily mean, that the interrupts are already re-enabled.
; ; Basically, interrupt re-enabling is carried out at the end of
; ; the corresponding service routine in normal operation mode.
; ; The flag responsible for the current ISR call has to be cleared
; ; to prevent recursive ISR calls. Other interrupt flags, activated
; ; during execution of this ISR, will immediately be served upon
; ; termination of the current ISR run.
; _ISR_RS232error
; bsf INTCON,INTE ; after error, re-enable IRQ already here
; _ISR_RS232end
; bcf INTCON,INTF ; clear RB0/INT interrupt flag
; goto ISRend ; terminate execution of ISR
;
IFNDEF M_BANK_ID
ERROR "Missing include file: m_bank.asm"
ENDIF
IFNDEF TXport
ERROR "Define TXport in MAIN PROGRAM."
ENDIF
IFNDEF TXtris
ERROR "Define TXtris in MAIN PROGRAM."
ENDIF
IFNDEF BASE
ERROR "Declare BASE (Base address of user file registers) in MAIN PROGRAM"
ENDIF
IFNDEF TXD
ERROR "Declare TXD register in MAIN PROGRAM"
ENDIF
IFNDEF RXD
ERROR "Declare RXD register in MAIN PROGRAM"
ENDIF
RS232init macro
BANK1
bcf TXtris ; set output
bsf RXtris ; set input with weak pull-up
bcf OPTION_REG,INTEDG ; RS232 interrupt on falling edge
BANK0
bsf TXport ; set default state: logical 1
bcf INTCON,INTF ; ensure interrupt flag is cleared
bsf INTCON,INTE ; enable RB0/INT interrupt
bsf INTCON,GIE ; enable global interrupt
endm
SENDw macro
call SENDsub
endm
RECEIVE macro
call SB_Wait ; first wait sub-routine
btfsc RXport
goto _RSerror ; no valid start bit
movlw 0x07
movwf TEMP1 ; number of bits to receive, 9600-7-N-1
_RECa call T_Wait ; inter-baud wait sub-routine
btfsc RXport
bsf RXD,0x07
btfss RXport
bcf RXD,0x07
rrf RXD,f ; do this 7 times
decfsz TEMP1,f
goto _RECa
bcf RXD,0x07 ; clear MSB since only 7 bits arrived
call T_Wait ; inter-baud wait sub-routine
btfss RXport ; check if stop bit is valid
goto _RSerror ; no valid stop bit
endm
;*** When entering this subroutine, ISR context restore has already consumed some cycles ***
SB_Wait movlw 0x08 ; FOR RECEPTION of start bit
movwf TEMP2 ; total wait cycle: 52 us
goto X_Wait ; (=> sampling in the center of each bit)
goto X_Wait
RETURN
Concept
Available resources
This Excel Worksheet has been designed to speed-up the implementation of 16 bit assembler look-up tables.
There are the following advantages:
The Worksheet activates a Visual Basic macro, which fetchs the hexadecimal blocks from the table.
The "Analyse-Function" Excel Add-In needs to be switched on to calculate the 8 bit hexadecimal blocks from the
decimal values.
The software has been tested under Windows 95 and Excel 97 on a Pentium 166.
The assembler source code, which shows the implementation of the table read is available under :
projects / 16 bit table read.
[Toc] [Top]
Teleclub-Decoder
Update August 2002: Teleclub wird digital! Wirklich? In vielen Gemeinden ist der Teleclub weiterhin analog zu
empfangen. Hier kann dieser Decoder immernoch funktionieren!
Update Mai 2000: Bestellnummern berprft und angepasst. Der Decoder luft auch im sterreichischen Wien fr den
Sender TELEKINO!
ACHTUNG: Der Nachbau und Betrieb dieser Schaltung zum Empfangen von "Teleclub" ist verboten!
Die hier zu findenden Informationen sind ausschliesslich zur Information und Weiterbildung gedacht!
Inhalt:
Layout
Bestckungsplan
Schema
Stckliste
Bauanleitung
Abgleichanleitung
FAQ
Links zum Thema
Layout:
zurck...
download, anzeigen
Bestckungsplan:
zurck...
download, anzeigen
Schema:
zurck...
Fr die technisch interessierten Leute hier das genaue Schema des Decoders. Zum Anschauen am Bildschirm oder zum
downloaden und ausdrucken...
Stckliste:
zurck...
Das sind die Bauteile die unbedingt bentigt werden. Wer den Decoder mit Batterie betreiben will oder schon ein Netzteil besitzt,
und wer die Antennenkabel direkt auf den Print lten will, kann sich damit einen fertigen, perfekt funktionierenden Decoder
bauen. Fr alle die etwas hhere Ansprche haben, hier noch einige Bauteile fr die "Luxus-Ausfhrung"...
Bauanleitung:
zurck...
Abgleichanleitung:
zurck...
Der Abgleich erfordert einiges an Gedult. Also nicht gleich aufgeben bevor man nicht mindestens 20min an den Potis
herumgeschraub hat. Grundstzlich lsst sich sagen: Wenn sich das Bild eines uncodierten Senders durch Einschalten des
Decoders irgendwie verndert, dann funktioniert er auch.
1. Decoder in die Antennenleitung des Fernsehers oder Videos schalten. Scart Strecker anschliessen. (WICHTIG: Scart- und
Antennenstecker mssen am selben Gert angeschlosen werden!)
2. Potentiometer wie folgt einstellen: P1 ganz nach rechts, P2 in Mittelstellung, P3 Mittelstellung, P4 ganz nach rechts, P5 ganz
nach links, P6 ganz nach links, C1 auf maximale Kapazitt.
Die Stellungen "links" und "rechts" bei den stehend montierten Potentiometern sind wie folgt definiert:
Die Potentiometer P5, P6 und P3 knnen normalerweise in dieser Stellung belassen werden. Fr die Einstellung des Decoders
sind vorallem P1, P2 und P4 von Bedeutung.
3. Einen uncodierten Sender einstellen. Solange der Decoder ausgeschalten ist, sollte das Bild absolub normal erscheinen. Sobald
der Decoder aber eingeschalten wird, erscheinen helle, horizontale Streifen und das Bild ist unruhig.
4. Bild mit P2 stabilisieren. Die Streifen bleiben, das Bild sollte aber ruhiger werden.
5. P1 langsam nach links drehen, bis die Streifen pltzlich verschwinden und das Bild gleichmssig hell erscheint.
6. Auf Teleclub umschalten. P4 langsam nach links drehen bis das decodierte Bild erscheint.
8. Mit P4 kann die horizontale Position des Bildes so eingestellt werden, dass keine flimmernden Kanten an den Bildrndern
links und rechts zu sehen sind.
11. Je nach verwendetem Fernsehgert oder Videorecorder kann es sein dass der Eingangspegel des SCART-Signals mit P3
nachgestellt werden muss.
Nichts funktioniert? Oder sonstige Probleme mit dem Ablgeich? Vielleicht steht was im FAQ...
Electronic
Circuits &
Radio Controlled
Modeling
Microchip PIC
Microcontrollers
R/C Modeling
Photo Gallery
Electronic Circuits
Servo Checker
http://www.electronic-engineering.ch/index.html12/02/2008 17:13:01
Guestbook of www.electronic-engineering.ch
Guestbook
Hallo peter jan, 17 juni a.s is er op vliegbasis leeuwarden de jaarlijkse open dag van de kon. luchtmacht. er
komen alle bekende stuntteams van de navo, vooral de blue angels uit de usa zijn bijzonder zij zullen
eenmalig in europa optreden. het volledige programma vind je op google :kon.luchtmacht, open dagen 2006.
belangstelling?? groeten uit nijverdal.
Hans Voortman Nijverdal Nederland no URL given
Thanks for the oportunity to tell you what a great site this is. Many thanks, johneiderton@gmail.com
John Eiderton Nanjing China no URL given
What an incredible source for pic users!!! It's a very very impressive work you have done here!! Probably
the best on those topics we can find on the web! Crystal clear informations!!! Thanks a lot for such a
synthetic view of the lcd, RS232 and RC program using PIC micro!!! Thanks a lot!
Vincent Paris France no URL given
Excellent website! I have tried a lot of your serial LCD modules, adapting them to 20 Mhz instead of 4 Mhz,
using PIC16F84A and PIC16F877A and 4x20, 2x12, 2x16 and 2x40 LCD's. I also slowed down the
animation when first connecting to the serial port. At 20 Mhz it was running really fast! Your assembler
modules have worked smoothly. Thanks again... I really do appreciate your hard work!
Mark Zembal Town of York Canada no URL given
I'm also a radio modeler like you with prefers into giant scale models. I 'm a mechanical engineer but I'm
new in PICs and I found your site very helpful. You have done a nice work! It will help me to begin more
easy with PICs. Thank you, Prodromos
Prodromos Kavala Greece no URL given
Hola! Enhorabuena por tu pgina, los contenidos que tienes en ella son muy buenos y me estan sirviendo
mucho para el proyecto que estoy desarrollando. Gracias !! Y saludos desde Espaa !! Byez...
Charly Zaragoza Espaa no URL given
down graded to 1 meter steps (atmospheric variations mess things up a bit) The RX will also have a sensor
(the reference pressure at ground level) to help eliminate the atmospheric variations. I hope to have this
system up and running in about a month's time. I hope this lot will provide you with some further ideas. The
use of such a device in a model glider is unbelievable. You learn so much form it. You can also set up/trim a
competition plane for minimum sink quite easily with such an instrument. Good luck
Brian Mulder Cape Town South Africa no URL given
[Top]
About Me
General
Welcome at my website. My name is Peter Luethi. After having been working abroad at AMD Dresden Design Center for nearly 3
years, I have moved back from Dresden, Germany to Urdorf, Switzerland. At November 1, 2003, I have started my Ph.D. thesis back
at the Integrated Systems Laboratory of the Swiss Federal Institute of Technology (ETH Zurich) in Switzerland.
My favourite hobbies are scuba diving, playing volleyball (Height: 1.98m, so do not ask on which position ...), creating convenient
electronic circuits and building and building and building and finally flying RC model airplanes. Take a glance at my "baby"...
I hope you've got some inspiration, useful information or applications to develop your own electronic circuits.
During my study...
In 1999, I have been working for 3 months at Philips Semiconductors Zurich. I have updated and built new cell libraries (pcells) for
the Cadence Design Framework. I was busy with creating Parametrizable on-chip CMOS decoupling Capacitors and
Parametrizable high-voltage CMOS Transistors (0 - 16 V). The aim of my project was to get easy drag and drop cells with
automatic DRC-compliant layout generation, so that the analog design engineers do not have to draw (and match) the layout all the
time by hand. The process was a single poly, 2 metal, 0.6 um CMOS process.
These parametrizable cells are used in CMOS LCD driver chips for mobile phones. The chips are sold as ASSPs (application
specific standard product). Note: In almost every Nokia mobile is a Philips LCD driver chip, and maybe today some of my
parametrizable on-chip capacitors...
I have also participated in a robot contest at our university. Our team consisted of 5 students, 3 electrical engineers and 2 mechanical
engineers. Here are some pictures of the Swiss SmartROB Championships at the Swiss Federal Institute of Technology in Zurich.
We have finished our students project "Parametrizable Hybrid Stack-Register Processor as VHDL Soft Intellectual Property
Module". The processor is designed to handle medium to high interrupt rates very efficiently. Therefore our processor architecture is
based on a mixture between stack and register-based architecture to merge the advantages of both of them. I've written a scientific
paper about this project and presented it at the 13th Annual IEEE International ASIC/SOC Conference, September 2000,
Washington D.C., USA.
We have also finished our second project, a "Low Cost Inertial Navigation System" based on piezo acceleration sensors and piezo
gyros. Our task was to find out, how precise navigation is possible and where the bottle-neck will be. The whole system consists of
three acceleration sensors, three gyros, some filter stages, a PCMCIA data acquisition card and a portable computer. It worked quite
well: The current setup is suitable for measuring and controlling the spatial representation (that means the acceleration and the
angles), but is not able to trace the actual position. First, the accuracy of the sensors have to be improved by a factor of 10 to be able
to calculate a reliable position. And also some more sophisticated algorithms like kalman filters and suitable position feedback/
update mechanisms are necessary, maybe in conjunction with additional GPS data.
At home, when time comes by, I'm busy with the Motorola MPXS4100A absolute pressure sensor.
I try to build a precision digital altimeter with the NSC ADC12130 12 bit A/D converter, two PIC 16F84 microcontroller, a Dot-
LCD display and a wireless transmitter and receiver. The aim is to get the actual altitude of my airplanes in real time, providing the
base for further enhancements such as a variometer,...
When this circuit is working well, I'll maybe interface a Microchip 24C65 IC-EEPROM to get an autonomous data-logger.
Afterwards the logged data will be transmitted to a PC into an Excel worksheet to visualize the route flown.
I have successfully finished my M.Sc. diploma thesis in electrical engineering on the Southbridge of the chipset for the next-
generation AMD 64 bit "hammer series" processors (the powerful "Sledgehammer" and his smaller counterpart, the "Clawhammer")
at AMD Dresden Design Center, Germany.
My task was to setup a performance analysis, which is capable of revealing possible performance bottlenecks already during
implementation time and addressing solutions to cope with these problems. The performance analysis should cover the entire
Southbridge with all its specific protocols, also the new Lightning Data Transport" (LDT) bus* specified to transmit up to 1600 mtps
(million transactions per second). The LDT bus developed and standardized by a special interest group including AMD is
implemented between North- and Southbridge and will serve the 64 bit / 66 MHz PCI bus bridges and the devices attached to the
Southbridge. So there was and still is enough work to be done...
I have been working at the AMD Dresden Design Center, Germany on RTL-based block- and system-level verification and
performance analysis for next-generation HyperTransport" chipsets for AMDs x86-64 CPUs (see picture of AMD 8111 x86-64
Southbridge "Thor" below).
I checked the correct functionality and interoperability of next-generation HyperTransport" chipsets for AMD's hammer series. I
also received the "AMD Fab 30 Vice President's Award" for outstanding achievements in conjunction with my diploma thesis
"Performance Analysis of AMD Southbridge Zorak". In March 2003, I got the Best Paper Award at "Verisity's Club Verification" for
"Verification Glue: How to compose system-level environments".
Today...
After having been abroad for nearly 3 years, I have moved back from Dresden, Germany to Urdorf/Zurich, Switzerland in September
2003.
At November 1, 2003, I have started my Ph.D. thesis back at the Integrated Systems Laboratory of the Swiss Federal Institute of
Technology (ETH Zurich) in Switzerland.
My project is in the area of MU-MIMO (Multi-User Multiple Input Multiple Output) for fourth generation (4G) wireless systems.
The main objective of MIMO is to increase the overall data rate by using the same bandwidth but multiple antennas to transmit
multiple data streams simultaneously. MIMO technology allows for significant increase in throughput, range and quality of service
(QoS) at the same overall transmit power and without additional bandwidth expenditure.
MIMO-based communication is only highly beneficial if we have a so-called rich-scattering environment, i.e. numerous signal
reflections, for instance in a large open indoor office environment. When radio signals are travelling across such an environment,
they get their independent spatial signature imposed by different wave reflections and absorbtions. The spatial signatures are affected
by the frequency of the signal, the environment (channel), but very important, also by the location of transmit and receive antennas.
In the case of MIMO communication, we are transmitting different signals from spatially different transmit antennas to spatially
different receive antennas, therefore every received signal has obtained its independent spatial signature. Since all radio signals are
transmitted simultaneously in the same frequency band, the receiver gets a superposition of all signals. The task of the MIMO
receiver is to separate this superposition into different data streams. The spatial signatures can be measured in the receiver (channel
estimation), and afterwards inverted (channel inversion). The subsequent equalization of the received signal is carried out to split the
received signal into different data streams originally sent by the MIMO transmitter. The complexity and performance of channel
inversion and data equalization are heavily related to the underlying MIMO detection algorithm.
Some sophisticated algorithms, demanding data processing, and high-performance digital integrated circuits behind the radio-
frequency (RF) front-end are the pre-requisites for this wireless acquisition methodology. The research focus of our team starts with
algorithm analysis (select suitable candidate algorithms with respect to a subsequent hardware implementation) and MATLAB
programming (assess reduced precision effects, i.e. fixed-point evaluation), includes VHDL coding, synthesis and functional
verification, and finally needs also integration on FPGA prototyping hardware or ASICs. The goal is to demonstrate a dedicated
subset of algorithms (e.g. linear, pseudo-linear or non-linear MIMO detection) on an OFDM based MU-MIMO hardware testbed
with wireless links in real-time. The work serves as assessment of algorithmic- and/or hardware-related issues regarding possible
future industrial high-density integration.
If you have any comments, hints or suggestions, or even improvements of the provided circuits,
you may contact me at web@electronic-engineering.ch (not to be abused by spam)
Please be aware that it may take some time until I answer the question.
In case of too many requests, I won't be able to answer all of them due to limited time.
This site was checked by SiteInspector and, with the exception of popularity, excellent rated !
[Top]
Study theses
Publications
Awards
The task was to develop an autonomously navigating robot, which had to be able to detect and collect
letters - also autonomously. The letters were distributed in a square area of 7.9 x 7.9 meters, which
was designed as a labyrinth.
The aim was to develop a highly parametrizable RISC processor as soft IP (Intellectual Property)
module based on VHDL (Very high speed integrated circuits Hardware Description Language) for
embedded systems.
Features:
The aim of the project was first to design a complete inertial navigation system and second to find out,
how precise such a platform built from low cost sensors is and how its performance can be improved.
The "Zorak" Southbridge is a prototype part of the chipset for the next-generation AMD 64 bit
"hammer series" processors (the powerful "Sledgehammer" and his smaller counterpart, the
"Clawhammer"). My task was to setup a performance analysis environment for the "Zorak"
Southbridge, which is capable of revealing possible performance bottlenecks already during
implementation time in RTL design. The performance analysis covers the entire Southbridge with all
its specific protocols, also the new Lightning Data Transport (LDT)* bus specified to transmit up to
1600 mtps (million transactions per second). One transaction could be done on various data widths: If
we take one byte at maximum clock rate, the resulting bandwidth will be 1.6 GB/s, but allowing for
even more by using larger data widths. The LDT bus developed and standardized by a special
interest group (SIG) including AMD is implemented between North- and Southbridge and will serve
the 64 bit / 66 MHz PCI bus bridges (and other bridges) and the devices attached to the Southbridge.
So there was and still is enough work to be done...
I am now with AMD Dresden Design Center, Germany, working on RTL-based block- and system
level verification and performance analysis. I check the correct functionality and interoperability of
next-generation HyperTransport chipsets for AMD's hammer series.
"... for your excellent diploma thesis 'Performance Analysis of AMD Southbridge Zorak' and extensive
documentation of the software structure and its internal blocks - the prerequisite for further usage and
development ..."
[Toc] [Top]
Links
Table of Contents [Toc]
Electronic Links
Microchip PIC Links
R/C Links
GPS Links
Data Sheets & Application Notes
Colleague's Sites
Xsens.com
Embedded inertial navigation solutions.
IO.DLL
Universal Windows I/O driver, IO.DLL allows seamless port I/O operations for Windows 95/98/
NT/2000/XP using the same library
Wireless World AG
Swiss distributor for various wireless components
u-blox GPS
Swiss miniature MCM* 12 channel GPS receiver.
* Multi-Chip-Module
Larry's Garmin connector
Interface your GPS to a computer using the RS232 port.
Peter Bennett's GPS and NMEA Site - Garmin Support
National Semiconductors
Infineon
Maxim Semiconductors
Linear Technology
QuestLink
Free subscription, very good for everything!
Microchip PIC Microcontroller
Manufacturer of my micro-controllers. You can get there all PIC data sheets, many application notes
and the MPLAB Integrated Development Environment for free.
Fairchild Semiconductor
Chip directory
www.tmoser.ch
Thomas Moser has studied electrical engineering together with me. He worked with me on the Swiss
SmartROB Contest and the Low Budget Inertial Navigation System. He is interested in network and
distributed computing, and embedded systems engineering.
www.lka.ch
Lukas Karrer has also studied electrical engineering with me. We did not work together on any
projects, but we had a great time. He is interested in network computing (founder of swiss non-
commercial Unix-dedicated website www.trash.net), and web content usability (start-up www.stimmt.
ch).
www.zwickers.ch
Thomas Zwicker, another study colleague, is interested in network computing and image processing
algorithms. He is busy with developing an autonomous flying radio controlled helicopter.
[Toc] [Top]
Software
Electronics
DCF77 Capture & Visualization (Excel 97 Worksheet with Visual Basic Macro)
Automatic Table Generator for MPLAB Assembler (Excel 97 Worksheet with Visual Basic Macro)
Windows 95 HyperTerminal
because Windows 98 HyperTerminal does not echo locally typed 153 kB HyperTerminal95.zip
characters.
Windows 95/98
88.4 kB osc251.zip
implemented by a student at Moscows State University, Physic
Dep., Homepage with Versions for Win3.x/Win95
This page has been created using HomeSite V1.2, an excellent HTML source
503 kB hs12.exe
code editor implemented by Nick Bradbury. Windows 95/98
Virtual desktop for Windows 95/98 (to get several desktops like in Unix/
Linux systems, crucial for convenient programming, but presumes enough
234 kB sDesk.zip
RAM for smooth operation, works fine with 128 MB RAM and 500 MHz
CPU)
For Windows XP, use the Microsoft PowerToys to get multiple desktops.
[Toc] [Top]
Data Sheets
Table of Contents [Toc]
PIC Instruction Set Quick Reference Quick reference of all PIC instructions, including special
instruction mnemonics. This data sheet was extracted with
GhostView directly from document DS33014G, MPASM
User's Guide, pp. 196-209.
(PDF, 116 kB)
Hitachi HD44780 Data Sheet Everything about the dot matrix LCD controller IC Hitachi
HD44780.
(PDF, 389 kB)
Samsung KS0073 Data Sheet Everything about the dot matrix LCD controller IC Samsung
KS0073.
(PDF, 673 kB)
The Extended Concise LCD Data Sheet Describes all commands for the Dot Matrix LCD Display.
This document is based on the earlier version "The Concise
LCD Data Sheet" written by Craig Peacock, Australia. Thanks
also to Craig Peacock, who made a smaller PDF 1.2 file with
an original Acrobat PDF Writer.
(PDF, 44 kB)
Link: How to control HD44780 based LCDs Describes the basics of the Hitachi HD44780 based character
LCDs.
(Peer Ouwehand's LCD pages)
[Toc] [Top]
I first entered the microcontroller world with a proprietary, mask-programmed controller kit bought from Conrad Electronics, a german electronics distributor. It was a Conrad C-Control Basic kit, a
68HC05B based controller board with RS232 link and an external serial EEPROM as program memory. The user develops its application in a kind of BASIC programming language, which is
afterwards translated by the development software into byte-tokens. The byte tokens are then loaded into the serial EEPROM. During execution, the controller reads these byte-tokens from the
external EEPROM and interprets them using the internal, pre-programmed routines. For first contact with microcontrollers, it was a good approach, although there were some unsatisfying facts:
These reasons have lead me to change to another controller solution. Finally, I decided to change to the Microchip PIC controllers.
The Microchip PIC microcontrollers are a convenient and cost-effective solution for a lot of home-made applications, because:
Although I use PIC microcontrollers often, I would not consider the PIC microcontroller as high-performance RISC controller - as claimed by the manufacturer. High-performance - compared to
what? There is no reference for comparison given...
On the other hand, I personally would implement a more sophisticated architecture based on one instruction per oscillator cycle, i.e. 1 MIPS @ 1 MHz. This is more power-efficient and would at least
indicate that there is best use made of every clock cycle when using a single execution pipeline. For the core, I would check the requirements carefully and decide whether to use a two, three or four
stage pipeline. And for not loosing any performance, additional delayed-branching would be introduced. A deeper stack for the program counter may also be suitable, especially when serving a lot of
interrupt sources and doing prioritized interrupt handling in software (i.e. another high-priority ISR call during a low-priority ISR call). Finally, an ability to check the stack levels used would also be
welcome, as well as hardware-based context save on entrance and exit of the interrupt service routine.
I started with the PIC16C84 (an early EEPROM version of today's standard flash version 16F84).
Today, I would say, the PIC16F84 is the best-suited Microchip RISC controller to start with:
PIC16F84
Once you have acquired some experience in PIC programming and you are familiar with the PIC architecture, I suggest to switch to the PIC16F77 (that's what I did also). It offers a lot of peripheral
hardware blocks, so that you don't have to handle this in software (e.g. RS232 transmission and reception):
PIC16F77
You can also switch directly to the PIC16F877, which offers additional peripheral interfaces, especially if you want to connect some IC peripheral components:
PIC16F877
I started with the PICSTART Plus development programmer from Microchip in 1998, and I still use the same programmer today:
This setup programs most PIC microcontrollers (PIC12xxx, PIC16xxx, PIC17xxx, PIC18xxx), and allows firmware updates whenever new PIC controllers come out. I have never experienced any
issues using this commercially available programmer with the Windows operating system (Win95, Win98, WinXP). You just have to ensure that the intended RS232 port to use is in the range of
Com1 to Com4.
The latest version of the PICSTART Plus programmer allows instant software-based firmware updates to the internal flash controller. See buy.microchip.com for ordering details.
Years ago, I had to buy an extra PIC controller (UV-erasable PIC17C44JW) and had to burn the corresponding firmware to it (HEX-file supplied with MPLAB IDE). But Microchip abandoned this
re-programming procedure of the 17C44JW some times ago. Today, the firmware upgrade of the programmer is performed directly from MPLAB IDE, but only if you have one of the lastest flash-
based PICSTART Plus programmer, or installed the PICSTART Plus Processor Upgrade Kit (containing a PIC18F6720) in your elderly programmer (#UK003010, costs about 29.00 US-$, ordering
information).
http://www.electronic-engineering.ch/microchip/faq/faq.html (4 of 12)12/02/2008 17:13:14
FAQ for Microchip PIC 8 bit microcontroller programming
In-Circuit Debugger 2 (ICD2): #DV164005 or #DV164007 (additional RS232 cable & power supply)
40 pin ICD header: #AC162051
optional: Universal Programming Module for ICD2: #AC162049
Please see also the latest* README text files for PICSTART Plus (17 kB) & ICD2 (32 kB)
* by 19.06.2005
PIC16F87X devices are shipped with low-voltage programming enabled. PICSTART Plus programmer uses
the high-voltage programming method. Some devices do not exit programming mode properly if low-voltage
programming is enabled, resulting in invalid read and programming operations.
Place a 10 Kohm resistor between the RB3 pin and one of the ground pins on the programming socket. Refer
to the device datasheet for the pinout of the specific device."
As first step, read the documentation of your controller, especially the memory and register architecture, the instruction set (PIC Instruction Set Quick Reference) and the I/O port section. Then try to
implement a blinking LED application using the PIC16F84 and a busy loop for waiting (you can also use my assembler module m_wait.asm).
If your LEDs are blinking, you certainly want to connect your controller to your PC to exchange some data. Build a RS232 hardware setup with a MAX232 level shifter and a PIC. If you use the
PIC16F84, the RS232 communication must be done by software. You can use the 'Simple RS232 interface'. Try first to burn the provided HEX-file onto the PIC16F84 to check for proper HW-setup.
Once everything is working well, you can get the assembler source code and change the content according to your needs.
Answer: These are my standard macro definitions declared in the module file m_bank.asm. If you include this module file in your main program, you can make use of these instruction macros. For
instance, the macro BANK1 performs a memory bank change to bank 1. Further, the macro BNEQ 0x23,LAB1 translates to 'branch on not equal w and 0x23' and performs a jump to label LAB1, if
the working register w does not match the value 0x23.
Question: What kind of instructions are BNZ and SKPNZ, since they are not listed in the Instruction Set Chapter of my PIC controller?
Answer: These are 'Special Instruction Mnemonics' listed in Table B.11 in the PIC Instruction Set Quick Reference, i.e. built-in mini-macros of the MPLAB assembler. For instance, SKPNDC
translates as 'Skip on no digit carry' and simply assembles BTFSC 3,1.
Only declare the main assembler file as source file in the MPLAB project. For instance, this is the file PIC_Test.asm in the project PIC_Test.mcp below on the picture. It will generate a HEX-file
named PIC_Test.hex when you execute 'build' or 'build all'. Ensure that the pathes to the include files exist - or remove the pathes and copy the include files to the directory of the main source.
The include files must not be listed for separate compilation under the MPLAB Project. They are just included in the main source through include statements. During assembly time (MPASM), these
files are just inline expanded and treated as normal assembler code. Separate compilation is neither needed nor possible, since I've written the module code for inline compilation (and initially for
simplicity) with no object or linker directives.
Of course, when project size and complexity increases, one may consider to rewrite the code to object-based sources...
MPLAB IDE
showing the project source file (PIC_Test.asm)
to be assembled by MPASM.
Once the communication between the PIC controller and the PC is running successfully, I suggest to implement a visual interface on your peripheral device (the PIC controller). This can be done
easiest by using a commonly available dot matrix LCD and one of my LCD assembler modules.
If more sophisticated I/O functionality is desired, you can consider to attach a standard AT keyboard (ordinary PS/2 PC keyboard) to the microcontroller. Look therefore at the AT keyboard projects.
When your code grows, you will run into the architectural issues of the PIC microcontroller. The PIC instruction set has been defined - in early days - as a natural engineering trade-off between
functionality and program memory requirements. One advantage of a larger instruction word width is the increase in direct addressable space for immediate instructions, e.g. 'CALL Label' with Label
resolved to a program memory location by the linker/assembler. On the contrary, larger instruction word width require more program memory, what results in larger chip area and therefore higher
manufacturing costs.
The PIC16xxx microcontroller series features immediate address instructions (e.g. 'CALL' or 'GOTO'), which support 11 bit immediate values. Using 11 bits for immediate addressing, we can only
address 2k words in the program memory. But what if we want to support larger memory space? One possibility to work around this limitation is to introduce a new instruction in order to jump
between the different 2k memory blocks. That's why we need to deal with the upper two bits ([4:3]) of the PCLATH register. These bits cannot be altered with 'CALL' or 'GOTO' instructions, but
need to be set manually before the jump.
There is quite a good discussion and elaboration of methods to deal with paging for the PIC16xxx microcontrollers on this site.
C [Toc] [Top]
There exist several commercial solutions to program the PIC microcontroller in C. Unfortunately, little of them are available for free.
If you know other free C compilers, you are kindly requested to email me. I will add it to the list below.
A limited edition of HI-TECH's PIC C compiler is available for free on this site. It is intended to be used with PIC16F84 and 16F877, although with limitations in memory usage and/or code
size. (No personal experience with this compiler so far.)
Write only small pieces of new code, whenever possible within a simplified test program.
Most hobby-developers have no expensive in-circuit debugger tool (real-time debugging in the target application using specific software, with breakpoints and register watches). Use therefore
dot matrix LCD and/or RS232 interface for debugging.
Use encapsulated well-verified blocks, which you put together as parameterizable building blocks in the target application.
For large projects, try to use object code and the linker provided by Microchip MPASM IDE.
In case you have built a PIC application including serial communication (RS232), but it does not work properly, try to debug it the following way:
1. Write a simple PIC assembler program for the PIC16F84 @ 4 MHz using the module m_rs096.asm. The program keeps transmitting a dedicated character every second, e.g. something like:
You may also use one of the communication test programs, commtest1.asm or commtest2.asm, which transmit constantly status messages '@' and echo on every received character.
2. Setup the HyperTerminal program (Win9x, WinXP) using the standard settings as follows:
Start the HyperTerminal application using the standard settings. It should now receive a '@' every second from the PIC microcontroller. If not, check the MAX232 and the RS232 connectors, until
you receive the characters...
Question: I can not figure out the connection between dot matrix LCD and PIC microcontroller. Do you have a schematic?
Answer: Basically, there is a text description in the header section of each LCD assembler module file. But here is also a PDF schematic to illustrate the connection between display and controller.
Question: I have downloaded from your site the assembler module file 'm_lcd_bf.asm' for my PIC project. The LCD display I use is a 20x4 (CrystalFontz CFAH2004A-TMI-JP), but it does not
work. I dont see any character and the problem is not the contrast
Answer: I've recently adapted some parts of the initialization section of the LCD module files (longer wait delay after display clear). I assume you have a newer type of display controller than the
traditional Hitachi HD44780 (PDF data sheet, 389 kB). In case you have the LCD controller Samsung KS0073 (PDF data sheet, 673 kB), you have to set the constant 'LCDTYPE' to 0x1 in your main
program. This adds specific configuration commands of the new controller type, i.e. the extended function set to set up the line count (PDF data sheet, 186 kB). You may have to adapt the line count
to your KS0073-type display in the extended function set part of the LCD initialization section of the LCD module file (e.g. m_lcde.asm).
If this does not help, try to use longer delays for the initialization procedure.
Below the declarations for the module file m_lcde.asm. First try the circuit with a 4 MHz crystal, later on with 20 MHz. If this does not work, you may have to adapt the initialization section to your
specific display controller (latency, commands). But first try with the standard settings for PIC16F7x and 4 MHz:
#include "..\m_bank.asm"
#include "..\m_wait.asm"
#include "..\m_lcde.asm"
In case of failure, ensure that you do not use the temporary registers at BASE+0 - BASE+3 elsewhere in your code, especially not in your interrupt service routine (ISR)! If this setup works perfectly,
you may upgrade to the more efficient LCD modules m_lcde_bf.asm or m_lcdexbf.asm (busy flag instead of wait loop).
If you cannot compile the projects and errors like below appear, you did not specify the path to your include files correctly. Check the '#include' statements:
#include "..\m_bank.asm"
#include "..\m_wait.asm"
Although most of my code is below the critical size of 2k instruction words, page crossings may occur if you extend the assembler source code to your needs. Please read the recommendations about
paging above.
Below are some interesting text snippets found on the web about the history of Microchip PIC controllers.
A complete version of John Bayko's interesting 'Great Microprocessors of the Past and Present' may be retrieved at http://www.sasktelwebsite.net/jbayko/cpu.html.
The roots of the PIC originated at Harvard university for a Defense Department project, but was beaten by a simpler (and more reliable at the time) single memory design from Princeton. Harvard
Architecture was first used in the Signetics 8x300, and was adapted by General Instruments for use as a peripheral interface controller (PIC) which was designed to compensate for poor I/O in its 16
bit CP1600 CPU. The microelectronics division was eventually spun off into Arizona Microchip Technology (around 1985), with the PIC as its main product.
The PIC has a large register set (from 25 to 192 8-bit registers, compared to the Z-8's 144). There are up to 31 direct registers, plus an accumulator W, though R1 to R8 also have special functions -
R2 is the PC (with implicit stack (2 to 16 level), and R5 to R8 control I/O ports. R0 is mapped to the register R4 (FSR) points to (similar to the ISAR in the F8, it's the only way to access R32 or
above).
http://www.electronic-engineering.ch/microchip/faq/faq.html (10 of 12)12/02/2008 17:13:14
FAQ for Microchip PIC 8 bit microcontroller programming
The PIC16x is very simple and RISC-like (but less so than the RCA 1802 or the more recent 8-bit Atmel AVR microcontroller which is a canonical simple load-store design - 16-bit instructions, 2-
stage pipeline, thirty-two 8-bit data registers (six usable as three 16-bit X, Y, and Z address registers), load/store architecture (plus data/subroutine stack)). It has only 33 fixed length 12-bit
instructions, including several with a skip-on-condition flag to skip the next instruction (for loops and conditional branches), producing tight code important in embedded applications. It's marginally
pipelined (2 stages - fetch and execute) - combined with single cycle execution (except for branches - 2 cycles), performance is very good for its processor catagory.
The PIC17x has more addressing modes (direct, indirect, and relative - indirect mode instructions take 2 execution cycles), more instructions (58 16-bit), more registers (232 to 454), plus up to 64K-
word program space (2K to 8K on chip). The high end versions also have single cycle 8-bit unsigned multiply instructions.
The PIC16x is an interesting look at an 8 bit design made with slightly newer design techniques than other 8 bit CPUs in this list - around 1978 by General Instruments (the 1650, a successor to the
more general 1600). It lost out to more popular CPUs and was later sold to Microchip Technology, which still sells it for small embedded applications. An example of this microprocessor is a small
PC board called the BASIC Stamp, consisting of 2 ICs - an 18-pin PIC16C56 CPU (with a BASIC interpreter in 512 word ROM (yes, 512)) and 8-pin 256 byte serial EEPROM (also made by
Microchip) on an I/O port where user programs (about 80 tokenized lines of BASIC) are stored.
Actually, the PIC architecture was first integrated by Signetics for a company in San Jose (Scientific Memory Systems as I recall) using Bipolar technology and dubbed the 8X300. Prior to that, the
architecture had been a scientific curiosity since its invention by Harvard University in a Defense Department funded competition that pitted Princeton against Harvard.
Princeton won the competition because the mean time between failure (MTBF) of the simpler single memory architecture was much better, albeit slower, than the Harvard submission. With the
development of the transistor and IC's, the Harvard Architecture is finally coming into its own.
Microchip has made a number of enhancements to the original architecture, and updated the functional blocks of the original design with modern advancements that are in concert with existing
architectural processes and
enabled by the low cost of semiconductors.
Back in 1965, General Instruments (GI) formed a Microelectronics Division, and indeed used this division to generate some of the earliest viable EPROM and EEPROM memory architectures. As
you may be aware, the GI Microelectronics Division were also responsible for a wide variety of digital and analog functions, in the AY3-xxxx and AY5-xxxx families.
GI also generated a 16 bit microprocessor, called the CP1600, in the early 70s. This was a reasonable microprocessor, but not particularly good at handling I/Os. For some very specific applications
where good I/O handling was needed, GI designed a Peripheral Interface Controller (or PIC for short), in around 1975. It was designed to be very fast, since it was I/O handling for a 16 bit machine,
but didn't need a huge amount of functionality, so its microcoded instruction set was small. Hopefully, you can see what's coming....yes, the architecture designed in '75 is substantially the PIC16C5x
architecture today. Granted, the1975 version was manufactured in NMOS, and was only available in masked ROM versions, but still a good little uC. The market, however, didn't particularly think
so, and the PIC remained designed in at a handful of large customers only.
During the early 80s, GI took a long hard look at their business, and restructured, leaving them to concentrate on their core activities, which is essentially power semiconductors. Indeed they are still
doing this very successfully now. GI Microelectronics Division became GI Microelectronics Inc. (a wholly owned subsidiary), which in 85% was finally sold to venture capital investors, including
the fab in Chandler, Arizona. The venture capital people took a long hard look at the products in the business, and got rid of most of it - all the AY3- and AY5- parts and a whole bunch of other stuff,
leaving the core business of the PIC and the serial and parallel EEPROMs. A decision was taken to restart the new company, named Arizona Microchip Technology, with embedded control as its
differentiator from the rest of the pack.
As part of this strategy, the PIC165x NMOS family was redesigned to use one of the other things that the fledgling company was good at, i.e. EPROM - the concept of the CMOS based, one-time-
programmable (OTP) and eraseable EPROM program memory PIC16C5x family was born.
[Toc] [Top]
TELL A
SEARCH WEBRING: This WebRing All
FRIEND!
Computers & Internet > Hardware Add this feed:
PICmicro Sites Add Your
Manager: uandmekids Web Site.
Join Here!
Iron WebMaster
A collection of websites about the Microchip PIC microcontroller and related projects.
example: jonathan's PIC ASM and PC Programming Project - **Updated 5/17/07** On
Round 2 VOTING
this web site you will find code, libraries, programs, and accompanying projects using PIC
Assembly Language. The keynote project is a PC based Oscilloscope I call the
PPMScope. Get in on the Action!
Ads by Google WebRing Rating Survey
Amazing PIC programmer Which of these statements best describes your
Just $32, most devices supported ICSP, SQTP, copy-limit features. experience(s) with this Ring?
www.flexipanel.com Only members who are logged in may register a vote. You
are either not logged in or not a WebRing member. Use the
Automatic code generator Sign In link at top to log in or register for a WebRing User ID.
LPC2xxx embedded systems CAN - Ethernet - PWM - ADC - RTOS.
www.TTE-Systems.com Easy to navigate with interesting sites.
submit my vote
view results without voting
picsystems
this group is about PIC projects.
Andy Programming
View and get updates of current and future projects, download source code for both windows and dos.
Robotics UK
Welcome to robotics UK, i'll show you how to use a PIC in robotics
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
homepage 9/1/2006
Welcome to my site
Decode IR
RC5 code PICmicro Sites
Panasonic code Get this free Prev | Ring Hub | Join | Rate|
software Next
Daewoo protocol
WebRing Inc.
Search
Sony code
Pic sourcecode for
You can find on my site:
Sony IR protocol
JVC protocol Information about infrared light:
Tinyserir-RC5
Decode ir: On this page you can find a description about the basics of using infrared light for remote control,
RC5 receiver
what you need to decode it and what you can do with it: for example control you pc, windows, winamp or mp3
pic18f bootloader player.
PIC sourcecodes
Detailed description of the folowing different remote protocols:
Leds
Constant current RC5 protocol: Originally developed by Phillips and the most popular for hobby projects.
source for Leds Sony SIRC protocol:Also popular for hobby but less than the rc5 protocol
Always winning with Panasonic protocol
roulette JVC protocol
Daewoo protocol
Datasheets
Links
Who am I
Control your pc with an infrared remote protocol, Pic sourcecodes and hobby projects:
Pic sourcecode for sony ir protocol: Here you can find the sourcecode and hexfiles to decode infrared signals of
a sony remote control with a pic microcontroller. With the buttons 0..9 you can control the output pins of the
controller.
The code is also serial transmitted on an output pin you can directly connect it to a pc and control windows or
mediaplayer and etc..
Pic sourcecodes:Here you can find different source codes for the microchip pic microcontrollers like the
pic16f84,pic16f628,pic12f629,pic12f675.
Tinyserir chip: A preprogrammed pic microcontroller for decoding RC5 infrared remote controls.
Tinyserirchip: Here you can find the description, the testprogram and datasheets of the tinyserirchip. You can
use this cheap and easy to use chip to control your pc, plc, robot and everything with a serial port. Because
windows is not realtime it can be hard to decode the fast ir signals. Because you need to sample many times it can
also slow down your system many times. But with the use of the tinyserirchip you can solve all these problems.
Bootloader page Yep here you can find how to make your own simple bootloader based on the application note
00851 of microchip, but I changed this a little bit.
Leds: On this page you can find out what leds are, how you can connect it properly without troubles. How you
need to calculate the right value of the series resistor.
Constant current source: Here a detailed descripton of a constant current source with a LM317, how to use and
calculate them and of course the schematic (circuit). You can use it to connect white or blue leds, Luxeon
lumileds
Always winning in the casino with roulette: it's not about cheating or other illegal actions but a simple trick.
Allways winning with roulette: Here you can read a tip for free how you can allways win with a roulette game
in a casino or online casino's. It's simple and pure mathematical not difficult to understand how it works.
I am in the process of putting all the theory in the Library of Terms and Routines into a 400
page book with 4 main projects plus a number of other articles. This is a major undertaking and
although most of the information is available on the website, the convenience of having it in a
single reference source is driving me to complete the task - mainly because I want to have it as a
reference source myself. In the process, the work is being revised, updated and corrected.
The book will be published by TAB books and will cost US$24.95 It is still 2 months from
completion, then two more months for publishing and printing.
I will let you know when the release date comes closer.
100,000
hits plus:
Powered
by
counter. [Skip Prev] [Prev] [Next] Previous 5 Sites | Skip Previous |
bloke. [Skip Next] [Random] [Next 5] Previous | Next
com [List Sites] [Join Ring] Skip Next | Next 5 Sites | Random Site
| List Sites
Contact Information:
Colin Mitchell
To (email): Talking Electronics
PO Box 486
Your e-mail:
Cheltenham,
Victoria, 3192
You can add your comments TOO! Australia
Talking Electronics,
Take a look at Talking Electronics 35 Rosewarne Avenue,
site: http://www4.tpg.com.au/users/ Cheltenham 3192
talking/index.html It has PICF84 Victoria Australia
micro programming and lots of Basic
Electronics Theory, with circuits that Tel: (03) 9584 2386
"move" on thesend
page! Also try their Fax: (03) 9583 1854
"easy" address: http://all.at/te
Website address: www4.tpgi.com.au/users/talking/ email: talking@tpg.com.au
Not Copyright 2003 Colin Mitchell - you can copy anything - in fact you should copy all the projects and data
sheets.
Welcome to theempirenet.com
Internet Services
Hosting Talk
The Empirenet
Empirenet
Way International
MS
Home Shopping
Next
Catalog
Staples
Comet
http://theempirenet.com/eewebring/index.html12/02/2008 17:14:28
Electronics Engineering
TELL A
SEARCH WEBRING: This WebRing All
FRIEND!
Engineering > Electrical Add this feed:
Electronics Engineering Add Your
Manager: uandmekids Web Site.
Join Here!
Iron WebMaster
The Electronics Engineering Web Ring is dedicated to all web sites and users that
participate in the world of electronic engineering. Only sites that are seen to be
Round 2 VOTING
contributing to the community will be added to the ring. Sites purely advertising goods or
filled with links to other sites will unfortunately be rejected. This web ring is completely
open to the public. Get in on the Action!
example: Electronics 2000 - Electronics 2000, for electronics hobbyists, engineers and
students. Online calculators, software downloads, technical data, beginners guide, WebRing Rating Survey
pinouts, forum, links and more. Which of these statements best describes your
experience(s) with this Ring?
Ads by Google Only members who are logged in may register a vote. You
are either not logged in or not a WebRing member. Use the
USB Instruments Sign In link at top to log in or register for a WebRing User ID.
USB PC Scopes, Logic Analyzers Data Loggers, Waveform
Generators. www.usb-instruments.com Easy to navigate with interesting sites.
Hytronic Electronics Easy to navigate with OK sites.
Electronic Transformer Various Ballasts and Motion Sensors. www.
hytronik.com Easy to navigate but poor sites.
Electronics 2000
Electronics 2000, for electronics hobbyists, engineers and students.
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
Office Cam The Multimedia Electronic Literature & Learning Internet Site Cam Page
This web site is dedicated to the advancement of electronic engineering skills.
Karaoke Live TV
Netzero Free dial-up
Videos Unreleased Episode of Star-Trek Hotmail Free email
Visit Microsoft EE Community Center Tripod Free web pages
Electronics Search Engine
Information on Atlanta, GA
AltaVista - WebCrawler- HotBot- Lycos- Infoseek- Excite-- Image Surfer - Starting Point - DejaNews-
More...
Yellow Pages - People Search - City Maps - Get Local - Today's Web Events & Chats - Whowhere - More
Yahoos
[ Skip Previous | Previous | LIST SITES | Next | Skip Next | Random Site ]
http://www.mellis.net/12/02/2008 17:14:58
roboDNA - Robotic modules and software - Free Lego NXT PC Remote Software - Lego NXT Direct Commands
Drive-by-wire Operations
Autonomous State Operations
Piloted-Autonomous Operations
Telemetry Feedback
Monitoring Sessions
RoboDNA's Dashboard Designer allows engineers and robot builders to quickly and easily build libraries
of Dashboard Interfaces to remotely operate prototypes from a PC.
The PicDem 2 Sample Workspace provides sample C code and a dashboard to interact with 8 bit PIC
parts.
Electronics Engineering
Prev | Ring Hub | Join | Rate|
Next
WebRing Inc.
Search
Visit a complete list of WebRing memberships here
Sponsored Link: Ashton Pub Ottawa
TELL A
SEARCH WEBRING: This WebRing All
FRIEND!
Programming Languages > C and C++ Add this feed:
Embedded Technology Add Your
Manager: michaelanburaj Web Site.
Join Here!
Iron WebMaster
Microprocessors, controllers, RTOS, Networking / Communication
Protocols & Embedded technology related sites
Round 2 VOTING
Get in on the Action!
Ads by Google
Celestial Horizons
Basic Compilers for PIC microcontrollers.
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
TELL A
SEARCH WEBRING: This WebRing All
FRIEND!
Programming Languages > C and C++ Add this feed:
Embedded Technology Add Your
Manager: michaelanburaj Web Site.
Join Here!
Iron WebMaster
Microprocessors, controllers, RTOS, Networking / Communication
Protocols & Embedded technology related sites
Round 2 VOTING
Get in on the Action!
Ads by Google
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
This web site is dedicated to the memory of James Leonard Callaghan (Cal)
Graphics by Elated
Embedded Technology
Prev | Ring Hub | Join | Rate|
Next
Search
WebRing Inc.
Visit a complete list of WebRing memberships here
http://www.indeso.com/12/02/2008 17:15:49
Microchip PIC Project resource and guide page
Project description:
This is a very small program to try the Sharp GP2Y0D340K infrared object detector.
Electronics used:
Sharp GP2Y0D340K
Project description:
This is a sound playback system for a PIC or any other microcontroller. It uses a clever encoding system
to mathematically model the actual performance of the RC filter when the signal is encoded. This allows
playback of good quality sound with the absolute minimum software and hardware. The RC filter
modeling (encoding algorithm) has been refined to be PIC friendly in binary math, giving the ability to
playback AND RECORD in real time even on a PIC, even with high rates up to 150+ kbit/sec.
Electronics used:
LM741
Link: A system to record and/or play sound in a bit stream format
Project description:
The Devantech SFR04 Ultrasonic Range Finder indicates the distance to the closest object within range.
Echos that arrive later are received and processed, but subsequently ignored. For a true radar all signals
should be taken into account.
Electronics used:
Devantech SFR04
Project description:
Climate Controller. This controller uses the Sensirion SHT11 combined temperature and humidity
sensor. Measurement and Display:
Scale selectable between Centigrade and Fahrenheit
Humidity 0 - 100% temperature compensated
Temperature -40 to 123 C (-40 to- 254 F)
Electronics used:
SHT11
Project description:
I recently had to make a guitar amplifier and thought it would be cool to include a PIC based guitar
tuner. I had an AIWA 3-disc stereo lying around with a non-functioning CD player. The tuner and tape
deck still worked fine, and it was rated for I think 30 watts/channel.
Electronics used:
AD620
LM10
Project description:
These tubes were originally in a Wang desktop calculator, manufactured in 1969. A PIC16F73 is the
only IC used, although it was a stretch with all 22 IO being used. The timing reference is obtained from
the 60 HZ AC line, although during a power outtage a 9 volt NiCad keeps the CPU powered and the
timing is generated by an interrupt routine (10 MHZ clock crystal). A 5 pin header on the main circuit
board is used for ISP and allowed for easy debugging.
Project description:
This project is based on ideas from Rickards electronic projects page and David B. Thomas VCR Pong.
However, I have developed the simplicity even further, eliminating most of the external components.
Using microcontrollers with internal 4MHz clock generator there is no need for the xtal. The 12f675 part
also operates on wide voltage range, and the regulator can be removed. For game controller, I plan on
using the old Commodore 64 style paddless. They include firing buttons, which I plan on using as power
switch and game reset. 16F675 has a low power sleep mode with 1nA current consumption, so I plan on
using that to switch off.
Project description:
I needed a way to automatically control the main heating of our house. The basic idea is to start the
heating at a certain time in the morning, and to switch it off at night. The switching points are different
on various weekdays.
Project description:
This one is using a 16F876 PIC, MCP1047A temperature sensor ( X2 ), MCP1541 voltage reference and
MCP6022A opamp. The display is a 2 row HD74780 based 2X16 char, SII L1652BIJ2 but any other
display based on HD74780 can be used.
Electronics used:
MCP1047A
MCP6022A
MCP1541
HD74780
Link: Dual Thermometer with serial output
Project description:
Some time ago I use to create an Internet Plug - it was useful except one aspect - no password
protection was available for the Site Player. In order to solve this problem I have attached a 16F877
processor to the Site Player. Now the Internet Plug is Password Protected and also the status of the exits
is saved in EEPROM so is not lost in case of a power failure. One of the simplest applications will be to
control the lights from the distance, meaning from any computer connected to the Internet.
Electronics used:
SitePlayer Moule
Project description:
This project is a simple DTMF Remote control. The DTMF detector is integrated in software. All the
logic requested to receive and decode DTMF Commands over the phone line is integrated in the 16F877
chip, only few external components are used.
Electronics used:
MCP6022
Link: DTMF Remote control
Project description:
A co-worker of mine wanted a small timer that ranged from 1s to 15s depending on what the user
selected. They wanted to use a set of 4 dip switches to select the time. Needed to be as small as possible
(weight being very critical) and run off of a 9V battery. Needed 2 failsafes to prevent accidental ignition
of the second stage of the rocket.
Electronics used:
TC4422
Link: Rocket timer
Project description:
This project uses 16F628A as the microprocessor, TC-77 for temperature sensing and 24LC64 as storage
device. The objective is to create a low power temperature recoding device. The entire device consumes
400uA of current. The power is supplied by a standard battery pack (3.6V) for cordless phone. Lower
power comsumption is possible if the shutdown code is implemented for the TC-77 temperature sensor,
however, due to the time limitation, it is not available in this version of the code.
Electronics used:
TC-77
24LC64
Project description:
The main thing I want to do in this bit is build a data communication system from a Palm to a PIC using
IRDA (Infra Red). At first I was going to use just raw IR transmission with no protocol, so all the error
correction would have to be taken care of by the software -no real problem there- but I found out than
the newer Palms dont support raw IR mode, apparently they are hard wired that way, the other option
was to use the IRcomm protocol, it acts like a virtual serial port -you send a in you get a out.
Electronics used:
Palm Pilot
Project descrition:
Description how to use the PIC microcontroller to control a LCD with the SED 1300 controller.
Link: SED 1300 LCD
Timer, PIC16F628
Project description:
This is a cyclic timer (24 hours clock) which may be programmed to turn on and off some device at
programmed time. I made it because Im too lazy to turn light in my aquarium in the morning and turn it
off in the evening.
Electronics used:
74164N
Link: Timer
Project description:
This is a how-to project that shows you how to connect your PIC to the EM202, ethernet to serial
module. Now you can communicate over the ethernet to serial port.
Electronics used:
EM202
Link: Ethernet to Serial module, EM202, PIC16F628
Project description:
This circuit receives the signal from a IR remote control, like those used to control your TV or DVD
player and allows the signal to be repeated in another location.
Electronics used:
TSUS5400 Vishay
Project description:
This PIC based circuit uses Red, Green and Blue high brightness LEDs that are pulse width modulated
(PWM) to vary the intensity of each colour LED. This allows effectively any colour to be generated. The
circuit is designed to fit into a low voltage Halogen light fitting.
Project description:
The main reason I built this is because someone I knew wanted a stand alone device that is capable of
measuring/test CPU Cooler Fans independent of the computer. And here it is, a PIC16F627 based CPU
Cooler Fan Speed Tester. The speed is displayed on 4 units of 7 segment display as shown.
Previous Entries
SEND TO A FIREND
Send to a friend:
NAVIGATION
Home
PIC Books & Articles
PIC Code library
PIC Compilers
PIC Forums
PIC Vendors
Submit your project
What is a PIC?
Search
Search
Uncategorized (79)
Add to favorites
Subscribe
Entries (RSS)
Comments (RSS)
picguide.org was made to put all Microchip PIC MCU Projects on one place, to help the beginner get
started and to minimize the time to find useful information and resources related to the PIC MCU.
Embedded Technology
Prev | Ring Hub | Join | Rate|
Next
WebRing Inc.
Search
Visit a complete list of WebRing memberships here
Concept
Transmitter
Resolution
Note
So far...
Documents
Receiver
Components
Technical Data of Wireless Transmitter and Receiver
Remarks
Evaluation Board
Initial Test Setup
PCB Evaluation Board
Schematics of Evaluation Board
Available PIC Assembler Code
Software
Measurements
Further Information
Documents
Sensor Ordering Information
Other Circuits and Utilities
Links
Future Steps
The current concept incorporates a wireless transmitter and receiver and is thought to be used for remote controlled airplanes or
appliances with two seperate parts. In other words, we have one dedicated transmitter (acquisition, filtering) and one dedicated
receiver part (user-interface, look-up table, calibration, storage), capable of being connected together with any physical layer, e.g.
wired, wireless, infrared. If you want to build a standalone altimeter/variometer just for hiking or mountaineering, this setup can
obviously be simplified by omitting the wireless components.
So far, only the transmitter part with all its analog circuitry has been completed entirely - the digital receiver part has still to be done,
but does not necessarily have to be a PIC microcontroller. For instance, it could also be a personal computer, connected through the
standardized RS232 protocol and a wired/wireless interface to the transmitter part.
The (pending) challenge of the receiver implementation is the field evaluation of the most suitable and accurate temperature and non-
linear pressure-altitude correction algorithms. There is maybe need for adding a temperature sensor to the transmitter part.
Increase the range by taking a better A/D converter or decrease the Amplifier-
Gain (reduction of resolution).
In practice, I'll set the resolution to 1 meter, so a total range of 4096 meters will
be available. This is enough precise for my R/C models, but allows to use this
altimeter also for hiking and mountaineering.
The following components have been used: Analog to digital converter NSC ADC12130, a Microchip PIC16F84 controller, a quad
op-amp NSC LMC660, a Maxim MAX232 RS232 level shifter, and the Motorola MPXS4100A absolute pressure sensor.
Top view of removable pressure sensor module. Circuit design CDP-TX-01 wireless
transmitter, 434 MHz, up to 7.5 kb/s, uni-
directional
General
Oscillator type: Crystal
Frequency: 433.920 MHz, 434.075 MHz (Europe)
458.650 MHz (United Kingdom)
Frequency stability: +/- 2.5 kHz (-10 up to +55 C)
HF channels: single (fixed channel)
Range: up to 1000 m (free distance, line of sight)
Baud rate (specified): 300 - 4800 baud
Bit rate (measured at short up to 7500 bits/s
distance):
Operating conditions: -10 up to +60 C
Type approval: I-ETS 300 220 / Germany, France, Switzerland, Sweden, UK, Holland, Austria, EMC
Transmitter
HF power output: 10 mW +/- 3 dB @ 50 Ohm
Modulation: FM narrow band
Start-up time: 30 ms
Input signal type: digital, 5 Volt
Deviation: 2.5 kHz
Supply voltage: 5.5 - 10 Volt
Power consumption: 18 mA typ.
Dimensions: 36 x 26 x 10 mm
Weight: 9.8 g
Receiver
Type: double superheterodyne, crystal oscillator
Sensitivity: -120 dBm (12 dB/SINAD, CCITT filter)
Selectivity: +/- 5 kHz @ -6 dB
Demodulation: FM narrow band
Distortion: < 5 % @ 1 kHz
Output signal type: digital, open collector
Other outputs: RSSI and AF
Supply voltage: 4.5 - 14 Volt
Power consumption: 10 mA typ.
Dimensions: 50 x 30 x 7.5 mm
Weight: 19 g
A lot of people have asked me where I got the Motorola absolute pressure sensor from.
By the way, Motorola distinguishes the sensor characteristics, feature set and package type by the sensor name, so you can also get
4100 sensor types similar to mine with different naming, e.g. MPXT 4100A or PPXA 4100A:
M Qualified standards
PX Pressure sensor
S Small outline package
The Circuit Design wireless transmitter and receiver are not necessary to use the evaluation board, since there exists a direct RS232
link to the PC.
An initial test setup for checking the mixed signal design: A significant problem was the digital noise in the analog circuitry supply
voltages. Finally the noise could be minimized by splitting up the power supplies to three independent sources: one digital power
supply voltage, one for the sensor and A/D converter, and one supply with slightly higher voltage for the operational amplifiers of
the filter stages. The above test setup contains no wireless transmitter, the data is directly transmitted to the computer using the
RS232 protocol and a MAX232 level shifter.
In this setup, I have used the LMC660 / LMC662 low-power rail-to-rail quad operational amplifiers for the fourth order Chebyshev
filter stages.
Moving from the test board to the first PCB, I have only made slight adaptations in the analog part of my design: I have altered the
filter characteristics from Chebyshev to Butterworth - but as a consequence, I had to replace the LMC660 operational amplifier by a
LM324 type, due to oscillating filters. Conclusion: In the analog world, nothing runs properly if it has not been tested.
If someone knows a good single supply, low-power, rail-to-rail operational amplifier with clean and linear output characteristics in
the entire input range, please let me know! The LMC660 is exactly specified this way, but showed up a really bad non-linear
characteristic in the upper input range. Bob Krech suggested the LMC6064 precision quad OP amplifier with pin-for-pin
replacement for the LM324.
The PCB-based evaluation board consists of analog circuitry at the left side and digital components at the right side of the board. In
the upper left corner are the three independent power supplies (5 V analog, 6.8 V analog, 5 V digital), all served from one battery
(8 - 10 V). The evaluation board contains further the active Butterworth filter stages built of one LM324 (left side), the NSC
ADC12130 A/D converter (center), the PIC 16F84 microcontroller (at right from A/D converter), a dot LCD display and a PORTB
connector (lower right corner), a direct RS232 interface with MAX232 level shifter (upper right corner), and an interface for the
wireless transmitter allowing for first field measurements (bottom center). The system owns two oscillators. A 4 MHz crystal
oscillator provides the conversion clock for the A/D converter, and a separate 4 MHz crystal for the microcontroller allows to
increase processor performance easily if necessary. This setup provides two A/D converter input channels: Channel 0 is already used
for the pressure sensor, but channel 1 can be used freely, e.g. for voltage surveillance of the R/C receiver battery. If two channels are
not sufficient, this system can easily be upgraded to eight channels by integrating the NSC ADC12138 A/D converter. The LCD
connector and the RS232 interface serve only for evaluation and debugging purposes in this setup. Finally, the noise characteristics
of my approach are very promising!
Although this board is now ready, a suitable R/C plane - my Piper Cherokee - has to be finished first for 'air evaluation'...
The above program needs additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_rs096.
asm
For those, who are not familiar with interfacing a PIC to the RS232 using a MAX232: RS232-Interface.pdf (9.7 kB)
I've done some measurements to see whether LSB toggling is sufficient low using the Excel RS232 data capture interface. All
measurements have been carried out at room temperature (without any temperature compensation) and without moving the test
board. The test period has been one hour with adequate warm-up time for the sensitive analog circuitry (pressure sensor, A/D
converter and op-amp).
Note: Because the entire design is laid out very sensitive in order to get a high resolution (in the range of one meter), the
accumulated drift could also originate from natural barometric variations.
Test setup: Drift of 2 bits during one hour (with a single spike).
Test setup: Drift of 3 bits during half an hour. The strange curve comes
possibly from temperature variations.
Data sheet of Motorola Absolute Pressure Sensor Series MPX4100A: MPX4100A (PDF, 117 kB)
Motorola Sensor Selector Guide (Acceleration, Pressure, and Smoke): SensorSelectorGuide (PDF, 166 kB)
Noise considerations for integrated pressure sensors: AN1646 (PDF, 153 kB)
A lot of people have asked me, where they could get the Motorola absolut pressure sensor from. I bought it from www.conrad.com
years ago, but now, these sensors may occassionally not be available there. Don't ask me where you can get them elsewhere, I don't
know...
As of 08.04.2005, there was one pressure sensor model from Motorola available at www.conrad.com:
Field measurements and evaluation of the most suitable temperature and non-linear pressure-altitude correction algorithms,
maybe with portable computer to be ready for quick alterations.
Design of the microcontroller-based receiver circuit.
Put all code together and create user-interface and calibration menu with liquid crystal display.
If applicable, a 24C65 EEPROM interface for storage.
If having not enough challenges, real time clock interface to Dallas DS1302.
[Toc] [Top]
Introduction
Possible Applications
Concept
How it works
Specifications
Features
Limitations
AT Keyboard Theory
Keyboard Scan Codes
Keyboard to Host Protocol
Keyboard Commands
Host to Keyboard Protocol
Host Commands
Project Resources
Available PIC Assembler Code
Schematic, Data Sheets, Pinout
User-specific Customization / FAQ
How do I use the AT Keyboard Input?
How does the Scan Pattern Decoding work exactly?
My own Key Customization
My own Key Sequence
Confusion about Sweden and Switzerland...?
Sometimes you only need a simple and cheap RS232 terminal to get sufficient control over a PC or a RS232 device. There is no need, no space or even no power
to place a monitor, a computer case and a keyboard. Maybe there exists also the problem, that the PC or the device is located somewhere else and you want to
interact with it over a short distance.
The cheapest way to obtain a complete user interface is the use of standard components, such as LCD modules and PC keyboards. A standard PC keyboard (PS/2
type) costs about US-$ 12, a 2 lines by 40 characters dot matrix LCD module around US-$ 20.
To connect these items to the serial port by cable, a microcontroller and a RS232 level shifter are necessary. For longer distance control, there exists also the
possibility to interconnect the terminal with the other device by a wireless physical transmission layer.
The RS232 terminal for instance is very convenient in conjunction with a PC based Juke-Box playing MP3 files. You only need a command line programmable
MP3 player (or a player with a supplied Active-X interface) and a software-based connection between player and RS232 port. This software 'connection' could be
realized using Visual Basic and the often supplied Active-X interfaces of the various Windows based MP3 players.
Another possible area for applications is PC observed access control. Therefore, the RS232 terminal is placed at the entrance to the supervised area.
A further enhancement to be able to satisfy todays needs for network-based communication would be a complete TCP/IP based communication layer together with
an Ethernet front-end. Then it would be possible to control simple Ethernet appliances, e.g. your coffee maker, electrical rolling shutters, autonomous net-based
lawn mower,... ;-) by this remote terminal. Brave new world ...
The routine below contains no support for an LCD display. It only shows the complete fetch and decoding of AT keyboard scan patterns and RS232 transmission
of ASCII characters to the RS232 client. If you want a PIC 16F84 based solution with additional LCD, have a look at the keyboard v2xx project.
The problem with the PIC 16F84 is the lack of RS232 hardware. The whole keyboard scan pattern fetch, decode and RS232 data transmission is done by software.
Additional RS232 data reception has also to be carried out by software - based on interrupts - but is not implemented within this project. The current
implementation features a preemptive interrupt-based keyboard scan pattern acquisition.
A recent picture of my workplace connecting a Microsoft PS/2 AT An elderly picture of my workplace, at which the initial
keyboard to the PIC16F84. development took place.
Any key stroke on the local keyboard will send the corresponding scan patterns from the keyboard to the PIC microcontroller. Afterwards, the microcontroller
converts the keyboard scan patterns to ASCII characters and transmits them to the RS232 target device.
The keyboard scan code capture is done by an interrupt service routine (ISR). The event, which triggers the interrupt is a falling edge on the keyboard clock line
(PORTB,0). Keyboard scan pattern acquisition takes place at the keyboard data line (PORTA,4). After 11 clocks (i.e. 11 external interrupts on RB0/INT), the
interrupt service routine has completely captured an 8 bit element of the entire scan pattern and sets a ready flag. The decoding of this 8 bit element is then carried
out during normal operation mode, activated by a valid ready flag whilst keeping the keyboard stalled (keyboard clock line low).
The fact, that the scan pattern acquisition is carried out using an interrupt service routine and the decoding thereof is done during normal operation mode allows for
performing other tasks concurrently: That's why I call the acquisition methodology preemptive, it does not block the processor in the main loop while acquiring
keyboard data - therefore passing processing resources to other services. Explicitely, it works as follows:
After proper acquisition, the corresponding flag KBDflag is set (at the end of the ISR) and the decoded keyboard character resides in the register KBD. The
KBDflag is cleared at the end of the service routine KBDdecode.
Infinitive main loop to acquire keyboard input (keyboard_v1xx.asm), keyboard data is in register KBD:
;******************************
_MLOOP btfsc KBDflag ; check scan pattern reception flag
call KBDdecode ; if set, call decoding routine
;btfsc your_other_flag
;call your_other_service
goto _MLOOP
;******************************
Only RS232 transmission is supported by this program, since PORTB,0 interrupt is already used by the keyboard clock line. There exists no possibility to
implement also RS232 reception using my modules m_rsxxx.asm, because they require PORTB,0 as well and are laid out as non-preemptive data acquisition
routines (see also 'Limitations').
For dedicated code adaptations, please refer to the section 'User-specific Customization' below.
To visualize the ASCII data sent by this microcontroller application, use a terminal program like the Windows Hyperterminal. Below an example session, which
proves the correct functionality of the keyboard interface. This terminal program and the Excel 97 RS232 Debug Interface have been used to debug the interface
during implementation time.
Example of a session using the Windows HyperTerminal. The entire contents was sent by the PIC controller.
In case you want RS232 reception and keyboard decoding simultaneously on a single PIC 16X84, you'll have to configure either the keyboard clock line or the
RS232 reception data line (both targeting PORTB,0 interrupt) to another separate interrupt source (e.g. PORTB,4 - PORTB,7 change interrupt) and to alter the
RS232 data fetch routine to a preemptive one. But then you'll also run into troubles by using the LCD modules, because they are written to work on entire 8 bit
ports (such as PORTB on 16X84, and PORTC & PORTD on 16X74).
So if you really appreciate to run the RS232 terminal entirely on a PIC 16X84 - from a technical perspective it is possible - you'll have to rewrite the LCD modules
and the software RS232 reception routine. Be aware that there won't be a lot of code space remaining for other enhancements after putting all terminal related stuff
onto the 16X84.
A workaround to get RS232 reception on the PIC 16X84 using this software could be a solution based on polling. But make sure you are polling fast enough, also
in worst case.
Hey,
First, lemme say that I like your site and thank you for providing excellent reference material for us home-hobbyist microcontroller geeks. I am currently
working on a music/noise project that uses a PS/2 keyboard interfaced to a PIC16F84, and I used your page at http://www.electronic-engineering.ch/microchip/
projects/keyboard/v1xx/keyboard_v1xx.html heavily as a reference when designing hardware and writing code. Anyway, I just thought that I would mention
that I ran into a problem that I have since solved. The problem involved sending bytes *TO* the keyboard from the PIC (in order to light NumLock and
ScrollLock). Your "Host To Keyboard Protocol" section indicates that the keyboard will take the data line low for a clock after the byte is sent to create an ACK
bit. Apparently, the PS/2 keyboard that I have (generic $10 comp-USA brand) doesn't send an ACK bit, but rather sends a whole byte. If my code attempted to
wait for the ACK bit, it hung indefinitely. I changed the wait to look for a byte (by calling my existing function) and everything worked perfectly. I stumbled on
this idea by looking at other online references (most notably, some Linux kernel code at http://www.mscs.mu.edu/~georgec/Classes/207.1998/14Minix_book/S/
src%20kernel%20keyboard.c.html#307). I have seen this ACK *byte* mentioned elsewhere too. I *think* the keyboard sends back 0xFA as an ACK byte, but I
have not personally confirmed this. Perhaps your excellent documentation could just use a quick note of clarification so that other don't run into the same
problem. Maybe something as simple as: "NOTE: Some keyboards send an ACK byte (value 0xFA) instead of an ACK bit.".
Thanks again,
Jason
The comment above refers to bi-directional communication between PIC microcontroller and AT keyboard, i.e. to the source code of the AT Keyboard Interface
V2.xx and higher versions. The bi-directional communication between host and keyboard is designed to support both Ack bits and Ack bytes.
Every command sent from the host to the keyboard needs to have an Odd Parity bit and an Ack bit at the end.
Every command received by the keyboard from the host needs to be acknowledged by the keyboard by sending an Ack byte (0xFA) to the host. See also
section 'Host to Keyboard Protocol'.
However, some AT keyboards may behave different and may need code adaptations to get bi-directional communication working properly.
A complete functional description and timing diagram of the AT keyboard is available at Craig Peacock's website. Please refer to his website Interfacing the PC's
Keyboard for an excellent and comprehensive description of all features and commands of the AT keyboard. At this place, I want to thank Craig Peacock for his
outstanding work with his website.
Below I only want to sketch the most important technical aspects to be known when interfacing a PC's keyboard. Small parts of the introduction below are more or
less copied from Craig Peacock's tutorial.
The diagram below shows the scan codes assigned to the individual keys for the english keyboard layout. The keys' corresponding scan codes are the numbers on
the keys, for example the scan code of the ESC key is 0x76. All scan codes are shown in hexadecimal representation.
The scan code assignments are quite random (thanks to IBM and other early computer manufacturers) and appear to be really weird sometimes, for instance the
break key. In many cases the easiest way to convert the scan code to ASCII characters would be to use a lookup table. Below are the scan codes shown for the
extended part of the keyboard and the numeric keypad.
Cite of Craig Peacock: "How about E1,14,77,E1,F0,14,F0,77! Now that can't be a valid scan code? Wrong again. It happens to be sent when you press the pause/
break key. Don't ask me why they have to make it so long! Maybe they were having a bad day or something?"
The AT keyboard sends different scan codes on pressing, holding and releasing of each button. An example is given at the table below:
All scan patterns can easily be visualized and verified with the AT Scan Code Debug Routine and the RS232 Debug Interface.
The data transfer is implemented as bi-directional protocol: The keyboard can send data to the host (microcontroller) and the host can send commands and data to
the keyboard. The host has the ultimate priority over the direction. It can at anytime (although not recommended) send a command to the keyboard.
The keyboard is free to send data to the host when both KBD data and KBD clock lines are high (idle). The serial clock is generated by the keyboard, but the host
can also use it as a clear-to-send line: If the host takes the KBD clock line low, the keyboard will buffer any data until the KBD clock is released, i.e. goes high.
Should the host take also the KBD data line low, then the keyboard will prepare to accept a command from the host.
The transmission of data in the forward direction, i.e. keyboard to host, is done with a frame of 11 bits. The first bit is a start bit (logic 0) followed by 8 data bits
(LSB first), one parity bit (odd parity) and a stop bit (logic 1). Each bit has to be read on the falling edge of the clock.
Once the host commands are sent from the host to the keyboard, the keyboard commands must be
sent from the keyboard to the host. If you think this way, you must be correct. Below details of some of
the commands which the keyboard is able to send.
FA Acknowledge
AA Power on self test passed (BAT completed)
EE See echo command (host commands)
FE Resend - upon receipt of the resend command the host should re-transmit the last byte sent.
00 Error or buffer overflow
FF Error or buffer overflow
The host to keyboard protocol is initiated by taking the KBD data line low. However to prevent the keyboard from sending data at the same time that you attempt
to send the keyboard data, it is common to take the KBD clock line low for more than 60 us. This is more than one bit length. Then the KBD data line is taken low,
while the KBD clock line is released. The keyboard will start generating a clock signal on its KBD clock line. This process can take up to 10 ms. After the first
falling edge has been detected, you can load the first data bit on the KBD data line. This bit will be read into the keyboard on the next falling edge, after which you
can place the next bit of data. This process is repeated for all 8 data bits. After the data bits comes an odd parity bit.
Once the parity bit has been sent and the KBD data line is in a idle state (high) for the next clock cycle, the keyboard will acknowledge the reception of the new
data. The keyboard does this by taking the KBD data line low for the next clock transition. If the KBD data line is not idle after the 10th bit (start, 8 data bits, and
parity bit), the keyboard will continue to send a KBD clock signal until the KBD data line becomes idle (Note: see also Limitations).
These commands are sent by the host to the keyboard. The most common command would be the setting/resetting of the status indicators (i.e. the Num lock, Caps
Lock & Scroll Lock LEDs). The more common and useful commands are shown below.
ED Set status LED's - This command can be used to turn on and off the Num Lock, Caps Lock & Scroll Lock LED's. After sending ED, keyboard will reply
with ACK (FA) and wait for another byte which determines their status. Bit 0 controls the Scroll Lock, bit 1 the Num Lock and bit 2 the Caps lock. Bits 3
to 7 are ignored.
EE Echo - upon sending an echo command to the keyboard, the keyboard should reply with an echo (EE).
F0 Set scan code set. Upon sending F0, keyboard will reply with ACK (FA) and wait for another byte, 01-03 which determines the scan code used. Sending 00
as the second byte will return the scan code set currently in use.
F3 Set typematic repeat rate. Keyboard will acknowledge command with FA and wait for a second byte, which determines the typematic repeat rate.
F4 Keyboard enable - clears the keyboard's output buffer, enables keyboard scanning and returns an acknowledgment.
F5 Keyboard disable - resets the keyboard, disables keyboard scanning and returns an acknowledgment.
FE Resend - upon receipt of the re-send command, the keyboard will re-transmit the last byte sent.
FF Reset - resets the keyboard.
Please refer to Craig Peacock's website for more information: Interfacing the PC's Keyboard
Main File Main Keyboard Decode Lookup Table SHIFT Keyboard Decode Lookup Table HEX Files
Latest version: English 'codepage' (QWERTY) English 'codepage' (QWERTY) QWERTY 'codepage':
kbd_1xx.asm View: eng_main.html View: eng_shif.html kbd_104_eng.hex
Download: eng_main.asm Download: eng_shif.asm
QWERTZ 'codepage':
Modified Swiss German Modified Swiss German kbd_104_sg.hex
'codepage' (QWERTZ) 'codepage' (QWERTZ)
View: ger_main.html View: ger_shif.html
Download: ger_main.asm Download: ger_shif.asm
The above programs need additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_rs096.asm
For those, who are not familiar with interfacing a PIC to the RS232 using a MAX232: RS232-Interface.pdf (9.7 kB)
The schematic of the AT keyboard interface using the PIC 16F84: Keyboard_V1xx.pdf.
You don't know how a dot matrix LCD is working? Have a look at my data sheets page.
You can get the pinout and a description of the various keyboard connectors <here>.
This section covers important details of the code structure. For a high level view, please refer to the section 'How it works' above. Basically, I have written this
keyboard project in such a way that it is completely customizable depending on your programming/PIC assembler skills.
Question: I'm running your AT Keyboard code. But how do I use the decoded input of the AT keyboard...?
Answer: The decoded content resides usually in the register KBD. You can use the content of this register in the main routine in the infinitive loop. Please see the
section 'How it works' above.
How does the Scan Pattern Decoding work exactly? [Toc] [Top]
Question: How does your AT scan pattern decoding work exactly? You are using two strange look-up tables...
Answer: Have a look at some parts of the 'AT Keyboard Lookup Table', e.g. the eng_main.asm (QWERTY):
The simple lookup table decoding is done with retlw x and DT x. These directives just return the corresponding ASCII character. The more sophisticated decoding
is done with subroutines, i.e. goto _XYZ. This means for instance that for a ENTER/RETURN key hit on the keyboard, the subroutine _CRLF is executed (carriage
return, line feed) and for ALT, CTRL, SHIFT and CAPS_LOCK, the corresponding flags are set in their corresponding subroutines.
Because the keyboard sends slightly different scan patterns for both, key hit and key release, there is need for a key release handling. This is done with the so-
http://www.trash.net/~luethi/microchip/projects/keyboard/v1xx/keyboard_v1xx.html (13 of 18)12/02/2008 17:16:09
AT Keyboard Interface V1.04 for Microchip PIC 16F84 Microcontroller
called release flag. So for every single character typed, the interrupt service routine is called twice (due to two different scan codes for hit and release) and the scan
pattern decoding routine is executed twice.
There are these four main code blocks in the keyboard assembler source:
To save code space, I've implemented the two look-up tables (main and shift) as follows:
Small letters (a-z) are translated directly with the main look-up table, capital letters (A-Z) are obtained by simply adding d'224' (8 bit unsigned wrap-
around) to the main look-up table results of small letters. Active shift button of the keyboard is only tracked by the shift flag.
Shift table is only used for special character conversion, e.g. +, %, &, (, ), ?
Compression is also applied to lookup sections, where scan patterns are quite distant, e.g. for the entire keyboard num-block (keypad).
If you apply changes to the existing code, you may need to change the ORG directives in order to realign the assembler code properly, due to the different lookup
tables and the PIC page boundaries.
Question: I have built successfully your AT keyboard project and it is running very well.
Now I want to customize my code such as to print out a predefined phrase e.g. 'Hello World' whenever I hit a specific key...?
Answer: This is not a difficult task, if you just use one specific key, for instance F9.
(For sequences like 'asdf', you must write your own detection routine for the main loop by checking the values in register KBD.) First look at the look-up tables
(LUT), for instance the eng_main.asm (QWERTY):
It is essentially a LUT which performs the decoding of the acquired keyboard scan codes into characters. At the top, the entries for the F1-F12 function keys are
located.
If you want a specific text to be displayed by pressing F9, change the line
retlw A'9' ; F9 -> 9 0x01
KBDtable ; (not used for characters typed with shift button active)
addwf PCL,F
retlw 0 ; invalid entry
retlw A'9' ; F9 -> 9 0x01
retlw 0 ;
retlw A'5' ; F5 -> 5
to
goto _MyRoutine
KBDtable ; (not used for characters typed with shift button active)
addwf PCL,F
retlw 0 ; invalid entry
goto _MyRoutine ; NEW: user-specific decoding for F9
retlw 0 ;
retlw A'5' ; F5 -> 5
Then you implement your own key-specific handler/subroutine _MyRoutine in the main file (section sub-routines), which displays your string, e.g. something like:
_MyRoutine
SENDw 'H' ; send to RS232
SENDw 'e'
SENDw 'l'
SENDw 'l'
SENDw 'o'
SENDw ' '
SENDw 'W'
SENDw 'o'
SENDw 'r'
SENDw 'l'
RETLW 'd' ; return with last character in w
http://www.trash.net/~luethi/microchip/projects/keyboard/v1xx/keyboard_v1xx.html (15 of 18)12/02/2008 17:16:09
AT Keyboard Interface V1.04 for Microchip PIC 16F84 Microcontroller
; alternative termination:
; SENDw 'd'
; RETLW 0 ; clear w to obtain invalid entry
You can do anything in this routine, just terminate with a RETLW 0 and ensure not to change any reserved registers...
If you want to alter the output for the keyboard characters in general, look at the the '_OUTP' section in the assembler source file kbd_1xx.asm:
There, the acquired keyboard character (in KBD) is sent to the RS232 interface.
If having a LCD display, the value of KBD might also be displayed using:
This is roughly what is done in the '_OUTP' section in the assembler source file kbd_2xx.asm.
Question: I have built successfully your AT keyboard project and it is running very well.
Now I want to customize my code such as to detect a specific key sequence, e.g. 'asdf'. Is this feasible...?
Answer: This is a more challenging task. (Alternatively, consider to just use one specific key e.g. F9 as described above.)
You need to write your own subroutine in the main loop in order to detect the desired character sequence. The keyboard character is usually passed within the
register KBD.
;******************************
_MLOOP btfsc KBDflag ; check scan pattern reception flag
call KBDdecode ; if set, call decoding routine
;btfsc your_other_flag
;call your_other_service
goto _MLOOP
;******************************
Do you know Microsoft? Are you a global player, too? Or do you travel sometimes to Europe?
Did it happen to you, that you ended up in Stockholm instead of Zurich?
Don't worry, even Microsoft is confused by the two european countries, Sweden and Switzerland.
You are excused as well if you mix this up...
[Toc] [Top]
Concept
How it works
Specifications
Features
Limitations
Project Resources
Available PIC Assembler Code
Schematic, Data Sheets, Pinout
User-specific Customization
This implementation contains the complete fetch and decoding of AT keyboard scan patterns as well as RS232 transmission of ASCII characters to the RS232
target device. It also features an interface to a dot matrix LCD display to visualize the characters typed on the locally attached keyboard.
Any key stroke on the local keyboard will send the corresponding scan patterns from the keyboard to the PIC microcontroller. Afterwards, the microcontroller
converts the keyboard scan patterns to ASCII characters, shows them on the LCD display and transmits them to the RS232 target device.
The keyboard scan code capture is done by an interrupt service routine. The event, which triggers the interrupt is a falling edge on the keyboard clock line
(PORTB,0). Keyboard scan pattern acquisition takes place at the keyboard data line (PORTA,4). After 11 clocks (i.e. 11 external interrupts on RB0/INT), the
interrupt service routine has completely captured an 8 bit element of the entire scan pattern and sets a ready flag. The decoding of this 8 bit element is then carried
out during normal operation mode, activated by a valid ready flag whilst keeping the keyboard stalled (keyboard clock line low).
The fact, that the scan pattern acquisition is carried out using an interrupt service routine and the decoding thereof is done during normal operation mode allows for
performing other tasks concurrently: That's why I call the acquisition routine preemptive. It does not block the processor while acquiring data.
Only RS232 transmission is supported by this program, since PORTB,0 interrupt is already used by the keyboard clock line. There exists no possibility to
implement also RS232 reception using my modules m_rsxxx.asm, because they require PORTB,0 as well and are laid out as non-preemptive data acquisition
routines (see also 'Limitations').
For dedicated code adaptations, please refer to the section 'User-specific Customization' below.
If you don't know the theory of AT keyboards, have a look at my short introduction or at Craig Peacocks tutorial about Interfacing the PC's Keyboard.
Main File Main Keyboard Decode Lookup Table SHIFT Keyboard Decode Lookup Table HEX Files
Latest version: English 'codepage' (QWERTY) English 'codepage' (QWERTY) QWERTY 'codepage':
kbd_2xx.asm View: eng_main.html View: eng_shif.html kbd_204_eng.hex
Download: eng_main.asm Download: eng_shif.asm
Slim version without ALT- QWERTZ 'codepage':
DEC & CTRL-HEX feature: Modified Swiss German Modified Swiss German kbd_204_sg.hex
kbd_202b.asm 'codepage' (QWERTZ) 'codepage' (QWERTZ)
View: ger_main.html View: ger_shif.html
Download: ger_main.asm Download: ger_shif.asm
The above programs need additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_rs096.asm, m_lcd_bf.asm
Important: Due to bi-directional communication between controller and keyboard as well as between controller and LCD display, the above programs only
work if both components are connected and are working properly!
For those, who are not familiar with interfacing a PIC to the RS232 using a MAX232: RS232-Interface.pdf (9.7 kB)
The schematic of the AT keyboard interface using the PIC 16F84: Keyboard_V2xx.pdf.
You don't know how a dot matrix LCD is working? Have a look at my data sheets page.
You can get the description of the various keyboard connectors <here>.
For a high level view, please refer to the section 'How it works' above.
Basically the same customization as for AT Keyboard Interface V1.xx applies to this implementation.
If you apply changes to the existing code, you may need to change the ORG directives in order to realign the assembler code properly.
[Toc] [Top]
Concept
How it works
Specifications
Features
Limitations
Project Resources
Available PIC Assembler Code
Schematic, Data Sheets, Pinout
User-specific Customization
This implementation contains the complete fetch and decoding of AT keyboard scan patterns as well as RS232 transmission and reception of ASCII characters to
and from the remote RS232 client. This microcontroller application also features an interface to a dot matrix LCD display to visualize the the data received from
the RS232 client on the first line, and the characters typed on the locally attached keyboard on the second line.
Any key stroke on the local keyboard will send the corresponding scan patterns from the keyboard to the PIC microcontroller. Afterwards, the microcontroller
converts the keyboard scan patterns to ASCII characters, shows them on the LCD display and transmits them to the RS232 target device.
The keyboard scan code capture is done by an interrupt service routine. The event, which triggers the interrupt is a falling edge on the keyboard clock line
(PORTB,0). Keyboard scan pattern acquisition takes place at the keyboard data line (PORTA,4). After 11 clocks (i.e. 11 external interrupts on RB0/INT), the
interrupt service routine has completely captured an 8 bit element of the entire scan pattern and sets a ready flag. The decoding of this 8 bit element is then carried
out during normal operation mode, activated by a valid ready flag whilst keeping the keyboard stalled (keyboard clock line low).
The fact, that the scan pattern acquisition is carried out using an interrupt service routine and the decoding thereof is done during normal operation mode allows for
performing other tasks concurrently: That's why I call the acquisition routine preemptive. It does not block the processor while acquiring data.
This program features also the capability of bi-directional communication between controller and keyboard for configuration purposes and to control the keyboard
LEDs. RS232 data exchange is carried out by using the internal USART of the PIC 16C74A. RS232 data reception is done on an interrupt-based acquisition
scheme, provided by the USART.
For dedicated code adaptations, please refer to the section 'User-specific Customization' below.
If you don't know the theory of AT keyboards, have a look at my short introduction or at Craig Peacocks tutorial about Interfacing the PC's Keyboard.
Processor: PIC16C74 A
Clock Frequency: 4.00 / 8.00 MHz crystal
Throughput: 1 / 2 MIPS
RS232 Baud Rate: 9600 / 19200 baud with BRGH = 1
Keyboard Routine Features: Capability of bi-directional communication between controller and
keyboard
Acquisition Methodology: Preemptive, interrupt-based keyboard scan pattern acquisition,
decoding to ASCII characters during normal operation mode
activated by ready flag
Code Size of entire Program: 964 instruction words
Required Hardware: AT keyboard, PS/2 connector, MAX232, HD44780 compatible dot
matrix LCD (2x16, 2x20 or 2x40 characters)
Required Software: RS232 terminal software (or Excel 97 RS232 Debug Interface)
Hey,
First, lemme say that I like your site and thank you for providing excellent reference material for us home-hobbyist microcontroller geeks. I am currently
working on a music/noise project that uses a PS/2 keyboard interfaced to a PIC16F84, and I used your page at http://www.electronic-engineering.ch/microchip/
projects/keyboard/v1xx/keyboard_v1xx.html heavily as a reference when designing hardware and writing code. Anyway, I just thought that I would mention
that I ran into a problem that I have since solved. The problem involved sending bytes *TO* the keyboard from the PIC (in order to light NumLock and
ScrollLock). Your "Host To Keyboard Protocol" section indicates that the keyboard will take the data line low for a clock after the byte is sent to create an ACK
bit. Apparently, the PS/2 keyboard that I have (generic $10 comp-USA brand) doesn't send an ACK bit, but rather sends a whole byte. If my code attempted to
wait for the ACK bit, it hung indefinitely. I changed the wait to look for a byte (by calling my existing function) and everything worked perfectly. I stumbled on
this idea by looking at other online references (most notably, some Linux kernel code at http://www.mscs.mu.edu/~georgec/Classes/207.1998/14Minix_book/S/
src%20kernel%20keyboard.c.html#307). I have seen this ACK *byte* mentioned elsewhere too. I *think* the keyboard sends back 0xFA as an ACK byte, but I
have not personally confirmed this. Perhaps your excellent documentation could just use a quick note of clarification so that other don't run into the same
problem. Maybe something as simple as: "NOTE: Some keyboards send an ACK byte (value 0xFA) instead of an ACK bit.".
Thanks again,
Jason
The comment above refers to bi-directional communication between PIC microcontroller and AT keyboard, i.e. to the source code of the AT Keyboard Interface
V2.xx and higher versions. The bi-directional communication between host and keyboard is designed to support both Ack bits and Ack bytes.
Every command sent from the host to the keyboard needs to have an Odd Parity bit and an Ack bit at the end.
Every command received by the keyboard from the host needs to be acknowledged by the keyboard by sending an Ack byte (0xFA) to the host. See also
section 'Host to Keyboard Protocol' at the AT Keyboard Interface V1.xx page.
http://www.trash.net/~luethi/microchip/projects/keyboard/v3xx/keyboard_v3xx.html (4 of 6)12/02/2008 17:16:12
AT Keyboard Interface V3.05 for Microchip PIC 16C74A Microcontroller
However, some AT keyboards may behave different and may need code adaptations to get bi-directional communication working properly.
Main File Main Keyboard Decode Lookup Table SHIFT Keyboard Decode Lookup Table HEX Files
Latest version: English 'codepage' (QWERTY) English 'codepage' (QWERTY) QWERTY 'codepage':
kbd_3xx.asm View: eng_main.html View: eng_shif.html kbd_3xx_eng.hex
Download: eng_main.asm Download: eng_shif.asm
Slim version without ALT- QWERTZ 'codepage':
DEC & CTRL-HEX feature: Modified Swiss German Modified Swiss German kbd_3xx_sg.hex
kbd_301.asm 'codepage' (QWERTZ) 'codepage' (QWERTZ)
View: ger_main.html View: ger_shif.html
Download: ger_main.asm Download: ger_shif.asm
The above programs need additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_lcd_bf.asm
Important: Due to bi-directional communication between controller and keyboard as well as between controller and LCD display, the above programs only
work if both components are connected and are working properly!
For those, who are not familiar with interfacing a PIC to the RS232 using a MAX232: RS232-Interface.pdf (9.7 kB)
The schematic of the AT keyboard interface using the PIC 16C74A: Keyboard_V3xx.pdf.
You don't know how a dot matrix LCD is working? Have a look at my data sheets page.
You can get the description of the various keyboard connectors <here>.
For a high level view, please refer to the section 'How it works' above.
Basically the same customization as for AT Keyboard Interface V1.xx applies to this implementation.
If you apply changes to the existing code, you may need to change the ORG directives in order to realign the assembler code properly.
[Toc] [Top]
Concept
How it works
Specifications
Parts order information
Features
Limitations
Project Resources
Available PIC Assembler Source Code
Schematics, Data Sheets, Pinout
User-specific Customization
This implementation contains the complete fetch and decoding of AT keyboard scan patterns as well as RS232 transmission and reception of ASCII characters to
and from the remote RS232 client. This microcontroller application also features an interface to a dot matrix LCD display to visualize the the data received from
the RS232 client on the first line, and the characters typed on the locally attached keyboard on the second line. Further, the application has also a small numeric
foil-keypad and a piezo-beeper for acoustic feedback.
Dynamic configuration of RS232 baud rate setting at start-up (user-customization with 1200 baud - 115200 baud), with 12 seconds inactivity time-out. In case the
time-out applies, the user-customization process terminates with the current setting. Default setting after power-up is 9600 baud.
Interrupt generator
for numeric foil-keypad: Whenever a key is hit, a key-
specific analog voltage is put on the first line to the A/
AT Keyboard Box V2.05 setup D converter. At the same time an interrupt is
with numeric foil-keypad, dot matrix LCD display and generated by this comparator circuit and put on the
AT keyboard second IRQ line.
http://www.trash.net/~luethi/microchip/projects/keyboard/kbd_box/kbd_box.html (2 of 10)12/02/2008 17:16:14
AT Keyboard Box V2.05 for Microchip PIC 16C74A Microcontroller
Front view
Numeric foil-keypad Microchip PIC16C74A microcontroller and piezo-
Connection topology: 1x12 beeper on the left side.
Here is only the description of the additional small numeric foil-keypad. The numeric foil-keypad is equipped with a specific resistor cascade to decode the values
through direct 8 bit A/D conversion using the PIC-internal A/D converter. The advantage is a very low pin usage: Only two pins are necessary for proper detection
and decoding of all keypad entries. One pin provides the analog value, the other pin serves for interrupt generation whenever a key of the keypad is touched. The
interrupt is used to start the A/D conversion.
During the interrupt service routine, only a short busy wait (analog settling time) and the A/D conversion - using the internal RC oscillator - is carried out. Before
leaving the ISR, the 8 bit A/D result is stored in a specific register and a dedicated flag is set.
Decoding of the A/D value is done during normal operation (activated by the flag) using two look-up tables. The first look-up table (LUT1) contains the expected
8 bit values of the keypad to check for valid entries. A numeric window of 3 allows for slight analog deviations during matching. The matching algorithm just
scans the entire LUT1 until the received keypad A/D result matches a LUT1 entry. The amount of loops carried out in LUT1 determines the position of the
corresponding symbol/character in LUT2. At the end, RS232 transmission and LCD display update are carried out.
Dynamic configuration of RS232 baud rate setting at start-up (user-customization with 1200 baud - 115200 baud). A watchdog timer implemented using TMR1
checks for inactivity during the customization process. After 12 seconds of inactivity, the user-customization process terminates with the current setting. At power-
up, the default setting is 9600 baud, which will be configured after the time-out - unless no user-customization takes place.
This setup works also without attached foil-keypad, even if the corresponding code is assembled and loaded into the microcontroller.
Note that every change in microprocessor clock frequency needs a re-calibration and/or re-design of the analog foil-keypad decoding circuitry.
The analog foil-keypad decoding approach deserves dedicated design and calibration: If a key on the keypad is hit, an interrupt is generated to start the A/D
conversion. The analog value built by the keypad resistor cascade needs some settling time until stable and reproduceable A/D values can be read out by the PIC
microprocessor (overshoots, undershoots).
This means that the PIC microprocessor clock frequency (related to the A/D conversion speed), output drive strength of the keypad resistor cascade and both
debounce capacitors on IRQ line and analog value pin affect the proper function of the keypad circuit. Whenever the PIC clock frequency is changed, (slight)
adaptations on the analog circuitry may have to be expected.
For calibration of the numeric foil-keypad, please refer to the page 'Numeric Foil-Keypad Calibration V0.04'.
Main File Main Keyboard Decode Lookup Table SHIFT Keyboard Decode Lookup Table HEX Files
Fully functional version English 'codepage' (QWERTY) English 'codepage' (QWERTY) QWERTY 'codepage':
V2.05: View: eng_main.html View: eng_shif.html kbd_box_eng.hex
kbd_box.asm Download: eng_main.asm Download: eng_shif.asm
QWERTZ 'codepage':
See also 'Numeric Foil- Modified Swiss German Modified Swiss German kbd_box_sg.hex
Keypad Calibration V0.04' 'codepage' (QWERTZ) 'codepage' (QWERTZ)
View: ger_main.html View: ger_shif.html
Download: ger_main.asm Download: ger_shif.asm
The above programs need additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_lcd_bf.asm
Important: Due to bi-directional communication between controller and keyboard as well as between controller and LCD display, the above programs only
work if both components are connected and are working properly!
Top view: kbd_box_top.pdf (with outdated 4 MHz crystal, now 14.7456 MHz)
LCD connection: kbd_box_lcd.pdf
Numeric foil-keypad: kbd_box_keypad.pdf
RS232 circuitry: kbd_box_max232.pdf
Power supply: kbd_box_power.pdf
Simulation of interrupt generation circuit (positive IRQ pulses): kbd_box_sdf.pdf
You don't know how a dot matrix LCD is working? Have a look at my data sheets page.
You can get the description of the various keyboard connectors <here>.
For a high level view, please refer to the section 'How it works' above.
Basically the same customization as for AT Keyboard Interface V1.xx applies to this implementation.
If you apply changes to the existing code, you may need to change the ORG directives in order to realign the assembler code properly.
[Toc] [Top]
Concept
How it works
Specifications
Supported Morse Alphabet
Features
Limitations
Project Resources
Available PIC Assembler Code
Schematic, Data Sheets, Pinout
User-specific Customization
This implementation contains the complete fetch and decoding of AT keyboard scan patterns as well as RS232 transmission of ASCII characters to the RS232
target device.
Additional Morse port for pulse-width modulated (PWM) Morse code output. Further, there is also the ability to enable acoustic Morse code feedback through a
Piezo beeper (parameterizable feature).
Parameterization of Piezo beeper support (acoustic Morse code feedback) with constant BEEP_ENABLE within section 'Parameterization' in program code.
Customization of Morse code speed at assemble time (length of dot, length of dash, wait period in between dash and dot, wait period in between two characters)
can be done using constants within section 'Constant declaration' in program code. No dynamic speed control during run time (not yet).
Since Morse code transmission needs some time for each character - especially numbers - multiple typed characters at the AT keyboard are stalled within the
keyboard internal TX buffer whenever the PIC microcontroller pulls down the open-collector clock line (between keyboard and PIC) for stalling. With this
scheme, up to 7 keyboard characters can be queued up without data loss (in my no-name 10$ keyboard). This queuing mechanism is maybe keyboard-dependent.
Translation from keyboard ASCII characters to Morse code is done using a look-up table. The look-up table for the ASCII to 16 bit Morse pattern conversion has
been created using an Excel 97 work sheet (MorseTableGenerator.zip) and Visual Basic macros. The supported Morse alphabet is listed in this table below.
The 16 bit Morse code look-up table for Microchip PIC assembler has been
http://www.trash.net/~luethi/microchip/projects/keyboard/morse_1x/morse_1x.html (2 of 6)12/02/2008 17:16:15
AT Keyboard Interface with Morse Code Support V1.02 for Microchip PIC16F84 Microcontroller
created automatically using an Excel 97 work sheet and Visual Basic macros.
Char Morse code Char Morse code Char Morse code Char Morse code
A .- N -. 0 ----- " .-..-.
B -... O --- 1 .---- ' .----.
C -.-. P .--. 2 ..--- () -.--.-
D -.. Q --.- 3 ...-- , --..--
E . R .-. 4 ....- - -....-
F ..-. S ... 5 ..... . .-.-.-
G --. T - 6 -.... : ---...
H .... U ..- 7 --... ? ..--..
I .. V ...- 8 ---..
J .--- W .-- 9 ----.
K -.- X -..-
L .-.. Y -.--
M -- Z --..
Main File Main Keyboard Decode Lookup Table SHIFT Keyboard Decode Lookup Table HEX Files
Latest version: English 'codepage' (QWERTY) English 'codepage' (QWERTY) QWERTY 'codepage':
morse_1x.asm View: eng_main.html View: eng_shif.html morse_1x_eng.hex
Download: eng_main.asm Download: eng_shif.asm
http://www.trash.net/~luethi/microchip/projects/keyboard/morse_1x/morse_1x.html (4 of 6)12/02/2008 17:16:15
AT Keyboard Interface with Morse Code Support V1.02 for Microchip PIC16F84 Microcontroller
QWERTZ 'codepage':
Modified Swiss German Modified Swiss German
morse_1x_sg.hex
'codepage' (QWERTZ) 'codepage' (QWERTZ)
View: ger_main.html View: ger_shif.html
Download: ger_main.asm Download: ger_shif.asm
The above programs need additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_rs096.asm, m_lcd_bf.asm.
For those, who are not familiar with interfacing a PIC to the RS232 using a MAX232: RS232-Interface.pdf (9.7 kB)
Basically, the schematic of the AT Keyboard Interface with Morse Code Support V1.02 is the same as the AT Keyboard Interface V1.04: Keyboard_V1xx.pdf
The only additional features:
The 16 bit Morse code look-up table for Microchip PIC assembler as Excel 97 work sheet with Visual Basic macros: MorseTableGenerator.zip
You don't know how a dot matrix LCD is working? Have a look at my data sheets page.
You can get the description of the various keyboard connectors <here>.
For a high level view, please refer to the section 'How it works' above.
Basically the same customization as for AT Keyboard Interface V1xx applies to this implementation.
If you apply changes to the existing code, you may need to change the ORG directives in order to realign the assembler code properly.
[Toc] [Top]
Concept
How it works
Specifications
Supported Morse Alphabet
Features
Limitations
Project Resources
Available PIC Assembler Code
Schematic, Data Sheets, Pinout
User-specific Customization
This implementation contains the complete fetch and decoding of AT keyboard scan patterns as well as RS232 transmission of ASCII characters to the RS232
target device. It also features an interface to a dot matrix LCD display to visualize the characters typed on the locally attached keyboard.
Additional Morse port for pulse-width modulated (PWM) Morse code output. Further, there is also the ability to enable acoustic Morse code feedback through a
Piezo beeper (parameterizable feature).
Basically, it works in the same way as the AT Keyboard Interface V2.03, although this program does not support direct Ctrl-Hex and Alt-Dec entry, and no bi-
directional communication between keyboard and PIC microcontroller. Further, there is also no RS232 data reception.
Morse pattern is signaled as pulse-width modulated stream at the Morse port, active high.
Parameterization of Piezo beeper support (acoustic Morse code feedback) with constant BEEP_ENABLE within section 'Parameterization' in program code.
Customization of Morse code speed at assemble time (length of dot, length of dash, wait period in between dash and dot, wait period in between two characters)
can be done using constants within section 'Constant declaration' in program code. No dynamic speed control during run time (not yet).
Since Morse code transmission needs some time for each character - especially numbers - multiple typed characters at the AT keyboard are stalled within the
keyboard internal TX buffer whenever the PIC microcontroller pulls down the open-collector clock line (between keyboard and PIC) for stalling. With this
scheme, up to 7 keyboard characters can be queued up without data loss (in my no-name 10$ keyboard). This queuing mechanism is maybe keyboard-dependent.
Translation from keyboard ASCII characters to Morse code is done using a look-up table. The look-up table for the ASCII to 16 bit Morse pattern conversion has
been created using an Excel 97 work sheet (MorseTableGenerator.zip) and Visual Basic macros. The supported Morse alphabet is listed in this table below.
The 16 bit Morse code look-up table for Microchip PIC assembler has been
created automatically using an Excel 97 work sheet and Visual Basic macros.
Char Morse code Char Morse code Char Morse code Char Morse code
A .- N -. 0 ----- " .-..-.
B -... O --- 1 .---- ' .----.
C -.-. P .--. 2 ..--- () -.--.-
D -.. Q --.- 3 ...-- , --..--
E . R .-. 4 ....- - -....-
F ..-. S ... 5 ..... . .-.-.-
G --. T - 6 -.... : ---...
H .... U ..- 7 --... ? ..--..
I .. V ...- 8 ---..
Main File Main Keyboard Decode Lookup Table SHIFT Keyboard Decode Lookup Table HEX Files
Latest version: English 'codepage' (QWERTY) English 'codepage' (QWERTY) QWERTY 'codepage':
morse_2x.asm View: eng_main.html View: eng_shif.html morse_2x_eng.hex
Download: eng_main.asm Download: eng_shif.asm
QWERTZ 'codepage':
Modified Swiss German Modified Swiss German morse_2x_sg.hex
'codepage' (QWERTZ) 'codepage' (QWERTZ)
View: ger_main.html View: ger_shif.html
Download: ger_main.asm Download: ger_shif.asm
The above programs need additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_rs096.asm, m_lcd_bf.asm
Important: Due to bi-directional communication between controller and LCD display, the above programs only work if both components are connected and
are working properly!
For those, who are not familiar with interfacing a PIC to the RS232 using a MAX232: RS232-Interface.pdf (9.7 kB)
Basically, the schematic of the AT Keyboard Interface with Morse Code Support V2.02 is the same as the AT Keyboard Interface V2.04: Keyboard_V2xx.pdf
The only additional features:
The 16 bit Morse code look-up table for Microchip PIC assembler as Excel 97 work sheet with Visual Basic macros: MorseTableGenerator.zip
You don't know how a dot matrix LCD is working? Have a look at my data sheets page.
You can get the description of the various keyboard connectors <here>.
For a high level view, please refer to the section 'How it works' above.
Basically the same customization as for AT Keyboard Interface V1.xx applies to this implementation.
If you apply changes to the existing code, you may need to change the ORG directives in order to realign the assembler code properly.
[Toc] [Top]
Concept
Specifications
Project Resources
Available Microchip PIC Assembler Source Code
PCB test board for PIC16F84 PIC16F84 test board with MAX232
using a dot matrix LCD display and a MAX232 for RS232 Test setup using LCD display on PortB and asynchronous RS232
transmission. connection (RX on PortB0, TX on PortA0). RS232 to USB1.1
connector in the back.
The above program needs additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_rs096.
asm
For those, who are not familiar with interfacing a PIC to the RS232 using a MAX232: RS232-Interface.pdf (9.7 kB)
[Toc] [Top]
Concept
Specifications
Project Resources
Available Microchip PIC Assembler Source Code
The above program needs additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_lcd.asm
For those, who are not familiar with interfacing a PIC to the RS232 using a MAX232: RS232-Interface.pdf (9.7 kB)
[Toc] [Top]
Concept
Specifications
Project Resources
Available Microchip PIC Assembler Source Code
Two independent RS232 interfaces, with display of received ASCII characters and corresponding decimal values on the dot matrix LCD.
ASCII values entered on one terminal window are transmitted by the first RS232 link to the controller, displayed on the LCD, and further
transmitted across the second RS232 link to the other terminal window. The microcontroller sends feedback of received characters back to
the issueing terminal window. When the PIC terminal is idle, it sends a status message '@' to both terminals every 2.75 seconds.
This program incorporates two independent RS232 interfaces, one hardware-based and one software-based. The HW-based RS232
interface uses the PIC-internal USART (and interrupts), configured to standard 9600 baud @ 4 MHz PIC clock. The SW-based RS232
interface is based on the module file m_rs096.asm, which performs interrupt-based RS232 reception on PortB0 (INTCON,INTF) at 9600
baud @ 4 MHz PIC clock.
The program shows the implementation and function of the modules m_bank.asm, m_wait.asm, m_lcd.asm, m_lcdv08.asm, and m_rs096.
asm on the PIC16F77.
The above program needs additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_lcd.asm
For those, who are not familiar with interfacing a PIC to the RS232 using a MAX232: RS232-Interface.pdf (9.7 kB)
[Toc] [Top]
Concept
Project Resources
Available Microchip PIC Assembler Source Code
This routine has been written to check the Excel Worksheet RS232scopeV102.xls.
It reads 16 bit values from a table, proceeds framing and sends the data to the PC.
The table was built with the "Automatic Table Generator for MPLAB Assembler"
The above program needs additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_lcd.asm
For those, who are not familiar with interfacing a PIC to the RS232 using a MAX232: RS232-Interface.pdf (9.7 kB)
[Toc] [Top]
Concept
Specifications
Project Resources
Available Microchip PIC Assembler Source Code
Schematics
This test application demonstrates the usage of the LCD assembler module files for dot matrix LCDs. It works for LCD controllers such
as Hitachi HD44780 (PDF data sheet, 389 kB), Samsung KS0073 (PDF data sheet, 673 kB), and compatibles.
It initializes the LCD display to the 4 bit transfer mode, loads two user-defined characters to the CGRAM,
and displays both of them together with some other special characters. Afterwards, an animation using
stars is shown, followed by a forth-and-back shift animation of a 'Hello World' string.
Shows the implementation and functionality of the modules m_wait.asm and m_lcd.asm on the PIC16F84. For the Samsung KS0073
controller type, the constant 'LCDTYPE' must be set to 0x1 to include also the extended function set features for configuration. If this
does not help, see also the FAQ section concerning LCD communication issues.
To see a schematic of the connection between LCD and PIC microcontroller, please refer to the schematic section below. Basically, the
connection is described in the header section of each LCD assembler module file.
LCD display output during operation LCD display output during operation
shows animation with stars shows forth-and-back shifting 'Hello World'
Specifications:
- used module m_lcdx.asm for building HEX-file with portB as LCD port
LCD port connections:
B0: not used, still available for INTB
B1: D4
B2: D5
B3: D6
B4: D7
B5: E
B6: R/W
B7: RS
The above program needs additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_lcd.asm
Download the PDF schematic to illustrate the connectivity of both 'classes' of LCD driver routines:
Modules m_lcd.asm, m_lcdx.asm, m_lcd_bf.asm, m_lcdxbf.asm: working only on entire ports ([1..7], without [0]),
e.g. PortB[1..7] on PIC16F84,
or PortB[1..7], PortC[1..7], PortD[1..7] on PIC16F77
Modules m_lcde.asm, m_lcde_bf.asm, m_lcdexbf.asm: working on separate, customizable ports,
e.g. PortB[0..2] for control lines & PortA[0..3] for data lines on PIC16F84, PIC16F7x,
or PortC[5..7] for control lines & PortD[0..3] for data lines on PIC16F77, or ...
Note that the data lines have to be on the low nibble of the port.
[Toc] [Top]
Concept
Specifications
Project Resources
Available Microchip PIC Assembler Source Code
This test application demonstrates the usage of the LCD assembler module files m_lcdv16.asm and m_lcdb16.asm on a PIC 16F84. These
module files are suitable for displaying decimal and binary information on a dot matrix LCD. Together with the module file m_lcd.asm,
they work with LCD controllers such as Hitachi HD44780 (PDF data sheet, 389 kB), Samsung KS0073 (PDF data sheet, 673 kB), and
compatibles.
The program initializes the LCD display to 4 bit transfer mode, clears two 8 bit registers (LO, HI) for the 16 bit counter, and displays
every counter step as decimal and binary value on the LCD display.
Shows the implementation and functionality of the modules m_wait.asm, m_lcd.asm, m_lcdv16.asm and m_lcdb16.asm on the PIC16F84.
For the Samsung KS0073 controller type, the constant 'LCDTYPE' must be set to 0x1 to include also the extended function set features for
configuration. If this does not help, see also the FAQ section concerning LCD communication issues.
Throughput: 1 MIPS
Code Size of entire Program: approx. 203 instruction words
LCD Transmission Mode: 4 Bit on D4 - D7 (MSB), uses high nibble of the LCD port
LCD Connections: 7 wires (4 Data, 3 Command)
Total LCD Connections: 10 wires (4 Data, 3 Command, 1 Vdd, 1 GND, 1 Contrast)
Required Hardware: HD44780 compatible dot matrix LCD (2x16, 2x20 or 2x40 characters)
Specifications:
- used module m_lcd.asm for building HEX-file with portB as LCD port
LCD port connections:
B0: not used, still available for INTB
B1: D4
B2: D5
B3: D6
B4: D7
B5: E
B6: R/W
B7: RS
The above program needs additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_lcd.
asm, m_lcdb16.asm
[Toc] [Top]
Concept
Specifications
Project Resources
Available Microchip PIC Assembler Source Code
This test application demonstrates the usage of the LCD assembler module file m_lcdb16.asm on a PIC 16F84. This module file is
suitable for displaying binary information on a dot matrix LCD. Together with the module file m_lcd.asm, it works with LCD controllers
such as Hitachi HD44780 (PDF data sheet, 389 kB), Samsung KS0073 (PDF data sheet, 673 kB), and compatibles.
The program initializes the LCD display to 4 bit transfer mode, clears two 8 bit registers (LO, HI) for the 16 bit counter, and displays
every counter step as binary value on the LCD display.
Shows the implementation and functionality of the modules m_wait.asm, m_lcd.asm, and m_lcdb16.asm on the PIC16F84. For the
Samsung KS0073 controller type, the constant 'LCDTYPE' must be set to 0x1 to include also the extended function set features for
configuration. If this does not help, see also the FAQ section concerning LCD communication issues.
LCD Transmission Mode: 4 Bit on D4 - D7 (MSB), uses high nibble of the LCD port
LCD Connections: 7 wires (4 Data, 3 Command)
Total LCD Connections: 10 wires (4 Data, 3 Command, 1 Vdd, 1 GND, 1 Contrast)
Required Hardware: HD44780 compatible dot matrix LCD (2x16, 2x20 or 2x40 characters)
Specifications:
- used module m_lcd.asm for building HEX-file with portB as LCD port
LCD port connections:
B0: not used, still available for INTB
B1: D4
B2: D5
B3: D6
B4: D7
B5: E
B6: R/W
B7: RS
The above program needs additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_lcd.
asm, m_lcdb16.asm
[Toc] [Top]
Concept
Project Resources
Available Microchip PIC Assembler Source Code
The Scan Code Debug Routine provides the ability to verify the scan patterns sent by the keyboard. The visualization can be done
with the RS232 Debug Interface, an Excel 97 Worksheet.
A screen shot from a debugging session is given below:
At the picture above, you can see the strange scan pattern sent by the
AT keyboard when pushing the Pause/Break key:
E1 14 77 E1 FO 14 FO 77
The above program needs additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_rs192.
asm
For those, who are not familiar with interfacing a PIC to the RS232 using a MAX232: RS232-Interface.pdf (9.7 kB)
[Toc] [Top]
Concept
How the numeric foil-keypad works
Specifications
Parts order information
Project Resources
Available Microchip PIC Assembler Source Code
Schematics, Data Sheets, Pinout
This application has entirely the same setup as the AT Keyboard Box V2.05.
This program refers to the calibration of the numeric foil-keypad of the AT Keyboard Box. The analog foil-keypad decoding approach deserves dedicated design
and calibration: If a key on the foil-keypad is hit, an interrupt is generated to start the A/D conversion. The analog value built by the keypad resistor cascade needs
some settling time until stable and reproduceable A/D values can be read out by the PIC microprocessor (overshoots, undershoots). For a detailed description,
please refer to the section 'How the numeric foil-keypad works' and the schematics below.
Numeric foil-keypad
Connection topology: 1x12
Interrupt generator
for numeric foil-keypad: Whenever a key is hit, a key-
specific analog voltage is put on the first line to the A/
AT Keyboard Box V0.04 setup D converter. At the same time an interrupt is
with numeric foil-keypad, dot matrix LCD display and generated by this comparator circuit and put on the
AT keyboard second IRQ line.
Here is the description of the additional small numeric foil-keypad. The numeric foil-keypad is equipped with a specific resistor cascade to decode the values
through direct 8 bit A/D conversion using the PIC-internal A/D converter. The advantage is a very low pin usage: Only two pins are necessary for proper detection
and decoding of all keypad entries. One pin provides the analog value, the other pin serves for interrupt generation whenever a key of the keypad is touched. The
interrupt is used to start the A/D conversion.
During the interrupt service routine, only a short busy wait (analog settling time) and the A/D conversion - using the internal RC oscillator - is carried out. Before
leaving the ISR, the 8 bit A/D result is stored in a specific register and a dedicated flag is set.
Decoding of the A/D value is done during normal operation (activated by the flag) using two look-up tables. The first look-up table (LUT1) contains the expected
8 bit values of the keypad to check for valid entries. A numeric window of 3 allows for slight analog deviations during matching. The matching algorithm just
scans the entire LUT1 until the received keypad A/D result matches a LUT1 entry. The amount of loops carried out in LUT1 determines the position of the
corresponding symbol/character in LUT2. At the end, RS232 transmission and LCD display update are carried out.
Dynamic configuration of RS232 baud rate setting at start-up (user-customization with 1200 baud - 115200 baud). A watchdog timer implemented using TMR1
checks for inactivity during the customization process. After 12 seconds of inactivity, the user-customization process terminates with the current setting. At power-
up, the default setting is 9600 baud, which will be configured after the time-out - unless no user-customization takes place.
This setup works also without attached foil keypad, even if the corresponding code is assembled and loaded into the microcontroller.
Note that every change in microprocessor clock frequency needs a re-calibration and/or re-design of the analog foil-keypad decoding circuitry. This means that
the PIC microprocessor clock frequency (related to the A/D conversion speed), output drive strength of the keypad resistor cascade and both debounce capacitors
on IRQ line and analog value pin affect the proper function of the keypad circuit. Whenever the PIC clock frequency is changed, (slight) adaptations on the analog
circuitry may have to be expected.
Main File Main Keyboard Decode Lookup Table SHIFT Keyboard Decode Lookup Table HEX Files
Debug and calibration English 'codepage' (QWERTY) English 'codepage' (QWERTY) QWERTY 'codepage':
version for numeric foil- View: eng_main.html View: eng_shif.html box_dbg_eng.hex
keypad V0.04: Download: eng_main.asm Download: eng_shif.asm
box_dbg.asm QWERTZ 'codepage':
box_dbg_sg.hex
The above programs need additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_lcd_bf.asm
Important: Due to bi-directional communication between controller and keyboard as well as between controller and LCD display, the above programs only
work if both components are connected and are working properly!
Top view: kbd_box_top.pdf (with outdated 4 MHz crystal, now 14.7456 MHz)
LCD connection: kbd_box_lcd.pdf
Numeric foil-keypad: kbd_box_keypad.pdf
RS232 circuitry: kbd_box_max232.pdf
Power supply: kbd_box_power.pdf
Simulation of interrupt generation circuit (positive IRQ pulses): kbd_box_sdf.pdf
You don't know how a dot matrix LCD is working? Have a look at my data sheets page.
You can get the description of the various keyboard connectors <here>.
[Toc] [Top]
Overview
Specifications
Project Resources
Available Microchip PIC Assembler Source Code
Hint
Do not try to connect the NSC ADC12130 to the PIC SSP interface of some more sophisticated PICs, eg. PIC 16C74. I've spent a
complete weekend trying to do that until I finally found out that the PIC SSP is not compatible with the one of the NSC ADC12130.
The clock and the data specifications of the PIC does not match with the ones of the ADC, there's an incompatible "skew" between
them.
The above program needs additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_lcd.asm
[Toc] [Top]
Concept
Components
Test Setup
Software
Project Resources
Available Microchip PIC Assembler Source Code
Precise time is always a nice feature. In Europe, we have a public RF transmitter located in Mainflingen, Germany, providing
standardized time information at 77.5 kHz. A cheap DCF77 receiver unit translates the RF data into PWM. A PIC 16F84
microcontroller performs software-based PWM decoding and transmits the data through RS232 to a PC with dedicated Excel 97
work sheet. The Excel 97 work sheet is able to acquire and log RS232 data, and also visualizes and translates complete DCF77
frames. A complete DCF77 evaluation setup is created.
The receiver has been ordered by Conrad Electronics, 92240 Hirschau, Germany (www.conrad.de)
Component:
Ordering number: #641138
Description: DCF77-Empfnger BN 641138
Price: Euro 9.95, December 2002
This unit performs the translation from 77.5 kHz RF to DCF77 PWM data. The information is encoded as follows: Pulse of 0.1s = 0,
0.2s = 1, numbers are encoded in BCD (binary coded decimal)
For detailed information, please refer to this document or the data sheet section.
Schematic:
Outputs need pull-up resistors (open collector) which have to draw
less than 1 mA.
1 - GND
2 - VDD, 1.5 V up to 15 V
3 - DCF77 PWM output, default active low, high pulses
4 - DCF77 PWM output, default active high, low pulses
For best reception, the Ferrit-antenna should be positioned rectangular to the direction of Mainflingen, Germany, the location of the
DCF77 transmitter.
This picture shows the test setup with DCF77 receiver unit at the lower right corner. The LCD display serves only for debugging
purposes and is not used within this project. This setup consists of DCF77 PWM bit stream decoder, PIC 16F84 microcontroller,
and MAX232 level shifter for serial transmission.
A second view on my standard PIC 16F84 test board. On this setup, I only use serial transmission, no reception. At the upper left
corner of the picture, you can see the RS232 to USB1.1 converter, which I bought because my Laptop has only a single serial port. It
works astonishingly well and entirely transparent to all my software. That's what I like - and expect from quality HW-SW co-design.
This is the graphical user interface of my Excel 97 work sheet designed to visualize and translate received serial DCF77 data from
the PIC microcontroller. You can see two valid DCF77 data frames, each of them containing 59 bits of information. Every frame is
enclosed with marks of value 2. Reception and decoding is done using Visual Basic macros. I used serial port 2, provided by the
USB1.1 serial converter, configured to 19200 baud, 8 data bits, no parity, 1 stop bit. The entire chart is setup to display 150 samples.
This is normally carried out within 150 seconds, assuming a clean DCF77 data reception containing a single PWM pulse every
second.
The bit streams of the two consecutive valid frames are displayed within the two large text boxes below the chart. The Visual Basic
code carries out a simple frame consistency check (59 data bits, no marks inside) automatically every complete frame and displays
the translation of the last valid frame in the three smaller text boxes at right. To keep it simple, there is neither DCF77 parity bit
checking nor any error handling implemented in the software.
The above program needs additional include files (modules) to get successfully assembled: m_bank.asm, m_wait.asm, m_lcd.asm
Download Excel 97 work sheet (DCF77 data visualization and translation): DCF77_Visualizer.zip (155 kB)
[Toc] [Top]
V1.06.0
jacOS
jacOS . ,
. jacOS event-driven priority-based RTOS. 1.06.0
, , , . .
.
.
: .
. ,
. -, , , .
, . , ,
. , , . ,
- , ,
.
, ?
. , , .
, . ROM, RAM.
, , , .
. , .
.
"" ( ), , .
"" , " ", , .
, :
.
, , . , , , "".
RTOS? , . , .
. RTOS .
. RTOS . ,
RTOS RTOS, , . , RTOS ,
? , , , .
.
jacOS 1.06.0 12- , 14- 16- PIC, AVR , MSP430 51.
. , 41- , , , .
18- . , "" .
, , , .
.
PIC 12 SMALL
H-T
256 ROM. .
2
3 .
PIC18 COMPACT 1. , TCB TCB 4 8- .
H-T ECB near, ECB - 3 4-.
,
128 RAM. (96
) ~=24
2.
64Kb(32)
PIC18 NORMAL 1. , TCB
Code model = Static overlay.
IAR ECB TCB 5 9- .
__bank1 (256 ). ECB - 4 5-.
AVR GCC NORMAL TCB 5 9- .
WINAVR ECB - 4 6-.
AVR COMPACT 1.
IAR __tiny. ~=30.
2. Cross Call tiny small
v0,v1,v3.
TCB 4 8- .
ECB - 2 5-.
1. Cross Call
NORMAL small
v3.
TCB - 5 12- .
ECB - 3 6-.
MSP430 NORMAL TCB 6 12- .
IAR ECB - 4 6-.
x51 NORMAL 1. 64Kb TCB 4 8- .
Keil ECB - 3 5-.
.
PIC12 , PIC16 HI-TECH PICC v8.05 Produce assembler list file
PIC18 HI-TECH PICC-18 v8.35
.
, path info .
.
.
.
. , .
, , "" ADC, , -
. , "", RTOS. ""
. "" , . ,
( ), , . .
, . , " " ,
.
jacOS . ,
. , ,
... . , .
IAR __task.
, , . (TCB).
//1 task_1 OST_TASK, TCB. jacOS
TCB. OST_TASK, - OST_TASK_T, .
TCB bank1. , . jacOS bank2
bank3. , , .
, .
OS_Cooperate() //5 .
. . , , OS_Cooperate() jacOS
.
, //2. static ,
. , static,
. PIC,
.
, . OS_Cooperate() ,
. , ? jacOS
, , .
, . . ,
your_func() , .
, . , .
your_func().
, , ,
. , .
C:, c:\jacos\prim
jacOS. PIC IDE - MPLAB 5.7x MPLAB 6.. .
, .
. , ,
, .
counter++ . , counter
. , IDE , counter++ .
/********************************************/
OS_Cooperate() , . //1
, //2. , //2 loc_var , sta_var,
, 45-.
- , .
/***** c:\jacos\prim\prim1*****************/
#define OS_MAIN
#include <jacos.h>
OST_TASK task1;
OST_TASK task2;
unsigned char counter;
void main(void)
{
OS_Init();
OS_Task_Create(T1,&task1); //1
OS_Task_Create(T2,&task2);
while(1) {
OS_Scheduler(); //2
}
}
/**** 1*******************************/
#define OS_MAIN
, main() , OS_MAIN.
#include <jacos.h>
.
.
OS_Init();
. .
OS_Task_Create(
OST_ADDRESS __,
OST_TASK_P __TCB,
OST_U8 );
. prim1 , OS_Task_Create() . - ,
- TCB.
, prim1 . , .
. ,
, , .
OS_Scheduler();
OS_Scheduler() .
. , OS_Scheduler() , .
. , OS_Scheduler() - ,
. , . , WDT, .
c:\jacos\prim\prim1.
, jacOS ? , .
"jacnfg.h". prim1 :
PIC12F675 :
main.c -
40Antln.lib -
:
1) jacnfg.h.
2) head ( \jacos\incl ).
.
. .
. ? , ,
100 150? OS_Delay().
/***** c:\jacos\prim\prim2*****************/
#define OS_MAIN
#include <jacos.h>
OST_TASK_T task1;
OST_TASK task2;
void main(void)
{
OS_Init();
OS_Task_Create(T1,&task1);
OS_Task_Create(T2,&task2);
PR2 = OS_TMR_TICK;
TMR2 = 0;
INTCON = 0b11000000;
TMR2IE = 1;
TMR2IF = 0;
T2CON = 0x05;
while(1) {
OS_Scheduler();
}
}
OST_TASK_T OST_TASK, .
OS_Delay() ( ).
- , . ,
. . . ,
, . .
, .
jacOS 1000- . 4 PIC 1.
, 1000- , .
, . , , ,
PIC16 1000- . , . , .
PIC . AVR MSP430 - 2000 .
OS_Delay(OST_TIMER __);
. , . .
, main, . . "
" , .
, . "". , ,
, - . ,
.
, . "".
. ,
. , - . , ,
.
. . .
"", TCB " ".
. TMR2 . ,
(4). OS_Timer() . OS_Timer(),
. OS_Delay(10) 1 10 , 9
+ 10+ . ? , , ,
, . .
, EEPROM 8-9 = 5.
, EEPROM
10.
OS_Delay(10ms); // :(
, , , OS_Delay()
. OS_Delay(),
. ,
"" . , , .
, , . . . ,
. .
, OS_Delay .
.
/***** c:\jacos\prim\prim3*****************/
. . .
__task void T1( void )
{
while(1) {
counter++;
OS_Cooperate();
OS_Task_Stop();
counter++;
}
}
. . .
__task void T3( void )
{
while(1) {
counter++;
OS_Cooperate();
if (counter > 15) {
if (OS_Task_Resume(&task1) == OS_ERROR) {
counter = 0;
}
}
counter++;
}
}
.
"" .
. . jacOS : . ,
, . - 0 1.
. - , - , - , .. , -
, , , .
, , .
, . , 0, , .
/***** c:\jacos\prim\prim4*****************/
#define OS_MAIN
#include <jacos.h>
OST_TASK_T task1;
OST_TASK task2;
OST_TASK task3;
OST_SEMAPHORE event1;
counter++; //N+4
}
}
void main(void)
{
OS_Init();
OS_Task_Create(T1,&task1);
OS_Task_Create(T2,&task2);
OS_Task_Create(T3,&task3);
OS_Sem_Create(&event1,0);
PR2 = OS_TMR_TICK;
TMR2 = 0;
INTCON = 0b11000000;
TMR2IE = 1;
TMR2IF = 0;
T2CON = 0x05;
while(1) {
OS_Scheduler();
}
}
OST_SEMAPHORE event1;
(ECB) c OST_SEMAPHORE.
bank1.
OS_Sem_Create(
OST_SEMAPHORE_P __,
OST_SEM __
);
OS_Sem_Create . ECB, -
. 0 1. , .
, , , .
OS_Post_BSemR(
OST_SEMAPHORE_P __,
OST_ERR_MSG _
);
OS_Post_BSemR , ECB , .
OS_ERROR - , , . . OS_NOERR -
. , . (
), .
OS_Wait_Sem(OST_SEMAPHORE_P __ );
OS_Wait_Sem , , , OS_Wait_Sem 0
. , . , .
, FIFO. .
OS_Wait_Sem . . ,
, .
, OS_Wait_Sem 0, .
.
OS_Cooperate(), . , jacOS
, , , .
, . , , ,
, "" . OS_Cooperate.
jacOS OS_Post_BsemR: OS_Post_BSem - , .
OS_Post_BSemI - .
. .
"" . , .
, V1.06.0 .
.
/***** c:\jacos\prim\prim5*****************/
. . .
OST_MESSAGE event1;
OS_Msg_Create(&event1,0);
. . .
OST_MESSAGE event1;
OST_MESSAGE - ECB .
OS_Post_Msg(
OST_MESSAGE_P ___,
OST_MSG_P __
);
, . .
. , , - .
, . jacOS V1.06.0 ,
, . , ,
.
OS_Wait_Msg(
OST_MESSAGE_P ___,
OST_MSG_P __
);
OS_Wait_Msg lvalue, .
OS_Msg_Create(
OST_MESSAGE_P ___,
OST_MSG_P __
);
OS_Msg_Create. , .
(void*)0, HT PICC 0.
.
, , - . ? jacOS V1.06.0
, .
/***** c:\jacos\prim\prim6*****************/
#define OS_MAIN
#include <jacos.h>
OST_TASK_T task1;
OST_TASK_T task2;
OST_TASK task3;
OST_MESSAGE event1;
unsigned char counter;
unsigned char even;
unsigned char odd;
void main(void)
{
OS_Init();
OS_Task_Create(T1,&task1,1);
OS_Task_Create(T2,&task2,1);
OS_Task_Create(T3,&task3,0);
OS_Msg_Create(&event1,0);
PR2 = OS_TMR_TICK;
TMR2 = 0;
INTCON = 0b11000000;
TMR2IE = 1;
TMR2IF = 0;
T2CON = 0x05;
while(1) {
OS_Scheduler();
}
}
void OS_Idle(void)
{
counter--;
}
/***** c:\jacos\prim\prim6*****************/
OS_Wait_MsgT(
OST_MESSAGE_P ___,
OST_MSG_P __
OST_TIMER __
);
, OS_Wait_Msg .
, .
OS_Timeout().
OST_ERR_MSG OS_Timeout(void);
1- .
, .
OS_Task_Status(). :
OSS_TIMER_Q - (delayed)
OSS_EVENT_Q - (, , )
OSS_STOPPED -
OS_STS_PRIO_MASK -
, , . ,
. , ,
.
.
, . . OS_Idle(), .
.
, ,
, .
__task void Task1( void )
{
while(1) {
counter++;
OS_Wait_SemT(&event1,5);
if ( OS_Timeout() ) {
counter++;
OS_Cooperate();
}
}
}
, "" .
.
jacOS . -
, . (), .
, .
, .
OS_Wait_Sem(&ev1); //1
OS_Wait_Sem(&ev2);
OS_Wait_Sem(&ev3);
. . .
OS_Wait_Flag(&event1,mask); //2
/***** c:\jacos\prim\prim7*****************/
#define OS_MAIN
#include <jacos.h>
OST_TASK task1;
OST_TASK task2;
OST_TASK task3;
OST_FLAGS event1;
OS_Clear_Flag(&event1,0x03); //6
OS_Task_Resume(&task2); //7
counter = 0;
}
}
void main(void)
{
OS_Init();
OS_Task_Create(T1,&task1,0);
OS_Task_Create(T2,&task2,1);
OS_Task_Create(T3,&task3,2);
OS_Flag_Create(&event1,0);
while(1) {
OS_Scheduler();
}
}
/***** c:\jacos\prim\prim7*****************/
#define OS_Lib_Type OS_et
#define OS_MAX_PRIO 2
/**** jacnfg.h ****************************/
3 . .
OST_FLAGS event1;
OST_FLAGS - ECB .
OS_Flag_Create(
OST_FLAGS_P ___,
OST_FLG __);
OS_Wait_Flag(
OST_FLAGS_P ___,
OST_FLG _);
OS_Set_Flag(
OST_FLAGS_P ___,
OST_FLG __);
OS_Clear_Flag(
OST_FLAGS_P ___,
OST_FLG ___);
, . , - jacOS V1.06.0
8- 16- .
, - . , :
while(1) {
// ROM 2-3
// PIC16.
if (!(OS_Read_Flag(&event1) & task1_run)) break;
counter++;
if (!(OS_Read_Flag(&event1) & task1_run)) break;
OS_Cooperate();
counter++;
}
OS_Task_Stop();
}
}
.
, . , .
: OS_Post_CSemI(), OS_Post_BSemI(), OS_Post_MsgI(),
OS_Set_FlagI(), OS_Clear_FlagI(), OS_Accept_MsgI(), OS_Accept_SemI(). jacOS
.
, , . ,
( AVR , , OS_Timer()) .
.
. , ,
, . (background) . ,
, , .
/***** c:\jacos\prim\prim8*****************/
#define OS_MAIN
#include <jacos.h>
OST_TASK task1;
OST_TASK task2;
OST_TASK task3;
OST_MESSAGE event1;
char * msg;
unsigned char counter;
void main(void)
{
OS_Init();
OS_Task_Create(T1,&task1);
OS_Task_Create(T2,&task2);
OS_Task_Create(T3,&task3);
OS_Msg_Create(&event1,0);
PR2 = OS_TMR_TICK;
TMR2 = 0;
INTCON = 0b11000000;
TMR2IE = 1;
TMR2IF = 0;
T2CON = 0x05;
while(1) {
OS_Scheduler();
}
}
#pragma interrupt_level 0
interrupt void intr(void)
{
char i;
if ( OS_Is_Timer()) {
OS_Timer_Tick_Set();
if (OS_Post_MsgI(&event1,&st2) == OS_ERROR) {
i--;
}
}
}
/***** c:\jacos\prim\prim8*****************/
#define OS_Lib_Type OS_ein2
#define OS_TMR_TICK 249
#define OS_USE_MSG_I
/**** jacnfg.h ****************************/
OST_ERR_MSG OS_Post_MsgI(
OST_MESSAGE_P ___,
OST_MSG_P __);
OS_ERROR , , , ,
. OS_NOERR . OS_Post_MsgI OS_Post_MsgR.
#pragma interrupt_level 0
#define OS_USE_MSG_I
OS_USE_MSG_I OS_Post_MsgI() .
3 . . 1.
, 1, . .
, . ,
. , . , V1.06.0
( OS_Post_MsgQ(), OS_Post_MsgQI(), OS_Post_MsgQR(), OS_Wait_MsgQ, OS_Wait_MsgQT,
OS_MsgQ_Create(), OS_Accept_MsgQ(), OS_Accept_MsgQI() ).
OS_Timer() .
. , , OS_Timer 12- PIC.
/***** c:\jacos\prim\prim9*****************/
. . .
while(1) {
OS_Scheduler();
if (OS_Is_Timer()) {
OS_Timer();
OS_Timer_Tick_Set();
}
}
. . .
OS_Is_Timer() OS_Timer_Tick_Set() :
// 12- PIC.
#define OS_Is_Timer() TMR0 & 0x80
// 14- PIC.
#define OS_Is_Timer() T0IF
#define OS_Timer_Tick_Set()\
{\
TMR0 -= OS_TMR_TICK;\
T0IF = 0;\
}
// PIC18.
#define OS_Is_Timer() TMR2IF
// AVR.
#define OS_Is_Timer() (TIFR & (1 << TOV0))
// MSP 8051 -
//. ,
// .
#define OS_Is_Timer() (1)
#define OS_Timer_Tick_Set() {}
.
, .
. , , , , , .
:
, . (. 1)
:
n- round robin, delays,
d- delays
e-
c- delays
t- delays
:
t-
i-
:
n-
-
:
- , delays .
2- , delays .
. 2.
1. .
PIC (HI-TECH)
211 12C(R)509(A,AF,AG), 12CE519, 12F509
212 16C505
222 16C(R)57(A,B,C), 16C(R)58(A,B), 16F57
401 16C554(A), 16C556(A), 16C558(A), 16C(R)62(A,B), 16C620, 16C621, 16C622, 16C(R)64(A),
16C712, 16C715, 16C716, 16C(R)72(A)
40A 12F629, 12F675, 16C71, 16C710, 16C711, 16C(R)84, 16F630, 16F676, 16F84(A)
40B 12C671, 12C672, 12CE673, 12CE674, 12F683, 16C432, 16C433, 16C620A, 16C621A, 16C622A,
16C641, 16C661, 16CE623, 16CE624, 16CE625, 16F684, 16F716
40C 12F635, 16C717, 16C770, 16C781, 16C782, 16F72, 16F627(A), 16F628(A), 16F636, 16F818,
16F819, 16F870, 16F871, 16F872
411 16C(R)63(A), 16C(R)65(A,B), 16C73(A,B), 16(L)C74(A,B)
412 16F73, 16F74, 16F737, 16F747, 16F873(A), 16F874(A)
41B 16C642, 16C662
41C 16C771, 16C773, 16C774, 16C923, 16C924, 16C925, 16F648A, 16F688, 16F87, 16F88
42C 16C66, 16C67, 16C745, 16C76, 16C765, 16C77, 16F76, 16F77, 16F767, 16F777, 16F876(A),
16F877(A)
800 PIC18
80E PIC18 errata (18F5x)
PIC (IAR)
I18 Target: PIC18, Code model - Static overlay
AVR GCC WINAVR
A20 Target: Instruction set - avr2 (MCU types: at90s2313, at90s2323, attiny22, at90s2333,
at90s2343, at90s4414, at90s4433, at90s4434, at90s8515, at90c8534, at90s8535)
A30 Target: Inst. set - avr3 (MCU types: atmega103, atmega603, at43usb320, at76c711)
A40 Target: Inst. set - avr4 (MCU types: atmega8, atmega83, atmega85)
A50 Target: Inst. set - avr5 (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
atmega64, atmega128, at43usb355, at94k)
AVR (IAR)
2. .
PIC 12, 14 (void const *)
2
800, 80E (void far *)
2
I18 (void __dptr *)
3
A20, A30, A40, A50 (void *)
2
At0, At1, As1, (void __generic *)
2
At3, As3, Ns3, Es3 (void __generic *)
3
430 (void *)
2
S51, C51, L51 (void *)
3
.
jacnfg.h . , 800ctun.lib,
:
#define OS_Lib_Type OS_ctun
, OS_Lib_Type, OS_ .
, . , 0,1,2 3,
:
#define OS_MAX_PRIO 3
,
.
, .
.
#define OS_USE_CSEM_I // OS_Post_SemI()
#define OS_USE_BSEM_I // OS_Post_BSemI()
#define OS_USE_MSG_I // OS_Post_MsgI()
#define OS_USE_FLAGS_I // OS_Set_FlagI()
#define OS_USE_MSGQ_I // OS_Post_MsgQI()
OS_Timer_Tick_Set() OS_Is_Timer() , , ,
.
, , ,
:
#define OS_OPTI_SEMT // OS_Wait_Sem() OS_Wait_SemT()
#define OS_OPTI_MSGT // OS_Wait_Msg() OS_Wait_MsgT()
#define OS_OPTI_MSGQT // OS_Wait_MsgQ() OS_Wait_MsgQT()
#define OS_OPTI_DELAY // OS_Delay()
, . ,
Es3, Ns3 Ns1 :
#define OS_MEM_MODEL NORMAL
.
OS_Accept_Msg()
OS_Accept_Msg(
OST_MESSAGE_P ___,
OST_MSG_P __);
, . , NULL.
OS_Wait_Msg(), , .
: , background
OS_Accept_MsgI()
OS_Accept_MsgI(
OST_MESSAGE_P ___,
OST_MSG_P __);
, . , NULL.
.
:
OS_Accept_MsgQ()
OS_Accept_MsgQ(
OST_MSGQUEUE_P ____,
OST_MSG_P __);
. , NULL. OS_Wait_MsgQ(), ,
.
: , background
OS_Accept_MsgQI()
OS_Accept_MsgQI(
OST_MSGQUEUE_P ____,
OST_MSG_P __);
. , NULL. OS_Wait_MsgQ(), ,
. .
:
OS_Accept_Sem()
OS_Accept_Sem(OST_SEMAPHORE_P ___);
0, . OS_Wait_Sem(),
.
: , background
OS_Accept_SemI()
OS_Accept_SemI(OST_SEMAPHORE_P ___);
0, . OS_Wait_Sem(),
, . .
:
OS_Clear_Flag()
OS_Clear_Flag(
OST_FLAGS_P ___,
OST_FLG ___)
.
: , background
OS_Clear_FlagI()
OS_Clear_FlagI(
OST_FLAGS_P ___,
OST_FLG ___)
. .
:
OS_Cooperate()
OS_Cooperate()
.
:
OS_Cur_Delay
OST_TIMER OS_Cur_Delay
. ,
sleep OS_Cur_Delay. : {OS_Cur_Delay = 1; OS_Timer();}
OS_Cur_Delay . , sleep
.
: , background
OS_Cur_Task()
OST_TASK_P OS_Cur_Task()
(TCB) .
:
OS_Delay()
OS_Delay(OST_TIMER __)
. 0.
:
OS_Flag_Create()
OS_Flag_Create(
OST_FLAGS_P ___,
OST_FLG __)
.
: , background
OS_Init()
OS_Init()
. .
: background
OS_Msg_Create()
OS_Msg_Create(
OST_MESSAGE_P ___,
OST_MSG_P __)
.
: , background
OS_MsgQ_Create()
OS_MsgQ_Create(
OST_MSGQUEUE_P ____,
OST_MSGQ_DESCR_P ___,
OST_U8 _,
OST_MSG_P *_____)
. . , ,
. ( , ,
, ). ECB
RAM. _ , .
: , background
:
OST_MSGQUEUE msgq;
bank1 OST_MSGQ_DESCR mqdscr;
bank1 OST_MSG_P mbuff[5];
while(1) {
counter++;
OS_Post_MsgQR(&msgq, rx, y);
}
}
OS_Post_BSem()
OS_Post_BSem(OST_SEMAPHORE_P ___);
1 0.
.
: , background
OS_Post_BSemI()
1 0.
. .
OS_USE_BSEM_I .
:
OS_ERROR - ,
OS_NOERR -
OS_Post_BSemR()
OS_Post_BSemR(
OST_SEMAPHORE_P ___,
OST_ERR_MSG _)
1 0.
.
: , background
OS_ERROR - ,
OS_NOERR
OS_Post_CSem()
OS_Post_CSem(
OST_SEMAPHORE_P ___,
OST_SEM __);
.
. 0, 255 (65535) 8- (16) .
: , background
OS_Post_CSemI()
OST_ERR_MSG OS_Post_CSemI(
OST_SEMAPHORE_P ___,
OST_SEM __);
.
. . 0, 255 (65535) 8-
(16) . OS_USE_CSEM_I
.
:
OS_ERROR - , .
OS_NOERR -
OS_Post_CSemR()
OS_Post_CSemR(
OST_SEMAPHORE_P ___,
OST_SEM __,
OST_ERR_MSG _)
.
. 0, 255 (65535) 8- (16) .
: , background
OS_ERROR - , .
OS_NOERR -
OS_Post_Msg()
OS_Post_Msg(
OST_MESSAGE_P ___,
OST_MSG_P __);
, , .
.
: , background
OS_Post_MsgI()
OST_ERR_MSG OS_Post_MsgI(
OST_MESSAGE_P ___,
OST_MSG_P __)
, , .
. .
OS_USE_MSG_I .
:
OS_ERROR - ,
OS_NOERR -
OS_Post_MsgQ()
OS_Post_MsgQ(
OST_MSGQUEUE_P ____,
OST_MSG_P __);
. .
: , background
OS_Post_MsgQI()
OST_ERR_MSG OS_Post_MsgQI(
OST_MSGQUEUE_P ____,
OST_MSG_P __);
. .
.
OS_USE_MSGQ_I .
:
OS_ERROR - . , .
OS_NOERR -
OS_Post_MsgQR()
OS_Post_MsgQR(
OST_MSGQUEUE_P ____,
OST_MSG_P __,
OST_ERR_MSG _);
. .
: , background
OS_ERROR - . , .
OS_NOERR -
OS_Post_MsgR()
OS_Post_MsgR(
OST_MESSAGE_P ___,
OST_MSG_P __,
OST_ERR_MSG _)
, , .
.
: , background
OS_ERROR - ,
OS_NOERR -
OS_Post_MsgRI()
OS_Post_MsgRI(
OST_MESSAGE_P ___,
OST_MSG_P __,
OST_ERR_MSG _)
, , .
. .
:
OS_ERROR - ,
OS_NOERR -
OS_Read_Flag()
. .
:
OS_Read_Msg()
. .
:
OS_Read_Sem()
. .
:
OS_Scheduler()
OS_Scheduler()
. .
: background
OS_Sem_Create()
OS_Sem_Create(
OST_SEMAPHORE_P ___,
OST_SEM __);
, ECB, .
: , background
OS_Set_Flag()
OS_Set_Flag(
OST_FLAGS_P ___,
OST_FLG __)
. , ,
.
: , background
OS_Set_FlagI()
void OS_Set_FlagI(
OST_FLAGS_P ___,
OST_FLG __)
. .
OS_USE_FLAGS_I .
OS_Status()
OS_Status()
.
:
OSS_EVENT - ,
OSS_IDLE -
OS_Task_Create()
OS_Task_Create(
OST_ADDRESS __,
OST_TASK_P __TCB,
OST_U8 );
, .
: , background
OS_Task_Restart()
OS_Task_Restart(
OST_ADDRESS ___,
OST_TASK_P __TCB);
( ) .
:
OS_Task_Resume()
, . .
: , background
OS_ERROR - , ""
OS_NOERR -
OS_Task_Status()
OS_Task_Status(OST_TASK_P __TCB,)
.
:
:
OSS_TIMER_Q -
OSS_EVENT_Q -
OSS_STOPPED -
OS_STS_PRIO_MASK -
OS_Task_Stop()
OS_Task_Stop()
"". ,
.
:
OS_Ticks()
OS_Ticks()
, . OS_Timer()
1-, , . ,
. OS_Ticks() >= 2 , , ,
.
:
OS_Timeout()
OST_ERR_MSG OS_Timeout(void)
OS_Wait_SemT(), OS_Wait_MsgT(),
OS_Wait_MsgQT().
:
OS_ERROR - .
OS_NOERR - .
OS_Timer()
OS_Timer()
.
:
OS_Timer_Queue()
OST_TASK_P OS_Timer_Queue()
TCB , . , NULL.
:
OS_Wait_Flag()
OS_Wait_Flag(
OST_FLAGS_P ___,
OST_FLG _)
, , ,
.
:
OS_Wait_Msg()
OS_Wait_Msg(
OST_MESSAGE_P ___,
OST_MSG_P __);
, , .
. lvalue.
:
OS_Wait_MsgQ()
OS_Wait_MsgQ(
OST_MSGQUEUE_P ____,
OST_MSG_P __)
, , . ,
, . lvalue.
:
OS_Wait_MsgQT()
OS_Wait_MsgQT(
OST_MSGQUEUE_P ____,
OST_MSG_P __,
OST_TIMER __)
, , . ,
, . .
NULL. lvalue.
OS_Timeout().
:
:
counter = 0;
}
counter++;
}
}
OS_Wait_MsgT()
OS_Wait_MsgT(
OST_MESSAGE_P ___,
OST_MSG_P __,
OST_TIMER __);
, , . .
. . lvalue.
0. OS_Timeout().
OS_Wait_Sem()
OS_Wait_Sem(OST_SEMAPHORE_P ___);
, , .
:
OS_Wait_SemT()
OS_Wait_SemT(
OST_SEMAPHORE_P ___,
OST_TIMER __)
, , .
. 0.
OS_Timeout().
:
_____________________________________________________________________
http://jacos.narod.ru
jacos_post@mtu-net.ru
Data Recorder
DESIGNS
2007-10-01 USB BitScope 100 Release
Opto-Isolated USB BitScope Released
Meet the new opto-isolated BS100U BitScope.
They're all BitLib based and include source so you can see exactly how they work. You can also modify them
to suit your needs or use them as a starting point for your own BitScope software.
BitLib is also ideal when integrating BitScope with third party software tools. The DAQ spreadsheet provides
one example but we'll be releasing a number of others over the coming months based on your feedback.
Email us at projects and send us your requests.
You can download a PDF copy of the review Silicon Chip have kindly sent us here.
In addition to Replay and Export features announced already, this new release
includes user interface improvements such as auto range, normalize, input offset
control and channel calibration.
There are also numerous small changes like context menus for fast parameter entry,
live waveform generator previews, intelligent parameter "toggle on click" as well as
various small bug fixes.
To upgrade to DSO Version 1.3, simply download the archive, unpack and install.
For what you can expect to see, check out Display Export and the offline replay DSO tutorial.
This brand new BitScope replaces BS440N as our top of the range 12
Updated BitScope DSO software is included supporting the additional channels and new features.
2006-05-25
You can now use this diminutive BitScope in PC based Data Acquistion just like its
larger brethren.
About the same size and weight as a Pocket PC, the USB powered Pocket Analyzer needs no bulky
accessories. With the same mixed signal, analog and logic capture capabilities as all BitScopes, Pocket
Analyzer sets the standard for portable PC based test gear.
2006-03-24
Whether saving a single waveform to disk or logging frames continuously 24x7, DDR is the tool for the job
and now it's a standard part of BitScope DSO.
DDR listens to all enabled channels, recording waveform and logic data to a buffer or files. DDR files may be
loaded for replay and comparison with new data or reviewed with another BitScope DSO or even loaded into
a numerical analysis tools like Microsoft Excel or Mathworks MatLab.
DDR works with all current BitScopes and may be downloaded as part of the latest DSO release.
2005-05-25
This all new guide is a comprehensive online reference to the BitScope DSO
software with numerous examples showing how to get the very best results from
your BitScope.
Learn how to use the built-in waveform generator for transfer function analysis or the cursors to measure
slew rates. Or maybe you're working with very low level signals and need to know how to optimize your
waveform resolution. It's all here.
Also, for all those people how have been asking us - the new BS310N is shipping now !
2005-05-05
This new model which replaces BS300N has the same high performance
specifications to our popular USB model BS310U, but with ethernet UDP/IP connectivity this model is fully
networkable which means you can use it in the same room on a local network or half way around the world
via the Internet !
If you're after a USB model, BS310U and BS50U are also both available.
2004-07-01
x10 and x50 gain input multiplier, software switchable AC/DC coupling, 50 ohm termination all in a package
about 2/3 the size and weight of BS300U.
This classic BitScope is published here so you can learn how it works.
BitScope has evolved a long way since 1998 but all BitScopes are still based on
the same Analog + Digital concept of the original design.
Released as kits, BitScope BS220 and BS300 became very popular with
electronics enthusiasts the world over. We have since been forced to discontinue
the kits as some through-hole parts used are obsolete.
The current models BS310, BS50 and BS442 are now all SMT designs and
have become very popular with professional engineers in design and
development, manufacture, testing and service fields.
Now all models are available as manufactured products but the core design at
the heart of all these BitScopes remains the same and is published at this website.
Likewise the BitScope Virtual Machine programming API is explained and its specifications published so
anyone can write software for BitScope or build their own add-on modules.
Still not sure what BitScope is ? BitScope is a built and tested (and previously build it yourself DIY), open design, digital storage
oscilloscope and logic analyzer (also, digital sampling oscilloscope, mixed signal oscilloscope, DSO) based on the MicroChip PIC which
can be used as a PC oscilloscope, multi-purpose portable test instrument, or networked remote data acquisition device (ie DAQ), that
uses open source software and commercial software for Windows, Linux and Macintosh with drivers for numerical analysis tools such
as Mathworks MatLab or National Instruments LabVIEW that connects to your PC via ethernet (using UDP/IP) or USB (or RS-232 in
older models). Also included as part of some BitScope models is an arbitrary waveform generator (AWG) aka user programmable
function generator, an analog oscilloscope emulation (CRO) and powerful spectrum analyzer (FFT).
Google Search
WWW www.bitscope.com
The University Students Services 12 February 2008, Tuesday (Selasa) ( 4 Safar 1429 AH )
Kemasukan Pakej Untuk Mesyuarat, Seminar & Konfrensi 2008 Hotel UiTM
Management Research Community
Home
Products
Design
Sales
Sample
Buy Online
Corporate
What's New
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=6412/02/2008 17:21:57
Beyond Logic
Tuesday, February
12th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
batch file? Kills rouge processes provided for the driver and can also
where Window's Task Manager fails. double as good example for Parallel
Port drivers taking to ParPort.sys.
BeyondExec - Spawn Processes and/
or Shutdown Remote Windows On-The-Go Supplement - Point-to-
NT/2000/XP WorkStations. Version Point Connectivity for USB.
2.04 The On-The-Go Supplement is a new
Have you ever wanted to run a tack on standard for USB allowing for
process such as an application the first time, USB Devices to talk to
installer, service pack, virus signature each other without the need for a
update etc or shutdown a single or "host". While the standard is still in its
group of remote computers without early days, we look at some of the
having the burden of installing any features of OTG. Philips demonstrated
remote client on your target aspects of OTG with their ISP1161
computers? Full-speed Universal Serial Bus single-
chip host and device controller. While
Beyond Logic Shutdown Utility for it doesnt fully comply to the OTG
NT/2000/XP Version 1.01 standard, it does make a wonderful
The Windows 2000 Professional Host Controller for embedded systems
Resource Kit and Windows XP such as uClinux.
introduce a shutdown.exe command
line utility to shutdown local USB with the simplicity of RS-232
computers. However a quick play with FTDI has two USB Interface ICs, the
these utilities will fine that they are less FT8U232AM and FT8U245AM which
than adequate. The Beyond Logic takes the hassle out of USB. One
shutdown.exe actually powers down provides a asychronous serial
computers while giving your users the interface, while the other provides a
option of cancelling the operation or byte wide FIFO with little need to worry
allowing you to only target computers about the underlying USB protocols
without a logged on user. and USB device drivers. Ideal if you
are starting out in USB, or you want to
Bmail - Command Line SMTP Mailer quickly add USB to your devices.
for Batch Jobs Version 1.07
The Philips PDIUSBD11 USB
Bmail is a free but lean command line
SMTP mail sender. Bmail allows the Peripheral with I2C Serial
user to automate the sending of email
messages containing log files, data Interface.
downloads or error messages on Philips has two USB devices which
Win32 based computers. allows any microcontroller the ability to
talk USB. However while the silicon
Delete/Copy by Owner utility for has many features which others don't,
Windows NT/2000/XP Version 1.02 the data sheets are a little light on
Have you ever had the need to find, content. In fact they miss some
copy or delete files that were owned fundamental Initialisation routines
by a certain user? A great way to back needed to get the device working in
up files created by previous the first place. This article gives a
employees or to clean workstations sample schematic and the answers to
when one leaves. many questions kindly answered by
potential, by running your own binaries F2 and quit using Alt-X. Couldn't be
on it. simpler. . .
Interfacing the PC
Google Search I'm feeling lucky
Embedded Technology
Prev | Ring Hub | Join | Rate|
Next
WebRing Inc.
Search
Visit a complete list of WebRing memberships here
Contents
What is EIA232?
Likely Problems when Using an EIA232 Interface
Pin Assignments
Cable Wiring Examples (New!)
Signal Definitions
Signal Ground and Shield
Primary Communications Channel
Secondary Communications Channel
Modem Status and Control Signals
Transmitter and Receiver Timing Signals
Channel Test Signals
Electrical Standards
Common Signal Ground
Signal Characteristics
Signal Timing
Accepted Simplifications of the Standard
What is EIA232?
Next Topic | TOC
In the early 1960s, a standards committee, today known as the Electronic Industries Association, developed a
common interface standard for data communications equipment. At that time, data communications was thought to
mean digital data exchange between a centrally located mainframe computer and a remote computer terminal, or
possibly between two terminals without a computer involved. These devices were linked by telephone voice lines,
and consequently required a modem at each end for signal translation. While simple in concept, the many
opportunities for data error that occur when transmitting data through an analog channel require a relatively complex
design. It was thought that a standard was needed first to ensure reliable communication, and second to enable the
interconnection of equipment produced by different manufacturers, thereby fostering the benefits of mass production
and competition. From these ideas, the RS232 standard was born. It specified signal voltages, signal timing, signal
function, a protocol for information exchange, and mechanical connectors.
Over the 40+ years since this standard was developed, the Electronic Industries Association published three
modifications, the most recent being the EIA232F standard introduced in 1997. Besides changing the name from
RS232 to EIA232, some signal lines were renamed and various new ones were defined, including a shield conductor.
During this 40-year-long, rapidly evolving period in electronics, manufacturers adopted simplified versions of this
interface for applications that were impossible to envision in the 1960s. Today, virtually all contemporary serial
interfaces are EIA232-like in their signal voltages, protocols, and connectors, whether or not a modem is involved.
Because no single "simplified" standard was agreed upon, however, many slightly different protocols and cables
were created that obligingly mate with any EIA232 connector, but are incompatible with each other. Most of the
difficulties you will encounter in EIA232 interfacing include at least one of the following:
1 - The absence or misconnection of flow control (handshaking) signals, resulting in buffer overflow
or communications lock-up.
2 - Incorrect communications function (DTE versus DCE) for the cable in use, resulting in the reversal
of the Transmit and Receive data lines as well as one or more handshaking lines.
3 - Incorrect connector gender or pin configuration, preventing cable connectors from mating properly.
Fortunately, EIA232 driver circuitry is highly tolerant of misconnections, and will usually survive a drive signal
being connected to ground, or two drive signals connected to each other. In any case, if the serial interface between
two devices is not operating correctly, disconnect the cable joining this equipment until the problem is isolated.
Pin Assignments
Next Topic | Previous Topic | TOC
If the full EIA232 standard is implemented as defined, the equipment at the far end of the connection is named the
DTE device (Data Terminal Equipment, usually a computer or terminal), has a male DB25 connector, and utilizes
22 of the 25 available pins for signals or ground. Equipment at the near end of the connection (the telephone line
interface) is named the DCE device (Data Circuit-terminating Equipment, usually a modem), has a female DB25
connector, and utilizes the same 22 available pins for signals and ground. The cable linking DTE and DCE devices
is a parallel straight-through cable with no cross-overs or self-connects in the connector hoods. If all devices exactly
followed this standard, all cables would be identical, and there would be no chance that an incorrectly wired cable
could be used. This drawing shows the orientation and connector types for DTE and DCE devices:
EIA232 communication function and connector types for a personal computer and
modem. DCE devices are sometimes called "Data Communications Equipment" instead
of Data Circuit-terminating Equipment.
Here is the full EIA232 signal definition for the DTE device (usually the PC). The most commonly used signals are
shown in bold.
This shows the full EIA232 signal definition for the DCE device (usually the modem). The most commonly used
signals are shown in bold.
Many of the 22 signal lines in the EIA232 standard pertain to connections where the DCE device is a modem, and
then are used only when the software protocol employs them. For any DCE device that is not a modem, or when two
DTE devices are directly linked, far fewer signal lines are necessary.
You may have noticed in the pinout drawings that there is a secondary channel which includes a duplicate set of
flow-control signals. This secondary channel provides for management of the remote modem, enabling baud rates to
be changed on the fly, retransmission to be requested if a parity error is detected, and other control functions. This
secondary channel, when used, is typically set to operate at a very low baud rate in comparison with the primary
channel to ensure reliability in the control path. In addition, it may operate as either a simplex, half-duplex, or full-
Transmitter and receiver timing signals (pins 15, 17, and 24) are used only for a synchronous transmission protocol.
For the standard asynchronous 8-bit protocol, external timing signals are unnecessary.
IMPORTANT: Signal names that imply a direction, such as Transmit Data and Receive Data, are
named from the point of view of the DTE device. If the EIA232 standard were strictly followed, these
signals would have the same name for the same pin number on the DCE side as well. Unfortunately,
this is not done in practice by most engineers, probably because no one can keep straight which side is
DTE and which is DCE. As a result, direction-sensitive signal names are changed at the DCE side to
reflect their drive direction at DCE. The following list gives the conventional usage of signal names:
The following wiring diagrams come from actual cables scanned by the CableEye PC-Based Cable Test System.
CableEye's software automatically draws schematics whenever it tests a cable. Click here to learn more about
CableEye.
This shows a 9-pin DTE-to-DCE serial cable that would result if the EIA232 standard were
strictly followed. All 9 pins plus shield are directly extended from DB9 Female to DB9
Male. There are no crossovers or self-connects present. Use this cable to connect modems, 80K
printers, or any device that uses a DB9 connector to a PC's serial port.
This cable may also serve as an extension cable to increase the distance between a
computer and serial device. Caution: do not exceed 25 feet separation between devices
without a signal booster!
A loopback connector usually consists of a connector without a cable and includes internal
wiring to reroute signals back to the sender. This DB9 female connector would attach to a
DTE device such as a personal computer. When the computer receives data, it will not 80K
know whether the signals it receives come from a remote DCE device set to echo
characters, or from a loopback connector. Use loopback connectors to confirm proper
operation of the computer's serial port. Once confirmed, insert the serial cable you plan to
use and attach the loopback to the end of the serial cable to verify the cable.
In this case, Transmit Data joins to Received Data, Request-to-Send joins to Clear-to-Send,
and DTE-Ready joins to DCE-Ready and Received Line Signal Detect.
Use this female-to-female cable in any application where you wish to connect two DTE
devices (for example, two computers). A male-to-male equivalent of this cable would be
used to connect two DCE devices. 80K
The cable shown below is intended for RS232 asynchronous communications (most PC-
based systems). If you are using synchronous communications, the null modem will have
additional connections for timing signals, and a DB25 connector would be necessary.
NOTE: Not all null modem cables connect handshaking lines the same way. In this cable,
Request-to-Send (RTS, pin 7) asserts the Carrier Detect (pin 1) on the same side and the
Clear-to-Send (CTS, pin 8) on the other side of the cable.
Left Side: Connect to 9-pin DTE (computer) Right Side: Connect to 9-pin DTE (computer)
Signals on the DB25 DTE side are directly mapped to the DB9 assignments for a DTE
device. Use this to adapt a 25-pin COM connector on the back of a computer to mate with a
9-pin serial DCE device, such as a 9-pin serial mouse or modem. This adapter may also be 80K
in the form of a cable.
Left Side: Connect to 25-pin DTE (computer) Right Side: Connect to 9-pin DCE (modem)
This adapter has the same wiring as the previous cable (#4) except that pin 1 is wired to
the connector shell (shield). Note that the cable's shield is usually a foil blanket
surrounding all conductors running the length of the cable and joining the connector 84K
shells. Pin 1 of the EIA232 specification, called out as "shield", may be separate from the
earth ground usually associated with the connector shells.
Left Side: Connect to 25-pin DTE (computer) Right Side: Connect to 9-pin DCE (modem)
Signals on the DB9 DTE side are directly mapped to the DB25 assignments for a DTE
device. Use this to adapt a 9-pin COM connector on the back of a computer to mate with a
25-pin serial DCE devices, such as a modem. This adapter may also be in the form of a 80K
cable.
Left Side: Connect to 9-pin DTE (computer) Right Side: Connect to 25-pin DCE (modem)
This shows a 25-pin DTE-to-DCE serial cable that would result if the EIA232 standard
were strictly followed. All 25 pins plus shield are directly extended from DB25 Female to
DB25 Male. There are no crossovers or self-connects present. Use this cable to connect 84K
modems, printers, or any serial device that uses a DB25 connector to a PC's serial port.
This cable may also serve as an extension cable to increase the distance between computer
and serial device. Caution: do not exceed 25 feet separation between devices without a
signal booster!
Caution: the male end of this cable (right) also fits a PC's parallel printer port. You may
use this cable to extend the length of a printer cable, but DO NOT attach a serial device to
the computer's parallel port. Doing so may cause damage to both devices.
Left Side: Connect to 25-pin DTE (computer) Right Side: Connect to 25-pin DCE (modem)
A loopback connector usually consists of a connector without a cable and includes internal
wiring to reroute signals back to the sender. This DB25 female connector would attach to a
DTE device such as a personal computer. When the computer receives data, it will not 80K
know whether the signals it receives come from a remote DCE device set to echo
characters, or from a loopback connector. Use loopback connectors to confirm proper
operation of the computer's serial port. Once confirmed, insert the serial cable you plan to
use and attach the loopback to the end of the serial cable the verify the cable.
In this case, Transmit Data joins to Received Data, Request-to-Send joins to Clear-to-Send,
and DTE-Ready joins to DCE-Ready and Received Line Signal Detect.
Use this female-to-female cable in any application where you wish to connect two DTE
devices (for example, two computers). A male-to-male equivalent of this cable would be
used to connect two DCE devices. 84K
Note that Pins 11 and 12 are not necessary for this null modem cable to work. As is often
the case, the manufacturer of equipment that uses this cable had a proprietary application in
mind. We show it here to emphasize that custom serial cables may include connections for
which no purpose is clear.
IMPORTANT: This cable employs NO handshaking lines between devices. The handshake
signals on each side are artificially made to appear asserted by the use of self-connects on
each side of the cable (for example, between pins 4 and 5). Without hardware handshaking,
you risk buffer overflow at one or both ends of the transmission unless STX and ETX
commands are inserted in the dataflow by software.
Left Side: Connect to 25-pin DTE (computer) Right Side: Connect to 25-pin DTE (computer)
Use this female-to-female cable in any application where you wish to connect two DTE
devices (for example, two computers). A male-to-male equivalent of this cable would be
used to connect two DCE devices. 84K
The cable shown below is intended for EIA232 asynchronous communications (most PC-
based systems). If you are using synchronous communications, the null modem will have
additional connections for timing signals not shown here.
NOTE: Not all null modem cables connect handshaking lines the same way. Refer to the
manual for your equipment if you experience problems. In this cable, the DTE Ready (pin
20) on one side asserts the DCE Ready (pin 6) and the Request to Send (pin 5) on the other
side.
Left Side: Connect to 25-pin DTE (computer) Right Side: Connect to 25-pin DTE (computer)
Use this female-to-female cable in any application where you wish to connect two DTE
devices (for example, two computers). A male-to-male equivalent of this cable would be
used to connect two DCE devices. 84K
NOTE: Not all null modem cables connect handshaking lines the same way. Refer to the
manual for your equipment if you experience problems. In this cable, the DTE Ready (pin
20) on one side asserts the Clear to Send (pin 5), DCE Ready (pin 6), and Carrier Detect
(pin 8) on the other side.
Left Side: Connect to 25-pin DTE (computer) Right Side: Connect to 25-pin DTE (computer)
Use this female-to-female cable in any application where you wish to connect two DTE
devices (for example, two computers). A male-to-male equivalent of this cable would be
used to connect two DCE devices. 84K
NOTE: Not all null modem cables connect handshaking lines the same way. Refer to the
manual for your equipment if you experience problems. In this cable, the Request-to-Send
(pin 4) on one side asserts the Clear-to-Send (pin 5) on the SAME side (self-connect) and
the Carrier Detect (pin 8) on the other side. The other handshaking signals are employed in
a conventional manner.
Left Side: Connect to 25-pin DTE (computer) Right Side: Connect to 25-pin DTE (computer)
Use this female-to-female cable in any application where you wish to connect two DTE
devices (for example, two computers). A male-to-male equivalent of this cable would be
used to connect two DCE devices. 84K
NOTE: Not all null modem cables connect handshaking lines the same way. Refer to the
manual for your equipment if you experience problems. In this cable, the DTE Ready (pin
20) on one side asserts the Clear-to-Send (pin 5) and the DCE Ready (pin 6) on the other
side. Request-to-Send (pin 4) on one side asserts Received Line Signal Detect (pin 8) on
the other side.
Left Side: Connect to 25-pin DTE (computer) Right Side: Connect to 25-pin DTE (computer)
Use this female-to-female cable in any application where you wish to connect two DTE
devices (for example, two computers). A male-to-male equivalent of this cable would be
used to connect two DCE devices. 84K
NOTE: Not all null modem cables connect handshaking lines the same way. Refer to the
manual for your equipment if you experience problems. In this cable, the DTE Ready (pin
20) on one side asserts the DCE Ready (pin 6), and Carrier Detect (pin 8) on the other side.
Request to Send (pin 4) is unused, and Clear-to-Send (pin 5) is driven by a proprietary
signal (pin 11) determined by the designer of this cable.
Left Side: Connect to 25-pin DTE (computer) Right Side: Connect to 25-pin DTE (computer)
For synchronous communications, the null modem cable includes an additional conductor
for timing signals, and joins pins 15, 17, and 24 on one side to pins 15 and 17 on the other.
Pin 24 on the right side should connect to the timing signal source.
Left Side: Connect to 25-pin DTE (computer) Right Side: Connect to 25-pin DTE (computer)
This simplified null modem cable uses only Request-to-Send (pin 4) and Clear-to-Send (pin
5) as handshaking lines; DTE Ready, DCE Ready, and Carrier Detect are not employed, so
this cable should not be used with modems. 80K
CAUTION! Normally, null modem cables have the same gender on each connector (either
both male for two DTE devices, or both female for two DCE devices). This cable would be
used when the gender on one of the devices does not conform to the standard. However, the
opposite genders imply usage as a straight through cable, and if used in that manner will
not function. Further, if used as a standard null-modem between two computers, the
opposite gender allows you to connect one end to the parallel port, an impermissible
situation that may cause hardware damage.
Signal Definitions
Next Topic | Previous Topic | TOC
Signal functions in the EIA232 standard can be subdivided into six categories. These categories are summarized
below, after which each signal described.
2 - Primary communications channel. This is used for data interchange, and includes flow control
signals.
3 - Secondary communications channel. When implemented, this is used for control of the remote
modem, requests for retransmission when errors occur, and governance over the setup of the primary
channel.
4 - Modem status and control signals. These signals indicate modem status and provide intermediate
checkpoints as the telephone voice channel is established.
5 - Transmitter and receiver timing signals. If a synchronous protocol is used, these signals provide
timing information for the transmitter and receiver, which may operate at different baud rates.
6 - Channel test signals. Before data is exchanged, the channel may be tested for its integrity, and the
baud rate automatically adjusted to the maximum rate that the channel can support.
Pin 7, Pin 1, and the shell are included in this category. Cables provide separate paths for each, but internal wiring
often connects pin 1 and the cable shell/shield to signal ground on pin 7.
Pin 7 - Ground All signals are referenced to a common ground, as defined by the voltage on pin 7. This conductor
may or may not be connected to protective ground inside the DCE device. The existence of a defined ground
potential within the cable makes the EIA232 standard different from a balanced differential voltage standard, such as
EIA530, which provides far greater noise immunity.
Pin 2 - Transmitted Data (TxD) This signal is active when data is transmitted from the DTE device to the DCE
device. When no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage).
NOTE: Pin 2 on the DCE device is commonly labeled "Received Data", although by the EIA232
standard it should still be called Transmitted Data because the data is thought to be destined for a
remote DTE device.
Pin 3 - Received Data (RxD) This signal is active when the DTE device receives data from the DCE device. When
no data is transmitted, the signal is held in the mark condition (logic '1', negative voltage).
NOTE: Pin 3 on the DCE device is commonly labeled "Transmitted Data", although by the EIA232
standard it should still be called Received Data because the data is thought to arrive from a remote
DTE device.
Pin 4 - Request to Send (RTS) This signal is asserted (logic '0', positive voltage) to prepare the DCE device for
accepting transmitted data from the DTE device. Such preparation might include enabling the receive circuits, or
setting up the channel direction in half-duplex applications. When the DCE is ready, it acknowledges by asserting
Clear to Send.
NOTE: Pin 4 on the DCE device is commonly labeled "Clear to Send", although by the EIA232
standard it should still be called Request to Send because the request is thought to be destined for a
remote DTE device.
Pin 5 - Clear to Send (CTS) This signal is asserted (logic '0', positive voltage) by the DCE device to inform the
DTE device that transmission may begin. RTS and CTS are commonly used as handshaking signals to moderate the
flow of data into the DCE device.
NOTE: Pin 5 on the DCE device is commonly labeled "Request to Send", although by the EIA232
standard it should still be called Clear to Send because the signal is thought to originate from a remote
DTE device.
These signals are equivalent to the corresponding signals in the primary communications channel. The baud rate,
however, is typically much slower in the secondary channel for increased reliability.
Pin 6 - DCE Ready (DSR) When originating from a modem, this signal is asserted (logic '0', positive voltage)
when the following three conditions are all satisfied:
3 - The modem has completed dialing or call setup functions and is generating an answer tone.
If the line goes "off-hook", a fault condition is detected, or a voice connection is established, the DCE Ready signal
is deasserted (logic '1', negative voltage).
IMPORTANT: If DCE Ready originates from a device other than a modem, it may be asserted to
indicate that the device is turned on and ready to function, or it may not be used at all. If unused, DCE
Ready should be permanently asserted (logic '0', positive voltage) within the DCE device or by use of
a self-connect jumper in the cable. Alternatively, the DTE device may be programmed to ignore this
signal.
Pin 20 - DTE Ready (DTR) This signal is asserted (logic '0', positive voltage) by the DTE device when it wishes
to open a communications channel. If the DCE device is a modem, the assertion of DTE Ready prepares the modem
to be connected to the telephone circuit, and, once connected, maintains the connection. When DTE Ready is
deasserted (logic '1', negative voltage), the modem is switched to "on-hook" to terminate the connection.
IMPORTANT: If the DCE device is not a modem, it may require DTE Ready to be asserted before the
device can be used, or it may ignore DTE Ready altogether. If the DCE device (for example, a printer)
is not responding, confirm that DTE Ready is asserted before you search for other explanations.
Pin 8 - Received Line Signal Detector (CD) (also called carrier detect) This signal is relevant when the DCE
device is a modem. It is asserted (logic '0', positive voltage) by the modem when the telephone line is "off-hook", a
connection has been established, and an answer tone is being received from the remote modem. The signal is
deasserted when no answer tone is being received, or when the answer tone is of inadequate quality to meet the local
modem's requirements (perhaps due to a noisy channel).
Pin 12 - Secondary Received Line Signal Detector (SCD) This signal is equivalent to the Received Line Signal
Detector (pin 8), but refers to the secondary channel.
Pin 22 - Ring Indicator (RI) This signal is relevant when the DCE device is a modem, and is asserted (logic '0',
positive voltage) when a ringing signal is being received from the telephone line. The assertion time of this signal
will approximately equal the duration of the ring signal, and it will be deasserted between rings or when no ringing
is present.
Pin 23 - Data Signal Rate Selector This signal may originate either in the DTE or DCE devices (but not both), and
is used to select one of two prearranged baud rates. The asserted condition (logic '0', positive voltage) selects the
higher baud rate.
Pin 15 - Transmitter Signal Element Timing (TC) (also called Transmitter Clock) This signal is relevant only
when the DCE device is a modem and is operating with a synchronous protocol. The modem generates this clock
signal to control exactly the rate at which data is sent on Transmitted Data (pin 2) from the DTE device to the DCE
device. The logic '1' to logic '0' (negative voltage to positive voltage) transition on this line causes a corresponding
transition to the next data element on the Transmitted Data line. The modem generates this signal continuously,
except when it is performing internal diagnostic functions.
Pin 17 - Receiver Signal Element Timing (RC) (also called Receiver Clock) This signal is similar to TC
described above, except that it provides timing information for the DTE receiver.
Pin 24 - Transmitter Signal Element Timing (ETC) (also called External Transmitter Clock) Timing signals are
provided by the DTE device for use by a modem. This signal is used only when TC and RC (pins 15 and 17) are not
in use. The logic '1' to logic '0' transition (negative voltage to positive voltage) indicates the time-center of the data
element. Timing signals will be provided whenever the DTE is turned on, regardless of other signal conditions.
Pin 18 - Local Loopback (LL) This signal is generated by the DTE device and is used to place the modem into a
test state. When Local Loopback is asserted (logic '0', positive voltage), the modem redirects its modulated output
signal, which is normally fed into the telephone line, back into its receive circuitry. This enables data generated by
the DTE to be echoed back through the local modem to check the condition of the modem circuitry. The modem
asserts its Test Mode signal on Pin 25 to acknowledge that it has been placed in local loopback condition.
Pin 21 - Remote Loopback (RL) This signal is generated by the DTE device and is used to place the remote
modem into a test state. When Remote Loopback is asserted (logic '0', positive voltage), the remote modem redirects
its received data back to its transmitted data input, thereby remodulating the received data and returning it to its
source. When the DTE initiates such a test, transmitted data is passed through the local modem, the telephone line,
the remote modem, and back, to exercise the channel and confirm its integrity. The remote modem signals the local
modem to assert Test Mode on pin 25 when the remote loopback test is underway.
Pin 25 - Test Mode (TM) This signal is relevant only when the DCE device is a modem. When asserted (logic '0',
positive voltage), it indicates that the modem is in a Local Loopback or Remote Loopback condition. Other internal
self-test conditions may also cause Test Mode to be asserted, and depend on the modem and the network to which it
is attached.
Electrical Standards
Next Topic | Previous Topic | TOC
The EIA232 standard uses negative, bipolar logic in which a negative voltage signal represents logic '1', and positive
voltage represents logic '0'. This probably originated with the pre-RS232 current loop standard used in 1950s-
vintage teletype machines in which a flowing current (and hence a low voltage) represents logic '1'. Be aware that
the negative logic assignment of EIA232 is the reverse of that found in most modern digital circuit designs. See the
inside rear cover of the CableEye manual for a comparison.
The EIA232 standard includes a common ground reference on Pin 7, and is frequently joined to Pin 1 and a circular
shield that surrounds all 25 cable conductors. Data, timing, and control signal voltages are measured with respect to
this common ground. EIA232 cannot be used in applications where the equipment on opposite ends of the
connection must be electrically isolated.
NOTE: optical isolators may be used to achieve ground isolation, however, this option is not
mentioned or included in the EIA232 specification.
Signal Characteristics
Next Topic | Previous Topic | TOC
Equivalent Circuit - All signal lines, regardless of whether they provide data, timing, or control information, may be
represented by the electrical equivalent circuit shown here:
This is the equivalent circuit for an EIA232 signal line and applies to signals
originating at either the DTE or DCE side of the connection. "Co" is not specified in the
standard, but is assumed to be small and to consist of parasitic elements only. "Ro" and
"Vo" are chosen so that the short-circuit current does not exceed 500ma. The cable
length is not specified in the standard; acceptable operation is experienced with cables
that are less than 25 feet in length.
Signal State Voltage Assignments - Voltages of -3v to -25v with respect to signal ground (pin 7) are considered
logic '1' (the marking condition), whereas voltages of +3v to +25v are considered logic '0' (the spacing condition).
The range of voltages between -3v and +3v is considered a transition region for which a signal state is not assigned.
Logic states are assigned to the voltage ranges shown here. Note that this is a "negative
logic" convention, which is the reverse of that used in most modern digital designs.
Most contemporary applications will show an open-circuit signal voltage of -8 to -14 volts for logic '1' (mark), and
+8 to +14 volts for logic '0' (space). Voltage magnitudes will be slightly less when the generator and receiver are
connected (when the DTE and DCE devices are connected with a cable).
IMPORTANT: If you insert an LED signal tester in an EIA232 circuit to view signal states, the signal
voltage may drop in magnitude to very near the minimum values of -3v for logic '1', and +3v for logic
'0'. Also note that some inexpensive EIA232 peripherals are powered directly from the signal lines to
avoid using a power supply of their own. Although this usually works without problems, keep the
Short-Circuit Tolerance - The generator is designed to withstand an open-circuit (unconnected) condition, or short-
circuit condition between its signal conductor and any other signal conductor, including ground, without sustaining
damage to itself or causing damage to any associated circuitry. The receiver is also designed to accept any signal
voltage within the range of 25 volts without sustaining damage.
CAUTION: Inductive loads or magnetically induced voltages resulting from long cables may cause
the received voltage to exceed the 25-volt range momentarily during turn-on transients or other
abnormal conditions, possibly causing damage to the generator, receiver, or both. Keep the cable
length as short as possible, and avoid running the cable near high-current switching loads like electric
motors or relays.
Fail-Safe Signals - Four signals are intended to be fail-safe in that during power-off or cable-disconnected
conditions, they default to logic '1' (negative voltage). They are:
Schmitt triggers or other hysteresis devices may be used to enhance noise immunity in some designs, but should
never be adjusted to compromise the fail-safe requirement.
Signal Timing
Next Topic | Previous Topic | TOC
The EIA232 standard is applicable to data rates of up to 20,000 bits per second (the usual upper limit is 19,200
baud). Fixed baud rates are not set by the EIA232 standard. However, the commonly used values are 300, 1200,
2400, 9600, and 19,200 baud. Other accepted values that are not often used are 110 (mechanical teletype machines),
600, and 4800 baud.
Changes in signal state from logic '1' to logic '0' or vice versa must abide by several requirements, as follows:
1 - Signals that enter the transition region during a change of state must move through the transition
region to the opposite signal state without reversing direction or reentering.
2 - For control signals, the transit time through the transition region should be less than 1ms.
3 - For Data and Timing signals, the transit time through the transition region should be
b - 4% of the bit period for bit periods between 25ms and 125s,
An acceptable pulse (top) moves through the transition region quickly and without
hesitation or reversal. Defective pulses (bottom) could cause data errors.
4 - The slope of the rising and falling edges of a transition should not exceed 30v/S. Rates higher
than this may induce crosstalk in adjacent conductors of a cable.
Note that neither the ASCII alphabet nor the asynchronous serial protocol that defines the start bit, number of data
bits, parity bit, and stop bit, is part of the EIA232 specification. For your reference, it is discussed in the Data
Communications Basics section of this web site.
The EIA232 document published by the Electronic Industries Association describes 14 permissible configurations of
the original 22-signal standard. Each configuration uses a subset of the 22 defined signals, and serves a more limited
communications requirement than that suggested by using all the available 22-signals. Applications for transmit-
only, receive-only, half-duplex operation, and similar variations, are described. Unfortunately, connection to DCE
devices other than modems is not considered. Because many current serial interface applications involve direct
device-to-device connections, manufacturers do not have a standard reference when producing printers, plotters,
print spoolers, or other common peripherals. Consequently, you must acquire the service manual for each peripheral
device purchased to determine exactly which signals are utilized in its serial interface.
END
Return to TOC
TOC | General info | 8051 example | PIC example | Misc. examples | Manuf./Distrib. | Home | Sign
Guestbook | View Guestbook
Table Of Contents
0. Table Of Contents
1. General
1.1. Disclaimer
1.2. Usage
1.3. Purpose
2.4. Interfacing
3. 8051 example
3.1. Basic control software
3.1.3. Code
3.1.3.1. LCD initialisation
3.2.3. Code
...
3.3. Availability
3.4. Target hardware
3.4.1. Controller
3.4.2. Interface
3.5.2. Hardware
4. PIC example
4.1. Basic control software
4.1.3. Code
...
4.3. Availability
4.4. Target hardware
4.4.1 Controller
4.4.2 Interface
4.5.2. Hardware
5. Miscellaneous examples
5.1. PIC16C54 using only 3 lines
6.3. Asia
6.4. Australia
6.6. Africa
TOC | General info | 8051 example | PIC example | Misc. examples | Manuf./Distrib. | Home | Sign
Guestbook | View Guestbook
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
There is a general consensus that in years to come more and more Internet devices will be embedded and
not PC oriented. Just one such prediction is that by 2010, 95% of Internet-connected devices will not be
computers. So if they are not computers, what will they be? Embedded Internet devices.
One popular solution is to use an 8 bit microcontroller such as a Rabbit 2000, AVR or PIC and a Ethernet
MAC such as a CS8900A or RTL8029AS hanging of its parallel port pins in 8 bit mode. A TCP/IP stack is
normally written in C and can be striped of features and ported to these resource limited microcontrollers.
While this works and we detail many such boards below, a little debate is brewing over its reliability and
functionality.
With DOS (denial of service) attacks becoming more and more common, it doesnt take much to knock your
little 8 bit microcontroller off the network. In fact some configurations have a little trouble keeping up with the
high volume of broadcast packets floating around a loaded network, let alone any malicious attacks.
One solution of course is to put in a bigger processor. This is the case with Embedded Linux devices such as
Coldfire, DragonBall or ARM based devices. They are quite powerful enough to allow a suitable bandwidth
and not be susceptible to someones malicious intent.
The other solution is to use a hardware TCP/IP stack. A hardware based stack is not new. If you have
followed this site, you will be aware of the Sekio S-7600A hardware stack which incorporated a TCP/IP stack
with a PPP controller so you could connect it to a modem. Sekio had licensed the technology from Iready
Corporation. While it had its place in data logging or dial on demand applications where your device could
dial up the Internet and send you an email to the effect that your house has been broken into or the past 24
hours logged data etc, it wouldn't connect to the popular ethernet networks present everywhere today.
The next logical progression had to be the Ethernet interface. Sekio has exited the embedded Internet
business discontinuing its S-7600 on the 1st September. However the concept is still alive.
A hardware TCP/IP stack has a couple of advantages. Firstly as they are hardware based, most run at close
to line speeds encapsulating and striping streams of data on the fly. This makes it increasingly more difficult
to cause a DOS attack and almost impossible to run malicious code using principals of buffer overruns etc.
However being hardware makes it difficult to upgrade should little quirks be found allowing say SYN attacks
for example.
Later we detail some devices from Ipsil and Connect One. Both have the ability to upload new firmware
which future proofs the designs in these peripheral devices. However the Ipsil and Connect One devices on
the market today rely on an external ethernet MAC such as the popular CS8900A or RTL8029AS. This
contributes to the chip count.
Ipsil has preliminary data on their IP8932 which combines a webserver, Ethernet MAC layer, and TCP/IP
controller all on a single chip. This allows the one chip with 20 digital or analog inputs to display webpages
without the need of a microcontroller. Ipsil has WebHoles technology which allows holes (simular to server
side includes principles) to be filled in with values from the I/O ports. If you do happen to need more
complexity, you can add a microcontroller and talk via standard TCP/IP socket calls.
However WIZnet Inc already has a simular device on the Market. The W3150A incorporates a TCP/IP stack
and a future proofed 10/100 Ethernet MAC. So when it comes to chip count, it makes sense to off load the
burden of the TCP/IP stack into a second peripheral chip complete with Ethernet MAC. It can reduce time to
market, as the design of the TCP/IP stack is omitted (or saves costs of licensing one), plus you have a more
stable product. Your 8 bit micro effectively has more grunt now, as it's no longer responsible for the lower
TCP/IP protocols and ethernet encapsulation. All these advantages and yet, still only two chips.
How long before the leading microcontroller manufacturers are going to integrate a hardware TCP/IP stack
and ethernet MAC into their microcontrollers making a one chip solution?
Answer : WIZnet Inc. and Atmel Corporation to jointly develop and market Internet connectivity
solutions.
WIZnet Inc. and Atmel Corporation has forged a strategic partnership to develop and co-market
Internet connectivity solutions. As part of this agreement WIZnet will manufacture OEM products
around Atmels AVR microcontrollers. Both have agreed to move in the direction of system-on-chip
(SoC) which will see WIZnets TCP/IP hardwired technology be integrated with Atmels MCU cores.
Outcome? An AVR with \ hardware TCP/IP stack and ethernet in the one chip. I can't wait. . . .
Lantronix
Lantronix has developed the XPort. It's a x86 processor with 256Kbytes SRAM, 512Kbytes Flash and
a 10/100 Ethernet Interface in tiny package not much bigger than the standard Ethernet socket.
Having a mature O/S, the XPort can send e-mail alerts or serve web pages among other things. There
is even a model with 128-bit AES Rijndael encryption if you need it. Encapsulated in a single drop in
module, the EMC-compliant XPort makes the perfect partner to your Amtel or PIC based Internet
Application offloading the responsibility of the TCP/IP stack to the XPort. Communication between the
module and your MCU is done by a 300bps to 230 kbps asynchronous serial port.
Digi International has another even more impressive little module out. They have crammed a 32bit
ARM processor running at 55MHz complete with large amounts of flash and RAM into a small PCB
mount module. But what makes these modules more impressive is the ability to switch between a
wired 10/100 ethernet or 802.11b module. Both are pin to pin compatible making your designs built
around the Digi Connect ME family even more flexible. The wireless module is enclosed, and as such
is FCC approved, so you are not required to get approvals for your WIFI design further decreasing
your time to market. If however resources are a little tight, then the EM family may be for you offering
increased memory, multiple serial ports, SPI and more I/O.
Digi Connect ME
Digi Connect EM
Ipsil have three products in its IP range. The IPu8930 is currently on the market and is sold as a
module complete with a RTL8019AS ethernet MAC on the bottom. With a development kit for only
$199 USD, this looks like at good entry point into this market. In the pipeline is the IP8932 which
incorporates the Ethernet MAC into the one chip, and the IPu8942 designed for data streaming
applications.
IP8930
IP8932
Single-chip TCP Controller with Ethernet and SlipNet designed for general purpose
monitoring, control, and connectivity applications.
Supports a wide range of network applications and protocols including TCP/IP, UDP,
DHCP, ICMP (ping), FTP and Telnet
64Pin QFP
IP8942
Single-chip TCP Controller with Ethernet designed for multimedia applications such as
streaming video and audio.
Optimised for streaming
Connect One
Connect One has iChip offerings in both ethernet and dial-up/wireless based solutions. The dial-up/
wireless iChips get integrated at remote sites or in mobile phones and supports the full range of
AMPS, CDMA, CDPD, GPRS, GSM, iDEN, and TDMA wireless modems. This allows you to contact
the Internet from remote locations, making it ideal for data logging applications. The iChip introduced
in 1999 was claimed to be the first Internet peripheral chip on the market that uses updateable flash
memory to store the full Internet protocol stack. This allows it to be updated without having to throw
out the chip.
Supports ARP, IP, ICMP, UDP, TCP, DNS, DHCP, SMTP, POP3, MIME and HTTP
Supports 10Mbps Crystal LAN CS8900A and Realtek RTL8019AS Ethernet controllers in
16bit mode. (Requires external PLD for CS8900 Handshaking)
Supports 100Mbps SMSC (LAN91C111 and LAN91C113) and Asix AX88796L Ethernet
MACs.
iChip suggests they will have support for 802.11b Wireless LAN at the beginning of 2003
Opens up to 10 TCP or UDP sockets and up to 2 Listen (server) sockets.
iChip Lan supports asynchronous comms speeds up to 230,000 bps
68 pin PLCC
3.3V or 5V (RTL8019A only supports 5V) 70mA Typ @ 3.3V, 160mA @ 5V
WIZnet Inc
WIZnet Inc claims to have the world's first Ethernet based TCP/IP hardware chip, the W3100A. This
features a hardware TCP/IP stack, plus a 10/100 Ethernet MAC Layer in the one chip.
RealTek RTL8019AS ISA Full-Duplex Ethernet Controller with Plug and Play Function
After purchasing bare RTL8019AS ICs in Australia for your own designs? Look no further than
Embedtronics - $20 AUD each.
The first modules come from the Web51 project. Most of the project is open source and free to
download. The code is available from the Web51 site under the GNU General Public License. On
visiting the Web51 web site, you will see the abundance of examples and information that one could
easily spend hours if not days browsing.
Ethernut
Charon 2
Seiko Instruments Inc have come up with what should be a very popular chip. Having already picked
up the Electronic Products 1999 Product of the Year Award, the S-7600A is a 48 pin package which
takes care of the TCP/IP stack in hardware. This allows quite dumb processors the ability to talk on
the internet. The S-7600A incorporates a UART which is connected to the internet using PPP (Point to
Point Protocol) either via a dedicated link or via a dial up modem. A microcontroller can then send the
S-7600 streams of information which is automatically encapsulated in a TCP/UDP datagram and sent
using IP.
S-7600A
Supports Industry Standard Protocols : TCP/IP (Ver. 4.0) PPP (STD-51-compliant) UDP
Supports two general purpose sockets
Easier application development (Hardware takes care of Encapsulation, PPP, TCP/IP
Stack)
48-pin QFP
The uCSimm has been a very popular module ever since one little advertisement in Circuit Cellar. The
uCSimm is an embedded Ethernet module ideal for Internet connectivity. Based on a Motorola 68K
running Linux there is no limits to what you can achieve with this unit. If your imagination isn't with you
today, check out the uCSimm and uCLinux Forums on http://www.uClinux.org
uC68EZ328
MC68EZ328 Motorola
Dragonball
Microcontroller
8 Mb DRAM (4096k x
16 bits)
1 Mb (512k x 16 bits) / 2
Mb (1024k x 16 bits) / 4
Mb (2048k x 16 bits)
ROM
10baseT Ethernet
+3.3 volt
For those who can't help making their own (Maybe with extra I/O or no conformal coating on the gold
contacts . .) this device uses a 68EZ328 Dragon Ball Processor. Motorola has a 68EN302 processor,
based on their 68K Architecture complete with Embedded Ethernet Interface. While this seems the
better option, reality is that you can't obtain these easily and they use a normal medium speed crystal.
The dragonball on the other hand will run from DC to 16.58 MHz with 2.7 MIPS performance. What is
quite useful is the 68EZ328's ability to generate it's 16.58MHz internal clock with a tiny 32.768 kHz
crystal using it's internal PLL clock Multiplier. Ideal for those small locations. The uCSimm has two
small crystals tucked on the back of the module.
The 68EN328 has a built in DRAM controller which requires no Glue Logic. This, coupled with a
CS8900A LAN Controller makes the module so simple, anyone could wack one together customised
to their specs. Even the software is a breeze with the unit running on uClinux, an open source
embedded Linux. With all this functionality, I have to ask - who needs an embedded I386?
The TINI standing for Tiny InterNet Interface is a product of Dallas Semiconductor. It's very simular to
the uCSimm and you could easily mistake it for a uCSimm from a distance. Both the uCSimm and TINI
come with daughter boards for testing.
DSTINI1 - TINI
Verification Module
DS80C390
Processor @
36.864MHz.
31.8 mm x
102.9 mm 72-
pin SIMM board
512KByte Flash
512K/1MByte
nonvolatile
SRAM
Ethernet
10Base-T
interface
(SMC91C96)
Dual 1-Wire
interface
(IButton)
CAN interface /
Dual Serial
Port / I2C
Interface
Requires
single +5VDC
Power Supply
News
Sep. 2007 New technical literature, Electric field intensity at the receiving point, is
uploaded.
Sep. 2007 New on-line calculation tool, Hight pattern calculation, is uploaded.
Sep. 2007 New on-line calculation tool, Fresnel zone calculation, is uploaded.
Please select a model Jul. 2007 863 - 865 MHz multi channel wireless audio transmitter and receiver are
released.
May. 2007 New on-line calculation tool for creating a RF channel plan
Welcome to Circuit Design, a leading supplier of low power radio modules. Circuit Design
specializes in the design and manufacture of embedded transmitter, receiver, transceiver
and RF modems in the license-exempt, low power radio band (Short Range Devices in
Europe). Low-power, narrow-bandwidth and discrete component designs are targeted at
long-range, battery-powered industrial applications. These serve well in fields such as
telecommand, telecontrol, telemetry, alarms, and security, and for all kinds of wireless
data transmission where high reliability is required.
RF design guide
Calculation tools
Application examples
Technical literature
Regulatory compliance
Environmental compliance
Home
privacy | legal statement | RFMD Sales & Technical Support Center: 336.678.5570|
Circulators
Aerospace & Defense Products
Networking
Media Converters
Other
Discontinued Products
ISM Band Transceivers
900 MHz
2.4 GHz
5.8 GHz
Discontinued Products
Wireless Infrastructure
General Purpose Amplifiers
Modulators
Low Noise Amplifiers
High Power Amplifiers
Wireless LAN
Broadband/CATV Amplifiers
Home | Specials | Sales | Services | Contact Cart | Order Info | Downloads | MicroX | Search | Links | About
Products We specialize in modular microcontroller based hardware and software solutions - specially
for the PIC microcontroller from Microchip.
CAN Bus All our products have a 15 day money back satisfaction guarantee! Products can be purchased online via our site.
Clearance Sale Simply add the products you want to your shopping cart, checkout, and within 2 working days your order will be
shipped! Alternatively you can purchase through our worldwide distributors.
Components
Connectors We are going Lead-Free, soon all our products will be RoHS compliant! For great specials on our excess leaded
stock, check out our Clearance Sale for discounts of up to 70%!
Development kits
Ethernet Ethernet USB
GPS Our range of Ethernet boards Our new
start at just USD55.00. All SBC44UC
Hardware boards are programmed with board has a
I/O Modules our free Modtronix TCP/IP full speed
stack and have a web based USB
LCD Displays
interface. All source code is interface, and
Microcontrollers provided for fee, and can be is assembled
PIC H-Series Boards modified using free C compiler with the
and MPLAB IDE from PIC18F4550
PIC MicroX Boards PIC chip from
Microchip. Custom web pages
Programmers can be uploaded to the board. Tags in web pages can be used Microchip. It is programmed with a
bootloader. It has been designed to work with
RS232 to monitor inputs. Accepts commands via UDP or HTTP for
the free Microchip USB Software. It has 33
RS485 & RS422 configuring the board and controlling outputs. For details, click
user programmable I/O ports, ADC inputs,
here. PWM outputs and more. Power can be
Serial Displays
provided by the USB bus, or an external
Software power supply. For details, click here.
USB
Serial and Standard LCD Displays Microchip PIC Microcontrollers
Personal
We stock a large range of We have a
Log In Serial (I2C/SPI) and Standard large range
Create an Account Character and Graphic LCD of PIC12,
modules, ready for worldwide PIC14,
Cart Contents shipping at discount prices! PIC16, and
Checkout PIC18 PIC
Microcontrollers
Information
in stock.
Forum Place your
online order
Shipping & Returns
now and have them shipped anywhere in the
Payment world for only USD3.00!
Privacy Notice
MicroX Product Range PIC Based SBCs With Bootloader
All Products
This range of
Contact Us PIC based
SBC(Single
Currencies Board
Computer)
US Dollar
boards are
pre
Shopping Cart
programmed
0 items with a
bootloader!
Specials Our MicroX product range consists of modular PIC based single No programmer is required to program the
board computers (SBC) and expansion boards. This highly board! By using a free PC program, the user
modular design allows you to quickly and economically realize can reprogram the PIC chip in circuit via the
your microcontroller based project by combining different Ethernet or the PCs serial port. In stead of the
boards. More Information........ serial port, a USB to Serial converter can be
used to program it via the USB. To see all
boards in this range, click here.
24LC512-I/P
US$3.95
US$2.95
Xsens is a leading developer and supplier of products for measurement of motion, orientation and position, based upon miniature MEMS inertial sensor technology. News
Winner of Innovation Award
Moven MTi-G Xsens has won the
Overijssel Innovation Award
Inertial Mocap Suit Miniature AHRS with integrated GPS with Moven!
more >>
Xsens is hiring!
Xsens is looking for
(technical-) commercial
professionals
more >>
Events
GDC - San Francisco
Game Developers
Conference.
Moven by Xsens on booth
#6539
Click here for a complete overview of all inertial measurement units
ION GNSS - Fort Worth
Xsens' small, low-cost and highly accurate 3D measurement units enable applications such as control, stabilization and navigation of unmanned vehicles, robots and other objects, as well as human motion capturing (USA) The Institute of
Navigation presents Satellite Division
for character animation, training and simulation, and movement science. Technical Meeting 2007. Booth #100
http://www.xsens.com/12/02/2008 17:27:11
Geek Hideout --> IO.DLL
Geek Hideout
Home
What's New? IO.DLL
Sign Guestbook
View Guestbook Synopsis
IO.DLL allows seamless port I/O operations for Windows 95/98/NT/2000/XP using the same
library.
Most Popular!
Tell Me a Secret Introduction
Drug Lord 2.2
IO.DLL In the pre-Windows days, it was a relatively simple matter to access I/O ports on a typical PC.
Parallel Port Monitor Indeed, nearly every language sported a special command for doing so. As Windows emerged
and gradually evolved, this flapping in the wind behaviour could no longer be tolerated because
Me of operating system's ability to virtualize hardware.
Who am I?
What I Do Virtualizing hardware means that an application (typically a DOS box in Windows) believes it is
Resume talking directly to a physical device, but in reality it is talking to a driver that emulates the
My Computers hardware, passing data back and forth as appropriate. This is how you are able to open dozens
Contact Me of DOS boxes in your Windows session, each one with the strange notion that it has exclusive
access to peripherals such as the video adapter, keyboard, sound card and printer.
Drug Lord 2.2
Download If one were to rudely bang out data to an I/O port that Windows thought it was in full control of,
Today's High Scores the "official bad thing" could occur, the severity of which depending upon the exact hardware that
High Scores was being accessed. Actually, with the virtualization just mentioned, it is quite improbable that
Windows would permit anything too nasty from occuring.
Programming Tools
IO.DLL Windows 95/98 actually does allow I/O operations be executed at the application level, although
Servo Control
you'd be hard pressed to find a language that supports this directly. Typically the programmer
QuietMessageBox will have to resort to assembly language for this kind of low-level control. If you know what you
giftab are doing, this can be a quick and easy way to access I/O ports. Of course, not everyone knows,
or desires to learn 80x86 assembly programming just because they want to turn on a lamp from
Freeware their computer. However, the unwillingness to learn assembly language becomes rather trivial
Parallel Port Monitor when faced with 9x's big brother.
HTML Color Blender
Windows NT/2000/XP, being the secure operating system that it is, does not permit port I/O
Finance operations at the application level at all. Period. A program with inline IN and OUT assembly
Interest Calculator instructions that runs perfectly on Windows 95/98 will fail horribly when it comes to Windows
shopLocal NT/2000/XP.
About My Collection Obviously, writing a driver that does acts a proxy for the I/O calls isn't the most ideal solution.
Luminox 32xx There is, however, a solution for NT/2000/XP that allows the same convienience of inline
Invicta 9937 assembly language that 95/98 does.
Sandoz Sub
Sandoz Explorer As mentioned, a kernel mode driver can do whatever it wants. The implication here is that if
Timex 20501 another kernel mode driver shut off application access to the I/O ports, it should be possible for
Invicta Torture Test another kernel mode driver to turn it back on. This is where IO.DLL enters the picture.
Invicta Speedway
Invicta GMT Licensing
WCT-5513
IO.DLL is completely free! However, you may not:
Knife Reviews
About My Collection Charge others for it in any way. For example, you cannot sell it as a stand alone product.
Benchmade 670 Charge for an IO.DLL wrapper, such as an OCX or Delphi control whose purpose is just
to put a fancy interface on IO.DLL. I consider these to be "derived works" and they must
Knowledge be provided free of charge.
Hydraulic pumps Claim that it is your property.
Quine-McClusky
Also, the author (that's me) cannot be held liable due to io.dll's failure to perform. As with most
Silly Stories free stuff, you are on your own.
Danny the Dog
Rupert and the Wine
The Lame Beggar
Source Code and Special Modifications
Taco Man
Ant Story The source code is available for $1,000 US.
Sausage Shoes
I'm willing to work with people should they require a special modification to IO.DLL. For example,
Random Silliness you might have a strict timing requirement of some sort that can only be done in kernel mode.
Versitile Pork For a fee, I will modify IO.DLL and/or the embedded kernel mode driver for the task at hand.
The Stooges
The Paperboy Description of IO.DLL
Essays IO.DLL provides a useful set of commands for reading and writing to the I/O ports. These
iPod Shuffle Woes commands are consistent between 95/98 and NT/2000/XP. Furthermore, there is no need for the
Human Limitations programmer to learn assembly language or muck with kernel mode drivers. Simply link to the
DLL and call the functions. It's that easy.
Freaky
One
Windows NT/2000/XP is accomodated through the use of a small kernel mode driver that
Two releases the ports as needed to the application. This driver is embedded in the DLL and is
Three installed if Windows NT/2000/XP is determined to be the underlying operating system.
Four
Five Due to the very minor overhead involved in dynamically linking to IO.DLL, and the optimized
Six functions contained within, access to I/O ports is nearly as fast as if it was written in raw
Seven assembler and inlined in your application. This holds true for both Windows 95/98 and Windows
Eight NT/2000/XP.
Link Log Before moving on, it is probably prudent to mention that the technique employed in IO.DLL for
Entire Log releasing the ports to the application level isn't, strictly speaking, the proper way to do things.
Last 25 The proper way is to have a virtual device driver for Windows 95/98 and a kernel mode driver for
Last 50 Windows NT/2000/XP. This isn't very practical for many people though, nor is it really necessary.
Last 100 There are several successful commercial products on the market that do exactly what IO.DLL
Search Link Log does. Let it be noted though that some of them are shady with their explanation of how their
Random Link product works, meanwhile charging $500 or more for it.
Other Download
Tell Me a Secret
Unix Hierarchy The following two files are for C++ users. There is more info on these in the prototypes section.
C Commandments
Dog Asks God io.cpp 1k
Links io.h 1k
Weird Words
Random Addresses
C/C++ Prototypes
Learn: ebullient
To use IO.DLL with Visual C++/ Borland C++, etc, you'll need to use LoadLibrary and
GetProcAddress. Yes, it's more of a pain than using a .lib file, but because of name mangling, it's
the only reliable way of calling the functions in IO.DLL. I've gone ahead and done the dirty work
for you:
io.cpp
io.h
Just save these two files and include them in your project. For a Visual C++, you may need to
add #include "StdAfx.h" at the top of io.cpp otherwise the compiler will whine at you.
These two files take care of calling LoadLibrary and all the neccessary calls to GetProcAddress,
making your life happy once again.
The only step you are required to do is call LoadIODLL somewhere at the beginning of your
program. Make sure you do this or you will find yourself faced with all sorts of interesting crashes.
Please let me know if you find any errors in the above two files. They are new and haven't been
tested all that much.
Delphi Prototypes
Important! To use these functions in your Delphi program, the correct calling convention of
stdcall is required. For example:
Function Descriptions
Please refer to the prototype for the particular language you are using.
PortOut
Outputs a byte to the specified port.
PortWordOut
Outputs a word (16-bits) to the specified port.
PortDWordOut
Outputs a double word (32-bits) to the specified port.
PortIn
Reads a byte from the specified port.
PortWordIn
Reads a word (16-bits) from the specified port.
PortDWordIn
Reads a double word (32-bits) from the specified port.
SetPortBit
Sets the bit of the specified port.
ClrPortBit
Clears the bit of the specified port.
NotPortBit
Nots (inverts) the bit of the specified port.
GetPortBit
Returns the state of the specified bit.
RightPortShift
Shifts the specified port to the right. The LSB is returned, and the value passed becomes the
MSB.
LeftPortShift
Shifts the specified port to the left. The MSB is returned, and the value passed becomes the LSB.
IsDriverInstalled
Returns non-zero if io.dll is installed and functioning. The primary purpose of this function is to
ensure that the kernel mode driver for NT/2000/XP has been installed and is accessible.
Other Information
An excellent document about the standard parallel port can be found here.
Hier Newsletter
Wireless Technologien finden sich in allen Bereichen unseres tglichen Lebens. abonnieren!
Suche + Sitemap
Angefangen beim Autoschlssel, der per Knopfdruck die Schliess- und Alarmanlage
bettigt bis hin zur funkgesttzen Zieleinrichtung bei militrischen Spezialverbnden -
Anwendungen von A bis Z sind heute nicht mehr denkbar ohne die Nutzung von Neuheiten ...
Menu / Navigation
Datenfunk-Technologien.
:. MU-1 434 MHz
:.OnlineShop OEM Funkmodem
:.Wireless-Anwendungen :.STD-302-500:
->Automobilbau 500 mW GFSK
->Gebaeudeautomation Funk-Transceiver
:.Funkkomponenten :.ER-TP-01-RS
Easy-Radio Tester-
:.Funkmodule
Programmer
Auf den folgenden Seiten finden Sie detaillierte Informationen ber Funk-Anwendungen
:.Funkmodems
in den verschiedensten Anwendungsbereichen. :.CTWLAN mini:
:.Funkfernsteuerungen
Lassen Sie sich berraschen und inspirieren. RS232-WLAN
Und wenn Sie neugierig geworden und auf neue Ideen gekommen sind, kontaktieren Sie
Serial Client
:.Antennen uns!
Wir zeigen Ihnen gerne, wie Sie Datenfunk in krzester Zeit in Ihre eigene Anwendung Bridge
:.Firmenprofil integrieren knnen. Zum Beispiel mit unseren Easy-Radio Funkmodulen: dank
:. RF1172D: OFW
integriertem Easy-Radio Funkprotokoll brauchen Sie nicht Monate oder Wochen zur
:.Links Integration von Wireless in Ihre Anwendung. Front-End Filter im
Wir zeigen Ihnen, wie ihre Anwendung Wireless wird innerhalb von Stunden oder Mini-Gehuse
wenigen Tagen. Garantiert!
:. RO2101D OFW
Umfragen
Resonator im 3,8 x
Nachfolgend finden Sie einige wichtige Anwendungsbereiche fr die Datenbertragung
3,8 mm Formfaktor
per Funk:
:. EasyRadio - der
Wireless im Automobilbau neue Standard fr
Wireless in der Gebudeautomation die Funk-
Wireless in industriellen Anwendungen Datenbertragung
Wireless in der Medizintechnik
:. 3-Kanal-
Wireless in militrischen Anwendungen
Empfnger SHR-7/
Wireless in der Telekommunikation
L3 mit Code-
Wireless in Sport und Lifestyle-Anwendungen
Lernfunktion im
433 MHz Band
Dies sind nur einige Beispiele. Bitte informieren Sie uns ber Ihre Anwendung. Wir sind
neugierig und lernen gerne tglich neue Anwendungen kennen. :. ER400PEN
Handsender macht
EasyRadio noch
praktischer
:.PA-TR1 UHF
Power Booster fr
bi-direktionale
Anwendungen
Romanshornerstr. 117, CH-8280 Kreuzlingen, Fon +41 (71) 698 6480, Fax +41 (71) 698 6481, www.wirelessworldag.ch
Electronics Engineering
Prev | Ring Hub | Join | Rate|
powered by dixit.net v2.2 Next
WebRing Inc. Search
Visit a complete list of WebRing memberships here
Sponsored by NetBurner
Most follow one of two approaches to adding embedded Ethernet to any particular system. You can
buy an all-in-one embedded Ethernet system, like the NetBurner Network Development Kit, or you
can build it all from separate components.
NetBurner designs and manufactures a wide variety of low cost 32-bit embedded Ethernet devices
that can be used to network-enable existing products or create new network-enabled products. In
addition to the device hardware, NetBurner also provides a complete development platform
including:
Core Modules and Serial to Ethernet Modules can be customized to suit any application with the
NetBurner Network Development Kit. These kits provide everything you need to create custom
applications for your embedded network device.
The IDE provides an easy to use interface to edit and download your application. In fact, a single
build command will compile the application, download it over the network, program the flash
memory of the NetBurner device, and reboot the device in less than 10 seconds.
For developers who prefer not to use an IDE, or wish to use the tools with a different IDE, the
development tools can be run without the IDE directly from the command line using a standard
make file.
The TCP/IP Stack was written by NetBurner as a high performance TCP/IP stack for embedded
applications. The stack is integrated with the RTOS, Web Server and I/O system, providing easy
development of network applications. The following protocols are supported:
* ARP
* DHCP, BOOTP
* FTP Client and Server
* HTTP
* ICMP
* IGMP (multicast)
* IP
* NTP, SNTP
* POP3
* PPP
* SMTP
* SNMP
* SSL
* Statistics Collection
* TCP
* Telnet
* UDP
The uC/OS RTOS is a preemptive multitasking real-time operating system designed to be very
efficient and full featured, providing rapid real-time response and a small footprint. You can easily
create and manage multiple tasks and communicate between tasks with the intuitive API. The
RTOS is integrated with the I/O system to make communication with the other system components,
such as the TCP/IP Stack, quick and easy.
* Based on uC/OS
* Real-time preemptive multitasking operating system
* Semaphores, Mail Boxes, Message Queues, FIFOs, Mutexs and Timers
* Stack Checking
* Task Debugging Tools
* The I/O system is integrated with the RTOS
If you have not used a RTOS before do not worry - you can use the "user task" automatically
created by the system as if it were your main loop. The advantage is that the Web Server, TCP/IP
Stack and serial interfaces are all interrupt driven and run in their own tasks. This means that
changes you may make to the user task will not change the timing of the network interface.
The NetBurner web server is integrated with the TCP/IP stack and RTOS, enabling you to quickly
develop dynamic web pages and content. The dynamic content is especially easy to use since you
can add C function call references to your HTML content.
* Compresses a user provided directory of HTML documents, gifs, and JAVA classes into a file
that is embedded in the runtime application
* Supports Dynamic HTML
* Supports Forms, Cookies and Passwords
The GCC C/C++ compiler is one of the most well known and widely used ANSI compliant compilers
available today. NetBurner maintains and supports the latest updates and releases so developers
can stay focused on product development. Each release of GCC is tested with the NetBurner tools
and software.
The Embedded Flash File System (EFFS) enables embedded systems developers to add one or
more types of Flash memory storage such as: on-board flash chips, SD Flash Cards, Compact
Flash Cards, Multi-Media Cards, RAM Drives, NAND and NOR Flash arrays. Additional features
include wear-leveling, bad block management and CRC32 checks. The system contains an easy to
use flexible common reentrant API.
The EFFS will enable you to store such things as: application data, images, video, audio or files for
FTP transfers. In one provided example, a memory card from a digital camera can simply be
plugged in to a NetBurner device and the images and video accessed via a web browser.
Debugging
" The Insight debugger is a full-featured graphical user interface to the GNU Debugger that enables
you to efficiently debug applications for your NetBurner device.
" TaskScan enables you to determine the status of your application tasks through a network
connection in your release code.
" SmartTraps enable you to track down errors in your application by providing detailed processor
information when a trap occurs.
Embedded SNMP
Simple Network Management Protocol (SNMP) is a system for exposing a number of variables to a
Network Management System. These variables are grouped together into SNMP MIB's
(Management Information Bases).
Embedded SSL
Secure Sockets Layer (SSL) encrypts and secures data for transmission over the Internet or local
network. SSL is an optional software module for the NetBurner development suite. The NetBurner
SSL implementation was written from the ground up to provide high performance and a small
memory footprint of approximately 90K bytes. The SSL module is integrated with the NetBurner
TCP/IP stack and web server, enabling you to add secure web pages to your product with just a
few function calls. Unlike 8-bit and 16-bit microcontrollers, the 32-bit NetBurner processor platforms
can easily handle the demands of connecting and transmitting data using SSL.
Schematics and software for a PIC 16C84programmer to be connected to the serial port. Largely based
on the "prog84" software and information gathered on the pic list. Written in C, developed under
FreeBSD, compiles with gcc and should be easily portable to other OS. Full sources and schematics
(chunky graphics) are available.
For DOS users: DOS executable (don't forget the configuration file).
PIC assembler.
Sources for the PIC assembler developed by Timo Rossi. Minor differences in the syntax from the
Microchip Assembler, but full source code available, and it can be used on Unix systems.
C++ source for a PIC16C84 simulator, developed as a student project by Tommaso Cucinotta and
Alessandro Evangelista. Command line interface, very powerful trace facilities. Compiles with g++/
djgpp.
A reference sheet for the PIC16C84 containing HW and SW data (courtesy of Giuseppe Di Termine).
This is a simple 50 MHz auto-ranging Frequency meter, developed as a course project by Simone
Benvenuti and Andrea Geniola. It uses a single PIC 16C84 and 4 displays to measure frequencies in the
0Hz..50MHz range. Output is shown in exponential format (XXX E) in order to have enough significant
digits. The PIC shuts down when the input is idle for some time, and turns on automatically when a
frequency is applied to the input. Source code and schematics available.
This is a cable tester made of two modules, useful to test network or phone or other cables where the two
ends are far away from each other. Partly developed as a course project by Maurizio Fabbri, Fabio Raso.
Schematics and full source and documentation. The sources should be assembled with Timo Rossi's
picasm.
NOTE: the archive is a gzipped tar file. gzip != zip. If you have trouble to handle it, all files can be
found in the tester directory.
Ths project implements a MIDI pedal keyboard with Program Change Function. It can change sounds
and/or effects of your musical devices (keyboard, expander, ...) with the only action of your foot. This
work was done by Maila Fatticcioni and Massimo Grasso
Luigi Rizzo
Dipartimento di Ingegneria dell'Informazione -- Univ. di Pisa
via Diotisalvi 2 -- 56126 PISA
tel. +39-50-568533 Fax +39-50-568522
email: l.rizzo@iet.unipi.it
H-Bridge
This circuit drives small DC motors up to about 100 watts or 5 amps or 40 volts, whichever comes first.
Using bigger parts could make it more powerful. Using a real H-bridge IC makes sense for this size of
motor, but hobbyists love to do it themselves, and I thought it was about time to show a tested H-bridge
motor driver that didn't use exotic parts.
Operation is simple. Motor power is required, 6 to 40 volts DC. There are two logic level compatible
inputs, A and B, and two outputs, A and B. If input A is brought high, output A goes high and output B
goes low. The motor goes in one direction. If input B is driven, the opposite happens and the motor runs in
the opposite direction. If both inputs are low, the motor is not driven and can freely "coast", and the circuit
consumes no power. If both inputs are brought high, the motor is shorted and braking occurs. This is a
special feature not common to most discrete H-bridge designs, drive both inputs in most H-bridges and
they self-destruct. About 0.05 amp is consumed in this state.
Stress-testing the H-bridge with Basic Stamp 2, PWM circuit, motor-dynamo, and 12 volt battery.
To do PWM(pulse width modulation) speed control, you need to provide PWM pulses. PWM is applied to
one input or the other based on direction desired, and the other input is held either high(locked rotor) or
low(float). Depending on the frequency of PWM and the desired reaction of the motor, one or the other
may work better for you. Holding the non-PWM'ed input low generally works best for low frequency
PWM, and holding the non-PWM'ed input high generally works best at high frequencies, but is not
efficient and produces a lot of heat, especially with these Darlingtons, so locked rotor is not recommended
for this circuit.
Truth table:
input | output
A | B | A | B
---------------
0 0 | float
1 0 | 1 0
0 1 | 0 1
1 1 | 1 1
Performance:
Please reference the accompanying schematic diagram. The circuit uses Darlington power transistors to
reduce cost. Forward losses are typically 1 to 2 volts, and since the current must pass through two
transistors, expect losses to total up to 4 volts at maximum current. The 4 Darlington transistors need to be
heatsunk based on your expected current and duty cycle.
PWM operation over 3 khz will likely lead to high losses and more heat dissipation, due to the simplicity
of the circuit and the construction of Darlington transistors. You might get away with higher frequencies if
you put a 1K resistor emitter-base on each TIP12x transistor. I prefer to go with very low frequencies, 50
to 300Hz.
Operation with logic signals greater than the motor supply voltage is allowed and absorbed by R7 and R8.
The circuit is really intended to be operated with CMOS logic levels, logic high being about 4 volts.
If you live in the U.S., expect the TIP120 and TIP125 transistors to cost about $0.50 and the very common
and generic "quad-2" PN2222A to cost about $0.10. An inexpensive source for hobbyist-grade parts like
these is Jameco Electronics. At low duty cycles, currents up to the 8 amp rated peak of the transistors is
allowed, but there is no current limiting in this circuit, so it would be unwise to use this circuit to drive a
motor that consumes more than 5 amps when stalled.
Operation over 3khz will lead to higher losses. If it is required to run at higher frequency, additional pinch-
off resistors can be added to Q1,2,3 and 4, supplementing the internal resistors. A good value would be 1k,
and the resistors should be soldered from base to emitter.
To reduce RF emissions, keep the wires between the circuit and the motor short. No freewheel diodes are
required, they are internal to the TIP series Darlington transistors.
Drive the circuit from 5-volt logic. Drive levels higher than 5 volts will tend to heat up R1 and 2. This is
OK for short periods of time.
Power supply voltage is 5 to 40 volts. Output current up to 5 amps is allowed if the power supply voltage is
18 volts or less. Peak current must be kept below 8 amps at all times.
There is no current limiting in this circuit. Reversing a motor at full speed can cause it to draw huge
currents, understand your load to avoid damage. There are higher powered devices in the TIP series of
Darlington transistors, these can be substituted if needed. Look at the TIP140 and TIP145, please note they
are in a bigger package and dont fit the PC board layout.
Files:
hb01sch.gif Schematic in GIF format
hb01sch.pdf Schematic in PDF format
hb01pc.gif PC board foil layout in GIF format. Not to scale.
hb01pc.pdf PC board foil layout in PDF format. Print your transfer with this.
hb01st.gif Parts stuffing diagram in GIF format. Not to scale.
hb01st.pdf Parts stuffing diagram in PDF format.
hb01pl.txt Parts list in plain text format.
A: Yes, but you dont want to. Darlingtons are not efficient. You will have too much heat to deal with.
A: Yes, but not in this circuit. I suggest using the IR2112 chip to drive MOSFETs. See Digi-Key.
Sorry, I did not have enough time to update this site anymore.
I work with Ubicom microcontrollers (100MIPS, compatible with PIC16C5X) now and maintain
Ubicom Net Resources site - more than 100 links now.
Please go the PICLIST.COM with all PIC-related questions. You will also find many Ubicom resources
here.
If you are interested, old Microchip Net Resources page is still here (not updated from 31-Jul-1999),
more than 500000 visitors from 1996...
Alexey Vladimirov
http://www.geocities.com/SiliconValley/Way/5807/12/02/2008 17:27:58
Datenlogger
Self made data-logger V2.5 (second edition) (gehe zur deutschen Version)
The sensor for barometric altitude and its amplifier are contained on the printed circuit board now.
Since the dissolution of altitude (10 bit) is too rough for the climb rate, an additional circuit is on the board.
An amplifier for current measurements as well as an amplifier for measuring bridges are likewise contained on the board.
Thus only an additional shunt or a measuring bridge (e.g. a differential pressure sensor with pitot tube) needs to be attached.
The measured data can be stored in a EEPROM and / or transferred by telemetry or by cable to a PalmPilot or PC.
The baud rate for the telemetry mode is selectable. 1200 and 9600 baud are available.
The data rate for the transfere of the the stored data to the Palm / PC was increased to 38400 baud.
Version V2.5 are different to version V2.4 in case of the circuit for current measurement. Therefore BEC-systems can used now.
Version V2.9 supports also GPS-receiver with ANTARIS chipset and simultaneously using of internal temperature sensor of MS5534A and
external DS1820 sensor. This version can use 24C256, 24C512 or 24C1024 EEPROMs and has an internal 'bootloader' implemented.
With V2.9g you can configure the datalogger for the 'Multilogging mode' (more than one loggs possible after switch off).
V2.9h supports DS18S20 temperature sensors, 2-wire connection for the temp sensor (connect pin1 and 3 of the sensor) and better start
condition for GPS using.
Additional sensors:
The software is in the development phase and can measure only the following signals at the moment.
1. Software version V2.9 for the PIC-controller (inclusive bootloader): log29_pic.zip (for 32k /64k and 128kByte EEPROM)
Remark: Install this version always first. Following versions will be loadable then via the internal bootloader of this version.
2. Betaversion V2.9h for the PIC-controller: log29h_alti_pic.zip (for 32k /64k and 128kByte EEPROM)
3. Software for the PalmPilot: logger_2g_Palm.zip ( for V2.9g and higher versions, limited to 32k data)
4. Brief description for the old Palm program (english): log_e.pdf
5. Telemertry software for the PC: telePC02.zip (Coefficients can be changed by 'SkyPlot')
6. An Exel example sheet: log2_exel.zip
7. The Windows software for the transmission of the dates to a computer as well as the program for showing of the GPS-data please
download by http://www.sprut.de :
(LoggerLeser: http://www.sprut.de/electronic/soft/logger.htm)
(SkyPlot: http://www.sprut.de/electronic/soft/skyplot.htm)
Perhaps you can buy a finished datalogger in a lightly changed layout by Walter Windhagauer.
main page aircrafts airfield airfield rules software for calculation of centre of gravity measurement of speed links
Overview
Manufacturing your own CAMPAC clones
Some of the Futaba R/C transmitters have a dedicated slot to insert optional CAMPAC memory modules. These memory modules are
available in various capacities, for instance 4 kB, 16 kB, and 64 kB, and enable the storage of all configuration settings of multiple R/C
models. A commercial 16 kB Futaba CAMPAC module costs (or used to cost) about 90 US-$ and allows storage for another 11 models
within the Futaba FC-18V3 plus R/C transmitter.
This CAMPAC clone features 1 bank of 16 kB storage (i.e. accessible without manual bank-switching through DIP-switch).
It can't be that complex and can't incorporate such expensive electronic parts to justify that dealer price.
So let's build our own parts...
My CAMPAC clones are based on the work of Jim White, Dave Rigotti, Dave Tatosian, and Rob Crockett. The ClonePac website is
I provide here a local HTML snapshot of Rob Crockett's initial webpage, or a PDF document for print-out.
If you want more than 16 kB of storage, e.g. for your FC-28, you may consider to order Model-Gadget's Ultra-PAC-II featuring storage
of 64 kB (1 bank), 256 kB (4 banks), or 512 kB (8 banks). In my opinion, the Ultra-PAC-II is a very nice solution which provides quite a
reasonable price-performance ratio regarding engineering- and manufacturing-costs. One Ultra-PAC item costs between 32 US-$ and
90 US-$.
16 kB ClonePac in service
in my Futaba FC-18 V3 plus R/C transmitter
[Toc] [Top]
Avionics
VoltGuard G3 LipoGuard G4
Digital battery monitor The brightest ever
with memory LiPo battery monitor
Ground equipment
Welcome to
Home Page
Autonomous Unmanned Air Vehicles
Palmetto Florida U.S.A
A.U.A.V. has been instrumental in the development of small to medium size UAV's,
Autopilots, Autonomous flight control systems, Digital spread spectrum RC control
systems, telemetry and data down link systems. A.U.A.V. has created a series of
autonomous aircraft to fit the needs of universities and the research industry. The
systems that A.U.A.V. has developed are low cost and very reliable due to the "keep it
simple" process. A complete turnkey UAV system from A.U.A.V. allows the program
manager to concentrate more on the payload and experiments rather then spending
their valuable time designing the airframe and flight control system. A.U.A.V. would
be delighted to work closely with you to meet the specific requirements of your
mission.
Dave brought Flamingo # 06 back from Australia with him in October 2007.
Wireless transmitter:
Circuit Design CDP-01
Dot Matrix LCD Display
simplex, up to 7.5 kbits/s
PowerSupply LCD.sch
434.075 MHz
B PowerSupply.sch B
LCD RS
LCD RS
LCD R/W
VBAT VBAT LCD R/W
LCD E CON2_1
LCD E
PIC TXD 1
VDD VDD
LCD D4 VSS 2
VSS VSS LCD D4
LCD D5 VBAT 3
LCD D5
LCD D6 CON03
VREF+ VREF+ LCD D6
LCD D7
VREF- VREF- LCD D7
VA_1 VA_1
VA_2 VA_2 VDD VDD
A_GND A_GND VSS VSS Title
Top Level of Precision Digital Altimeter
A A
Written by Date
23-Apr-2001
Peter Luethi
Revision Page
Dietikon, Switzerland 1.03 1 of 8
1 2 3 4
1 2 3 4
D D
C C
VA_1
SENS1_2
1 8
C C C 2 7
Vsens
10u 100n 10n 3 6
4 5
MPXS4100A
A_GND
B B
Title
VA_1 VA_1
Pressure Sensor MPXS 4100 A
A A_GND A_GND A
Written by Date
23-Apr-2001
Peter Luethi
Revision Page
Dietikon, Switzerland 1.03 2 of 8
1 2 3 4
u-blox: GPS / Galileo Products -> Legacy Products -> Legacy ProductsANTARIS Products
Search
Advanced Search
English | Deutsch |
Contact us Register Sitemap Terms of Use
Chinese
Home
ANTARIS GPS Receiver Products
About us
End of Life Notice for ANTARIS GPS Products
GPS / Galileo Products
u-blox 5 Products Since December 15, 2006, all ANTARIS GPS products have been phased out. The newer u-blox 5 and
ANTARIS 4 products (e.g. LEA-5H, TIM-4P, RCB-4H, etc.) are not affected by this phase-out.
ANTARIS 4 Products
GPS Antennas Read the End of Life Notice for details.
Product Catalogue
Legacy Products Dead
ANTARIS Products Low Cost Programmable SuperSense
Reckoning
LEA-LA
TIM-LA Chipsets ATR ATR Please contact Please contact
TIM-LC ANTARIS Chipset ANTARIS Chipset u-blox u-blox
TIM-LF without Flash with Flash
EPROM EPROM
TIM-LH
TIM-LL
TIM-LP GPS Modules With LEA-LA
TIM-LR 17 x 22 mm LNA
SBR-LS
RCB-LJ
ANTARIS EvalKit
SuperSense EvalKit GPS Modules With TIM-LA TIM-LL TIM-LH TIM-LR
25 x 25 mm LNA TIM-LP
ANTARIS SBEKit
GPS Receiver Boards
W/out TIM-LC TIM-LF
GPS Smart Antennas LNA
SiRFstar Products
GPS Technology GPS Receiver Boards RCB-LJ SBR-LS
A-GPS Services
Investor Relations
GPS Smart Antennas SAM-LS
Media Relations, News
Buy Samples
/products/index.html
last modified: 09.07.2007
Checkout our new USB A/mini-B cable for the newest Garmin's here.
Need more than two plugs? Click here for OEM pricing.
1. Click here if you want plugs for: eMap, etrex, and geko , work with our "E" type plugs:
2. If you want plugs for the RINO click here: rPlug - for the Garmin RINO.
NOTE: This new plug is much smaller with a diameter about the size of a pencil (7mm) than
our normal round plug (see below).
3. And plugs for other Garmin models, 1/2 inch round plug with 4 or 5 pins: Please
read the rest of this page to learn about our pPlug : for a pledge.
We have made: 556880 plugs! Current average 110/day down from 197/day in 2005. - Who-da-thunk?
Garmin's connector is molded onto a cable. You are at the right place if you want to
A "U-install" connector did not exist until build a cable for a Garmin GPS -- read on.
I made a mold in 1996. It was a crazy thing If however you want to buy a ready-made
to do because I needed just a few, but now cable - see Where-to-buy-cables. If
with Pfrancs worldwide to help, you can still neither, then go to-another-place.
get one or two.
Not all Pfrancs have PURPLE Pplugs so you may get black, and they won't look like the photo
above because after making 35,000 parts the mold wore out, so I spent all the pledge money,
and them some, to hire a world class professional mold maker to make us a new mold. We
include 4 gold socket pins and the screw. We ship them to our Pfrancs around the world so
you can get one or two fast and easy.
If you do This:
1) Make a pledge (a promise to send money (or things) if you are happy with our
service) and e-mail it to a Pfranc in your state/country. Click here to find-your-Pfranc.
The pledge amount includes shipping to your door, often in one or two days!
2) After it arrives, decide how satisfied you are with our service, then honor your
pledge to your Pfranc. You can send more if you are more (or less if less) happy than
you thought you'd be. You can honor your pledge with any amount at anytime during
your lifetime but don't wait too long because you could forget and someday find
yourself feeling bad and not know why. The current record is 3 years to honor a pledge.
(Update: 2006; We have a new record: 7 years, a pledge from 1999, how cool is that?
Does this mean we should make some new thing for a pledge? --- tell us what would be
cool. )
. . . . Thanks!
POP #1 Current shipping status, letters from customers, complete project history. My GPS
plug story how/why/when did all this happen?
(Notice: Garmin, nvi, eMap, geko, and eTrex areTrademarks of Garmin Corporation, and there may be references to other trademarks
of others - which we respect!, And so should all of us! ... Oh and BTW we've been promoting and working our trademark name: Purple
Computing, everyday for 24 years - around the world - and so I think all you other "computing" companies calling yourself Purple-this
and Purple-that ought to pick another color! Except it's OK for IBM to use "Purple Computer" because it's a ASCI massively parallel
supercomputer which is cool and they are cool and would be the first to stand up and defend my IP rights, and besides I've owned IBM
stock since 1994! )
[eMail larry]
The Garmin Home Page has software upgrades for some Garmin receivers (be SURE you get the right
one for your receiver!!), as well as a FAQ, manuals for many products, and other information.
Purple Computing (Larry Berg) has power and data connectors for Garmin 45 and similar receivers
(38,40, II, 12xl...). He also shows a cable wiring diagram.
Ready made cables using Larry's connectors are available from Dave Sorenson
Garmin.txt (27268 bytes) is another description of the Garmin protocol, by William Soley, Eric Werme,
Anton Helm and Daniel Zuppinger. (last update March 6, 1998)
FlyingD's GPS FLIGHT TRACK ANALYZER is a Freeware DOS program (small, very fast and works
on anything) that will analyze Garmin GPS-90 track files and will profile your flight returning the
following data and more: take-off time, landing time, total time, total flight time, total distance, flight
distance, average groundtrack, direct route distance, efficiency of the flown route, average groundspeed,
taxi & take-off run at departure, landing run and taxi at arrival.
Gardown11 (57,568 bytes, rev. Sept./97) transfers waypoint, route, and track data between a Garmin
GPS to a PC, and can log NMEA-0183 data. (MS-DOS) The latest version is available from the
GarDown home page By Mike Montgomery (mike@anali.demon.co.uk) Older versions are also
available: gardown8.zip, gardown9.zip
GarTrack is a Windows95 program for performance analysis for regatta sailors using data from a
Garmin GPS. Note: July 2007 - the author of this program has discontinued support for it, and has
asked me to remove the link to his site (and will be removing his site from the internet).
GPSdb is a waypoint database program for use with Garmin receivers. It requires Win95 or WinNT.
The program will upload and download waypoints, tracks, and routes. It will import from GarDown
files. Waypoints can be created in this program and uploaded to the GPS. Routes can be created by "drag
and drop". It also exports waypoints and tracks in Street Atlas format. Includes various map datums.
More info and downloads at http://blkbox.com/~hub/gpsdb. From Tim Hubbard (hub@blkbox.com)
GARNIX is an MS-DOS program to up/download waypoints, routes, etc. from a Garmin GPS . The
package includes a program to convert between Lat/Long, UTM and other grids, and to convert datums.
GPS Utility is a freeware/shareware program for users of Garmin or Magellan GPS receivers. As well as
upload/download, it provides facilities for mapping, sorting waypoints, filtering and selecting GPS data,
digitising from scanned maps, track analysis and other advanced tools (for example, generating
waypoints/routes from tracks). A variety of grids and coordinate formats are supported together with the
import/export of many different file types. The program exists in both 16-bit and 32-bit versions and
includes an extensive help system. For more information see http://www.gpsu.co.uk/
Thomas Ott Thomas Ott has a program called GPS2PILOT2PC . This program allows the USR/3Com
PalmPilot to track transfer data to/from a Garmin GPS. The program can also make the Pilot look like a
Garmin GPS to a PC, so the usual Garmin protocol programs can be used to transfer the track data
between the Pilot and a PC (or Mac, I suppose...)
GARtrip is a Win3.1/Win95 shareware program for users of a Garmin GPS receiver by Heinrich
Pfeifer.
Main Features:
Garmin_GPS_xla_01c.zip (15,492 bytes) contains the source code for an Excell Add-in (VB for Apps)
which converts GarDown7 track data to a *.dbf file, and converts the Lat/Long to the Swedish National
grid.
Garmin32.zip (for Win95, 211K, July 28/97) is another program to up/download waypoints, tracks, etc.
between a Garmin GPS and a PC. By Klaus Voigt (kpv@pcpostal.com)
Waypoint+ is a Windows95 program to transfer waypoints, routes and tracks between Garmin receivers
and a PC. It will write the data as a text file, or in formats compatible with DeLorme Street Atlas 3.0 or
4.0, or Map Expert 2.0. By B. Hildebrand (bhildebrand@worldnet.att.net) See the Waypoint+ home
page for further information and to download the program
MacGPS45.zip (59797 bytes) contains the source code and design notes (including a description of the
Garmin protocol) for John Waers' (jfwaers@csn.net) MacGPS-45 Macintosh program, which transfers
waypoints, routes, etc. between a Garmin GPS and a Mac. This file has been converted to a DOS archive
(and a MacWrite document converted to WordPerfect), but the program has not been ported to DOS.
The original Mac format source archive and program are available from ftp.csn.net/Unimac. Please note
that both these files contain the source for an early, somewhat buggy version of MacGPS. The
commercial version of this program is available from http://www.macgpspro.com/GPSPRO.html
GPS Manager (GPSMan) is a graphical manager of Garmin GPS data and lets you prepare, inspect and
change GPS data on a friendly environment. Note that GPSMan was thought of for use at home and not
for real-time use. GPSMan is a stand-alone Tcl/Tk program that implements part of the Garmin GPS
Interface Specification. This program was apparently developed under Linux. The author's site gives a
source for a Windows version of Tcl/TK which will allow it to be used under Windows.
GPSTrans is a Linux program based on MacGPS. It will upload/download waypoints, tracks, routes,
and almanac from a Garmin GPS. Written by Carsten Tschach (tschach@zedat.fu-berlin.de). This file
contains "tarred and zipped" C source. Another version, with some additions or corrections is gpstrans-
0.31b-js1.tar.gz (84,415 bytes), by Janne Sinkkonen (janne@avocado.pc.helsinki.fi) (I'm told the -js1
version is for Linux, the other is for Sun/HP)
gd2: This C language program (inspired by GarDown) is designed to download tracks, routes,
waypoints, position, clock, and almanac and to upload routes and waypoints from/to Garmin 12xl,
Garmin 38 and Garmin 45. The package includes man page, makefile, and notes. It works well on Linux
and FreeBSD, and needs help for SunOS. Available as a .shar file: gd2.shar (70662 bytes) or gzipped
tar: gd2.tgz (18415 bytes) Oct. 21, 1997. By Randolph Bentson (bentson@greig.seaslug.org)
gsa14.zip (53,423 bytes, Jan 22/97) contains some programs by Lance Rose (lancer@netrix.net) to
exchange waypoint data between a Garmin 45 (and probably most other models) and a DeLorme Street
Atlas 3.0 map file (.SA3) using the Garmin protocol. They let you create waypoints with the map
program and upload them to the GPS, or download the waypoint database from the GPS to a specified
map file for later manipulation.
G7To and G7ToWin convert GarDown7 download files to Street Atlas 3 format, or vice versa, and
converts either format to formats compatible with PROJ.EXE, NAD2NAD.EXE, or UTMS.EXE. This
version can also communicate directly with a Garmin or Lowrance receiver.
capg7100.zip (31045 bytes) includes a program to capture NMEA-0183 data at user-defined intervals,
and some batch files that semi-automate the conversion between the files captured with this program and
SA3 files. Can be used in conjunction with g7to and gardown7. (by Richard Hess rlh@interramp.com)
gmn_dxf2.zip (46093 bytes) converts the data downloaded by gardown into a .dxf file for import into
AutoCad or other drawing programs that read this format. (from DNelson@lanl.gov)
psigar20.zip (25925 bytes) is a shareware program to transfer waypoints, routes, track logs, etc. between
a Garmin 45 (not tested with other models) and a Psion series 3A
GarMap.zip (10878 bytes) provides an interface between Mapinfo Desktop Mapping Software and a
Garmin GPS receiver, using the proprietary Garmin/Garmin protocol. (from mholdern@sctyhq1.telecom.
com.au)
Garmin Data Monitor (229905 bytes) uses the Garmin protocol to display information not available via
NMEA-0183, such as satellite status, more precise position to display SA "wandering", etc.
wayuk11.zip HPx00LX palmtop databases of waypoints and segmented road track logs fo rthe UK. The
databases have been set up to allow their partial upload to a Garmin GPS45 with the G7TO203 program
so you can get a relatively detailed moving map display on your GPS without exceeding its memory
capacity. By John Seymour (john@blackbirds.demon.co.uk)
[home] [FAQS] [GPS info] [Links] [NMEA Info] [Wiring] [NMEA Progs] [Mapping Progs] [Street
Atlas] [Eagle] [Magellan] [Micrologic] [Navigation] [Scoring]
;***************************************************************************
;
; Precision Digital Altimeter Transmitter with NSC ADC12130
; =========================================================
;
; written by Peter Luethi, 25.12.1999, Switzerland
; last update : 23.4.2001
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS
; ==============
; Processor: Microchip PIC 16F84
; Clock: 4.00 MHz XT
; Throughput: 1 MIPS
; Required Hardware: NSC A/D Converter ADC12130
; Motorola MPXS4100 A
; Quad Op-Amp LM324
; - for remote use: Wireless Transmitter 9600 bps
; - for use with PC: RS232 level shifter (MAX232)
; Serial Output: 9600 baud, 8 Bit, No Parity, 1 Stopbit
;
;
; DESCRIPTION
; ===========
; This program has been designed for the Precision Digital Altimeter
; transmitter based on the PIC 16F84, the NSC ADC12130 12 bit A/D
; converter and the Motorola MPXS4100 A absolute pressure sensor.
; For further processing and visualization of the acquired data,
; there is another PIC with LCD display or a personal computer
; necessary. The serial output data of this transmitter has common
; RS232 format, so you can either use it directly connected to a
; personal computer or in conjunction with a wireless interface.
; If used with a personal computer, make sure there is a RS232
; level shifter (MAX232) between the PIC and the computer.
;
; The whole transmitter consists of 4 sections:
;
;
; 1. Data Aquisition & Analog Pre-Processing
; ==========================================
; The MPXS4100 A absolute pressure sensor is connected to A/D
; input channel 0. Two fourth order Butterworth active low pass
; filters (fc = 10 Hz) are implemented in front of the A/D channels
; 0 and 1 - realized with a quad Op-Amp - to minimize noise and to
; prevent aliasing.
;
; 2. A/D Conversion
; =================
; To convert the analog to digital data with adequate resolution,
; the NSC ADC12130 12 bit A/D converter has been used here.
; The communication between the A/D converter and the PIC is done with
; a software based SSP (Synchronous Serial Port) interface.
; Output format: Sign bit, MSB <12 bit data> LSB, X X X
;
; 3. Digital Data Processing
; ==========================
; After analog filtering and A/D conversion, the data has still some
; noise, what results in slightly toggling values.
; If we want to get rid of that, we have to implement a math routine,
; which calculates the actual value out of the actual sample and the
; previous ones.
; In this program it has been realized with a four stage ring buffer,
; which stores four 16 bit values (12 valid bits). Each of these values
; is the average calculated from 16 previously acquired 12 bit A/D
; samples. The current output value results from the average of this
; ring buffer. So one output value will be calculated every 16 A/D
; samples, with a history of 48 (=64-16) samples. The last acquired
; value has only a weight of a quarter.
; The NSC ADC12130 provides 2 input channels (CH0, CH1). I have used
; the same digital signal processing methods for both of them.
;
; 4. Data Transmission
; ====================
; The calculated output value is handled over to an RS232 routine.
; It is then transmitted serially to either a MAX232 or a wireless
; transmitter.
; Here, the m_rs096.asm module has been used to provide compatibility
; to wireless transmitters. Most of them support only up to 9600 bps.
; If you want to use this routine with a higher transmission rate (e.g.
; with a PC interface), you can only change the included m_rs098.asm
; to another one.
;
;
; IMPLEMENTATION
; ==============
; The following features are implemented in the PIC 16F84:
; - Setup of SSP communication and control lines to A/D converter
; - Auto Calibration and Mode Configuration of A/D converter
; - Readout of A/D values
PROCESSOR 16F84
#include "p16F84.inc"
; general
HI equ BASE+d'2' ; high nibble of data
LO equ BASE+d'3' ; low nibble of data
CH0_HI equ BASE+d'4'
CH0_LO equ BASE+d'5'
CH1_HI equ BASE+d'6'
CH1_LO equ BASE+d'7'
; A/D converter
AD_cnt equ BASE+d'8' ; counter
SSPSR equ BASE+d'9' ; SSP Shift Register
; average routine
sum_cnt equ BASE+d'10' ; counter
; ring buffer
RB_pnt equ BASE+d'13' ; pointer, BufferBASE offset
; RS232
TXD equ BASE+d'14' ; used for transmission
RXD equ BASE+d'15' ; received value
#include "../m_bank.asm"
#include "../m_wait.asm"
#include "../m_rs096.asm"
ADinit macro
BANK1
movlw b'11110000' ; set A/D control lines I/O direction
movwf TRISA
BANK0
movlw b'00000011' ; set A/D control lines :
movwf PORTA ; disable chip select & conversion,
endm ; SCK low
ADenable macro
movlw b'11111100' ; select chip & enable conversion
andwf PORTA,1
endm
ADdisable macro
movlw b'00000011' ; deselect chip & disable conversion
iorwf PORTA,1
endm
call AD_cmd
endm
RBinit macro
call RB_init
endm
decfsz AD_cnt,1
goto ad_loop
RETURN
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
SEND 'N'
SEND ' '
SEND 'D'
SEND 'I'
SEND 'G'
SEND 'I'
SEND 'T'
SEND 'A'
SEND 'L'
SEND ' '
SEND 'A'
SEND 'L'
SEND 'T'
SEND 'I'
SEND 'M'
SEND 'E'
SEND 'T'
SEND 'E'
SEND 'R'
SEND CR
SEND LF
SEND '1'
SEND '9'
SEND '9'
SEND '9'
SEND '-'
SEND '2'
SEND '0'
SEND '0'
SEND '1'
SEND ' '
SEND 'b'
SEND 'y'
SEND ' '
SEND 'P'
SEND 'e'
SEND 't'
SEND 'e'
SEND 'r'
SEND ' '
SEND 'L'
SEND 'u'
SEND 'e'
SEND 't'
SEND 'h'
SEND 'i'
SEND CR
SEND LF
SEND LF
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
MAIN ;**************************************************************
;*** INITIALIZATION ***
;**************************************************************
RS232init
ADinit
RBinit
;**************************************************************
;*** MAIN LOOP ***
;**************************************************************
LOOP
;**************************************************************
;*** A/D CHANNEL 0 READOUT (get the samples) ***
;*** 12 bit data unsigned, MSB first: <0000 MSB - LSB> ***
;**************************************************************
ADenable
ADcmd CH0se16MSB ; CH0, single-ended, 16 bit, MSB first
movfw SSPSR
movwf HI ; store high nibble in HI
bsf CONV ; disable conversion (for safety reasons)
ADcmd DummyCmd
movfw SSPSR
movwf LO ; store low nibble in LO
ADdisable
; result in HI, LO
;*** END OF READOUT ***
;------------------------------------------------
;**************************************************************
;*** FILL IN RING BUFFER & CALCULATE AVERAGE ***
;**************************************************************
;*****************************************************************
;*** You have to adapt the following division routine by hand, ***
;*** if you alter the amount of buffer registers. ***
;*** Default: divide by 4 (BufferLENGTH = 8 bytes) ***
;*****************************************************************
rrf sum_LO,1 ; divide by 2
rrf sum_LO,1 ; divide by 2
movfw sum_LO
movwf CH0_LO
movfw sum_HI
movwf CH0_HI
;**************************************************************
;*** A/D CHANNEL 1 READOUT ***
;*** 12 bit data unsigned, MSB first: <0000 MSB - LSB> ***
;**************************************************************
ADenable
ADcmd CH1se16MSB ; CH1, single-ended, 16 bit, MSB first
movfw SSPSR
movwf HI ; store high nibble in HI
bsf CONV ; disable conversion (for safety reasons)
ADcmd DummyCmd
movfw SSPSR
movwf LO ; store low nibble in LO
ADdisable
; result in HI, LO
;*** END OF READOUT ***
movfw sum_LO
movwf CH1_LO
movfw sum_HI
movwf CH1_HI
;**************************************************************
;*** SEND DATA TO PC, MSB FIRST ***
;**************************************************************
END
Sign-On
Home
About NXP
News
In Focus
Careers
Investors
Tech support
Contact
my.NXP
Select site:
English
http://www.nxp.com/search/12/02/2008 17:29:22
Welcome to Freescale Semiconductor
Contact Us
Worldwide: United States
Products Enter Part Number
Applications Enter Keyword
Login
My Freescale
Technologies
Support
Buy
About Freescale
Parametric Search
http://www.freescale.com/12/02/2008 17:29:32
Sensors
Technologies
Support Login
My Freescale
Buy
About Freescale
Sensors FreescaleSensors
Acceleration
Sensors Subscribe
Pressure
Proximity
Documentation
Training
FAQs
Design Resources
Product Selector
Getting Started Design
Search By Parameter
Supply Voltage - Min About Freescale Sensor Products Datasheets
MEMS Technology Innovative Sensing Tools
(V)
www.freescale.com
Site Map Terms of Use Privacy Practices Newsletter View Agreement RSS Feeds Freescale Semiconductor, Inc. 2004 - 2008. All Rights Reserved
United States
Contact Us
my.TI Login
Amplifiers & Linear Automotive Select Product Group Pricing & Availability
Clocks & Timers Broadband
Select Document Type GO TI eStore
DSP - Digital Signal Processing Communications & Telecom
Semiconductor Distributors
Data Converters Contact Technical Support
Computers & Peripherals Sales Representatives
Interface Quality & Lead-Free (Pb-Free) Data
Consumer Electronics
Logic KnowledgeBase
Industrial
Microcontrollers (MCU) Training & Events
Medical my.TI allows you to order free samples,
Power Management
TI Developer Conference
Security manage your newsletters and email
RFID Systems
Analog eLAB Design Center preferences, sign up for training events
Space, Avionics, & Defense
RF/IF & ZigBee Solutions
Log In or Register
DLP - TV, Projectors & Cinema
my.TI FAQ
Calculators & Education Technology
Texas Instruments (TI) designs and manufactures analog technologies, digital signal processing (DSP) and microcontroller (MCU) semiconductors. TI is a leader in semiconductor solutions for analog and digital
TI Worldwide | About TI | Contact Us | Investor Relations | Press Center | Corporate Social Responsibility | Careers | Tags | my.TI Login | All Searches | Site Map
Copyright 1995-2008 Texas Instruments Incorporated. All rights reserved. Trademarks | Privacy Policy | Terms of Use
Take advantage of TI's Cross-reference Search To find a semiconductor part, enter all or part of the number.
*Part Number
Enter Part Number
Search Modifier
Contains
Part Type
Both
Device
Product Group
All Parts
Tool/Software Type
Any
Product Status
Any Status
Military Status
All
Temperature Range
All Temperature Ranges
Search
TI Worldwide | About TI | Contact Us | Investor Relations | Press Center | Corporate Social Responsibility | Careers | Tags | my.TI Login | All Searches | Site Map
Copyright 1995-2008 Texas Instruments Incorporated. All rights reserved. Trademarks | Privacy Policy | Terms of Use
http://focus-webapps.ti.com/general/docs/sitesearch//advancedsearch.tsp12/02/2008 17:29:57
Analog, Linear, and Mixed-Signal Devices from Maxim/Dallas Semiconductor
ENGLISH
WHAT'S NEW PRODUCTS SOLUTIONS DESIGN APPNOTES SUPPORT BUY COMPANY MEMBERS
Video
Voltage References
Wireless, RF, and Cable
CONTACT US: FEEDBACK, QUESTIONS RATE THIS PAGE MAIL THIS PAGE
Copyright 2008 by Maxim Integrated Products, Dallas Semiconductor Legal Notices Privacy Policy
http://www.maxim-ic.com/12/02/2008 17:30:06
Linear Technology - Linear Home Page
Search
Analog-to-Digital Converters
Voltage Output DACs
Digital-to-Analog Converters
Switches and Multiplexers
Differential Amplifiers
Instrumentation Amplifiers
Video Functions
Amplifiers
High Speed Comparators
Application Specific
Comparators
Lowpass Filters
Filters
Shunt References
Series References
Voltage References
RMS-DC Conversion
Thermocouple Compensators
Switched Cap Building Blocks
Step-Up Regulators
Step-Down Regulators
Buck-Boost Regulators
Inverting Regulators
Multi-Topology DC/DC
LCD/CCD/OLED Bias
Switching Regulators
Negative Regulators
Positive Regulators
Linear Regulators
PMIC (DC-DC, PowerPath and Battery Charger)
Multi-Topology DC/DC
Regulated Step Up
Unregulated Inverters
LED Drivers
Power Path Controllers / Ideal Diodes
Bridge Drivers
PWM Controllers
Offline Controllers/PFC
Power Controllers
Battery Chargers
Battery Management
Hot Swap
Power-Over-Ethernet (PoE) Interface Controllers
Supervisory Circuits
Upconverting Mixers
Downconverting Mixers
I/Q Modulators
I/Q Demodulators
IF Amplifiers / ADC Drivers
RF Schottky Peak Detectors
RF Log Detectors
Low Power Transceivers
Handset PA Controllers
Optical Communications
RS232
RS422/485
Multiprotocol
I2C and SMBus Buffers and Accelerators
SIM Interface
CAN Transceiver
Silicon Oscillators
Timing
Radiation Tolerant Products
Military/JANS
Product Datasheets
Design Notes
Application Notes
LT Magazine
LT Chronicle
Solutions Brochures
Site Help
Site Map
Site Index
Send Us Feedback
BROWSE BROWSE
Products & Suppliers Services & Consultants
Electrical and Electronic Semiconductors Business
Components Data Acquisition and Signal Services
Sensors, Transducers and Conditioning Calibration and Testing
Detectors Imaging and Video Services
Test and Measurement Equipment Contract Manufacturing and
Equipment Industrial Computers and Fabrication
Optical Components and Embedded Systems Electrical and Electronic Contract
Optics Manufacturing and Process Manufacturing
Networking and Communication Equipment Engineering
Equipment Flow Control and Fluid Services
Motion and Transfer Industrial Automation
Controls Material Handling and Packaging Services
Fluid Power Equipment Industrial
Components Materials, Chemicals and Maintenance
Mechanical Adhesives Material Handling and Packaging
Components Industrial and Engineering Services
Laboratory Equipment and Scientific Software
Instruments
http://cmpmedia.globalspec.com/12/02/2008 17:30:23
Datasheets, Samples, and Buy, Fairchild Semiconductor - Global Leader in Power Optimization
Careers | Sitemap |
Home
Go
DATASHEETS, SAMPLES, BUY TECHNICAL INFORMATION APPLICATIONS DESIGN CENTER SUPPORT COMPANY INVESTORS MY FAIRCHILD
Application Notes
Drivers TRIACs MSI Functions
Design Tools
TRIACs Multiplexer/Demultiplexer Encoders/
Synchronous-Buck / Multi-phase Drivers Evaluation Boards
Decoders
Supervisory / Monitor ICs Models
Ground Fault Interrupt (GFI) Controllers
Specialty Logic New Product Highlights
Supervisors + PWM TinyLogic Online Seminars
Temperature Sensors Voltage Level Translators
Stabilizers
Lighting and Display Optoelectronics Latest News | RSS
Voltage Regulators
LDOs
CCFL Ballast IC Infrared Products
Fairchild Semiconductor
Positive Voltage Linear Regulators CFL/Lighting Ballast Control IC Optocouplers Appoints Allan Lam
Negative Voltage Linear Regulators Critical (CrCM)/Boundary Conduction Executive Vice President,
Mode (BCM) PFC Controllers for Lighting Worldwide Sales and
Shunt Regulators
Marketing
High Voltage Gate Drivers (HVIC)
Fairchild Semiconductor
LED Drivers
Selects Pune, India for
PDP Smart Power Module (PDP-SPM) Research and Development
Center, Supporting Lighting,
Automotive and Industrial
Applications
Fairchild Semiconductor's
Energy-Efficient Power
Solutions Featured at APEC
2008
Products | Design Center | Support | Company News | Investors | My Fairchild | Contact Us | Site Index | Privacy Policy | Site Terms & Conditions | Standard Terms & Conditions of Sale
site version
is
page last
edited on
20020716
page was
never
integrally
checked for
link
correctness
have this site
translated
other mirror
sites
netCOMPONENTS
Search (Part Search Demo)
This site contains:Numerically and functionally ordered chip lists, chip pinouts and lists of chip manufacturers,
manufacturers of controller embedding tools, electronics books, CDROM's, magazines, WWW sites and much more.
Mailing E-insite chip
list news
Search elsewhere:
Chip to search for search at comment
ABCsemiconductors
ChipDocs
Search engines that may require a (free) registration and login, or that keep changing their form protocol:
URL name comment
Pinouts
You can help this site and all it's viewers by entering chip pinouts!
Add a pinout with 8, 14, 16, 18, 20, 24, 28, 32, 40, 44, 48, 64 pins.
local General
local Advertising here
www.xs4all.nl/~ganswijk/chipdir/ml/index.htm Mailing list
www.xs4all.nl/~ganswijk/chipdir/regcomp.htm Register a company
www.xs4all.nl/~ganswijk/chipdir/register.htm Register yourself
Miscellaneous
Software
Manufacturers of
Traders
local Brokers help companies find obsolete and otherwise scarce chips of any brand.
local Distributors sell new components in bulk but only from selected manufacturers
local Retailers sell parts in small quantities over the counter. [Under construction]
netCOMPONENTS
Search (Part Search Demo)
Search at www.chipinfo.ru
Bought it's content probably from the Russian site www.chipinfo.ru/ and is therefore very
www.chipdocs.com/
good!
www.icmaster.com/ Registration is needed in advance.
Registration is needed before you can download datasheets. Chips can sometimes be
www.questlink.com/
ordered via their distributor partners.
www.spies.com/arcade/schematics/ Schematics of arcade chips and systems
For more data about the above WWW sites and for more information sites.
Books
More books
Home Welcome
Work Projects
The purpose of this page is to publish my study and private projects to get in touch with
Study Projects interested and interesting people. I am not introducing you to my cat or my motorcycle and
you will not find great talk about me as a person here. Instead I describe some of the things I
Private Projects have done for work, during my studies at the ETH in Zrich and during my spare time.
Contact
Work Projects
Here I present some of the things I've done for work. This is by far not a complete list and it is
not ment to be a CV. If you are interested in a CV please contact me directly. I documented
some things that I thought would interest you. And, of course, I am only publishing things that
I am allowed to :-(
Study Projects
I have studied electrical engineering at the ETH Zrich and finished my masters in spring
2001. The mandatory project and diploma theses are documented in the "Study Projects"
section and their reports are published. You will find some stuff about a voluntary robitic contest i participated in as well.
Private Projects
Since I am interested in a lot of things besides my profession and my studies, a lot of private projects emerge in my spare time.
Some of them are documented in the "Private Projects" section. This stuff is mostly experimental. To put it another way: Don't try
this at home ;-)
tm / 2007
http://www.tmoser.ch/typo3/3.0.html12/02/2008 17:30:37
trash.net:startseite
hintenrum
partner
sponsoren
obenrum
dienste Du hast soeben die Webseite des Vereins trash.net gefunden. Wir
faq mchten freie Software und Inhalte
projekte frdern und knnen eine technische Plattform fr Projekte in diesem
Sinne zur Verfgung stellen.
untenrum Falls Dir fr dein Vorhaben die Infrastruktur fehlt, dann erzhle uns doch
beer.trash.net davon - wir werden sehen,
trashholder value was wir tun knnen. Falls Du uns in unserem Vorhaben untersttzen
yoda.trash.net mchtest, dann kannst Du Mitglied werden.
your.trash.net
www.shegeeks.ch Fuer Neugierige gibt es zudem eine Liste mit einigen Projekten, die auf
unserem Server betrieben werden.
News
Kontakt | Lageplan
http://www.stimmt.ch/12/02/2008 17:30:44
zwickers homepage | Welcome
zwickers.ch
Home
Regula
Paul
Kati
Welcome
Matthias
Welcome to zwickers.ch
Thomas
Site Map
http://www.zwickers.ch/zwickers/phpwcms0609/index.php12/02/2008 17:30:46
RS232 Scope V1.02 - Data Capture with Excel 97 on Windows 95/98/ME/NT
Concept
Supported Operating Systems
Input data format
Major extracts
Available resources
This Excel Worksheet has been designed to visualize data sent from microcontrollers in a very convenient way.
The Worksheet activates a Visual Basic macro, which opens the specified ComPort and reads data as long as specified in the
drop-down menu "Duration". The "sampling time" can be selected in the drop-down menu "Interval".
At the end of each interval, the macro calculates the average of all data received during this interval. Afterwards, the graph is
updated automatically.
The data transmitted is enclosed by a frame: A Frame-Header (TX) and a Frame-Tail (/T) ensure, that the data is identified
properly. At the moment, there is no automatic resynchronisation built in, but the tests showed, that there is no urgent need for
that.
Maybe this feature will be necessary, if longer data streams are transmitted within one frame.
The software has been tested under Windows 95 - Excel 97 on a Pentium I 166 MHz, and under Windows 98 - Excel 97 on a
Pentium III 500 MHz and an Athlon 700 MHz.
The transmitted pattern comes from a 16 bit table implemented in a PIC16C84 and was transmitted with the m_rs096.asm. The
table has been generated with the "Automatic Table Generator for MPLAB Assembler".
The assembler source code for the test pattern is available under projects / 16 bit table read.
But recently, I obtained a different version of the RSAPI.DLL for WinXP, which you can download and try yourself. I've
named it RSAPI_71.DLL, you can rename it to RSAPI_70.DLL and install it in your WinXP C:\WINDOWS\system32\
directory. The Visual Basic sources refer currently to the name RSAPI_70.DLL, but you can change this, if desired.
Protocol: RS232
Input data format: Frame-Header, 2 byte of data (MSB, then LSB), Frame-Tail (Trailer)
Entire frame length: 6 byte
[Toc] [Top]
Concept
Supported Operating Systems
Available resources
This Excel Worksheet has been designed to easily visualize and debug data received on the serial port (RS232).
The Worksheet activates a Visual Basic macro, which opens the specified RS232 ComPort and reads data in an endless
loop. The received data bytes are converted to ASCII characters and to their binary, hexadecimal and decimal
representations. The interruption of the endless loop is done by pushing the 'Esc' button.
The software has been successfully tested under Windows 95/98 and Excel 97 on a Pentium III 500 MHz and an
Athlon 700 MHz system.
But recently, I obtained a different version of the RSAPI.DLL for WinXP, which you can download and try yourself.
I've named it RSAPI_71.DLL, you can rename it to RSAPI_70.DLL and install it in your WinXP C:\WINDOWS
\system32\ directory. The Visual Basic sources refer currently to the name RSAPI_70.DLL, but you can change this, if
desired.
[Toc] [Top]
AudioAnalyser Screenshot1:
Home
System requirements:
Release Notes:
AudioAnalyser V1.9
Date: 31.07.2006
AudioAnalyser V1.81
Date: 24.01.2006
AudioAnalyser V1.8
Date: 22.01.2006
AudioAnalyser V1.7
Date: 11.01.2006
AudioAnalyser V1.6
Date: 05.01.2006
AudioAnalyser V1.51
Date: 16.08.2005
AudioAnalyser V1.5
Date: 31.07.2005
AudioAnalyser V1.4
Date: 06.06.2005
AudioAnalyser V1.3
Date: 31.03.2005
AudioAnalyser V1.1
Date: 10.02.2005
Initial Revision
Home Multisine:
Home
It is possible to use the two programs together, if your soundcard supports the full
duplex mode. When using the two programs simultaneously, you have a full audio
measurement suite for your PC or external audio components.
Before you download the software, please read first the license.
Have fun using the software. Please report bugs and other issues concerning the
software to me.
Munich, 25.11.2007
Sebastian Dunst
http://softsolutions.sedutec.de/12/02/2008 17:30:52
softsolutions.sedutec.de
Multisine Screenshot1:
Home
System requirements:
http://softsolutions.sedutec.de/multisine.php (1 of 2)12/02/2008 17:30:53
softsolutions.sedutec.de
Release Notes:
Multisine V1.73
Date: 25.11.2007
no additional features
Multisine V1.72
Date: 26.06.2007
Multisine V1.71
Date: 21.01.2007
Multisine V1.7
Date: 08.01.2007
Multisine V1.61
Date: 13.09.2006
Multisine V1.6
Date: 04.07.2005
Multisine V1.5
Date: 28.02.2005
Multisine V1.4
Date: 04.02.2005
Head of Chair and Laboratory Professor Alexei R. Khokhlov Seminars and Conferences:
Seminar of the Polymer Council of RAS
Research Seminar in Polymer Physics
Research in Polymer Science
Nonlinear Dynamics and Chaos Group
Joint Scanning Probe Microscopy Group
Laboratory of Frontier Carbon Materials Common services:
Scientific Projects
Crysader Batch Cluster
History of Research in Polymer and Crystal Physics at the Physics Dept., MSU
Education
Available topics of term papers for the 2nd year students (in Russian) Scientific Libraries:
Admission of 3rd year students (information about laboratory, 4Mb PDF, in Russian) Physics Department's Library
Lecture Courses arXiv.org e-Print archive
Laboratory Courses
NEW! Lectures Timetable
Macrogalleria (local mirror here, laboratory access only)
Scientific and Educational Center for Physics and Chemistry of Polymers and Thin Organic Films (in Russian) Contact Information
Students
Lectures Timetable for Ph.D. students
Ph.D. Students
Alumni
http://polly.phys.msu.su/12/02/2008 17:31:04
Zelscope: Sound card oscilloscope and spectrum analyzer
Zelscope is a Windows software that converts your PC into a dual-trace storage oscilloscope
and spectrum analyzer. It uses your computer's sound card as analog-to-digital converter,
presenting a real-time waveform or spectrum of the signal - which can be music, speech, or
output from an electronic circuit. Zelscope features the interface of a traditional oscilloscope,
with conventional gain, offset, timebase, and trigger controls. As a real-time spectrum analyzer,
Zelscope can display the amplitude and phase components of the spectrum.
http://www.zelscope.com/12/02/2008 17:31:10
Planetside, the home of Terragen
Terragen 2 News
Terragen 2 Technology Preview
http://www.planetside.co.uk/12/02/2008 17:31:15
Quick Reference
Table B.6: 12-Bit Core Byte Oriented File Register Operations (Continued)
Hex Mnemonic Description Function
30f RRF f,d Rotate right f register f
C 7......0
03ff DECF
0Bff DECFSZ f,d Decrement f, skip if zero f - 1 d, skip if 0
0Aff INCF f,d Increment f f + 1 d
0Fff INCFSZ f,d Increment f, skip if zero f + 1 d, skip if 0
04ff IORWF f,d Inclusive OR W and f W .OR. f d
08ff MOVF f,d Move f f d
Table B.9: 14-Bit Core Byte Oriented File Register Operations (Continued)
Hex Mnemonic Description Function
008f MOVWF f Move W to f W f
0000 NOP No operation
0Dff RLF f,d Rotate left f register f
C 7......0
APPENDICES
APPENDICES
eral in W
0012 RETURN s Return from subroutine TOS PC, if s=1, WS W,
STATUSS STATUS, BSRS BSR,
PCLATU/PCLATH are unchanged
0003 SLEEP Enter SLEEP Mode 0 WDT, 0 WDT postscaler,
1 TO, 0 PD
APPENDICES
0 0 0 0 0 0 0 0
1 4096 1 256 1 16 1 1
2 8192 2 512 2 32 2 2
3 12288 3 768 3 48 3 3
4 16384 4 1024 4 64 4 4
5 20480 5 1280 5 80 5 5
6 24576 6 1536 6 96 6 6
Using This Table: For each Hex digit, find the associated decimal value. Add
the numbers together. For example, Hex A38F converts to 41871 as follows:
Hex 1000s Digit Hex 100s Digit Hex 10s Digit Hex 1s Digit Result
40960 + 768 + 128 + 15 = 41871
Decimal
Description
The HD44780U dot-matrix liquid crystal display controller and driver LSI displays alphanumerics,
Japanese kana characters, and symbols. It can be configured to drive a dot-matrix liquid crystal display
under the control of a 4- or 8-bit microprocessor. Since all the functions such as display RAM, character
generator, and liquid crystal driver, required for driving a dot-matrix liquid crystal display are internally
provided on one chip, a minimal system can be interfaced with this controller/driver.
A single HD44780U can display up to one 8-character line or two 8-character lines.
The HD44780U has pin function compatibility with the HD44780S which allows the user to easily
replace an LCD-II with an HD44780U. The HD44780U character generator ROM is extended to generate
208 5 8 dot character fonts and 32 5 10 dot character fonts for a total of 240 different character fonts.
The low power supply (2.7V to 5.5V) of the HD44780U is suitable for any portable battery-driven
product requiring low power dissipation.
Features
5 8 and 5 10 dot matrix possible
Low power operation support:
2.7 to 5.5V
Wide range of liquid crystal display driver power
3.0 to 11V
Liquid crystal drive waveform
A (One line frequency AC waveform)
Correspond to high speed MPU bus interface
2 MHz (when VCC = 5V)
4-bit or 8-bit MPU interface enabled
80 8-bit display RAM (80 characters max.)
9,920-bit character generator ROM for a total of 240 character fonts
208 character fonts (5 8 dot)
32 character fonts (5 10 dot)
167
HD44780U
64 8-bit character generator RAM
8 character fonts (5 8 dot)
4 character fonts (5 10 dot)
16-common 40-segment liquid crystal display driver
Programmable duty cycles
1/8 for one line of 5 8 dots with cursor
1/11 for one line of 5 10 dots with cursor
1/16 for two lines of 5 8 dots with cursor
Wide range of instruction functions:
Display clear, cursor home, display on/off, cursor on/off, display character blink, cursor shift,
display shift
Pin function compatibility with HD44780S
Automatic reset circuit that initializes the controller/driver after power on
Internal oscillator with external resistors
Low power consumption
Ordering Information
Type No. Package CGROM
HD44780UA00FS FP-80B Japanese standard font
HCD44780UA00 Chip
HD44780UA00TF TFP-80F
HD44780UA02FS FP-80B European standard font
HCD44780UA02 Chip
HD44780UA02TF TFP-80F
HD44780UBxxFS FP-80B Custom font
HCD44780UBxx Chip
HD44780UBxxTF TFP-80F
Note: xx: ROM code No.
168
HD44780U
OSC1 OSC2
CL1
CL2
M
Reset
circuit
Timing
ACL CPG generator
Instruction 7
register (IR) D
8
Display COM1 to
MPU Instruction
data RAM 16-bit Common COM16
RS inter- decoder
(DDRAM) shift signal
R/W face 80 8 bits register driver
E
Address 7 SEG1 to
counter 40-bit 40-bit Segment SEG40
8
7 shift latch signal
DB4 to register circuit driver
DB7
7
Input/ 8 Data 8
DB0 to output register
40
DB3 buffer (DR)
8 8 LCD drive
voltage
Busy selector
flag
Character Character
Cursor
generator generator
and
RAM ROM
blink
(CGRAM) (CGROM)
controller
64 bytes 9,920 bits
GND
5 5
Parallel/serial converter
and
attribute circuit
VCC
V1 V2 V3 V4 V5
169
HD44780U
170
HD44780U
SEG23
SEG24
SEG25
SEG26
SEG27
SEG28
SEG29
SEG30
SEG31
SEG32
SEG33
SEG34
SEG35
SEG36
SEG37
SEG38
80
79
78
77
76
75
74
73
72
71
70
69
68
67
66
65
SEG22 1 64 SEG39
SEG21 2 63 SEG40
SEG20 3 62 COM16
SEG19 4 61 COM15
SEG18 5 60 COM14
SEG17 6 59 COM13
SEG16 7 58 COM12
SEG15 8 57 COM11
SEG14 9 56 COM10
SEG13 10 55 COM9
SEG12 11 54 COM8
SEG11 12 FP-80B 53 COM7
SEG10 13 (Top view) 52 COM6
SEG9 14 51 COM5
SEG8 15 50 COM4
SEG7 16 49 COM3
SEG6 17 48 COM2
SEG5 18 47 COM1
SEG4 19 46 DB7
SEG3 20 45 DB6
SEG2 21 44 DB5
SEG1 22 43 DB4
GND 23 42 DB3
OSC1 24 41 DB2
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
OSC2
V1
V2
V3
V4
V5
CL1
CL2
DB0
DB1
VCC
M
D
RS
R/W
E
171
HD44780U
SEG21
SEG22
SEG23
SEG24
SEG25
SEG26
SEG27
SEG28
SEG29
SEG30
SEG31
SEG32
SEG33
SEG34
SEG35
SEG36
SEG37
SEG38
SEG39
SEG40
80
79
78
77
76
75
74
73
72
71
70
69
68
67
66
65
64
63
62
61
SEG20 1 60 COM16
SEG19 2 59 COM15
SEG18 3 58 COM14
SEG17 4 57 COM13
SEG16 5 56 COM12
SEG15 6 55 COM11
SEG14 7 54 COM10
SEG13 8 53 COM9
SEG12 9 52 COM8
SEG11 10 TFP-80F 51 COM7
SEG10 11 (Top view) 50 COM6
SEG9 12 49 COM5
SEG8 13 48 COM4
SEG7 14 47 COM3
SEG6 15 46 COM2
SEG5 16 45 COM1
SEG4 17 44 DB7
SEG3 18 43 DB6
SEG2 19 42 DB5
SEG1 20 41 DB4
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
GND
OSC1
OSC2
V1
V2
V3
V4
V5
CL1
CL2
VCC
M
D
RS
R/W
E
DB0
DB1
DB2
DB3
172
HD44780U
2 1 80 63
Type code
HD44780U
23 42
X
173
HD44780U
174
HD44780U
Pin Functions
No. of Device
Signal Lines I/O Interfaced with Function
RS 1 I MPU Selects registers.
0: Instruction register (for write) Busy flag:
address counter (for read)
1: Data register (for write and read)
R/ : 1 I MPU Selects read or write.
0: Write
1: Read
E 1 I MPU Starts data read/write.
DB4 to DB7 4 I/O MPU Four high order bidirectional tristate data bus
pins. Used for data transfer and receive
between the MPU and the HD44780U. DB7 can
be used as a busy flag.
DB0 to DB3 4 I/O MPU Four low order bidirectional tristate data bus
pins. Used for data transfer and receive
between the MPU and the HD44780U.
These pins are not used during 4-bit operation.
CL1 1 O Extension driver Clock to latch serial data D sent to the
extension driver
CL2 1 O Extension driver Clock to shift serial data D
M 1 O Extension driver Switch signal for converting the liquid crystal
drive waveform to AC
D 1 O Extension driver Character pattern data corresponding to each
segment signal
COM1 to COM16 16 O LCD Common signals that are not used are changed
to non-selection waveforms. COM9 to COM16
are non-selection waveforms at 1/8 duty factor
and COM12 to COM16 are non-selection
waveforms at 1/11 duty factor.
SEG1 to SEG40 40 O LCD Segment signals
V1 to V5 5 Power supply Power supply for LCD drive
VCC V5 = 11 V (max)
VCC, GND 2 Power supply VCC: 2.7V to 5.5V, GND: 0V
OSC1, OSC2 2 Oscillation When crystal oscillation is performed, a resistor
resistor clock must be connected externally. When the pin
input is an external clock, it must be input to
OSC1.
175
HD44780U
Function Description
Registers
The HD44780U has two 8-bit registers, an instruction register (IR) and a data register (DR).
The IR stores instruction codes, such as display clear and cursor shift, and address information for display
data RAM (DDRAM) and character generator RAM (CGRAM). The IR can only be written from the
MPU.
The DR temporarily stores data to be written into DDRAM or CGRAM and temporarily stores data to be
read from DDRAM or CGRAM. Data written into the DR from the MPU is automatically written into
DDRAM or CGRAM by an internal operation. The DR is also used for data storage when reading data
from DDRAM or CGRAM. When address information is written into the IR, data is read and then stored
into the DR from DDRAM or CGRAM by an internal operation. Data transfer between the MPU is then
completed when the MPU reads the DR. After the read, data in DDRAM or CGRAM at the next address
is sent to the DR for the next read from the MPU. By the register selector (RS) signal, these two registers
can be selected (Table 1).
When the busy flag is 1, the HD44780U is in the internal operation mode, and the next instruction will
:
not be accepted. When RS = 0 and R/ = 1 (Table 1), the busy flag is output to DB7. The next
instruction must be written after ensuring that the busy flag is 0.
The address counter (AC) assigns addresses to both DDRAM and CGRAM. When an address of an
instruction is written into the IR, the address information is sent from the IR to the AC. Selection of
either DDRAM or CGRAM is also determined concurrently by the instruction.
After writing into (reading from) DDRAM or CGRAM, the AC is automatically incremented by 1
(decremented by 1). The AC contents are then output to DB0 to DB6 when RS = 0 and R/ = 1 (Table:
1).
RS R/ : Operation
0 0 IR write as an internal operation (display clear, etc.)
0 1 Read busy flag (DB7) and address counter (DB0 to DB6)
1 0 DR write as an internal operation (DR to DDRAM or CGRAM)
1 1 DR read as an internal operation (DDRAM or CGRAM to DR)
176
HD44780U
Display data RAM (DDRAM) stores display data represented in 8-bit character codes. Its extended
capacity is 80 8 bits, or 80 characters. The area in display data RAM (DDRAM) that is not used for
display can be used as general data RAM. See Figure 1 for the relationships between DDRAM addresses
and positions on the liquid crystal display.
The DDRAM address (ADD) is set in the address counter (AC) as hexadecimal.
Display position
(digit) 1 2 3 4 5 79 80
DDRAM ..................
00 01 02 03 04 4E 4F
address
(hexadecimal)
Display
position 1 2 3 4 5 6 7 8
DDRAM 00 01 02 03 04 05 06 07
address
For
shift left 01 02 03 04 05 06 07 08
For
shift right 4F 00 01 02 03 04 05 06
177
HD44780U
2-line display (N = 1) (Figure 4)
Case 1: When the number of display characters is less than 40 2 lines, the two lines are
displayed from the head. Note that the first line end address and the second line start address are
not consecutive. For example, when just the HD44780 is used, 8 characters 2 lines are displayed.
See Figure 5.
When display shift operation is performed, the DDRAM address shifts. See Figure 5.
Display
position 1 2 3 4 5 39 40
00 01 02 03 04 .................. 26 27
DDRAM
address ..................
(hexadecimal) 40 41 42 43 44 66 67
Display
position 1 2 3 4 5 6 7 8
DDRAM 00 01 02 03 04 05 06 07
address
40 41 42 43 44 45 46 47
For 01 02 03 04 05 06 07 08
shift left
41 42 43 44 45 46 47 48
For 27 00 01 02 03 04 05 06
shift right
67 40 41 42 43 44 45 46
178
HD44780U
Case 2: For a 16-character 2-line display, the HD44780 can be extended using one 40-output
extension driver. See Figure 6.
When display shift operation is performed, the DDRAM address shifts. See Figure 6.
Display
position 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
DDRAM 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
address
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10
For
shift left
41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50
For 27 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E
shift right
67 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E
179
HD44780U
The character generator ROM generates 5 8 dot or 5 10 dot character patterns from 8-bit character
codes (Table 4). It can generate 208 5 8 dot character patterns and 32 5 10 dot character patterns.
User-defined character patterns are also available by mask-programmed ROM.
In the character generator RAM, the user can rewrite character patterns by program. For 5 8 dots, eight
character patterns can be written, and for 5 10 dots, four character patterns can be written.
Write into DDRAM the character codes at the addresses shown as the left column of Table 4 to show the
character patterns stored in CGRAM.
See Table 5 for the relationship between CGRAM addresses and data and display patterns.
Areas that are not used for display can be used as general data RAM.
180
HD44780U
Hitachi User
Start
Computer Determine
1
processing character patterns
EPROM Hitachi 4
No
OK?
Yes
Art work
M/T
Masking
Trial
Sample
Sample 6
evaluation
No
OK?
Yes
Mass
production
Note: For a description of the numbers used in this figure, refer to the preceding page.
181
HD44780U
Programming character patterns
This section explains the correspondence between addresses and data used to program character
patterns in EPROM. The HD44780U character generator ROM can generate 208 5 8 dot character
patterns and 32 5 10 dot character patterns for a total of 240 different character patterns.
Character patterns
EPROM address data and character pattern data correspond with each other to form a 5 8 or 5
10 dot character pattern (Tables 2 and 3).
Table 2 Example of Correspondence between EPROM Address Data and Character Pattern
(5 8 Dots)
LSB
A 1 1A 1 0 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 O 4 O3 O2 O1 O0
0 0 0 0 1 0 0 0 0
0 0 0 1 1 0 0 0 0
0 0 1 0 1 0 1 1 0
0 0 1 1 1 1 0 0 1
0 1 0 0 1 0 0 0 1
0 1 0 1 1 0 0 0 1
0 1 1 0 1 1 1 1 0
0 1 1 0 0 0 1 0 0 1 1 1 0 0 0 0 0 Cursor position
1 0 0 0 0 0 0 0 0
1 0 0 1 0 0 0 0 0
1 0 1 0 0 0 0 0 0
1 0 1 1 0 0 0 0 0
1 1 0 0 0 0 0 0 0
1 1 0 1 0 0 0 0 0
1 1 1 0 0 0 0 0 0
1 1 1 1 0 0 0 0 0
Character code Line
position
182
HD44780U
Handling unused character patterns
1. EPROM data outside the character pattern area: Always input 0s.
2. EPROM data in CGRAM area: Always input 0s. (Input 0s to EPROM addresses 00H to FFH.)
3. EPROM data used when the user does not use any HD44780U character pattern: According to
the user application, handled in one of the two ways listed as follows.
a. When unused character patterns are not programmed: If an unused character code is written
into DDRAM, all its dots are lit. By not programing a character pattern, all of its bits become
lit. (This is due to the EPROM being filled with 1s after it is erased.)
b. When unused character patterns are programmed as 0s: Nothing is displayed even if unused
character codes are written into DDRAM. (This is equivalent to a space.)
Table 3 Example of Correspondence between EPROM Address Data and Character Pattern
(5 10 Dots)
LSB
A 1 1A 1 0 A9 A8 A7 A6 A5 A4 A3 A2 A1 A0 O 4 O3 O2 O1 O0
0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0
0 0 1 0 0 1 1 0 1
0 0 1 1 1 0 0 1 1
0 1 0 0 1 0 0 0 1
0 1 0 1 1 0 0 0 1
0 1 1 0 0 1 1 1 1
0 1 0 1 0 0 1 0 0 1 1 1 0 0 0 0 1
1 0 0 0 0 0 0 0 1
1 0 0 1 0 0 0 0 1
1 0 1 0 0 0 0 0 0 Cursor position
1 0 1 1 0 0 0 0 0
1 1 0 0 0 0 0 0 0
1 1 0 1 0 0 0 0 0
1 1 1 0 0 0 0 0 0
1 1 1 1 0 0 0 0 0
Character code Line
position
183
HD44780U
Table 4 Correspondence between Character Codes and Character Patterns (ROM Code: A00)
Upper 4
Lower Bits 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
4 Bits
CG
RAM
xxxx0000 (1)
xxxx0001 (2)
xxxx0010 (3)
xxxx0011 (4)
xxxx0100 (5)
xxxx0101 (6)
xxxx0110 (7)
xxxx0111 (8)
xxxx1000 (1)
xxxx1001 (2)
xxxx1010 (3)
xxxx1011 (4)
xxxx1100 (5)
xxxx1101 (6)
xxxx1110 (7)
xxxx1111 (8)
Note: The user can specify any pattern for character-generator RAM.
184
HD44780U
Table 4 Correspondence between Character Codes and Character Patterns (ROM Code: A02)
Upper 4
Lower Bits 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
4 Bits
CG
xxxx0000 RAM
(1)
xxxx0001 (2)
xxxx0010 (3)
xxxx0011 (4)
xxxx0100 (5)
xxxx0101 (6)
xxxx0110 (7)
xxxx0111 (8)
xxxx1000 (1)
xxxx1001 (2)
xxxx1010 (3)
xxxx1011 (4)
xxxx1100 (5)
xxxx1101 (6)
xxxx1110 (7)
xxxx1111 (8)
185
HD44780U
Table 5 Relationship between CGRAM Addresses, Character Codes (DDRAM) and Character
Patterns (CGRAM Data)
0 0 0 * * * 1 1 1 1 0
0 0 1 1 0 0 0 1
0 1 0 1 0 0 0 1
Character
0 1 1 1 1 1 1 0 pattern (1)
0 0 0 0 * 0 0 0 0 0 0
1 0 0 1 0 1 0 0
1 0 1 1 0 0 1 0
1 1 0 1 0 0 0 1
1 1 1 * * * 0 0 0 0 0 Cursor position
0 0 0 * * * 1 0 0 0 1
0 0 1 0 1 0 1 0
0 1 0 1 1 1 1 1
Character
0 1 1 0 0 1 0 0
0 0 0 0 * 0 0 1 0 0 1 pattern (2)
1 0 0 1 1 1 1 1
1 0 1 0 0 1 0 0
1 1 0 0 0 1 0 0
1 1 1 * * * 0 0 0 0 0 Cursor position
0 0 0 * * *
0 0 1
0 0 0 0 * 1 1 1 1 1 1
1 0 0
1 0 1
1 1 0
1 1 1 * * *
Notes: 1. Character code bits 0 to 2 correspond to CGRAM address bits 3 to 5 (3 bits: 8 types).
2. CGRAM address bits 0 to 2 designate the character pattern line position. The 8th line is the
cursor position and its display is formed by a logical OR with the cursor.
Maintain the 8th line data, corresponding to the cursor display position, at 0 as the cursor
display.
If the 8th line data is 1, 1 bits will light up the 8th line regardless of the cursor presence.
3. Character pattern row positions correspond to CGRAM data bits 0 to 4 (bit 4 being at the left).
4. As shown Table 5, CGRAM character patterns are selected when character code bits 4 to 7 are
all 0. However, since character code bit 3 has no effect, the R display example above can be
selected by either character code 00H or 08H.
5. 1 for CGRAM data corresponds to display selection and 0 to non-selection.
* Indicates no effect.
186
HD44780U
Table 5 Relationship between CGRAM Addresses, Character Codes (DDRAM) and Character
Patterns (CGRAM Data) (cont)
0 0 0 0 * * * 0 0 0 0 0
0 0 0 1 0 0 0 0 0
0 0 1 0 1 0 1 1 0
0 0 1 1 1 1 0 0 1
0 1 0 0 1 0 0 0 1 Character
0 0 0 0 * 0 0 * 0 0 0 1 0 1 1 0 0 0 1 pattern
0 1 1 0 1 1 1 1 0
0 1 1 1 1 0 0 0 0
1 0 0 0 1 0 0 0 0
1 0 0 1 1 0 0 0 0
1 0 1 0 * * * 0 0 0 0 0 Cursor position
1 0 1 1 * * * * * * * *
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1 * * * * * * * *
0 0 0 0 * * *
0 0 0 1
0 0 0 0 * 1 1 * 1 1 1 0 0 1
1 0 1 0 * * *
1 0 1 1 * * * * * * * *
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1 * * * * * * * *
Notes: 1. Character code bits 1 and 2 correspond to CGRAM address bits 4 and 5 (2 bits: 4 types).
2. CGRAM address bits 0 to 3 designate the character pattern line position. The 11th line is the
cursor position and its display is formed by a logical OR with the cursor.
Maintain the 11th line data corresponding to the cursor display positon at 0 as the cursor
display.
If the 11th line data is 1, 1 bits will light up the 11th line regardless of the cursor presence.
Since lines 12 to 16 are not used for display, they can be used for general data RAM.
3. Character pattern row positions are the same as 5 8 dot character pattern positions.
4. CGRAM character patterns are selected when character code bits 4 to 7 are all 0.
However, since character code bits 0 and 3 have no effect, the P display example above can be
selected by character codes 00H, 01H, 08H, and 09H.
5. 1 for CGRAM data corresponds to display selection and 0 to non-selection.
* Indicates no effect.
187
HD44780U
The timing generation circuit generates timing signals for the operation of internal circuits such as
DDRAM, CGROM and CGRAM. RAM read timing for display and internal operation timing by MPU
access are generated separately to avoid interfering with each other. Therefore, when writing data to
DDRAM, for example, there will be no undesirable interferences, such as flickering, in areas other than
the display area.
The liquid crystal display driver circuit consists of 16 common signal drivers and 40 segment signal
drivers. When the character font and number of lines are selected by a program, the required common
signal drivers automatically output drive waveforms, while the other common signal drivers continue to
output non-selection waveforms.
Sending serial data always starts at the display data character pattern corresponding to the last address of
the display data RAM (DDRAM).
Since serial data is latched when the display data character pattern corresponding to the starting address
enters the internal shift register, the HD44780U drives from the head display.
The cursor/blink control circuit generates the cursor or character blinking. The cursor or the blinking will
appear with the digit located at the display data RAM (DDRAM) address set in the address counter (AC).
For example (Figure 8), when the address counter is 08H, the cursor position is displayed at DDRAM
address 08H.
AC 0 0 0 1 0 0 0
Display position 1 2 3 4 5 6 7 8 9 10 11
00 01 02 03 04 05 06 07 08 09 0A
DDRAM address
(hexadecimal)
40 41 42 43 44 45 46 47 48 49 4A
cursor position
Note: The cursor or blinking appears when the address counter (AC) selects the character
generator RAM (CGRAM). However, the cursor and blinking become meaningless.
The cursor or blinking is displayed in the meaningless position when the AC is a CGRAM address.
188
HD44780U
For 4-bit interface data, only four bus lines (DB4 to DB7) are used for transfer. Bus lines DB0 to DB3
are disabled. The data transfer between the HD44780U and the MPU is completed after the 4-bit data
has been transferred twice. As for the order of data transfer, the four high order bits (for 8-bit
operation, DB4 to DB7) are transferred before the four low order bits (for 8-bit operation, DB0 to
DB3).
The busy flag must be checked (one instruction) after the 4-bit data has been transferred twice. Two
more 4-bit operations then transfer the busy flag and address counter data.
For 8-bit interface data, all eight bus lines (DB0 to DB7) are used.
RS
R/W
Instruction register (IR) Busy flag (BF) and Data register (DR)
write address counter (AC) read
read
189
HD44780U
Reset Function
An internal reset circuit automatically initializes the HD44780U when the power is turned on. The
following instructions are executed during the initialization. The busy flag (BF) is kept in the busy state
until the initialization ends (BF = 1). The busy state lasts for 10 ms after VCC rises to 4.5 V.
1. Display clear
2. Function set:
DL = 1; 8-bit interface data
N = 0; 1-line display
F = 0; 5 8 dot character font
3. Display on/off control:
D = 0; Display off
C = 0; Cursor off
B = 0; Blinking off
4. Entry mode set:
I/D = 1; Increment by 1
S = 0; No shift
Note: If the electrical characteristics conditions listed under the table Power Supply Conditions Using
Internal Reset Circuit are not met, the internal reset circuit will not operate normally and will fail
to initialize the HD44780U. For such a case, initial-ization must be performed by the MPU as
explained in the section, Initializing by Instruction.
Instructions
Outline
Only the instruction register (IR) and the data register (DR) of the HD44780U can be controlled by the
MPU. Before starting the internal operation of the HD44780U, control information is temporarily stored
into these registers to allow interfacing with various MPUs, which operate at different speeds, or various
peripheral control devices. The internal operation of the HD44780U is determined by signals sent from
the MPU. These signals, which include register selection signal (RS), read/
:
write signal (R/ ), and the data bus (DB0 to DB7), make up the HD44780U instructions (Table 6). There
are four categories of instructions that:
190
HD44780U
Normally, instructions that perform data transfer with internal RAM are used the most. However, auto-
incrementation by 1 (or auto-decrementation by 1) of internal HD44780U RAM addresses after each data
write can lighten the program load of the MPU. Since the display shift instruction (Table 11) can perform
concurrently with display data write, the user can minimize system development time with maximum
programming efficiency.
When an instruction is being executed for internal operation, no instruction other than the busy
flag/address read instruction can be executed.
Because the busy flag is set to 1 while an instruction is being executed, check it to make sure it is 0
before sending another instruction from the MPU.
Note: Be sure the HD44780U is not in the busy state (BF = 0) before sending an instruction from the
MPU to the HD44780U. If an instruction is sent without checking the busy flag, the time between
the first instruction and next instruction will take much longer than the instruction time itself.
Refer to Table 6 for the list of each instruc-tion execution time.
Table 6 Instructions
Execution Time
Code (max) (when fcp or
Instruction RS R/ : DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Description fOSC is 270 kHz)
Clear 0 0 0 0 0 0 0 0 0 1 Clears entire display and sets
display DDRAM address 0 in address
counter.
Return 0 0 0 0 0 0 0 0 1 Sets DDRAM address 0 in 1.52 ms
home address counter. Also returns
display from being shifted to
original position. DDRAM
contents remain unchanged.
Entry 0 0 0 0 0 0 0 1 I/D S Sets cursor move direction 37 s
mode set and specifies display shift.
These operations are
performed during data write
and read.
Display 0 0 0 0 0 0 1 D C B Sets entire display (D) on/off, 37 s
on/off cursor on/off (C), and blinking
control of cursor position character
(B).
Cursor or 0 0 0 0 0 1 S/C R/L Moves cursor and shifts 37 s
display display without changing
shift DDRAM contents.
Function 0 0 0 0 1 DL N F Sets interface data length 37 s
set (DL), number of display lines
(N), and character font (F).
Set 0 0 0 1 ACG ACG ACG ACG ACG ACG Sets CGRAM address. 37 s
CGRAM CGRAM data is sent and
address received after this setting.
Set 0 0 1 ADD ADD ADD ADD ADD ADD ADD Sets DDRAM address. 37 s
DDRAM DDRAM data is sent and
address received after this setting.
Read busy 0 1 BF AC AC AC AC AC AC AC Reads busy flag (BF) 0 s
flag & indicating internal operation is
address being performed and reads
address counter contents.
191
HD44780U
Table 6 Instructions (cont)
Execution Time
Code (max) (when fcp or
Instruction RS R/ : DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Description fOSC is 270 kHz)
Write data 1 0 Write data Writes data into DDRAM or 37 s
to CG or CGRAM. tADD = 4 s*
DDRAM
Read data 1 1 Read data Reads data from DDRAM or 37 s
from CG or CGRAM. tADD = 4 s*
DDRAM
I/D = 1: Increment DDRAM: Display data RAM Execution time
I/D = 0: Decrement CGRAM: Character generator changes when
S = 1: Accompanies display shift RAM frequency changes
S/C = 1: Display shift ACG: CGRAM address Example:
S/C = 0: Cursor move ADD: DDRAM address When fcp or fOSC is
R/L = 1: Shift to the right (corresponds to cursor
250 kHz,
R/L = 0: Shift to the left address) 270
37 s = 40 s
DL = 1: 8 bits, DL = 0: 4 bits AC: Address counter used for 250
N = 1: 2 lines, N = 0: 1 line both DD and CGRAM
F = 1: 5 10 dots, F = 0: 5 8 dots addresses
BF = 1: Internally operating
BF = 0: Instructions acceptable
Note: indicates no effect.
* After execution of the CGRAM/DDRAM data write or read instruction, the RAM address counter
is incremented or decremented by 1. The RAM address counter is updated after the busy flag
turns off. In Figure 10, tADD is the time elapsed after the busy flag turns off until the address
counter is updated.
Address counter
(DB0 to DB6 pins) A A+1
t ADD
192
HD44780U
Instruction Description
Clear Display
Clear display writes space code 20H (character pattern for character code 20H must be a blank pattern)
into all DDRAM addresses. It then sets DDRAM address 0 into the address counter, and returns the
display to its original status if it was shifted. In other words, the display disappears and the cursor or
blinking goes to the left edge of the display (in the first line if 2 lines are displayed). It also sets I/D to 1
(increment mode) in entry mode. S of entry mode does not change.
Return Home
Return home sets DDRAM address 0 into the address counter, and returns the display to its original status
if it was shifted. The DDRAM contents do not change.
The cursor or blinking go to the left edge of the display (in the first line if 2 lines are displayed).
I/D: Increments (I/D = 1) or decrements (I/D = 0) the DDRAM address by 1 when a character code is
written into or read from DDRAM.
The cursor or blinking moves to the right when incremented by 1 and to the left when decremented by 1.
The same applies to writing and reading of CGRAM.
S: Shifts the entire display either to the right (I/D = 0) or to the left (I/D = 1) when S is 1. The display
does not shift if S is 0.
If S is 1, it will seem as if the cursor does not move but the display does. The display does not shift when
reading from DDRAM. Also, writing into or reading out from CGRAM does not shift the display.
D: The display is on when D is 1 and off when D is 0. When off, the display data remains in DDRAM,
but can be displayed instantly by setting D to 1.
C: The cursor is displayed when C is 1 and not displayed when C is 0. Even if the cursor disappears, the
function of I/D or other specifications will not change during display data write. The cursor is displayed
using 5 dots in the 8th line for 5 8 dot character font selection and in the 11th line for the 5 10 dot
character font selection (Figure 13).
B: The character indicated by the cursor blinks when B is 1 (Figure 13). The blinking is displayed as
switching between all blank dots and displayed characters at a speed of 409.6-ms intervals when f cp or fOSC
is 250 kHz. The cursor and blinking can be set to display simultaneously. (The blinking frequency
changes according to fOSC or the reciprocal of fcp. For example, when fcp is 270 kHz, 409.6 250/270 =
379.2 ms.)
193
HD44780U
Cursor or display shift shifts the cursor position or display to the right or left without writing or reading
display data (Table 7). This function is used to correct or search the display. In a 2-line display, the
cursor moves to the second line when it passes the 40th digit of the first line. Note that the first and
second line displays will shift at the same time.
When the displayed data is shifted repeatedly each line moves only horizontally. The second line display
does not shift into the first line position.
The address counter (AC) contents will not change if the only action performed is a display shift.
Function Set
DL: Sets the interface data length. Data is sent or received in 8-bit lengths (DB7 to DB0) when DL is 1,
and in 4-bit lengths (DB7 to DB4) when DL is 0.When 4-bit length is selected, data must be sent or
received twice.
Note: Perform the function at the head of the program before executing any instructions (except for the
read busy flag and address instruction). From this point, the function set instruction cannot be
executed unless the interface data length is changed.
Set CGRAM address sets the CGRAM address binary AAAAAA into the address counter.
194
HD44780U
Clear
Code 0 0 0 0 0 0 0 0 0 1
display
Entry
Code 0 0 0 0 0 0 0 0 0 1
mode set
Display
Code 0 0 0 0 0 0 0 0 0 1
on/off control
Figure 11
Cursor or
Code 0 0 0 0 0 1 S/C R/L * * Note: * Dont care.
display shift
Set CGRAM 0 0 0 0 A A A A A A
Code
address
Higher Lower
order bit order bit
Figure 12
195
HD44780U
Set DDRAM address sets the DDRAM address binary AAAAAAA into the address counter.
However, when N is 0 (1-line display), AAAAAAA can be 00H to 4FH. When N is 1 (2-line display),
AAAAAAA can be 00H to 27H for the first line, and 40H to 67H for the second line.
Read busy flag and address reads the busy flag (BF) indicating that the system is now internally operating
on a previously received instruction. If BF is 1, the internal operation is in progress. The next instruction
will not be accepted until BF is reset to 0. Check the BF status before the next write operation. At the
same time, the value of the address counter in binary AAAAAAA is read out. This address counter is
used by both CG and DDRAM addresses, and its value is determined by the previous instruction. The
address contents are the same as for instructions set CGRAM address and set DDRAM address.
S/C R/L
0 0 Shifts the cursor position to the left. (AC is decremented by one.)
0 1 Shifts the cursor position to the right. (AC is incremented by one.)
1 0 Shifts the entire display to the left. The cursor follows the display shift.
1 1 Shifts the entire display to the right. The cursor follows the display shift.
No. of
Display Duty
N F Lines Character Font Factor Remarks
0 0 1 5 8 dots 1/8
0 1 1 5 10 dots 1/11
1 * 2 5 8 dots 1/16 Cannot display two lines for 5 10 dot character font
Note: * Indicates dont care.
196
HD44780U
Cursor
Figure 14
197
HD44780U
To write into CG or DDRAM is determined by the previous specification of the CGRAM or DDRAM
address setting. After a write, the address is automatically incremented or decremented by 1 according to
the entry mode. The entry mode also determines the display shift.
Read data from CG or DDRAM reads 8-bit binary data DDDDDDDD from CG or DDRAM.
The previous designation determines whether CG or DDRAM is to be read. Before entering this read
instruction, either CGRAM or DDRAM address set instruction must be executed. If not executed, the first
read data will be invalid. When serially executing read instructions, the next address data is normally
read from the second read. The address set instructions need not be executed just before this read
instruction when shifting the cursor by the cursor shift instruction (when reading out DDRAM). The
operation of the cursor shift instruction is the same as the set DDRAM address instruction.
After a read, the entry mode automatically increases or decreases the address by 1. However, display shift
is not executed regardless of the entry mode.
Note: The address counter (AC) is automatically incremented or decremented by 1 after the write
instructions to CGRAM or DDRAM are executed. The RAM data selected by the AC cannot be
read out at this time even if read instructions are executed. Therefore, to correctly read data,
execute either the address set instruction or cursor shift instruction (only with DDRAM), then just
before reading the desired data, execute the read instruction from the second time the read
instruction is sent.
Write data to
Code 1 0 D D D D D D D D
CG or DDRAM
Higher Lower
order bits order bits
Figure 15
198
HD44780U
Interface to MPUs
RS
R/W
Internal
operation
DB7
write
Data
Instruction
P30 to P37
P77
P76
P75
Functioning
Busy
Busy flag
check
8
Busy
Busy flag
check
H8/325
E
RS
R/W
HD44780U
DB0 to DB7
Not
busy
Busy flag
COM1 to
COM16
SEG1 to
SEG40
16
40
Data
Instruction
write
LCD
199
HD44780U
Interfacing to a 4-bit MPU
The HD44780U can be connected to the I/O port of a 4-bit MPU. If the I/O port has enough bits, 8-bit
data can be transferred. Otherwise, one data transfer must be made in two operations for 4-bit data. In
this case, the timing sequence becomes somewhat complex. (See Figure 18.)
See Figure 19 for an interface example to the HMCS4019R.
Note that two cycles are needed for the busy flag check as well as for the data transfer. The 4-bit
operation is selected by the program.
RS
R/W
E
Internal
operation
Instruction
write
Functioning
Busy AC3
Busy flag
check
Note: IR7 , IR3 are the 7th and 3rd bits of the instruction.
AC3 is the 3rd bit of the address counter.
HMCS4019R
D15
D14
D13
R10 to R13
4
RS
R/W
E
Not
busy AC3
Busy flag
check
HD44780
DB4 to DB7
COM1 to
COM16
SEG1 to
SEG40
16
40
D7 D3
Instruction
write
LCD
200
HD44780U
Character Font and Number of Lines: The HD44780U can perform two types of displays, 5 8 dot
and 5 10 dot character fonts, each with a cursor.
Up to two lines are displayed for 5 8 dots and one line for 5 10 dots. Therefore, a total of three
The number of lines and font types can be selected by the program. (See Table 6, Instructions.)
Connection to HD44780 and Liquid Crystal Display: See Figure 20 for the connection examples.
HD44780
COM1
COM8
SEG1
SEG40
Example of a 5 8 dot, 8-character 1-line display (1/4 bias, 1/8 duty cycle)
HD44780
COM1
COM11
SEG1
SEG40
Example of a 5 10 dot, 8-character 1-line display (1/4 bias, 1/11 duty cycle)
201
HD44780U
Since five segment signal lines can display one digit, one HD44780U can display up to 8 digits for a 1-
line display and 16 digits for a 2-line display.
The examples in Figure 20 have unused common signal pins, which always output non-selection
waveforms. When the liquid crystal display panel has unused extra scanning lines, connect the extra
scanning lines to these common signal pins to avoid any undesirable effects due to crosstalk during the
floating state (Figure 21).
HD44780
COM1
COM8
COM9
COM16
SEG1
SEG40
Example of a 5 8 dot, 8-character 2-line display (1/5 bias, 1/16 duty cycle)
Cursor
202
HD44780U
Connection of Changed Matrix Layout: In the preceding examples, the number of lines correspond to
the scanning lines. However, the following display examples (Figure 22) are made possible by altering
the matrix layout of the liquid crystal display panel. In either case, the only change is the layout. The
display characteristics and the number of liquid crystal display characters depend on the number of
common signals or on duty factor. Note that the display data RAM (DDRAM) addresses for 4 characters
2 lines and for 16 characters 1 line are the same as in Figure 20.
Cursor
203
HD44780U
VLCD is the peak value for the liquid crystal display drive waveforms, and resistance dividing provides
voltages V1 to V5 (Figure 23).
Table 10 Duty Factor and Power Supply for Liquid Crystal Display Drive
Duty Factor
1/8, 1/11 1/16
Bias
Power Supply 1/4 1/5
V1 VCC1/4 VLCD VCC1/5 VLCD
V2 VCC1/2 VLCD VCC2/5 VLCD
V3 VCC1/2 VLCD VCC3/5 VLCD
V4 VCC3/4 VLCD VCC4/5 VLCD
V5 VCCVLCD VCCVLCD
VCC VCC
R R
V1 V1
R
V2 R V2
VLCD R VLCD
V3 R V3
V4 R
V4
R R
V5 V5
VR VR
5 V 5 V
1/4 bias 1/5 bias
(1/8, 1/11 duty cycle) (1/16, duty cycle)
204
HD44780U
COM1
1 2 3 4 8 1 2
VCC
V1
V2 (V3)
V4
V5
1 frame
COM1
1 2 3 4 11 1 2
VCC
V1
V2 (V3)
V4
V5
1 frame
COM1
1 2 3 4 16 1 2
VCC
V1
V2
V3
V4
V5
1 frame
205
HD44780U
Note: When using the internal reset, the electrical characteristics in the Power Supply Conditions Using
Internal Reset Circuit table must be satisfied. If not, the HD44780U must be initialized by
instructions. See the section, Initializing by Instruction.
206
HD44780U
Table 11 8-Bit Operation, 8-Digit 1-Line Display Example with Internal Reset
Instruction
Step
No. RS R/ : DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Display Operation
1 Power supply on (the HD44780U is initialized by the internal Initialized. No display.
reset circuit)
2 Function set Sets to 8-bit operation and
0 0 0 0 1 1 0 0 * * selects 1-line display and 5 8
dot character font. (Number of
display lines and character fonts
cannot be changed after step
#2.)
3 Display on/off control Turns on display and cursor.
_
0 0 0 0 0 0 1 1 1 0 Entire display is in space mode
because of initialization.
4 Entry mode set Sets mode to increment the
_
0 0 0 0 0 0 0 1 1 0 address by one and to shift the
cursor to the right at the time of
write to the DD/CGRAM.
Display is not shifted.
5 Write data to CGRAM/DDRAM Writes H. DDRAM has already
H_
1 0 0 1 0 0 1 0 0 0 been selected by initialization
when the power was turned on.
The cursor is incremented by
one and shifted to the right.
6 Write data to CGRAM/DDRAM Writes I.
HI_
1 0 0 1 0 0 1 0 0 1
7
8 Write data to CGRAM/DDRAM Writes I.
HITACHI_
1 0 0 1 0 0 1 0 0 1
9 Entry mode set Sets mode to shift display at the
HITACHI_
0 0 0 0 0 0 0 1 1 1 time of write.
10 Write data to CGRAM/DDRAM Writes a space.
ITACHI _
1 0 0 0 1 0 0 0 0 0
207
HD44780U
Table 11 8-Bit Operation, 8-Digit 1-Line Display Example with Internal Reset (cont)
Instruction
Step
No. RS R/ : DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Display Operation
11 Write data to CGRAM/DDRAM Writes M.
1 0 0 1 0 0 1 1 0 1 Cursor
12
13 Write data to CGRAM/DDRAM Writes O.
MICROKO_
1 0 0 1 0 0 1 1 1 1
14 Cursor or display shift Shifts only the cursor position to
MICROKO
_
0 0 0 0 0 1 0 0 * * the left.
15 Cursor or display shift Shifts only the cursor position to
MICROKO
_
0 0 0 0 0 1 0 0 * * the left.
16 Write data to CGRAM/DDRAM Writes C over K.
ICROCO
_
1 0 0 1 0 0 0 0 1 1 The display moves to the left.
17 Cursor or display shift Shifts the display and cursor
MICROCO
_
0 0 0 0 0 1 1 1 * * position to the right.
18 Cursor or display shift Shifts the display and cursor
MICROCO_
0 0 0 0 0 1 0 1 * * position to the right.
19 Write data to CGRAM/DDRAM Writes M.
ICROCOM_
1 0 0 1 0 0 1 1 0 1
20
21 Return home Returns both display and cursor
HITACHI
_
0 0 0 0 0 0 0 0 1 0 to the original position (address
0).
208
HD44780U
Table 12 4-Bit Operation, 8-Digit 1-Line Display Example with Internal Reset
Instruction
Step
No. RS R/ : DB7 DB6 DB5 DB4 Display Operation
1 Power supply on (the HD44780U is initialized by the internal Initialized. No display.
reset circuit)
2 Function set Sets to 4-bit operation.
0 0 0 0 1 0 In this case, operation is
handled as 8 bits by initializa-
tion, and only this instruction
completes with one write.
3 Function set Sets 4-bit operation and selects
0 0 0 0 1 0 1-line display and 5 8 dot
0 0 0 0 * * character font. 4-bit operation
starts from this step and
resetting is necessary. (Number
of display lines and character
fonts cannot be changed after
step #3.)
4 Display on/off control Turns on display and cursor.
_
0 0 0 0 0 0 Entire display is in space mode
0 0 1 1 1 0 because of initialization.
5 Entry mode set Sets mode to increment the
0 0 0 0 0 0 address by one and to shift the
0 0 0 1 1 0 cursor to the right at the time of
write to the DD/CGRAM.
Display is not shifted.
6 Write data to CGRAM/DDRAM Writes H.
H_
1 0 0 1 0 0 The cursor is incremented by
1 0 1 0 0 0 one and shifts to the right.
Note: The control is the same as for 8-bit operation beyond step #6.
209
HD44780U
Table 13 8-Bit Operation, 8-Digit 2-Line Display Example with Internal Reset
Instruction
Step
No. RS R/ : DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Display Operation
1 Power supply on (the HD44780U is initialized by the internal Initialized. No display.
reset circuit)
210
HD44780U
Table 13 8-Bit Operation, 8-Digit 2-Line Display Example with Internal Reset (cont)
Instruction
Step
No. RS R/: DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Display Operation
9 Write data to CGRAM/DDRAM HITACHI Writes M.
1 0 0 1 0 0 1 1 0 1 M_
10
11 Write data to CGRAM/DDRAM HITACHI Writes O.
1 0 0 1 0 0 1 1 1 1 MICROCO_
211
HD44780U
Initializing by Instruction
If the power supply conditions for correctly operating the internal reset circuit are not met, initialization
by instructions becomes necessary.
Refer to Figures 25 and 26 for the procedures on 8-bit and 4-bit initializations, respectively.
Power on
RS R/WDB7 DB6 DB5 DB4 DB3DB2 DB1 DB0 BF cannot be checked before this instruction.
0 0 0 0 1 1 * * * * Function set (Interface is 8 bits long.)
RS R/WDB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 BF cannot be checked before this instruction.
0 0 0 0 1 1 * * * * Function set (Interface is 8 bits long.)
RS R/WDB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 BF cannot be checked before this instruction.
0 0 0 0 1 1 * * * * Function set (Interface is 8 bits long.)
Initialization ends
212
HD44780U
Power on
RS R/W DB7 DB6 DB5 DB4 BF cannot be checked before this instruction.
0 0 0 0 1 1 Function set (Interface is 8 bits long.)
RS R/W DB7 DB6 DB5 DB4 BF cannot be checked before this instruction.
0 0 0 0 1 1 Function set (Interface is 8 bits long.)
RS R/W DB7 DB6 DB5 DB4 BF cannot be checked before this instruction.
0 0 0 0 1 1 Function set (Interface is 8 bits long.)
RS R/W DB7 DB6 DB5 DB4 BF can be checked after the following instructions.
0 0 0 0 1 0 When BF is not checked, the waiting time between
0 0 0 0 1 0 instructions is longer than the execution instuction
time. (See Table 6.)
0 0 N F * *
Function set (Set interface to be 4 bits long.)
0 0 0 0 0 0
Interface is 8 bits in length.
0 0 1 0 0 0
Function set (Interface is 4 bits long. Specify the
0 0 0 0 0 0
number of display lines and character font.)
0 0 0 0 0 1 The number of display lines and character font
0 0 0 0 0 0 cannot be changed after this point.
0 0 0 1 I/D S Display off
Display clear
213
HD44780U
214
HD44780U
215
HD44780U
Clock Characteristics
Write Operation
Read Operation
216
HD44780U
217
HD44780U
218
HD44780U
Clock Characteristics
Write Operation
Read Operation
219
HD44780U
220
HD44780U
VCC
(pull up MOS)
NMOS NMOS NMOS
I/O Pin
Pins: DB0 DB7 VCC VCC
(MOS with pull-up) (input circuit)
(pull-up MOS) PMOS PMOS
Input enable
NMOS
VCC
NMOS
PMOS Output enable
Data
NMOS
(output circuit)
(tristate)
221
HD44780U
6. Applies to input pins and I/O pins, excluding the OSC1 pin.
7. Applies to I/O pins.
8. Applies to output pins.
9. Current flowing through pullup MOSs, excluding output drive MOSs.
10. Input/output current is excluded. When input is at an intermediate level with CMOS, the excessive
current flows through the input circuit to the power supply. To avoid this from happening, the input
level must be fixed high or low.
11. Applies only to external clock operation.
Th Tl
Oscillator OSC1
0.7 VCC
0.5 VCC
Open OSC2 0.3 VCC
t rcp t fcp
Th
Duty = 100%
Th + Tl
12. Applies only to the internal oscillator operation using oscillation resistor Rf.
R f : 75 k 2% (when VCC = 3 V)
OSC1
R f : 91 k 2% (when VCC = 5 V)
Rf Since the oscillation frequency varies depending on the OSC1 and
OSC2 pin capacitance, the wiring length to these pins should be minimized.
OSC2
VCC = 5 V VCC = 3 V
500 500
400 400
f OSC (kHz)
f OSC (kHz)
300 300
(270) (270)
max. max.
200 typ. 200
typ.
min. min.
100 100
50 (91)100 150 50 (75) 100 150
R f (k ) R f (k )
222
HD44780U
13. RCOM is the resistance between the power supply pins (VCC, V1, V4, V5) and each common signal
pin (COM1 to COM16).
RSEG is the resistance between the power supply pins (VCC, V2, V3, V5) and each segment signal pin
(SEG1 to SEG40).
14. The following graphs show the relationship between operation frequency and current consumption.
VCC = 5 V VCC = 3 V
1.8 1.8
1.6 1.6
1.4 1.4
1.2 1.2
ICC (mA)
ICC (mA)
1.0 max. 1.0
0.8 0.8
0.6 typ.
0.6
max.
0.4 0.4
0.2 typ.
0.2
0.0 0.0
0 100 200 300 400 500 0 100 200 300 400 500
223
HD44780U
Load Circuits
VCC = 5 V
90 pF 11 k IS2074 H
50 pF
diodes
Test
point
30 pF
224
HD44780U
Timing Characteristics
VIH1 VIH1
RS VIL1 VIL1
tAS tAH
PWEH tAH
tEf
E VIH1 VIH1
VIL1 VIL1 VIL1
tEr
tDSW tH
VIH1 VIH1
DB0 to DB7 VIL1 Valid data VIL1
tcycE
VIH1 VIH1
RS VIL1 VIL1
tAS tAH
PWEH tAH
tEf
E VIH1 VIH1
VIL1 VIL1 VIL1
tEr
tDDR tDHR
VOH1 VOH1
DB0 to DB7 VOL1 * Valid data * VOL1
tcycE
225
HD44780U
tct
VOH2 VOH2
CL1 VOL2
tCWH
tCWH
tCSU
CL2 VOH2
VOL2
tCSU tCWL
tct
D VOH2
VOL2
tDH
tSU
VOH2
M
t DM
trcc tOFF*1
Notes: 1. tOFF compensates for the power oscillation period caused by momentary power supply
oscillations.
2. Specified at 4.5 V for 5-V operation, and at 2.7 V for 3-V operation.
3. For if 4.5 V is not reached during 5-V operation, the internal reset circuit will not operate
normally.
In this case, the LSI must be initialized by software. (Refer to the Initializing by
Instruction section.)
226
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
INTRODUCTION
KS0073 is a dot matrix LCD driver & controller LSI which is fabricated by low power CMOS technology.
It is capable of displaying 1, 2, or 4-lines with 58 or 68 dots format.
FUNCTIONS
FEATURES
Internal Memory
- Character Generator ROM (CGROM): 9600 bits. (240 characters 5 8 dot)
- Character Generator RAM (CGRAM): 648 bits. (8 characters 5 8 dot)
- Segment Icon RAM (SEGRAM): 168 bits. (96 icons max.)
- Display Data RAM (DDRAM): 808 bits. (80 characters max.)
Low power operation
- Power supply voltage range: 2.7 to 5.5 V (VDD)
- LCD Drive voltage range: 3.0 to 13.0 V (VDD to V5)
CMOS process
Programmable duty cycle: 1/17, 1/33 (Refer to Table 1.)
Internal oscillator with an external resistor
Low power consumptio
TCP or Bare chip available
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
BLOCK DIAGRAM
Power On Reset
Oscillator
(POR)
CLK1
RESET Timing Generator CLK2
M
IM
7
Instruction 34-bit
RS/ System Instruction Common
register Shift COM0 -
CS Interface Driver COM33
8 Decoder Register
Serial (IR)
E/ 4-bit/
SCLK Display data
8-bit RAM
RW/ Address (DDRAM)
SID Counter 80x8 bits D
7
7 8
60-bit 60-bit Segment
Latch SEG1 -
Data Shift SEG60
DB4 - 8 Driver
8 Register Register Circuit
DB7
(DR)
Input 8
DB3 - /Output 3 7 8 8
DB1 Buffer
Busy
D B 0/ Flag
SO D Character Character LCD
Cursor Driver
Segment Generator Generator & Blink Voltage
RAM RAM ROM Controller Selector
(SEGRAM) (CGROM) (CGROM)
Vci 16 bytes 64 bytes 9600 bits
C1 Voltage
C2 5
Converter 5/6 V1 - V5
V5OUT2
V5OUT3 Parallel to Serial converter
and Smooth Scroll Circuit
VDD
GND
(VSS)
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
PAD CONFIGURATIO
SEG45
SEG44
SEG43
SEG42
SEG41
SEG40
SEG39
SEG38
SEG37
SEG35
SEG24
SEG23
SEG22
SEG21
SEG20
SEG19
SEG18
SEG17
SEG16
SEG36
SEG34
SEG33
SEG32
SEG31
SEG30
SEG29
SEG28
SEG27
SEG25
SEG26
128
127
126
125
124
123
122
120
109
108
107
106
105
104
103
102
101
121
119
118
117
116
115
114
113
112
110
111
2
1
COM9 18 85 COM0
COM10 19 84 COM1
COM11 20 (0, 0) X 83 COM2
COM12 21 82 COM3
COM13 22 CHIP SIZE: 4870 5770 81 COM4
COM14 23 PAD SIZE: 100 100 80 COM5
COM15 24 UNIT: m 79 COM6
COM16 25 78 COM7
COM25 26 77 COM8
COM26 27 76 COM17
COM27 28 75 COM18
COM28 29 74 COM19
COM29 30 73 COM20
COM30 31 72 COM21
COM31 32 71 COM22
COM32 33 70 COM23
COM33 34 69 COM24
VDD 35 68 V1
OSC2 36 67 V2
DB0/SOD 50
V5OUT2 62
V5OUT3 63
OSC1 37
EXT 44
VSS1 46
DB1 51
DB2 52
DB3 53
DB4 54
DB5 55
DB6 56
DB7 57
VSS2 61
V5 64
V4 65
V3 66
CLK1 38
CLK2 39
RS/CS 47
D 40
M 41
RESET 42
IM 43
IE 45
RW/SID 48
E/SCLK 49
Vci 58
C2 59
C1 60
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
PAD COORDINATE
PAD PAD COORDINATE PAD PAD COORDINATE PAD PAD COORDINATE PAD PAD COORDINATE
NO NAME NO NAME NO NAME NO NAME
X Y X Y X Y X Y
1 SEG44 -1687 2719 24 COM15 -2269 -616 47 RS/CS -611 -2719 70 COM23 2269 -1741
2 SEG45 -1812 2719 25 COM16 -2269 -741 48 RW/SID -486 -2719 71 COM22 2269 -1616
3 SEG46 -2269 2122 26 COM25 -2269 -866 49 E/SCLK -361 -2719 72 COM21 2269 -1491
4 SEG47 -2269 1997 27 COM26 -2269 -991 50 DB0/SOD -236 -2719 73 COM20 2269 -1366
5 SEG48 -2269 1872 28 COM27 -2269 -1116 51 DB1 -111 -2719 74 COM19 2269 -1241
6 SEG49 -2269 1747 29 COM28 -2269 -1241 52 DB2 14 -2719 75 COM18 2269 -1116
7 SEG50 -2269 1622 30 COM29 -2269 -1336 53 DB3 139 -2719 76 COM17 2269 -991
8 SEG51 -2269 1497 31 COM30 -2269 -1491 54 DB4 264 -2719 77 COM8 2269 -866
9 SEG52 -2269 1372 32 COM31 -2269 -1616 55 DB5 389 -2719 78 COM7 2269 -741
10 SEG53 -2269 1247 33 COM32 -2269 -1741 56 DB6 514 -2719 79 COM6 2269 -616
11 SEG54 -2269 1122 34 COM33 -2269 -1866 57 DB7 639 -2719 80 COM5 2269 -491
12 SEG55 -2269 997 35 VDD -2269 -1991 58 Vci 764 -2719 81 COM4 2269 -366
13 SEG56 -2269 872 36 OSC2 -2269 -2116 59 C2 889 -2719 82 COM3 2269 -241
14 SEG57 -2269 747 37 OSC1 -1816 -2719 60 C1 1014 -2719 83 COM2 2269 -116
15 SEG58 -2269 622 38 CLK1 -1736 -2719 61 VSS2 1139 -2719 84 COM1 2269 9
16 SEG59 -2269 497 39 CLK2 -1611 -2719 62 V5 OUT2 1264 -2719 85 COM0 2269 134
17 SEG60 -2269 372 40 D -1486 -2719 63 V5 OUT3 1389 -2719 86 SEG1 2269 372
18 COM9 -2269 134 41 M -1361 -2719 64 V5 1514 -2719 87 SEG2 2269 497
19 COM10 -2269 9 42 RESET -1236 -2719 65 V4 1639 -2719 88 SEG3 2269 622
20 COM11 -2269 -116 43 IM -1111 -2719 66 V3 1764 -2719 89 SEG4 2269 747
21 COM12 -2269 -241 44 EXT -986 -2719 67 V2 2269 -2116 90 SEG5 2269 872
22 COM13 -2269 -366 45 IE -861 -2719 68 V1 2269 -1991 91 SEG6 2269 997
23 COM14 -2269 -491 46 VSS1 -736 -2719 69 COM 24 2269 -1866 92 SEG7 2269 1122
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
93 SEG8 2269 1247 102 SEG17 1688 2719 111 SEG26 563 2719 120 SEG35 -562 2719
94 SEG9 2269 1372 103 SEG18 1563 2719 112 SEG27 438 2719 121 SEG36 -687 2719
95 SEG10 2269 1497 104 SEG19 1438 2719 113 SEG28 313 2719 122 SEG37 -812 2719
96 SEG11 2269 1622 105 SEG20 1313 2719 114 SEG29 188 2719 123 SEG38 -937 2719
97 SEG12 2269 1747 106 SEG21 1188 2719 115 SEG30 63 2719 124 SEG39 -1062 2719
98 SEG13 2269 1872 107 SEG22 1063 2719 116 SEG31 -62 2719 125 SEG40 -1187 2719
99 SEG14 2269 1997 108 SEG23 938 2719 117 SEG32 -187 2719 127 SEG41 -1312 2719
100 SEG15 2269 2122 109 SEG24 813 2719 118 SEG33 -312 2719 127 SEG42 -1437 2719
101 SEG16 1813 2719 110 SEG25 688 2719 119 SEG34 -437 2719 128 SEG43 -1562 2719
A) TCP OUTLINE
OUTPUT SIDE
KS0073
DBO/SOD
V5OUT2
V5OUT3
RW/SID
E/SCLK
OSC2
OSC1
CLK1
RESET
CLK2
VSS2
RS/CS
VDD
VSS1
EXT
N C
DB1
DB2
DB3
DB4
DB5
DB6
DB7
NC
IM
V4
V3
Vci
V2
V1
V5
IE
M
C2
C1
D
KS0073
N C NC
VDD NC
OSC2 COM33
OSC1
CLK1
CLK2
...
9
8
7
6
5
4
3
11
17
16
15
14
13
12
10
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
M COM9
RESET 37 2
38 1 SEG60
IM 39 128
40 127
EXT 41 126
IE 42 125
43 124
VSS1 44 123
RS/CS 45 122
46 121
RW/SID 47 120
48 119
E/SCLK 49 118
DBO/SOD 50 117
51 116
DB1 52 115
53 114
........
DB2 54 113
55 112
DB3 111
56
134-TAB-35mm
DB4 57 110
58 109
DB5 59 108
86
87
88
89
90
91
92
93
94
95
96
97
98
99
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
VSS2
V5OUT2
...
V5OUT3
V5
COM24
V4
V3 NC
V2
NC
V1
NC
34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
PIN DESCRIPTION
Input/
Pin(No) Name Description Interface
Output
(Continued)
Input/
Pin(No) Name Description Interfac
Output
The value of Vci is converted twice. To use
Two times
the three times converter, the same V5 pin/
V5OUT2 (62) converter
capacitance as that of C1-C2 should be capacitance
output
Output connected here.
Three times
V5OUT3 (63) converter The value of Vci is converted three times. V5 pin
output
Interface Select Interface mode with the MPU.
IM (43) Input mode When IM = Low: Serial mode, -
selection When IM = High: 4-bit/8-bit bus mode.
In bus mode, used as register selection
input. When RS/CS = High, Data register is
selected. When RS/CS Low, Instruction
Register
register is selected.
RS/CS (47) Input select / MPU
In serial mode, used as chip selection input.
Chip select
When RS/CS = Low, selected.
When RS/CS = High, not selected
(Low access enable).
In bus mode, used as read/write selection
Read, write / input.
RW/SID (48) Input Serial input When RW/SID = High, read operation. MPU
data When RW/SID = Low, write operation.
In serial mode, used for data input pin.
Read, write In bus mode, used as read/write enable
E/SCLK (49) Input enable/Serial signal. MPU
clock In serial mode, used as serial clock input pin.
In 8-bit bus mode, used as lowest
Input Data bus 0 bit / bidirectional data bit. During 4-bit bus mode,
DB0/SOD (50) Output / Serial output open this pin. MPU
Output data In serial mode, used as serial data output
pin. If not in read operation, open this pin.
In 8-bit bus mode, used as low order
DB1 ~ DB3 bidirectional data bus.
MPU
(51 ~ 53) During 4-bit bus mode or serial mode, open
these pins.
Input,
Data bus 1 ~ 7 In 8-bit bus mode, used as high order
Output
bidirectional data bus. In 4-bit bus mode,
DB4 ~ DB7
used as both high and low order. MPU
(54 ~ 57)
DB7 used for Busy Flag output.
During serial mode, open these pins.
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
FUNCTION DESCRIPTION
System Interface
This chip has all three kinds of interface type with MPU: serial, 4-bit and 8-bit bus.
Serial and bus(4-bit/8-bit) are selected by IM input, and 4-bit bus and 8-bit bus are selected by the DL bit in the
instruction register.
During read or write operation, two 8-bit registers are used. one is the data register (DR), the other is the
instruction register(IR).
The data register(DR) is used as a temporary data storage place for being written into or read from
DDRAM/CGRAM/SEGRAM. Target RAM is selected by RAM address setting instruction. Each internal
operation, reading from or writing into RAM, is done automatically.
Hence, after MPU reads the DR data, the data in the next DDRAM/CGRAM/SEGRAM address is transferred into
DR automatically. Also, after MPU writes data to DR, the data in DR is transferred into DDRAM/CGRAM/
SEGRAM automatically.
The Instruction register (IR) is used only to store instruction code transferred from MPU.
MPU cannot use it to read instruction data.
To select register, use the RS/CS input pin in 4-bit/8-bit bus mode (IM High) or the RS bit in serial mode
(IM = Low).
When BF = High, it indicates that the internal operation is being processed. So during this time the next
instruction cannot be accepted. BF can be read, when RS = Low and R/W = High (Read Instruction Operation),
through the DB7 port. Before executing the next instruction, be sure that BF is not High.
MSB LSB
Display position
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
COM1 COM9
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17
COM8 COM16
SEG1 KS0073 SEG60 SEG1 KS0073 SEG60
DDRAM address
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
COM1 COM9
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18
COM8 COM16
(After Shift Left)
COM1 COM9
4F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16
COM8 COM16
(After Shift Right)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
COM1 COM9
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
COM8 COM16
SEG1 KS0073 SEG60 SEG1 KS0073 SEG60 SEG1 SEG40
Extension Driver (40SEG)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
COM1 COM9
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
COM8 COM16
COM1 COM9
4F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E
COM8 COM16
Fig-3. 1-line X 32 ch. display with 40 SEG. extension driver (5-dot font width)
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
Display position
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
COM1 COM9
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17
COM8 COM16
COM17 COM25
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57
COM24 COM32
SEG1 KS0073 SEG60 SEG1 KS0073 SEG60
DDRAM address
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
COM1 COM9
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18
COM8 COM16
COM17 COM25
41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58
COM24 COM32
(After Shift Left)
COM1 COM9
27 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16
COM8 COM16
COM17 COM25
67 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56
COM24 COM32
(After Shift Right)
Fig-4. 2-line 24 char. display (5-dot font width)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
COM1 COM9
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
COM8 COM16
COM17 COM25
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F
COM32
COM24
SEG1 KS0073 SEG60 SEG1 KS0073 SEG 60 SEG1 SEG40
Extension Driver (40SEG)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
COM1 COM9
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20
COM8 COM16
COM17 COM25
41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60
COM24 COM32
(After Shift Left)
COM1 COM9
27 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E
COM8 COM16
COM17 COM25
67 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E
COM24 COM32
Fig-5. 2-line 32 char. display with 40 SEG. extension driver (5-dot font width)
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
1 2 3 4 5 6 7 8 9 10 11 12 Display position
COM1
00 01 02 03 04 05 06 07 08 09 0A 0B DDRAM address
COM8
COM9
20 21 22 23 24 25 26 27 28 29 2A 2B
COM16
COM17
40 41 42 43 44 45 46 47 48 49 4A 4B
COM24
COM25
60 61 62 63 64 65 66 67 68 69 6A 6B
COM32
SEG1 KS0073 SEG60
1 2 3 4 5 6 7 8 9 10 11 12
COM1
01 02 03 04 05 06 07 08 09 0A 0B 0C
COM8
COM9
21 22 23 24 25 26 27 28 29 2A 2B 2C
COM16
COM17
41 42 43 44 45 46 47 48 49 4A 4B 4C
COM24
COM25
61 62 63 64 65 66 67 68 69 6A 6B 6C
COM32
1 2 3 4 5 6 7 8 9 10 11 12
COM1
13 00 01 02 03 04 05 06 07 08 09 0A
COM8
COM9
33 20 21 22 23 24 25 26 27 28 29 2A
COM16
COM17
53 40 41 42 43 44 45 46 47 48 49 4A
COM24
COM25
73 60 61 62 63 64 65 66 67 68 69 6A
COM32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Display position
COM1
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 DDRAM address
COM8
COM9
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33
COM16
COM17
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53
COM24
COM25
60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73
COM32
SEG1 KS0073 SEG60 SEG1 SEG40
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
COM1
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14
COM8
COM9
21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 20
COM16
COM17
41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 40
COM24
COM25
61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 60
COM32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
COM1
13 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12
COM8
COM9
33 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32
COM16
COM17
53 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52
COM24
COM25
73 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72
COM32
Fig-7. 4-line 20 char. display with 40 SEG. extension driver (5-dot font width)
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
Display position
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
COM1 COM9
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13
COM8 COM16
SEG1 KS0073 SEG60 SEG1 KS0073 SEG60
DDRAM address
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
COM1 COM9
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14
COM8 COM16
(After Shift Left)
COM1 COM9
4F 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12
COM8 COM16
(After Shift Right)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
COM1 COM9
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19
COM8 COM16
SEG1 KS0073 SEG60 SEG1 KS0073 SEG60 SEG1 SEG36
Extension Driver (40SEG)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
COM1 COM9
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A
COM8 COM16
Fig-9. 1-line 26char. display with 40 SEG. extension driver (6-dot font width)
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
Display position
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
COM1 COM9
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13
COM8 COM16
COM17 COM25
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53
COM24 COM32
SEG1 KS0073 SEG60 SEG1 KS0073 SEG60
DDRAM address
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
COM1 COM9
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14
COM8 COM16
COM17 COM25
41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54
COM24 COM32
(After Shift Left)
COM1 COM9
27 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12
COM8 COM16
COM17 COM25
67 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52
COM24 COM32
(After Shift Right)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
COM1 COM9
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19
COM8 COM16
COM17 COM25
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59
COM32
COM24
SEG1 KS0073 SEG 60 SEG1 KS0073 SEG60 SEG1 SEG36
Extension Driver (40SEG)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
COM1 COM9
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A
COM8 COM16
COM17 COM25
41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A
COM24 COM32
(After Shift Left)
COM1 COM9
27 00 01 02 03 04 05 06 07 08 09 0A 0B 0D 0D 0E 0F 10 11 12 13 14 15 16 17 18
COM8 COM16
COM17 COM25
67 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58
COM24 COM32
Fig-11. 2-line 26 char. display with 40 SEG. extension driver (6-dot font width)
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
1 2 3 4 5 6 7 8 9 10 Display position
COM1
00 01 02 03 04 05 06 07 08 09 DDRAM address
COM8
COM9
20 21 22 23 24 25 26 27 28 29
COM16
COM17
40 41 42 43 44 45 46 47 48 49
COM24
COM25
60 61 62 63 64 65 66 67 68 69
COM32
SEG1 KS0073 SEG60
1 2 3 4 5 6 7 8 9 10
COM1
01 02 03 04 05 06 07 08 09 0A
COM8
COM9
21 22 23 24 25 26 27 28 29 2A
COM16
COM17
41 42 43 44 45 46 47 48 49 4A
COM24
COM25
61 62 63 64 65 66 67 68 69 6A
COM32
1 2 3 4 5 6 7 8 9 10
COM1
13 00 01 02 03 04 05 06 07 08
COM8
COM9
33 20 21 22 23 24 25 26 27 28
COM16
COM17
53 40 41 42 43 44 45 46 47 48
COM24
COM25
73 60 61 62 63 64 65 66 67 68
COM32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Display position
COM1
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F DDRAM address
COM8
COM9
20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
COM16
COM17
40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F
COM24
COM25
60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F
COM32
SEG1 KS0073 SEG60 SEG1 SEG36
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
COM1
01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10
COM8
COM9
21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30
COM16
COM17
41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50
COM24
COM25
61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70
COM32
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
COM1
13 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E
COM8
COM9
33 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E
COM16
COM17
53 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E
COM24
COM25
73 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 7E
COM32
Fig-13. 4-line 16 char. display with 40 SEG. extension driver (6-dot font width)
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
CGRAM has up to eight 58-dot characters. By writing font data to CGRAM, user defined character can be use
(Refer to Table 4).
Table 4. Relationship between Character Code (DDRAM) and Character Pattern (CGRAM)
0 0 0 0 X 0 0 0 0 0 0 0 0 0 B1 B0 X 0 1 1 1 0 pattern 1
0 0 1 1 0 0 0 1
0 1 0 1 0 0 0 1
0 1 1 1 1 1 1 1
1 0 0 1 0 0 0 1
1 0 1 1 0 0 0 1
1 1 0 1 0 0 0 1
1 1 1 0 0 0 0 0
. . . . .
. . . . .
0 0 0 0 X 1 1 1 1 1 1 0 0 0 B1 B0 X 1 0 0 0 1 pattern 8
0 0 1 1 0 0 0 1
0 1 0 1 0 0 0 1
0 1 1 1 1 1 1 1
1 0 0 1 0 0 0 1
1 0 1 1 0 0 0 1
1 1 0 1 0 0 0 1
1 1 1 0 0 0 0 0
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
0 0 0 0 X 0 0 0 0 0 0 0 0 0 B1 B0 0 0 1 1 1 0 pattern 1
0 0 1 0 1 0 0 0 1
0 1 0 0 1 0 0 0 1
0 1 1 0 1 1 1 1 1
1 0 0 0 1 0 0 0 1
1 0 1 0 1 0 0 0 1
1 1 0 0 1 0 0 0 1
1 1 1 0 0 0 0 0 0
. . . . .
. . . . .
0 0 0 0 X 1 1 1 1 1 1 0 0 0 B1 B0 0 1 0 0 0 1 pattern 8
0 0 1 0 1 0 0 0 1
0 1 0 0 1 0 0 0 1
0 1 1 0 1 1 1 1 1
1 0 0 0 1 0 0 0 1
1 0 1 0 1 0 0 0 1
1 1 0 0 1 0 0 0 1
1 1 1 0 0 0 0 0 0
NOTE: 1. When BE (Blink Enable bit) = High, blink is controlled by B1 and B0 bit.
In displaying 5-dot font width, when B1 = 1, enabled dots in P0 P4 ports will blink,
and when B1 = 0 and B0 = 1, enabled dots in P4 port will blink.
When B1 = 0 and B0 = 0, blinking will not occur.
In displaying 6-dot font width, when B1 = 1, enabled dots of P0 P5 ports will blink,
and when B1 = 0 and B0 = 1, enabled dots of P5 port will blink.
When B1 = 0 and B0 = 0, blinking will not occur.
2. X: Dont care
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 S14 S15 S56 S57 S58 S59 S60 S61 S62 S63 S64 S65
S S S S S S S S S S S S S S S S S S S S S S S S S
E E E E E E E E E E E E E E E E E E E E E E E E E
G G G G G G G G G G G G G G G. . . G G G G G G G G G G
1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 5 5 5 5 6 6 6 6 6 6
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
Extension
Driver
S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12S13 S14S15 S16 S17 S18 S55S56 S57S58 S59 S60 S61S62S63 S64 S65 S66
S S S S S S S S S S S S S S S S S S S S S S S S S S S S S S
E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E
G G G G G G G G G G G G G G G G G G... G G G G G G G G G G G G
1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 5 5 5 5 5 6 6 6 6 6 6 6
0 1 2 3 4 5 6 7 8 5 6 7 8 9 0 1 2 3 4 5 6
Extension
Driver
INSTRUCTION DESCRIPTION
OUTLINE
To overcome the speed difference between the internal clock of KS0073 and the MPU clock, KS0073 performs
internal operation by storing control information to IR or DR. The internal operation is determined according to th
signal from MPU, composed of read/write and data bus (Refer to Table 6 and Table 10).
Instruction can be divided largely into four kinds,
(1) KS0073 function set instructions (set display methods, set data length, etc.)
(2) address set instructions to internal RAM
(3) data transfer instructions with internal RAM
(4) others.
The address of internal RAM is automatically increased or decreased by 1.
NOTE: During internal operation, Busy Flag (DB7) reads High. Busy Flag check must precede the next
instruction.
When an MPU program with Busy Flag (DB7) checking is made, 1/2Fosc is necessary for executing
the next instruction by the falling edge of the E signal after the Busy Flag (DB7) goes to Low.
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
(Table 6. continued)
(Table 6. continued)
Set
DDRAM 0 0 0 1 AC6 AC5 AC4 AC3 AC2 AC1 AC0 Set DDRAM address in address 39 s
Address counter.
Set
Scroll Set the quantity of horizontal dot
1 0 0 1 X SQ5 SQ4 SQ3 SQ2 SQ1 SQ0 39 s
Quantity scroll.
* NOTE: When an MPU program with Busy Flag (DB7) checking is made, 1/2Fosc is necessary for executing
the next instruction by the falling edge of the E signal after the Busy Flag (DB7) goes to Low.
X : Don't care
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
1) Display Clear
Clear all the display data by writing 20H (space code) to all DDRAM address, and set DDRAM address
to 00H into AC (address counter). Return cursor to the original status, bringing the cursor to the left
edge on first line of the display. Make entry mode increment (I/D = 1).
(1) RE = 0
When S = High, after DDRAM write, the display of enabled line by DS1 - DS4 bits in the Shift Enabl
instruction is shifted to the right (I/D = 0) or to the left (I/D = 1). But it will seem as if the cursor does
not move.
When S = Low, or DDRAM read, or CGRAM/SEGRAM read/write operation, shift of display as the
above function is not performed.
(2) RE = 1
0 0 0 0 0 0 0 1 1 BID
6-bit 6-bit
s CGROM 8 CGRAM 8
p character character
a b b
font font i
c i
e (5-dot) (6-dot) t
t
(CGROM) (CGRAM)
Shifts right/left cursor position or display without writing or reading of display data.
This instruction is used to correct or search display data (Refer to Table 7).
During 2-line mode display, cursor moves to the 2nd line after the 40th digit of the 1st line.
In 4-line mode, cursor moves to the next line, only after every 20th digit of the current line.
Note that display shift is performed simultaneously in all the lines enabled by DS1 - S4 in the Shift Enable
instruction.
When displayed data is shifted repeatedly, each line is shifted individually.
When display shift is performed, the contents of the address counter are not changed.
During low power consumption mode, display shift may not be performed normally.
(1) DH = 0
(2) (DH = 1)
9) Function Set
(1) (RE = 0)
(2) (RE = 1)
Setting SQ5 to SQ0, horizontal scroll quantity can be controlled in dot units. (Refer to Table 9)
In this case of KS0073 can show hidden areas of DDRAM by executing smooth scroll from 1 to 48 dots.
This instruction shows whether KS0073 is in internal operation or not. If the resultant BF is High,
the internal operation is in progress and should wait until BF to be Low, which by then the next instruction can be
performed. In this instruction the value of address counter can also be read.
* In the case of RAM write operation, AC is increased/decreased by 1 as in read operation after this. In this
time, AC indicates the next address position, but the previous data can only be read by read instruction.
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
* NOTE: When an MPU program with Busy Flag(DB7) checking is made, 1/2Fosc (is necessary) for
executing the next instruction by the falling edge of the E signal after the Busy Flag(DB7) goes t Low.
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
1) Display Clear
Clear all the display data by writing 20H (space code) to all DDRAM address, and set
DDRAM address to 00H into AC (address counter). Return cursor to the original status, namely, bring the
cursor to the left edge on first line of the display.
And entry mode is set to increment mode (I/D = High).
2) Return Home
When S = High, after DDRAM write, the entire display of all lines is shifted to
the right (I/D = Low) or to the left (I/D = High). But it will seem as if the cursor is not moving.
When S = Low, or DDRAM read, or CGRAM/SEGRAM read/write operation, shift of entire display is not
performed.
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
6-bit 6-bit
s CGROM 8 CGRAM 8
p character character
a b b
font font i
c i
e (5-dot) (6-dot) t
t
(CGROM) (CGRAM)
Shifting of right/left cursor position or display without writing or reading of display data.
This instruction is used to correct or search display data.(Refer to Table 7)
During 2-line mode display, cursor moves to the 2nd line after 40th digit of 1st line.
In 4-line mode, cursor moves to the next line, only after every 20th digit of the current line.
Note that display shift is performed simultaneously in all the lines.
When displayed data is shifted repeatedly, each line is shifted individually.
When display shift is performed, the contents of the address counter are not changed.
8) Function Set
(1) RE = 0
(2) RE = 1
Setting SQ5 to SQ0, horizontal scroll quantity can be controlled in dot units. (Refer to Table 12).
In this case KS0073 executes dot smooth scroll from 1 to 48 dots.
This instruction shows whether KS0073 is in internal operation or not. If the resultant BF is High, the
internal operation is in progress and should wait until BF becomes Low, which by then the next instruction
can be performed. In this instruction value of address counter can also be read.
* In case of RAM write operation, AC is increased/decreased by 1 as in read operation after this. In this time, AC
indicates the next address position, but the previous data can only be read by read instruction.
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
KS0073 can transfer data in bus mode (4-bit or 8-bit) or serial mode with MPU. Hence, both types, 4 or 8-bit
MPU can be used. In case of 4-bit bus mode, data transfer is performed by twice to transfer 1 byte data.
(1) When interfacing data length are 4-bit, only 4 ports, from DB4 to DB7, are used as data bus.
At first, higher 4-bit (in case of 8-bit bus mode, the contents of DB4 - DB7) are transferred, and then lower
4-bit (in case of 8-bit bus mode, the contents of DB0 - DB3) are transferred. So transfer is performed by
twice. Busy Flag outputs High after the second transfer is ended.
(2) When interfacing data length are 8-bit, transfer is performed at a time through 8 ports, from DB0 to DB7.
RS
R/W
E
Internal
signal Internal operation
INSTRUCTION Busy Flag Check Busy Flag Check Busy Flag Check INSTRUCTION
RS
R/W
Internal
signal Internal operation
No
DB7 D7 D3 Busy AC3 Busy AC3 D7 D3
When IM port input is Low, serial interface mode is started. At this time, all three ports, SCLK
(synchronizing transfer clock), SID (serial input data), and SOD (serial output data), are used. If KS0073 is to
be used with other chips, chip select port (CS) can be used. By setting CS to Low, KS0073 can receive
SCLK input. If CS is set to High, KS0073 resets the internal transfer counter.
Before transferring real data, start byte has to be transferred. It is composed of succeeding 5 High bits,
read write control bit (R/W), register selection bit (RS), and end bit that indicates the end of start byte.
Whenever succeeding 5 High bits are detected by KS0073, it resets the serial transfer counter and prepares
to receive next informations.
The next input data is the register selection bit which determines which register is to be used, and read write
control bit that determines the direction of data. Then end bit is transferred, which must have Low value t
show the end of start byte. (Refer to Fig 19, Fig 20)
CS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
SCLK
SID 1 1 1 1 1 R/W RS 0 D0 D1 D2 D3 0 0 0 0 D4 D5 D6 D7 0 0 0 0
CS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
SCLK
SID 1 1 1 1 1 R/W RS 0 0 0 0 0 0 0 0 0
SOD D0 D1 D2 D3 D4 D5 D6 D7
Busy Flag/
Starting Byte Read Data
SC LK Wait Wait
SID Start byte 1st byte 2nd byte 1st byte 2nd byte 1st byte 2nd byte
(Instruction1) (Instruction2) (Instruction3)
CO M 1
CO M 2
CO M 3
CO M 4
CO M 5
CO M 6
CO M 7
CO M 8
CO M 17
(CO M 0)
S EG 1
S EG 2
S EG 3
S EG 4
S EG 5
KS0073 S EG 6
S EG 7
S EG 8
S EG 9
S EG 10
..
S EG 58
S EG 59
S EG 60
CO M 16
CO M 15
CO M 14
CO M 13
CO M 12
CO M 11
CO M 10
CO M 9
COM 1
COM 2
COM 3
COM 4
COM 5
COM 6
COM 7
COM 8
COM 17
COM 18
COM 19
COM 20
COM 21
COM 22
COM 23
COM 24
COM 33
(COM 0)
SE G1
SE G2
KS0073 SE G3
SE G4
S EG 5
..
SE G58
SE G59
SE G60
CO M 32
CO M 31
CO M 30
CO M 29
CO M 28
CO M 27
CO M 26
CO M 25
CO M 16
CO M 15
CO M 14
CO M 13
CO M 12
CO M 11
CO M 10
CO M 9
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
COM1
COM2
COM3
COM4
COM5
COM6
COM7
COM8
COM9
COM10
COM11
COM12
COM13
COM14
COM15
COM16
COM17
COM18
COM19
COM20
COM21
COM22
COM23
COM24
COM25
COM26
KS0073 COM27
COM28
COM29
COM30
COM31
COM32
COM33
(COM0)
SEG1
SEG2
SE G3
SEG4
SEG5
..
SEG26
SEG27
SE G28
SEG29
SEG30
SEG31
SEG32
SE G33
SEG34
SEG35
SEG58
SEG59
SEG60
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
COM1
COM2
COM3
COM4
COM5
COM6
COM7
COM8
COM9
COM10
COM11
COM12
COM13
COM14
COM15
COM16
COM17
COM18
COM19
COM20
COM21
COM22
COM23
COM24
COM25
COM26
KS0073 COM27
COM28
COM29
COM30
COM31
COM32
COM33
(COM0)
SEG1
SEG2
SEG3
SEG4
SEG5
SEG6
..
SEG31
SEG32
S E G 33
SEG34
SEG35
SEG36
..
SEG58
SEG59
SEG60
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
COM1
COM2
COM3
COM4
COM5
COM6
COM7
COM8
COM9
COM10
COM11
COM12
COM13
COM14
COM15
COM16
COM17
COM18
COM19
COM20
COM21
KS0073 COM22
COM23
COM24
COM25
COM26
COM27
COM28
VD D COM29
COM30
COM31
COM32
EXT COM33
(COM0)
SEG1
SEG2
SE G 3
SEG4
SEG5
..
SEG58
SEG59
SEG60
SEG1
SEG2
S EG 3
SEG4
SEG5
Extension
..
Driver SEG36
SEG37
S E G 38
SEG39
SEG40
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
INITIALIZING
1) Initializing by Internal Reset Circuit
When the power is turned on, KS0073 is initialized automatically by power on reset circuit.
During the initialization, the following instructions are executed, and BF(Busy Flag) is kept "High"(busy state)
to the end of initialization.
When RESET pin = "Low", KS0073 can be initialized as in the case of power on reset.
During the power on reset operation, this pin is ignored.
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
INITIALIZING BY INSTRUCTION
Power on
Condition : fosc=270kHz
0 4-bit interface
DL
Function set 1 8-bit interface
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 1 DL(1) N 0 X X
0 1-line mod
N
1 2-line mod
0 blink off
B
Wait for more than 39 s 1 blink on
Clear Display
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 0 0 0 0 0 1
0 decrement mode
I/D
Entry Mode Set 1 increment mode
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 0 0 0 1 I/D S 0 entire shift off
S
1 entire shift on
Initialization end
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
Power on
Function set
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 1 0 X X X X
0 0 N 0 X X X X X X
0 blink off
Wait for more than 39 s B
1 blink on
Clear Display
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 0 0 X X X X
0 0 0 0 0 1 X X X X
0 decrement mode
Entry Mode Set I/D
1 increment mode
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
0 0 0 0 0 0 X X X X
0 entire shift off
0 0 0 1 I/D SH X X X X SH
1 entire shift o
Initialization end
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
1) IE=Low
1. Power supply on: Initialized by the internal power on reset circuit LCD DISPLAY
2) IE=High
1. Power supply on: Initialized by the internal power on reset circuit
...
12. Write data to DDRAM: Write G SAMSUNG_
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
1 0 0 1 0 0 0 1 1 1
...
30. Write data to DDRAM: Write R SAMSUNG
KS0073
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
LCD DRIVER_
1 0 0 1 0 1 0 0 1 0
FRAME FREQUENCY
VDD
V1
COM1
...
V4
V5
1 FRAME 1 FRAME
VDD
V1
COM1
...
V4
V5
1 FRAME 1 FRAME
VDD VDD
R
V1
R
V2
R0
V3
R
V4
R
V5
VEE
2) When an internal booster is used
(Boosting twice) (Boosting three times)
VDD VDD
+ VCI VDD + VCI VDD
_ GND
R _ GND
R
V1 V1
_ R _ R
C1 V2 C1 V2
1F R0 1F R0
+ C2 V3 + C2 V3
R R
V5OUT2 V4 V5OUT2 V4
R _ R
V5OUT3 V5 V5OUT3 V5
1F
Can be detached +
_ If not using _
1F power down mode 1F Can be detached
If not using
+ + power down mode
* 1. Boosted output voltage should not exceed the maximum value (13 V) of the LCD driving
voltage. Especially, a voltage of over 4.3V should not be supplied to the referenc
voltage (Vci) when boosting three times.
2. A voltage of over 5.5V should not be supplied to the reference voltage (Vci) when
boosting twice.
3. The value of resistance, according to the number of lines, duty ratio and the bias, is
shown below. (Refer to Table 13)
Table 13. Duty Ratio and Power Supply for LCD Driving
Item Data
Number of lines 1 2 or
Duty ratio 1/17 1/33
Bias 1/5 1/6.7
R R R
Divided resistance
R0 R 2.7R
KS0073 34COM / 60SEG DRIVER & CONTROLLER FOR DOT MATRIX LCD
ELECTRICAL CHARACTERISTICS
V IH 1
RS VIL1
tSU1
th1
R/W VIL1 VIL1
tw
th1
tf
E V IH 1 V IH 1
VIL1 VIL1 VIL1
tSU2
tr th2
V IH 1 V IH 1
DB0~DB7 VIL1 Valid Data VIL1
tc
V IH 1
RS VIL1
tSU
th
VIH1 VIH1
R/W
tw th
tf
E V IH 1 V IH 1
VIL1 VIL1 V IL1
tr tD tDH
V IH 1 V IH 1
DB0~DB7 VIL1 Valid Data VIL1
tc
tc
CS V IL1 V IL1
tS U 1 tr tw tw t h1
SCLK V IH 1 V IH 1 V IH 1 V IH 1
V IL1 V IL1 V IL1 V IL1
t SU 2 t h2
SID
tD tD H
SOD V OH1
VOL1
tr
VOH2
VOH2
tW VOL2
CLK1
tr tW
VOH2 VOH2
VOL2 VOL2
CLK2
tSU1 tW
VOH2
D VOL2
tDH
tSU1
M
VOL2
tDM
RESET TIMIN
tRES
RESET
V IL1 V IL1
Terminology
Correspondence between Character Codes and Character Patterns
Relationship between CGRAM Addresses, Character Codes (DDRAM) and Character Patterns (CGRAM Data)
Initializing the LCD by Instruction
8 bit Interface
4 bit Interface
This is only a short reference for the most important commands not mentionned
in "The Extended Concise LCD Data Sheet".
DDRAM- The address of the (maybe invisible) cursor, where the next char is written to.
Address You can write to all of these addresses (if implemented in silicon), even if they are not actually
displayed. So you can store external data on hidden positions. Or you can first write data to the
visible and hidden locations and then scroll the whole display to the hidden positions.
Length : 8 bit
Range: 0x00 - 0x27, 0x40 - 0x67, (...)
Note: The user can specify any pattern for character-generator RAM (8 different characters).
Notes:
Notes:
1. Character code bits 1 and 2 correspond to CGRAM address bits 4 and 5 (2 bits: 4 types).
2. CGRAM address bits 0 to 3 designate the character pattern line position. The 11th line
is the cursor position and its display is formed by a logical OR with the cursor.
Since lines 12 to 16 are not used for display, they can be used for general data RAM.
3. Character pattern row positions are the same as 5 X 8 dot character pattern positions.
4. CGRAM character patterns are selected when character code bits 4 to 7 are all 0.
However, since character code bits 0 and 3 have no effect, the P display
example above can be selected by character codes 00H, 01H, 08H, and 09H.
If the power supply conditions for correctly operating the internal reset circuit are not met,
initialization by instructions becomes necessary.
This procedure must take place in a software reset on a 4 bit Interface
to assure proper re-entry to the LCD communication.
Refer to the initialization procedure of my LCD assembler module files, e.g. m_lcd.asm.
[Toc] [Top]
Version: 25.6.1999
Clock-
Instruction RS RW D7 D6 D5 D4 D3 D2 D1 D0 Description Cycles
NOP 0 0 0 0 0 0 0 0 0 0 No Operation 0
Clear Display 0 0 0 0 0 0 0 0 0 1 Clear display & set address counter to zero 165
Set adress counter to zero, return shifted
Cursor Home 0 0 0 0 0 0 0 0 1 x display to original position. 3
DD RAM contents remains unchanged.
Entry Mode Set cursor move direction (I/D) and specify
0 0 0 0 0 0 0 1 I/D S automatic display shift (S).
3
Set
Display Turn display (D), cursor on/off (C), and
0 0 0 0 0 0 1 D C B cursor blinking (B).
3
Control
Cursor / Shift display or move cursor (S/C) and
0 0 0 0 0 1 S/C R/L x x specify direction (R/L).
3
Display shift
Set interface data width (DL), number of
Function Set 0 0 0 0 1 DL N F x x display lines (N) and character font (F).
3
(1) The above specifications are indications only (based on Hitachi HD44780). Timing will vary from manufacturer
to manufacturer.
This data sheet refers to specifications for the Hitachi HD44780 LCD Driver chip, which is used for most LCD
modules.
Common types are : 1 line x 20 characters
2 lines x 16 characters
2 lines x 20 characters
2 lines x 40 characters
4 lines x 20 characters
4 lines x 40 characters
unting
re mo d
o re
no m requi
EA DIP204B-4NLW
Dimension 75 x 27 mm
EA DIP204-4HNLED
Dimension 68 x 27 mm
FEATURES
* HIGH CONTRAST LCD SUPERTWIST DISPLAY
* CONTROLLER KS0073 (NEAR 100% COMPATIBLE WITH HD44780)
* INTERFACE FOR 4- AND 8-BIT DATA BUS
* SERIAL SPI INTERFACE (SID, SOD, SCLK)
* POWER SUPPLY +3.3..+5V (-4NLW, -4NLED)
* POWER SUPPLY +5V ( -4HNLED)
* OPERATING TEMPERATURE RANGE 0~+50C (-20..+70C: -4NLW, -4HNLED)
* BUILT-IN TEMPERATURE COMPENSATION (-4NLW, -4HNLED)
* LED BACKLIGHT Y/G max. 150mA@+25C
* LOW POWER WITH BLUE-WHITE OPTIC / max. 45mA@+25C
* SOME MORE MODULES WITH SAME MECHANIC AND SAME PINOUT:
- DOTMATRIX 1x8, 2x16
- GRAPHIC 122x32
* NO SCREWS REQUIRED: SOLDER ON IN PCB ONLY
* DETACHABLE VIA 9-PIN SOCKET EA B200-9 (2 PCS. REQUIRED)
ORDERING INFORMATION
LCD MODULE 4x20 - 3.73mm WITH LED BACKLIGHT Y/G EA DIP204-4NLED
SAME BUT FOR TOP. -20~+70C / TSTOR. -30~+80C EA DIP204-4HNLED
BLUE-WHITE, TOP. -20~+70C / TSTOR. -30~+80C EA DIP204B-4NLW
9-PIN SOCKET, HEIGHT 4.3mm (1 PC.) EA B200-9
ADAPTOR PCB WITH STANDARD PINOUT PITCH 2.54mm EA 9907-DIP
5 R/W (SID) H/L H=Read, L=Write 14 D7 (D3) H/L Display Data, MSB
BACKLIGHT
Using the LED backlight requires an current source or external current-limiting resistor. Forward
voltage for yellow/green backlight is 3.9~4.2V and for white LED backlight is 3.0~3.6V. Please take
care of derating for Ta>+25C.
Note: - Do never connect backlight direct to 5V; this may destroy backlight immediately !
- Blue-white displays do always need a backlight for contrast (min. 5mA).
Scroll Enable 1 0 0 0 0 0 1 H4 H3 H2 H1 Determ ine the line for horizontal scroll 39s
sets interface data length (DL=0:4-bit; DL=1:8-bit)
num ber of display lines (N=0: 1-line; N=1: 2-line)
0 0 0 0 0 1 DL N RE DH REV extension register (RE= 0/1) 39s
Function Set scroll/shift (DH=0: dot scroll; DH=1: display shift)
reverse bit (REV=0:norm al; REV=1:inverse display)
CG-/SEG-RAM blink (BE=0: disable; BE=1: enable)
1 0 0 0 0 1 DL N RE BE LP LP=0: norm al m ode; LP=1: low power m ode 39s
2
EA DIP204-4
INITIALISATION EXAMPLE FOR 8 BIT MODE Addressing:
Command RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Hex Description
1st. line $00..$13
Function Set 0 0 0 0 1 1 0 1 0 0 $34 8 bit data length, extension bit RE=1
2nd. line $20..$33
ext. Function Set 0 0 0 0 0 0 1 0 0 1 $09 4 line mode
3rd. line $40..$53
Function Set 0 0 0 0 1 1 0 0 0 0 $30 8 bit data length, extension bit RE=0 4th. line $60..$73
Display ON/OFF 0 0 0 0 0 0 1 1 1 1 $0F display on, cursor on, cursor blink
Clear Display 0 0 0 0 0 0 0 0 0 1 $01 clear display, cursor 1st. row, 1st. line
Entry Mode Set 0 0 0 0 0 0 0 1 1 0 $06 cursor will be automatically incremented
CHARACTER SET
A full character set is built in already.
Additionally to that 8 more characters can
be defined individually.
CONTRAST ADJUSTMENT
Pin 3 requires driving voltage for contrast
VEE. Adjustment can be done by external
potentiometer for example.
Note: In contrast to many other
dotmatrix lcd modules input is
supplied with VDD level here !
VDD
VEE
2,5k W
EA DIP204-4NLED EA DIP204B-4NLW
EA DIP204-4HNLED
00 00
addition to the 240 ROM fixed codes.
Set CG RAM Address Data
1.) The command "CG RAM Address Set"
Bit
defines the ASCII code (Bit 3,4,5) and the Adresse Hex Hex
00 00 00000 00 00
7 6 5 4 3 2 1 0
dot line (Bit 0,1,2) of the new character. 0 0 0 $40 0 0 1 0 0 $04
Example demonstrates creating ASCII 0 0 1 $41 0 0 1 0 0 $04
00
0 1 1 $43 0 0 1 0 0 $04
2.) Doing 8 times the write command "Data 0 1 0 0 0 X X X
1 0 0 $44 1 0 1 0 1 $15
Write" defines line by line the new 1 0 1 $45 0 1 1 1 0 $0E
character. 8th. byte stands for the cursor 1 1 0 $46 0 0 1 0 0 $04
line. 1 1 1 $47 0 0 0 0 0 $00
ATTENTION
handling precautions!
SERIAL MODE
Factory set for interface is parallel with 4 bit or 8 bit data bus. Alternative module can be programmes
with serial data stream. For that solder link 4/8 has to be opened and closed to SPI side. Specification
for serial operation mode is written down in user manual for KS0073: http://www.lcd-module.de/eng/
pdf/zubehoer/ks0073.pdf
ADAPTOR PCB
The adaptor pcb EA 9907-DIP is made for a quick
function test for all DIP modules. This interface board
provides the standard dotmatrix pinout with 1x14,
1x16, 2x7 and 2x8 pins (0.1" pitch).
ntage
e Mo lich
n
ke order
i
erf
EA DIP204B-6NLW
EA DIP204J-6NLW:
Abmessungen 75 x 46 mm
TECHNISCHE DATEN
* KONTRASTREICHE LCD-SUPERTWIST ANZEIGE
* BLAUER HINTERGRUND MIT WEISSER SCHRIFT
* WEISSER HINTERGRUND UND SCHWARZE SCHRIFT
* EXTREM KOMPAKT MIT NUR 75mm BREITE
* KONTROLLER KS0073 (SEHR HNLICH ZU HD44780)
* ANSCHLUSS AN 4- ODER 8-BIT DATENBUS
* SERIELLES SPI-INTERFACE (SID, SOD, SCLK, CS)
* SPANNUNGSVERSORGUNG +3,3..5,0V / typ. 4 mA (O. BELEUCHTUNG)
* BETRIEBSTEMPERATURBEREICH -20..+70C
* AUTOMATISCHE TEMPERATURKOMPENSATION
* LED-BELEUCHTUNG WEISS, max. 75mA@+25C
* 16 ICONS (BATTERIE, PFEILE ETC.) KNNEN ANGEZEIGT WERDEN
* KEINE MONTAGE ERFORDERLICH: EINFACH NUR IN PCB EINLTEN
* STECKBAR BER BUCHSENLEISTEN EA B254-12 (2 STK.)
* 128x64 GRAFIK IM GLEICHEN GEHUSE, GLEICHES PINOUT: EA DIP128
BESTELLBEZEICHNUNG
LCD-MODUL 4x20/6,45mm MIT LED-BELEUCHTUNG, BLAU EA DIP204B-6NLW
IN SCHWARZ-WEISS ALS FSTN EA DIP204J-6NLW
BUCHSENLEISTE 4,5mm HOCH, 12 PINS (1 STCK) EA B254-12
BELEUCHTUNG
Der Betrieb der Hintergrundbeleuchtung erfordert eine Stromquelle oder einen externen
Vorwiderstand zur Strombegrenzung. Die Flussspannung der Beleuchtung liegt zwischen 3,0V und
3,6V. Bitte beachten Sie ein Derating fr den Betrieb bei Temperaturen > +25C!
Achtung: Betreiben Sie die Beleuchtung nie direkt an 5V; das kann zur sofortigen Zerstrung fhren!
Technische nderung vorbehalten. Wir bernehmen keine Haftung fr Druckfehler und Applikationsbeispiele.
Zum Ablesen des blauen Displays ist die Hintergundbeleuchutng unbedingt erforderlich. Bei direkter
Sonneneinstrahlung emfehlen wir den J-Typ.
Set Scroll
Quantity
1 0 0 1 * SQ Sets the quantity of horizontal dot scroll (DH=0) 39s
2
EA DIP204-6
INITIALISIERUNGSBEISPIEL FR DEN 8-BIT MODUS Adressierung:
RE 1. Zeile $00..$13
Befehl Bit
RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Hex Bemerkung
2. Zeile $20..$33
Function Set 0 0 0 0 0 1 1 0 0 0 0 $30 8-Bit Datenlnge, extension Bit RE=0
0 0 0 0 0 0 0 0 1 1 0
3. Zeile $40..$53
Entry Mode Set $06 Cursor Auto-Increment
Function Set 0 0 0 0 0 1 1 0 1 1 0 $36 8-Bit Datenlnge, RE-Bit =1, Blink enable BE =1
4. Zeile $60..$73
ext. Function Set 1 0 0 0 0 0 0 1 0 0 1 $09 4-Zeilen Modus
Set SEGRAM adr 1 0 0 0 1 0 0 0 0 0 0 $40 Icon-RAM Adresse auf $00 setzen
Bitte beachten Sie, dass vor
16 x 16x $00 schreiben
1 1 0 0 0 0 0 0 0 0 0 $00
Write Data um alle Icons zu lschen jedem Schreibzugriff anhand des
Function Set 1 0 0 0 0 1 1 0 0 0 0 $30 8-Bit Datenlnge, RE-Bit =0 Busy-Flags sichergestellt sein
Display ON/OFF 0 0 0 0 0 0 0 1 1 1 1 $0F Display ein, Cursor ein, Cursor blinken muss, dass der Kontroller bereit
Clear Display 0 0 0 0 0 0 0 0 0 0 1 $01 Display lschen, Cursor auf 1. Spalte von 1. Zeile ist neue Daten anzunehmen !
ZEICHENSATZ
Neben abgebildeter Zeichensatz ist bereits
integriert. Zustzlich knnen 8 eigene Zeichen
frei definiert werden.
Technische nderung vorbehalten. Wir bernehmen keine Haftung fr Druckfehler und Applikationsbeispiele.
KONTRASTEINSTELLUNG
Die Kontrastspannung wird an Pin 3 (VCI)
eingespeist.
Das Display EA DIP204 besitzt eine eingebaute
Temperaturkompensation fr -20 bis +70C; ein
Nachstellen des Kontrastes whrend des Be-
triebs ist hier nicht mehr erforderlich.
VDD (5V)
VDD (3,3V)
VCI 470 W
1k
VCI
2,5k W
00 00
bis zu 8 weitere frei definiert werden (ASCII Codes 0..7).
1.) Mit dem Kommando "CG RAM Address Set" wird Adresse im CG RAM setzen Daten des Zeichens
der ASCII Code (Bit 3,4,5) und die entsprechende Bit
Adresse Hex Hex
Pixelzeile (Bit 0,1,2) des Zeichens angewhlt. Im
00 00 00000 00 00
7 6 5 4 3 2 1 0
Beispiel wird ein Zeichen mit dem Code $00 0 0 0 $40 0 0 1 0 0 $04
definiert. 0 0 1 $41 0 0 1 0 0 $04
2.) Mit dem Befehl "Data Write" wird nun Pixelzeile 0 1 0 $42 0 0 1 0 0 $04
fr Pixelzeile das Zeichen in das CG RAM
00
0 1 1 $43 0 0 1 0 0 $04
geschrieben. Ein Zeichen bentigt 8 0 1 0 0 0 1 0 0 $44 X X X
1 0 1 0 1 $15
Schreiboperationen, wobei die 8. Zeile der 1 0 1 $45 0 1 1 1 0 $0E
Cursorzeile entspricht. 1 1 0 $46 0 0 1 0 0 $04
3.) Das neu definierte Zeichen wird genauso 1 1 1 $47 0 0 0 0 0 $00
behandelt wie ein "normales" ASCII Zeichen
(Verwendung: "DD RAM Address Set", "Data Write").
3
EA DIP204-6
ABMESSUNGEN +0,0
75,0 -0,3
61,0 (VA)
0,2
56,33 (AA) 3,0 10,8
41,0 34,0
A
45,8 0,2
33,67 (AA)
38,0 (VA)
alle Mae in mm
Pin 1
2,50
J1 24
1 SPI 4/8
0,81
-20..+70C
0,78
0,81
6,45
KS0073
7,97
4x20 / 6,5mm
11- 2,54
24- 0,5
EA DIP204B-6NLW
Hinweis:
LC-Displays sind generell
12
nicht geeignet fr Wellen-
ELECTRONIC ASSEMBLY 13
0,48 oder Reflowltung.
0,45 Temperaturen ber 90C
0,1
24- 0,5 2,37
knnen bleibende Schden
63,5 2,84
hinterlassen.
das nebenstehende Bei- Set SEGRAM adr 1 0 0 0 1 0 0 0 0 1 0 $42 Icon-RAM Adresse auf $02 (Briefsymbol) setzen
spiel. Write Data 1 1 0 0 0 0 1 0 0 0 0 $10 $10 schreiben um das Briefsymbol anzuzeigen
SPI MODE
Das Modul kann auch mit synchron seriellen Daten beschrieben werden. Dazu muss die
Wechselltbrcke 4/8 auf der Modulrckseite geffnet und auf SPI geschlossen werden. Die
entsprechende Pinbelegung ist auf der Seite 2 oben abgebildet und die Spezifikation zur seriellen
Datenbertragung finden Sie im Kontrollerdatenblatt KS0073 von Samsung: http://www.lcd-
module.de/eng/pdf/zubehoer/ks0073.pdf. Die Initialisierung und Programmierung erfolgt identisch.
Grafik
bersicht: 98x32 .. 640x480 Pixel mit/ohne Kontroller
Grafikdisplays
Liste Einzeldatenbltter
EA DOGM132-5 DOG-Serie 132x32, 3,3V SPI Multi Colour
EA DOGM128-6 DOG-Serie 128x64, 3,3V SPI Multi Colour
EA DIP122-5 DIP-Modul 122x32 mit SED 1520 68x27mm
EA DIP128-6 DIP-Modul 128x64 mit KS0107/0108 75x46mm
EA DIP240-7 DIP-Modul 124x128 mit T6963 113x70mm
Intell. Grafik 240x128 mit integr. Fonts und
EA eDIP240-7
Grafikfunktionen
Intell. Grafik 320x240, 5,7" -VGA mit integr. Fonts
EA eDIP320-8
und Grafikfunktionen
EA GE120-5 120x32 Pixel mit 2 Fonts, Grafikroutinen, RS232
128x64 Pixel, supeklein mit 5Fonts, Grafikroutinen,
EA GE128-6N9
RS232
EA GE128-6N3 128x64 Pixel mit 3 Fonts, Grafikroutinen, RS232
EA GE128-7 240x64, 240x128, 128x128 Pixel, 3 Fonts,
EA GE240-6 /-7 Grafikroutinen, RS232
EA KIT120-5 120x32 Pixel, 5 Fonts, RS-232, Makros, Touch Panel
EA KIT122 122x32 Pixel mit 2 Fonts, Grafikroutinen, RS-232/Bus
Dotmatrix
8081-A3N DIP-Modul 1x8, 7,15mm
Displaykontroller
fr Textanzeigen
HD 44780 nicht mehr lieferbar
HD 66712 nahezu 100% kompatibel zu HD 44780
KS 0066 kompatibel zu HD 44780
KS 0073 nahezu 100% kompatibel zu HD 44780
LC 7985 kompatibel zu HD 44780
NT 3881 kompatibel zu HD 44780
SED 1278 kompatibel zu HD 44780
ST 7036 moderner Textkontroller, low power
ST 7066 kompatibel zu HD 44780
PCF 2116 mit IC Bus Interface (EA T123-I2C)
fr Grafikanzeigen
HD 61202/3 fr 128x64
HD 61830 nicht mehr lieferbar
KS 0107/8 fr 128x64, kompatibel zu HD 61202/3
KS 0713, S6B1713 fr 128x64
LH 155 fr 128x64
LC 7981 fr 128x128, 240x64, 160x80, komp. zu HD61830
PT6520 fr 120x32, kompatibel zu SED1520
PT6607/8 fr 128x64, kompatibel zu HD 61202/3
SBN1661 fr 120x32, kompatibel zu SED1520
S1D13700 fr 320x240, Ersatz fr SED 1335
SED 1520 fr 120x32 / 122x32
SED 1330 nicht mehr lieferbar
SED 1335 nicht mehr lieferbar
SED 1565/S1D15605 fr 128x64 mit Icons (132x65)
SSD1815 fr 132x64 mit Icons (132x65)
ST 7565R fr 128x64 mit Icons (132x65)
fr 128x64, 160x32, 256x32 mit chines.
ST 7920
Zeichensatz
T 6963 fr 128x64, 128x128, 240x64, 240x128
fr 7-Segmentanzeigen
uPD7225 32 Ausgnge, statisch, MUX 1/2, 1/3, 1/4
High-Level-Grafikkontroller
EA IC1520
High-Level-Grafikkontroller mit mehreren eingebauten
EA IC202 Fonts und Grafikroutinen fr LCDs mit SED1520,
EA IC6963 HD61202/KS0107 oder T6963 Kontroller
Adapterplatinen
EA 9041/42 Testplatine fr EA 2041 u. EA 2042
EA 9043 Funktionsplatine fr EA 2043
EA 9044 DVM Adapter fr EA 4044
EA 9055 DVM Adapter fr EA 4055 u. EA 4055-S
Umsetzer von BCD-Mux auf BCD-statisch f.
EA 9106
EA4106-SG
EA 9110-M PLL-Multiplikator fr Serie EA 6110
EA 9110-T Progr. Vorteiler fr Serie EA 6110
EA 9244 Funktionsplatine fr EA 2044
EA 9335-50 Displayadapter 3st., 13 mm auf 50 mm
EA 9340-50 Displayadapter 4st., 13 mm auf 50 mm
EA 9401 DVM-Adapter fr EA VK-1000
EA 9410-RMS True RMS, AC-Vorsatz fr Serie EA 4110
EA 9410-DC Potentialtrenner DC/DC fr Serie EA 4110
EA 9410-RMSDC True RMS und Potentialtrenner fr Serie 4110
EA 9610 Tiefstfrequenzmultiplikator fr Serie EA 6110
RS-232 Interface fr alphan. Dotmatrix Serie
EA 9700-A,-B,-C
EA 7000/8000/P000
Textkontroller 255 Texte fr Binranwahl fr
EA 9700-TXT
Dotmatrix-LCD
Digitalvoltmeter
EA 4001 3st. DVM, 13 mm, 9V
EA 4009-
3st. Sub-Micro-DVM, 5,5 mm, 9V
OEM1B
EA 4010-OEM1 3st. Sub-Micro-DVM, 5,5 mm, 9V
Ereigniszhler, Summenzhler
EA 2021-N 6st. Miniaturzhler mit Reset, 6 mm
EA TM-7010
4st/ 6st.. Miniaturzhler mit Batterie
EA TM-7016
EA 6024-
5st. Frequenz-/Tourenzhler, 8 mm im DIN-Gehuse
GDIN
EA 6105 8st. Universalzhler, 10/2 MHz, 13 mm
EA 6109 8st. Frequenz-/Tourenzhler progr. Zeitbasis, 15MHz, 13 mm
4st. Frequenz-/Tourenzhler progr. Zeitbasis, 2 MHz, 13-
EA 6110-FA
50mm
EA 6110-PA 4st. Pulsbreitenzhler progr. Zeitbasis, 13-50 mm
6st. Frequenz-/Tourenzhler progr. Zeitbasis, 4MHz BCD-
EA 6112
Mux,Vgl-Reg.
6st. Frequenz-/Tourenz. progr. Zeitbasis, stat. BCD Ausg.
EA 6116
3MHz, 13 mm
8-/16-st. Frequenz-/Periodendauerzhler, RS-232, bis 40MHz,
EA 6533
Autorange
EA TM-7760 6-st. Durchlussmesser/Summenzhler in Einem
Datenbltter / Software
Technische nderung vorbehalten. Wir bernehmen keine Haftung fr Druckfehler und Applikationsbeispiele in
unserer Dokumentation und auf dieser Werbsite.
The LCD drivers are classified into two types: the com-
mon driver and the segment driver. The common driver dri-
ves common electrodes and the segment driver drives seg-
ment electrodes. As shown in the figure above, these drivers
select a proper voltage level sequentially from the six voltage
levels (Va to Vf) to generate liquid crystal drive waveforms.
The six voltage levels are generated by resistance division.
The above figure shows the structure of an LCD. Liquid LCD CONTROLLER
crystals are placed between two types of glass substrates,
one having segment electrodes (SEG1, SEG2, and so on),
the other having common electrodes (COM1, COM2, and so
on). Each cross point of the segment and common elec-
trodes is a display pixel.
The LCD is driven as follows. The common electrodes
are sequentially selected. The display pixels on the selected
common electrode are turned on/off according to the
select/non-select signals of the corresponding segment elec-
trodes. This is called multiplex drive.
One of the methods to correspond display contents to dis- Most graphic modules feature the segment and common
play data is to assign a display data bit to a display pixel dot. In drivers on the LCD module, and use a 4-bit parallel interface
that case, if the MPU writes and stores data 11110000 at to an external controller. The controller can be an external PC
address 0 of the display data RAM, the LCD screen displays a board (such as the LCDC-1330) or the controller IC can be
pattern of K K K K l l l l according to the 0s and 1s in the located on the mother board with the microprocessor. In the
data. This correspondence method is called the graphic dis- larger graphic modules, all the board space is taken up with
play mode. The graphic display mode allows any pattern to the driver ICs. Also for small graphic modules with high reso-
be displayed, because each display pixel dot can be turned lution, there may be no room to locate the controller on the
on and off independently. module.
PRINCIPLES OF O P E R AT I O N
GRAPHIC MODULES WITH BUILT-IN POWER ON/OFF AND SIGNAL INPUT TIMING
CONTROLLER (G121C, G242C,
Power ON/OFF and signal input should be performed
G321D, G324E) according to the timing shown below in order not to damage
the LCD driving circuit and the LCD panel.
INTERFACE FUNCTION
SIGNAL
Timing characteristics of signal input into segment driver. Signal Symbol Item Min. Max. Unit
t CYC System cycle time 1000 - ns
80 series WR RD
timing tCC Control pulse width 220 - ns
TIMING CHARACTERISTICS TEMP. = 0 - 50C, VDD = 5.0V I 5%, VSS = OV
V O (VOLTS)
G1213, G1216
G2436
The DC/DC converter internally generates the power
supply voltage (VLC). Also, the G2436 has a built-in variable
resistor (VR ) which controls VLC. When VLC is changed, the li-
quid crystal operating voltage (Vopr) changes. This changes
the display screen contrast.
A P P L I C AT I O N N O T E S
G242C G649D
22K
22K
22K
14
13
LED BRIGHTNESS
VO
The surface brightness of the LED backlight varies
with the forward current.
-24 VDC
R3
=- (Vbe -V2)
R2 In addition, the forward voltage will change with temper-
If we choose R2 = 22K ohm, R3 = Gain x R2 ature. Here are examples for the G1213, G1216, G1226:
= 23.9 x 22K ohms
= 536K ohms G1213 FORWARD VOLTAGE AT TEMPERATURES
536K
Therefore, Vout = - (0.6 - V2) Temperature (Ta) Conditions VFmin. VFtyp. VF max.
22K
-20C IF = 40 mA 3.7V 3.9V 4.2V
The trimmer of the OP AMP is adjusted at room temperature
+25C IF = 40 mA 3.6V 3.8V 4.1V
(25C) resulting in pin 3 of the OP AMP to be at V2 = 0.272 V.
+70C IF = 25 mA 3.4V 3.6V 3.9V
536K
Then, Vout = - (0.6 - 0.272)
22K
= - 7.9912V
If the temperature is decreased 1C, the temp. coef. of G1216 FORWARD VOLTAGE AT TEMPERATURES
the 2N4401 transistor is increased by 2.3mV. Temperature (Ta) Conditions VF min. VF typ. VF max.
So, Vbe = 0.6V + 2.3mV = 0.6023V -20C IF = 90 mA 3.9V 4.3V 4.6V
The output of the OP AMP at 24C +25C IF = 90 mA 3.8V 4.1V 4.4V
536K +70C IF = 50 mA 3.5V 3.7V 3.9V
Vout = - (0.6023 - 0.272) = - 8.47V
22K
A P P L I C AT I O N N O T E S
To keep the brightness at 25C, use a thermosensitive To utilize this, constantly read this register, and when bit
element, like a thermistor, and a transistor as shown. Set the 6 goes LOW, begin writing to VRAM. The register must still be
thermosensitive element to about IF at 25C and configure it intermittently read at this point, and when bit 6 goes HIGH,
so that IF and VF will be reduced as the temperature rises. writing must stop.
The amount of time available is directly proportional to
TC/R - CR, where these are the System Set instruction code
parameters. C/R is defined by the number of lines in your dis-
play. TC/R must be > C/R + 4. To gain extra time in which to
write to VRAM, make TC/R larger.
As TC/R increases, however, the overall frame time will
decrease. It is normally around 70 Hz. If TC/R is made twice
C/R, the frame time should roughly halve. The formula relat-
ing TC/R and frame rate is Fosc >= TC/R x 9 x ~~F x fFR.
As an example, the G321D has a 6MHz clock cycle, and
each memory byte takes approximately 9 oscillator cycles.
You can calculate approximately how much time you have
per line to write to VRAM, and how much the frame rate will
be slowed down by increasing TC/R.
REDUCING SCREEN FLICKER If you make TC/R = 50 decimal, with C/R = 40 decimal,
then you should have approximately 15esec.s per line in
The 1330 controller chip is constantly reading the VRAM which to write your graphics data. If you send your data at a
on board to refresh the screen, and when the user is also cycle time of 0.5 MHz (one byte every 2 microseconds), you
writing to the VRAM, interference may occur which will show could send about 7 bytes per line. Thus it would take about 6
up as scattered noise on the screen. timing rows to input one new line, or about 6 frame times to
The only tool given to avoid this is the status register input one entire new frame. At TC/R = 50, frame time is about
read. Bit 6 of this register goes LOW during the time interval 15 msec.s (above formula). Thus it should take about 90
within which it is safe to write to the VRAM without corrupting msec.s to input a new frame of data.
the screen image.
19-4323; Rev 7b; 11/97
MAX220MAX249
The MAX220MAX249 family of line drivers/receivers is Superior to Bipolar
intended for all EIA/TIA-232E and V.28/V.24 communica- Operate from Single +5V Power Supply
tions interfaces, particularly applications where 12V is
(+5V and +12VMAX231/MAX239)
not available.
Low-Power Receive Mode in Shutdown
These parts are especially useful in battery-powered sys-
(MAX223/MAX242)
tems, since their low-power shutdown mode reduces
power dissipation to less than 5W. The MAX225, Meet All EIA/TIA-232E and V.28 Specifications
MAX233, MAX235, and MAX245/MAX246/MAX247 use Multiple Drivers and Receivers
no external components and are recommended for appli- 3-State Driver and Receiver Outputs
cations where printed circuit board space is critical. Open-Line Detection (MAX243)
Selection Table
Power No. of Nominal SHDN Rx
Part Supply RS-232 No. of Cap. Value & Three- Active in Data Rate
Number (V) Drivers/Rx Ext. Caps (F) State SHDN (kbps) Features
MAX220 +5 2/2 4 4.7/10 No 120 Ultra-low-power, industry-standard pinout
MAX222 +5 2/2 4 0.1 Yes 200 Low-power shutdown
MAX223 (MAX213) +5 4/5 4 1.0 (0.1) Yes 120 MAX241 and receivers active in shutdown
MAX225 +5 5/5 0 Yes 120 Available in SO
MAX230 (MAX200) +5 5/0 4 1.0 (0.1) Yes 120 5 drivers with shutdown
MAX231 (MAX201) +5 and 2/2 2 1.0 (0.1) No 120 Standard +5/+12V or battery supplies;
+7.5 to +13.2 same functions as MAX232
MAX232 (MAX202) +5 2/2 4 1.0 (0.1) No 120 (64) Industry standard
MAX232A +5 2/2 4 0.1 No 200 Higher slew rate, small caps
MAX233 (MAX203) +5 2/2 0 No 120 No external caps
MAX233A +5 2/2 0 No 200 No external caps, high slew rate
MAX234 (MAX204) +5 4/0 4 1.0 (0.1) No 120 Replaces 1488
MAX235 (MAX205) +5 5/5 0 Yes 120 No external caps
MAX236 (MAX206) +5 4/3 4 1.0 (0.1) Yes 120 Shutdown, three state
MAX237 (MAX207) +5 5/3 4 1.0 (0.1) No 120 Complements IBM PC serial port
MAX238 (MAX208) +5 4/4 4 1.0 (0.1) No 120 Replaces 1488 and 1489
MAX239 (MAX209) +5 and 3/5 2 1.0 (0.1) No 120 Standard +5/+12V or battery supplies;
+7.5 to +13.2 single-package solution for IBM PC serial port
MAX240 +5 5/5 4 1.0 Yes 120 DIP or flatpack package
MAX241 (MAX211) +5 4/5 4 1.0 (0.1) Yes 120 Complete IBM PC serial port
MAX242 +5 2/2 4 0.1 Yes 200 Separate shutdown and enable
MAX243 +5 2/2 4 0.1 No 200 Open-line detection simplifies cabling
MAX244 +5 8/10 4 1.0 No 120 High slew rate
MAX245 +5 8/10 0 Yes 120 High slew rate, int. caps, two shutdown modes
MAX246 +5 8/10 0 Yes 120 High slew rate, int. caps, three shutdown modes
MAX247 +5 8/9 0 Yes 120 High slew rate, int. caps, nine operating modes
MAX248 +5 8/8 4 1.0 Yes 120 High slew rate, selective half-chip enables
MAX249 +5 6/10 4 1.0 Yes 120 Available in quad flatpack package
For free samples & the latest literature: http://www.maxim-ic.com, or phone 1-800-998-8800.
For small orders, phone 408-737-7600 ext. 3468.
+5V-Powered, Multichannel RS-232
Drivers/Receivers
ABSOLUTE MAXIMUM RATINGSMAX220/222/232A/233A/242/243
MAX220MAX249
Supply Voltage (VCC) ...............................................-0.3V to +6V 16-Pin Narrow SO (derate 8.70mW/C above +70C) ...696mW
Input Voltages 16-Pin Wide SO (derate 9.52mW/C above +70C)......762mW
TIN..............................................................-0.3V to (VCC - 0.3V) 18-Pin Wide SO (derate 9.52mW/C above +70C)......762mW
RIN .....................................................................................30V 20-Pin Wide SO (derate 10.00mW/C above +70C)....800mW
TOUT (Note 1).....................................................................15V 20-Pin SSOP (derate 8.00mW/C above +70C) ..........640mW
Output Voltages 16-Pin CERDIP (derate 10.00mW/C above +70C).....800mW
TOUT ...................................................................................15V 18-Pin CERDIP (derate 10.53mW/C above +70C).....842mW
ROUT .........................................................-0.3V to (VCC + 0.3V) Operating Temperature Ranges
Driver/Receiver Output Short Circuited to GND.........Continuous MAX2_ _AC_ _, MAX2_ _C_ _ .............................0C to +70C
Continuous Power Dissipation (TA = +70C) MAX2_ _AE_ _, MAX2_ _E_ _ ..........................-40C to +85C
16-Pin Plastic DIP (derate 10.53mW/C above +70C)....842mW MAX2_ _AM_ _, MAX2_ _M_ _ .......................-55C to +125C
18-Pin Plastic DIP (derate 11.11mW/C above +70C)....889mW Storage Temperature Range .............................-65C to +160C
20-Pin Plastic DIP (derate 8.00mW/C above +70C) ....440mW Lead Temperature (soldering, 10sec) .............................+300C
Note 1: Input voltage measured with TOUT in high-impedance state, SHDN or VCC = 0V.
Stresses beyond those listed under Absolute Maximum Ratings may cause permanent damage to the device. These are stress ratings only, and functional
operation of the device at these or any other conditions beyond those indicated in the operational sections of the specifications is not implied. Exposure to
absolute maximum rating conditions for extended periods may affect device reliability.
ELECTRICAL CHARACTERISTICSMAX220/222/232A/233A/242/243
(VCC = +5V 10%, C1C4 = 0.1F TA = TMIN to TMAX unless otherwise noted.)
2 _______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
ELECTRICAL CHARACTERISTICSMAX220/222/232A/233A/242/243 (continued)
MAX220MAX249
(VCC = +5V 10%, C1C4 = 0.1F TA = TMIN to TMAX unless otherwise noted.)
PARAMETER CONDITIONS MIN TYP MAX UNITS
EN Input Threshold Low MAX242 1.4 0.8 V
EN Input Threshold High MAX242 2.0 1.4 V
CL = 50pF to 2500pF,
RL = 3k to 7k, MAX222/232A/233A/242/243 6 12 30
Transition Slew Rate VCC = 5V, TA = +25C, V/s
measured from +3V MAX220 1.5 3 30
to -3V or -3V to +3V
MAX222/232A/233A/242/243 1.3 3.5
Transmitter Propagation Delay tPHLT
MAX220 4 10
TLL to RS-232 (normal operation), s
Figure 1 MAX222/232A/233A/242/243 1.5 3.5
tPLHT
MAX220 5 10
MAX222/232A/233A/242/243 0.5 1
Receiver Propagation Delay tPHLR
MAX220 0.6 3
RS-232 to TLL (normal operation), s
Figure 2 MAX222/232A/233A/242/243 0.6 1
tPLHR
MAX220 0.8 3
Receiver Propagation Delay tPHLS MAX242 0.5 10
s
RS-232 to TLL (shutdown), Figure 2 tPLHS MAX242 2.5 10
Receiver-Output Enable Time, Figure 3 tER MAX242 125 500 ns
Receiver-Output Disable Time, Figure 3 tDR MAX242 160 500 ns
Transmitter-Output Enable Time MAX222/242, 0.1F caps
tET 250 s
(SHDN goes high), Figure 4 (includes charge-pump start-up)
Transmitter-Output Disable Time
tDT MAX222/242, 0.1F caps 600 ns
(SHDN goes low), Figure 4
Transmitter + to - Propagation MAX222/232A/233A/242/243 300
tPHLT - tPLHT ns
Delay Difference (normal operation) MAX220 2000
Receiver + to - Propagation MAX222/232A/233A/242/243 100
tPHLR - tPLHR ns
Delay Difference (normal operation) MAX220 225
Note 2: MAX243 R2OUT is guaranteed to be low when R2IN is 0V or is floating.
_______________________________________________________________________________________ 3
+5V-Powered, Multichannel RS-232
Drivers/Receivers
__________________________________________Typical Operating Characteristics
MAX220MAX249
MAX220/MAX222/MAX232A/MAX233A/MAX242/MAX243
AVAILABLE OUTPUT CURRENT MAX222/MAX242
OUTPUT VOLTAGE vs. LOAD CURRENT vs. DATA RATE ON-TIME EXITING SHUTDOWN
10 11 +10V
MAX220-01
MAX220-02
MAX220-03
1F V+
8 OUTPUT LOAD CURRENT 1F CAPS
10 FLOWS FROM V+ TO V-
6 EITHER V+ OR V- LOADED V+
0.1F CAPS
ALL CAPS +5V
OUTPUT CURRENT (mA)
VCC = 5V 0.1F
OUTPUT VOLTAGE (V)
4 9 1F +5V
4 _______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
ABSOLUTE MAXIMUM RATINGSMAX223/MAX230MAX241
MAX220MAX249
VCC ...........................................................................-0.3V to +6V 20-Pin Wide SO (derate 10 00mW/C above +70C).......800mW
V+ ................................................................(VCC - 0.3V) to +14V 24-Pin Wide SO (derate 11.76mW/C above +70C).......941mW
V- ............................................................................+0.3V to -14V 28-Pin Wide SO (derate 12.50mW/C above +70C) .............1W
Input Voltages 44-Pin Plastic FP (derate 11.11mW/C above +70C) .....889mW
TIN ............................................................-0.3V to (VCC + 0.3V) 14-Pin CERDIP (derate 9.09mW/C above +70C) ..........727mW
RIN......................................................................................30V 16-Pin CERDIP (derate 10.00mW/C above +70C) ........800mW
Output Voltages 20-Pin CERDIP (derate 11.11mW/C above +70C) ........889mW
TOUT ...................................................(V+ + 0.3V) to (V- - 0.3V) 24-Pin Narrow CERDIP
ROUT .........................................................-0.3V to (VCC + 0.3V) (derate 12.50mW/C above +70C) ..............1W
Short-Circuit Duration, TOUT ......................................Continuous 24-Pin Sidebraze (derate 20.0mW/C above +70C)..........1.6W
Continuous Power Dissipation (TA = +70C) 28-Pin SSOP (derate 9.52mW/C above +70C).............762mW
14-Pin Plastic DIP (derate 10.00mW/C above +70C)....800mW Operating Temperature Ranges
16-Pin Plastic DIP (derate 10.53mW/C above +70C)....842mW MAX2 _ _ C _ _......................................................0C to +70C
20-Pin Plastic DIP (derate 11.11mW/C above +70C)....889mW MAX2 _ _ E _ _ ...................................................-40C to +85C
24-Pin Narrow Plastic DIP MAX2 _ _ M _ _ ...............................................-55C to +125C
(derate 13.33mW/C above +70C) ..........1.07W Storage Temperature Range .............................-65C to +160C
24-Pin Plastic DIP (derate 9.09mW/C above +70C)......500mW Lead Temperature (soldering, 10sec) .............................+300C
16-Pin Wide SO (derate 9.52mW/C above +70C).........762mW
Stresses beyond those listed under Absolute Maximum Ratings may cause permanent damage to the device. These are stress ratings only, and functional
operation of the device at these or any other conditions beyond those indicated in the operational sections of the specifications is not implied. Exposure to
absolute maximum rating conditions for extended periods may affect device reliability.
ELECTRICAL CHARACTERISTICSMAX223/MAX230MAX241
(MAX223/230/232/234/236/237/238/240/241, VCC = +5V 10; MAX233/MAX235, VCC = 5V 5% C1C4 = 1.0F; MAX231/MAX239,
VCC = 5V 10%; V+ = 7.5V to 13.2V; TA = TMIN to TMAX; unless otherwise noted.)
_______________________________________________________________________________________ 5
+5V-Powered, Multichannel RS-232
Drivers/Receivers
ELECTRICAL CHARACTERISTICSMAX223/MAX230MAX241 (continued)
MAX220MAX249
6 _______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
__________________________________________Typical Operating Characteristics
MAX220MAX249
MAX223/MAX230MAX241
TRANSMITTER OUTPUT VOLTAGE (VOH)
TRANSMITTER OUTPUT vs. LOAD CAPACITANCE AT TRANSMITTER SLEW RATE
VOLTAGE (VOH) vs. VCC DIFFERENT DATA RATES vs. LOAD CAPACITANCE
8.5 7.4 12.0
MAX220-04
MAX220-06
MAX220-05
1 TRANSMITTER LOADED TA = +25C
2 TRANSMITTERS
LOADED 7.2 11.0 VCC = +5V
LOADED, RL = 3k
8.0 10.0 C1C4 = 1F
7.0
6.8
VOH (V)
MAX220-09
MAX220-08
MAX220-07
V- LOADED,
VOL (V)
VOL (V)
V+ AND V- V+ LOADED,
160kbits/sec NO LOAD
-7.5 -6.8 0 EQUALLY
80kbits/sec ON V+ NO LOAD
1 TRANS- -2 LOADED ON V-
-7.0 20Kkbits/sec
-8.0 MITTER
LOADED -4
-7.2
2 TRANS- 3 TRANS- -6
-8.5
MITTERS MITTERS -7.4
-8
LOADED LOADED ALL TRANSMITTERS UNLOADED
-9.0 -7.6 -10
4.5 5.0 5.5 0 500 1000 1500 2000 2500 0 5 10 15 20 25 30 35 40 45 50
VCC (V) LOAD CAPACITANCE (pF) CURRENT (mA)
V+
V-
SHDN*
500ms/div
*SHUTDOWN POLARITY IS REVERSED
FOR NON MAX241 PARTS
_______________________________________________________________________________________ 7
+5V-Powered, Multichannel RS-232
Drivers/Receivers
ABSOLUTE MAXIMUM RATINGSMAX225/MAX244MAX249
MAX220MAX249
Supply Voltage (VCC) ...............................................-0.3V to +6V Continuous Power Dissipation (TA = +70C)
Input Voltages 28-Pin Wide SO (derate 12.50mW/C above +70C) .............1W
TIN ENA, ENB, ENR, ENT, ENRA, 40-Pin Plastic DIP (derate 11.11mW/C above +70C) ...611mW
ENRB, ENTA, ENTB..................................-0.3V to (VCC + 0.3V) 44-Pin PLCC (derate 13.33mW/C above +70C) ...........1.07W
RIN .....................................................................................25V Operating Temperature Ranges
TOUT (Note 3).....................................................................15V MAX225C_ _, MAX24_C_ _ ..................................0C to +70C
ROUT ........................................................-0.3V to (VCC + 0.3V) MAX225E_ _, MAX24_E_ _ ...............................-40C to +85C
Short Circuit (one output at a time) Storage Temperature Range .............................-65C to +160C
TOUT to GND ............................................................Continuous Lead Temperature (soldering,10sec) ..............................+300C
ROUT to GND............................................................Continuous
Note 3: Input voltage measured with transmitter output in a high-impedance state, shutdown, or VCC = 0V.
Stresses beyond those listed under Absolute Maximum Ratings may cause permanent damage to the device. These are stress ratings only, and functional
operation of the device at these or any other conditions beyond those indicated in the operational sections of the specifications is not implied. Exposure to
absolute maximum rating conditions for extended periods may affect device reliability.
ELECTRICAL CHARACTERISTICSMAX225/MAX244MAX249
(MAX225, VCC = 5.0V 5%; MAX244MAX249, VCC = +5.0V 10%, external capacitors C1C4 = 1F; TA = TMIN to TMAX; unless oth-
erwise noted.)
8 _______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
ELECTRICAL CHARACTERISTICSMAX225/MAX244MAX249 (continued)
MAX220MAX249
(MAX225, VCC = 5.0V 5%; MAX244MAX249, VCC = +5.0V 10%, external capacitors C1C4 = 1F; TA = TMIN to TMAX; unless oth-
erwise noted.)
PARAMETER CONDITIONS MIN TYP MAX UNITS
POWER SUPPLY AND CONTROL LOGIC
MAX225 4.75 5.25
Operating Supply Voltage V
MAX244MAX249 4.5 5.5
MAX225 10 20
No load
VCC Supply Current MAX244MAX249 11 30
mA
(normal operation) 3k loads on MAX225 40
all outputs MAX244MAX249 57
TA = +25C 8 25
Shutdown Supply Current A
TA = TMIN to TMAX 50
Leakage current 1 A
Control Input Threshold low 1.4 0.8
V
Threshold high 2.4 1.4
AC CHARACTERISTICS
CL = 50pF to 2500pF, RL = 3k to 7k, VCC = 5V,
Transition Slew Rate 5 10 30 V/s
TA = +25C, measured from +3V to -3V or -3V to +3V
Transmitter + to - Propagation
tPHLT - tPLHT 350 ns
Delay Difference (normal operation)
Receiver + to - Propagation
tPHLR - tPLHR 350 ns
Delay Difference (normal operation)
Receiver-Output Enable Time, Figure 3 tER 100 500 ns
Receiver-Output Disable Time, Figure 3 tDR 100 500 ns
MAX246MAX249
5 s
(excludes charge-pump start-up)
Transmitter Enable Time tET
MAX225/MAX245MAX249
10 ms
(includes charge-pump start-up)
Transmitter Disable Time, Figure 4 tDT 100 ns
Note 4: The 300 minimum specification complies with EIA/TIA-232E, but the actual resistance when in shutdown mode or VCC =
0V is 10M as is implied by the leakage specification.
_______________________________________________________________________________________ 9
+5V-Powered, Multichannel RS-232
Drivers/Receivers
__________________________________________Typical Operating Characteristics
MAX220MAX249
MAX225/MAX244MAX249
MAX220-11
MAX220-12
VCC = 5V VCC = 5V WITH ALL TRANSMITTERS DRIVEN
8 LOADED WITH 5k
16 V+ AND V- LOADED 8.5
TRANSMITTER SLEW RATE (V/s)
6 EITHER V+ OR 10kb/sec
14 8.0 20kb/sec
V- LOADED
OUTPUT VOLTAGE (V)
V+, V (V)
1F CAPACITORS
10 0 8 TRANSMITTERS 7.0 60kb/sec
40kb/s DATA RATE DRIVING 5k AND
8 8 TRANSMITTERS -2
2000pF AT 20kbits/sec 6.5
LOADED WITH 3k -4 V- LOADED
6 6.0 100kb/sec
-6 V+ AND V- LOADED
200kb/sec
4 5.5
-8
V+ LOADED ALL CAPACITIORS 1F
2 -10 5.0
0 1 2 3 4 5 0 5 10 15 20 25 30 35 0 1 2 3 4 5
LOAD CAPACITANCE (nF) LOAD CURRENT (mA) LOAD CAPACITANCE (nF)
10 ______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
+3V
0V* 50% 50%
+3V INPUT
INPUT
0V
VCC
OUTPUT 50% 50%
V+ GND
0V
OUTPUT
V-
tPHLR tPLHR
tPHLS tPLHS
tPLHT tPHLT
EN
RX OUT 1k
RX IN RX VCC - 2V +3V
SHDN
a) TEST CIRCUIT 0V
150pF
OUTPUT DISABLE TIME (tDT)
+3V
EN INPUT V+
0V +5V
EN
OUTPUT ENABLE TIME (tER) 0V
-5V
+3.5V
V-
RECEIVER
OUTPUTS
+0.8V
a) TIMING DIAGRAM
b) ENABLE TIMING
+3V
EN
0V 1 OR 0 TX
EN INPUT
OUTPUT DISABLE TIME (tDR) 3k 50pF
VOH
VOH - 0.5V
RECEIVER VCC - 2V
OUTPUTS
VOL + 0.5V b) TEST CIRCUIT
VOL
c) DISABLE TIMING
Figure 3. Receiver-Output Enable and Disable Timing Figure 4. Transmitter-Output Disable Timing
______________________________________________________________________________________ 11
+5V-Powered, Multichannel RS-232
Drivers/Receivers
Table 1a. MAX245 Control Pin Configurations
MAX220MAX249
RA1RA4 3-State,
1 0 Shutdown All 3-State All Active All Active
RA5 Active
12 ______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
Table 1d. MAX247/MAX248/MAX249 Control Pin Configurations
MAX220MAX249
TRANSMITTERS RECEIVERS
OPERATION MAX247 TA1TA4 TB1TB4 RA1RA4 RB1RB5
ENTA ENTB ENRA ENRB
STATUS MAX248 TA1TA4 TB1TB4 RA1RA4 RB1RB4
MAX249 TA1TA3 TB1TB3 RA1RA5 RB1RB5
0 0 0 0 Normal Operation All Active All Active All Active All Active
All 3-State, except
0 0 0 1 Normal Operation All Active All Active All Active RB5 stays active on
MAX247
0 0 1 0 Normal Operation All Active All Active All 3-State All Active
All 3-State, except
0 0 1 1 Normal Operation All Active All Active All 3-State RB5 stays active on
MAX247
0 1 0 0 Normal Operation All Active All 3-State All Active All Active
All 3-State, except
0 1 0 1 Normal Operation All Active All 3-State All Active RB5 stays active on
MAX247
0 1 1 0 Normal Operation All Active All 3-State All 3-State All Active
All 3-State, except
0 1 1 1 Normal Operation All Active All 3-State All 3-State B5 stays active on
MAX247
1 0 0 0 Normal Operation All 3-State All Active All Active All Active
All 3-State, except
1 0 0 1 Normal Operation All 3-State All Active All Active RB5 stays active on
MAX247
1 0 1 0 Normal Operation All 3-State All Active All 3-State All Active
All 3-State, except
1 0 1 1 Normal Operation All 3-State All Active All 3-State RB5 stays active on
MAX247
Low-Power Low-Power
1 1 0 0 Shutdown All 3-State All 3-State
Receive Mode Receive Mode
Low-Power
1 1 1 0 Shutdown All 3-State All 3-State All 3-State
Receive Mode
______________________________________________________________________________________ 13
+5V-Powered, Multichannel RS-232
Drivers/Receivers
_______________Detailed Description when device power is removed. Outputs can be driven
MAX220MAX249
14 ______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
The receiver input hysteresis is typically 0.5V with a ShutdownMAX222MAX242
MAX220MAX249
guaranteed minimum of 0.2V. This produces clear out- On the MAX222 MAX235 MAX236 MAX240 and
put transitions with slow-moving input signals, even MAX241 all receivers are disabled during shutdown.
with moderate amounts of noise and ringing. The On the MAX223 and MAX242 two receivers continue to
receiver propagation delay is typically 600ns and is operate in a reduced power mode when the chip is in
independent of input swing direction. shutdown. Under these conditions the propagation
delay increases to about 2.5s for a high-to-low input
Low-Power Receive Mode transition. When in shutdown, the receiver acts as a
The low-power receive-mode feature of the MAX223, CMOS inverter with no hysteresis. The MAX223 and
MAX242, and MAX245MAX249 puts the IC into shut- MAX242 also have a receiver output enable input (EN
down mode but still allows it to receive information. This for the MAX242 and EN for the MAX223) that allows
is important for applications where systems are periodi- receiver output control independent of SHDN (SHDN
cally awakened to look for activity. Using low-power for MAX241). With all other devices SHDN (SHDN for
receive mode, the system can still receive a signal that MAX241) also disables the receiver outputs.
will activate it on command and prepare it for communi-
cation at faster data rates. This operation conserves The MAX225 provides five transmitters and five
system power. receivers while the MAX245 provides ten receivers and
eight transmitters. Both devices have separate receiver
Negative ThresholdMAX243 and transmitter-enable controls. The charge pumps
The MAX243 is pin compatible with the MAX232A, differ- turn off and the devices shut down when a logic high is
ing only in that RS-232 cable fault protection is removed applied to the ENT input. In this state, the supply cur-
on one of the two receiver inputs. This means that control rent drops to less than 25A and the receivers continue
lines such as CTS and RTS can either be driven or left to operate in a low-power receive mode. Driver outputs
floating without interrupting communication. Different enter a high-impedance state (three-state mode). On
cables are not needed to interface with different pieces of the MAX225 all five receivers are controlled by the
equipment. ENR input. On the MAX245 eight of the receiver out-
The input threshold of the receiver without cable fault puts are controlled by the ENR input while the remain-
protection is -0.8V rather than +1.4V. Its output goes ing two receivers (RA5 and RB5) are always active.
positive only if the input is connected to a control line RA1RA4 and RB1RB4 are put in a three-state mode
that is actively driven negative. If not driven, it defaults when ENR is a logic high.
to the 0 or OK to send state. Normally the MAX243s Receiver and Transmitter Enable
other receiver (+1.4V threshold) is used for the data line Control Inputs
(TD or RD) while the negative threshold receiver is con- The MAX225 and MAX245MAX249 feature transmitter
nected to the control line (DTR DTS CTS RTS, etc.). and receiver enable controls.
Other members of the RS-232 family implement the The receivers have three modes of operation: full-speed
optional cable fault protection as specified by EIA/TIA- receive (normal active) three-state (disabled) and low-
232E specifications. This means a receiver output goes power receive (enabled receivers continue to function
high whenever its input is driven negative left floating at lower data rates). The receiver enable inputs control
or shorted to ground. The high output tells the serial the full-speed receive and three-state modes. The
communications IC to stop sending data. To avoid this transmitters have two modes of operation: full-speed
the control lines must either be driven or connected transmit (normal active) and three-state (disabled). The
with jumpers to an appropriate positive voltage level. transmitter enable inputs also control the shutdown
mode. The device enters shutdown mode when all
transmitters are disabled. Enabled receivers function in
the low-power receive mode when in shutdown.
______________________________________________________________________________________ 15
+5V-Powered, Multichannel RS-232
Drivers/Receivers
Tables 1a1d define the control states. The MAX244 The MAX249 provides ten receivers and six drivers with
MAX220MAX249
has no control pins and is not included in these tables. four control pins. The ENRA and ENRB receiver enable
The MAX246 has ten receivers and eight drivers with inputs each control five receiver outputs. The ENTA
two control pins, each controlling one side of the and ENTB transmitter enable inputs control three dri-
device. A logic high at the A-side control input (ENA) vers each. There is no always-active receiver. The
causes the four A-side receivers and drivers to go into device enters shutdown mode and transmitters go into
a three-state mode. Similarly, the B-side control input a three-state mode with a logic high on both ENTA and
(ENB) causes the four B-side drivers and receivers to ENTB. In shutdown mode, active receivers operate in a
go into a three-state mode. As in the MAX245, one A- low-power receive mode at data rates up to
side and one B-side receiver (RA5 and RB5) remain 20kbits/sec.
active at all times. The entire device is put into shut- __________Applications Information
down mode when both the A and B sides are disabled
(ENA = ENB = +5V). Figures 5 through 25 show pin configurations and typi-
cal operating circuits. In applications that are sensitive
The MAX247 provides nine receivers and eight drivers to power-supply noise, VCC should be decoupled to
with four control pins. The ENRA and ENRB receiver ground with a capacitor of the same value as C1 and
enable inputs each control four receiver outputs. The C2 connected as close as possible to the device.
ENTA and ENTB transmitter enable inputs each control
four drivers. The ninth receiver (RB5) is always active.
The device enters shutdown mode with a logic high on
both ENTA and ENTB.
The MAX248 provides eight receivers and eight drivers
with four control pins. The ENRA and ENRB receiver
enable inputs each control four receiver outputs. The
ENTA and ENTB transmitter enable inputs control four
drivers each. This part does not have an always-active
receiver. The device enters shutdown mode and trans-
mitters go into a three-state mode with a logic high on
both ENTA and ENTB.
16 ______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
+5V INPUT C3
TOP VIEW
C5
16
1 VCC
C1+ 1 16 VCC C1+ V+ 2 +10V
C1 +5V TO +10V
V+ 2 3 C1-
15 GND VOLTAGE DOUBLER
4
C1- 3 C2+ +10V TO -10V 6 -10V
14 T1OUT C2 5 C2- VOLTAGE INVERTER
V-
C4
C2+ 4 MAX220 13 R1IN
+5V
MAX232
C2- 5 MAX232A 12 R1OUT 400k
V- 6 11 T1IN T1OUT 14
11 T1IN
+5V
T2OUT 7 10 T2IN TTL/CMOS RS-232
INPUTS 400k OUTPUTS
R2IN 8 9 R2OUT 10 T2IN T2OUT 7
GND
15
+5V INPUT C3
TOP VIEW ALL CAPACITORS = 0.1F
C5
17
2 VCC 3 +10V
C1+ +5V TO +10V
C1 V+
(N.C.) EN 1 4 C1- VOLTAGE DOUBLER
20 SHDN
5
(N.C.) EN 1 C1+ 2 C2+ 7 -10V
18 SHDN 19 VCC
C2 +10V TO -10V V-
6 C2- C4
VOLTAGE INVERTER
C1+ 2 17 VCC V+ 3 18 GND
V+ 3 C1- 4 +5V
16 GND 17 T1OUT
400k
C1- 4 15 T1OUT C2+ 5 MAX222 16 N.C.
MAX242 12 T1IN T1OUT 15
C2+ 5 MAX222 14 R1IN C2- 6 15 R1IN +5V
MAX242 TTL/CMOS RS-232
C2- 6 13 R1OUT V- 7 14 R1OUT INPUTS 400k OUTPUTS
11 T2IN T2OUT 8
V- 7 12 T1IN T2OUT 8 13 N.C.
T2OUT 8 11 T2IN R2IN 9 12 T1IN 13 R1OUT R1IN 14
R2IN 9 10 R2OUT R2OUT 10 11 T2IN
TTL/CMOS 5k RS-232
OUTPUTS INPUTS
DIP/SO 10 R2OUT R2IN 9
SSOP
1 (N.C.) EN 5k
( ) ARE FOR MAX222 ONLY. 18
GND SHDN
PIN NUMBERS IN TYPICAL OPERATING CIRCUIT ARE FOR DIP/SO PACKAGES ONLY.
16
______________________________________________________________________________________ 17
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
+5V
TOP VIEW
0.1
28 27
+5V VCC VCC
400k
T1IN
3 11
ENR 1 +5V T1OUT
28 VCC
400k
ENR 2 27 VCC
T2IN
T1IN 3 4 12
26 ENT +5V T2OUT
T2IN 4 25 T3IN 400k
R1OUT 5 MAX225 24 T4IN T3IN
25 18
+5V T3OUT
R2OUT 6 23 T5IN
400k
R3OUT 7 22 R4OUT
T4IN
24 17
R3IN 8 21 R5OUT +5V T4OUT
R2IN 9 20 R5IN 400k
T5IN T5OUT
R1IN 10 19 R4IN 23 16
T1OUT 11 18 T3OUT ENT
26 15
T2OUT 12 17 T4OUT T5OUT
SO R2OUT R2IN
6 9
5k
R3OUT R3IN
7 8
MAX225 FUNCTIONAL DESCRIPTION
5k
5 RECEIVERS
5 TRANSMITTERS R4OUT R4IN
22 19
2 CONTROL PINS
1 RECEIVER ENABLE (ENR) 5k
1 TRANSMITTER ENABLE (ENT)
R5OUT R5IN
21 20
5k
1 ENR
2 ENR
PINS (ENR, GND, VCC, T5OUT) ARE INTERNALLY CONNECTED. GND GND
CONNECT EITHER OR BOTH EXTERNALLY. T5OUT IS A SINGLE DRIVER. 13 14
18 ______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
+5V INPUT
TOP VIEW 1.0F
11
12 1.0F
C1+ VCC 13
1.0F 14 +5V TO +10V V+
C1- VOLTAGE DOUBLER
15
C2+ +10V TO -10V 17
1.0F VOLTAGE INVERTER V-
16 C2-
1.0F
+5V
400k
7 T1IN T1OUT 2
T1
GND 10 19 R5OUT*
8 R1OUT R1IN 9
VCC 11 18 R5IN* R1
5k
C1+ 12 17 V-
V+ 13 16 C2- R2IN 4
5 R2OUT
R2
C1- 14 15 C2+
5k
Wide SO/
SSOP LOGIC 26 R3OUT R3IN 27 RS-232
R3
OUTPUTS INPUTS
5k
22 R4OUT R4IN 23
R4
5k
19 R5OUT R5IN 18
R5
*R4 AND R5 IN MAX223 REMAIN ACTIVE IN SHUTDOWN 5k
NOTE: PIN LABELS IN ( ) ARE FOR MAX241 24 EN (EN) SHDN 25
(SHDN)
GND
10
______________________________________________________________________________________ 19
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
7 1.0F
8 C1+ VCC
V+ 9
1.0F 10 C1- +5V TO +10V
VOLTAGE DOUBLER
T3OUT 1 20 T4OUT 11
C2+ +10V TO -10V 13
T1OUT 2 19 T5IN 1.0F 12 V-
C2- VOLTAGE INVERTER
1.0F
T2OUT 3 18 N.C. +5V
400k
T2IN 4 17 SHDN 5 T1IN T1OUT 2
T1 T1
T1IN 5 MAX230 16 T5OUT +5V
400k
GND 6 15 T4IN 4 T2IN T2OUT 3
T2
VCC 7 14 T3IN +5V
400k
C1+ 8 13 V-
TTL/CMOS 14 T3IN T3OUT 1 RS-232
T3
V+ 9 12 C2- INPUTS +5V OUTPUTS
400k
C1- 10 11 C2+ 15 T4IN T4OUT 20
T4
+5V
400k
DIP/SO 19 T5IN T5OUT 16
T5
N.C. x 18 GND
17 SHDN
6
+5V INPUT
TOP VIEW 1.0F +7.5V TO +12V
13 (15)
1 VCC 14 (16)
C1+ V+
1.0F 2 +12V TO -12V 3
C1- VOLTAGE CONVERTER V-
C2
+5V 1.0F
C+ 1 14 V+ C+ 1 16 V+
400k
C- 2 13 VCC C- 2 15 VCC (10) (13)
8 T1IN T1OUT 11
T1
V- 3 12 GND V- 3 14 GND
+5V
TTL/CMOS RS-232
T2OUT 4 MAX231 11 T1OUT T2OUT 4 MAX231 13 T1OUT INPUTS 400k OUTPUTS
R2IN 5 10 R1IN R2IN 5 12 R1IN 7 T2IN T2OUT 4
T2
R2OUT 6 9 R1OUT R2OUT 6 11 R1OUT
(11) (12)
9 R1OUT R1IN 10
T2IN 7 8 T1IN T2IN 7 10 T1IN R1
GND
PIN NUMBERS IN ( ) ARE FOR SO PACKAGE 12 (14)
20 ______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
+5V INPUT
1.0F
TOP VIEW
7
+5V VCC
400k
2 T1IN T1OUT 5
T2IN 1 20 R2OUT
+5V
T1IN 2 19 R2IN TTL/CMOS RS-232
400k
INPUTS OUTPUTS
R1OUT 3 18 T2OUT 1 T2IN T2OUT 18
R1IN 4 17 V-
3 R1OUT R1IN 4
T1OUT 5 MAX233 16 C2-
MAX233A
GND 6 15 C2+ TTL/CMOS 5k RS-232
OUTPUTS OUTPUTS
VCC 7 14 V+ (C1-)
(V+) C1+ 8 13 C1- (C1+) 20 R2OUT R2IN 19
+5V INPUT
TOP VIEW 1.0F
6 1.0F
7
C1+ VCC 8
+5V TO +10V V+
1.0F 9
C1- VOLTAGE DOUBLER
10
C2+ +10V TO -10V 12
1.0F VOLTAGE INVERTER V-
T1OUT 1 11 C2-
16 T3OUT 1.0F
+5V
T2OUT 2 15 T4OUT
400k
T2IN 3 14 T4IN
4 T1IN T1OUT 1
T1
T1IN 4 MAX234 13 T3IN +5V
GND 5 12 V- 400k
VCC 6 11 C2- 3 T2IN T2OUT 3
T2
C1+ 7 +5V RS-232
10 C2+ TTL/CMOS
INPUTS 400k OUTPUTS
V+ 8 9 C1-
13 T3IN T3OUT 16
T3
+5V
DIP/SO
400k
14 T4IN T4OUT 15
T4
GND
5
______________________________________________________________________________________ 21
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
+5V INPUT
TOP VIEW 1.0F
12
VCC
+5V
400k
8 T1IN T1OUT 3
T1
+5V
400k
7 T2IN T2OUT 4
T2
+5V
400k
TTL/CMOS 15 T3IN T3OUT 2 RS-232
T3
INPUTS OUTPUTS
T4OUT 1 24 R3IN +5V
400k
T3OUT 2 23 R3OUT T4OUT 1
16 T4IN
T4
T1OUT 3 22 T5IN
+5V
T2OUT 4 21 SHDN 400k
R2IN 5 MAX235 20 EN 22 T5IN T5OUT 19
T5
R2OUT 6 19 T5OUT
T2IN 7 18 R4IN
9 R1OUT R1IN 10
T1
T1IN 8 17 R4OUT
5k
R1OUT 9 16 T4IN
17 R4OUT R4IN 18
R4
5k
14 R5OUT R5IN 13
R5
5k
20 EN 21
SHDN
GND
11
22 ______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
TOP VIEW +5V INPUT
1.0F
9 1.0F
10 11
C1+ VCC V+
1.0F +5V TO +10V
12
C1- VOLTAGE DOUBLER
13 15
C2+ V-
1.0F +10V TO -10V
14 C2- 1.0F
VOLTAGE INVERTER
+5V
400k
7 T1IN T1OUT 2
T1
C1+ 10 15 V-
V+ 11 14 C2- R1IN 4
5 R1OUT
R1
C1- 12 13 C2+
5k
DIP/SO
22 R2OUT R2IN 23 RS-232
TTL/CMOS R2
OUTPUTS INPUTS
5k
17 R3OUT R3IN 16
R3
5k
20 EN 21
SHDN
GND
______________________________________________________________________________________ 23
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
TOP VIEW
+5V INPUT
1.0F
9 1.0F
10 VCC 11
C1+ V+
+5V TO +10V
1.0F 12 VOLTAGE DOUBLER
C1-
13 15
C2+ V-
1.0F +10V TO -10V
14 VOLTAGE INVERTER 1.0F
C2-
+5V
400k
5k
17 R3OUT R3IN 16
R3
5k
GND
8
24 ______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
TOP VIEW
+5V INPUT
1.0F
9 1.0F
10 VCC 11
C1+ V+
+5V TO +10V
1.0F 12
C1- VOLTAGE DOUBLER
13
C2+ 15
1.0F +10V TO -10V V-
14
C2- VOLTAGE INVERTER 1.0F
+5V
400k
C1+ 10 15 V-
DIP/SO
4 R2OUT R2IN 3
R2
TTL/CMOS 5k RS-232
OUTPUTS INPUTS
22 R3OUT R3IN 23
R3
5k
17 R4OUT R4IN 16
R4
5k
GND
8
______________________________________________________________________________________ 25
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
TOP VIEW
7.5V TO 13.2V
+5V INPUT INPUT
1.0F
4 5
6 VCC V+
C1+ 8
V-
+10V TO -10V
1.0F 7 1.0F
C1- VOLTAGE INVERTER
+5V
400k
24 T1IN T1OUT 19
T1
R1OUT 1 24 T1IN +5V
400k
R1IN 2 23 T2IN
TTL/CMOS 23 T2IN T2OUT 20
GND 3 22 R2OUT T2 RS-232
INPUTS OUTPUTS
VCC 4 21 R2IN +5V
400k
V+ 5 MAX239 20 T2OUT
16 T3IN T3OUT 13
C+ 6 19 T1OUT T3
C- 7 18 R3IN
DIP/SO
TTL/CMOS 17 R3OUT R3IN 18 RS-232
R3
OUTPUTS INPUTS
5k
11 R4OUT R4IN 12
R4
5k
10 R5OUT R5IN 9
R5
5k
14 EN 15
N.C.
GND
3
26 ______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
+5V INPUT
TOP VIEW 1.0F
19
25 1.0F
C1+ VCC 26
1.0F 27 +5V TO +10V V+
C1- VOLTAGE DOUBLER
28
C2+ +5V TO -10V 30
1.0F VOLTAGE INVERTER V-
29 C2- 1.0F
+5V
400k
15 T1IN T1OUT 7
T1
+5V
400k
14 T2IN T2OUT 8
T2
R3OUT
T2OUT
T1OUT
T3OUT
T4OUT
R2IN
R3IN
N.C.
N.C.
N.C.
T5IN
+5V
400k
+5V 400k
5k
OUTPUTS INPUTS
5k
Plastic FP
39 R4OUT R4IN 40
R4
5k
36 R5OUT R5IN 35
R5
5k
42 EN 43
SHDN
GND
18
______________________________________________________________________________________ 27
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
16
1
C1+ VCC
2 +10V
0.1F +5V TO +10V V+
3 C1- VOLTAGE DOUBLER
4
C2+
C1+ 1 16 VCC +10V TO -10V 6 -10V
0.1F 5 C2- V-
VOLTAGE INVERTER
V+ 2 15 GND 0.1F
C1- 3 14 T1OUT +5V
V- 6 11 T1IN +5V
TTL/CMOS RS-232
T2OUT 7 10 T2IN INPUTS 400k OUTPUTS
DIP/SO
12 R1OUT R1IN 13
TTL/CMOS 5k RS-232
OUTPUTS INPUTS
9 R2OUT R2IN 8
28 ______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
+5V
TOP VIEW 1F
1F
20
21
C1+ VCC 22
1F
TB4OUT
TA4OUT
TA3OUT
TA2OUT
TA1OUT
TB1OUT
TB2OUT
TB3OUT
23 C1- +5V TO +10V VOLTAGE DOUBLER V+
RA4IN
RA5IN
RB5IN
24 26
C2+ V- 1F
1F 25 C2-
6 5 4 3 2 1 44 43 42 41 40 +10V TO -10V VOLTAGE INVERTER
2 TA1OUT +5V +5V TB1OUT 44
400k
15 TA1IN TB1IN 30
RA3IN 7 39 RB4IN
RA2IN 8 38 RB3IN +5V +5V
2 TA2OUT TB2OUT 43
RA1IN 9 37 RB2IN
400k
RA1OUT 10 36 RB1IN 16 TA2IN TB2IN 29
RA2OUT 11 35 RB1OUT
RA3OUT 12
MAX244 34 RB2OUT 3 TA3OUT +5V +5V TB3OUT 42
RA4OUT 13 33 RB3OUT 400k
RA5OUT 14 32 RB4OUT 17 TA3IN TB3IN 28
TA1IN 15 31 RB5OUT
4 TA4OUT +5V +5V TB4OUT 41
TA2IN 16 30 TB1IN
400k
TA3IN 17 29 TB2IN 18 TA4IN TB4IN 27
9 RA1IN RB1IN 36
18 19 20 21 22 23 24 25 26 27 28
TA4IN
GND
C1+
V+
C1-
C2+
C2-
V-
TB4IN
TB3IN
VCC
5k 5k
5k 5k
MAX249 FUNCTIONAL DESCRIPTION
10 RECEIVERS 11 RA2OUT RB2OUT 34
5 A-SIDE RECEIVER 7 RA3IN RB3IN 38
5 B-SIDE RECEIVER
8 TRANSMITTERS 5k 5k
4 A-SIDE TRANSMITTERS
4 B-SIDE TRANSMITTERS 12 RA3OUT RB3OUT 33
NO CONTROL PINS 6 RA4IN RB4IN 39
5k 5k
13 RA4OUT RB4OUT 32
5 RA5IN RB5IN 40
5k 5k
14 RA5OUT RB5OUT 31
GND
19
______________________________________________________________________________________ 29
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
+5V
TOP VIEW
1F
40
VCC
ENR 1 40 VCC 16 TA1OUT +5V +5V TB1OUT 24
400k
TA1IN 2 39 ENT
2 TA1IN TB1IN 38
TA2IN 3 38 TB1IN
17 TA2OUT +5V +5V TB2OUT 23
TA3IN 4 37 TB2IN
400k
TA4IN 5 36 TB3IN
3 TA2IN TB2IN 37
RA5OUT 6 35 TB4IN
RA4OUT 7
MAX245 34 RB5OUT 18 TA3OUT +5V +5V TB3OUT 22
400k
RA3OUT 8 33 RB4OUT
4 TA3IN TB3IN 36
RA2OUT 9 32 RB3OUT
19 TA4OUT +5V +5V TB4OUT 21
RA1OUT 10 31 RB2OUT
400k
RA1IN 11 30 RB1OUT 5 TA4IN TB4IN 35
RA2IN 12 29 RB1IN
1 ENR ENT 39
RA3IN 13 28 RB2IN
11 RA1IN RB1IN 29
RA4IN 14 27 RB3IN
RA5IN 15 26 RB4IN
5k 5k
TA1OUT 16 25 RB5IN
TA4OUT 19 22 TB3OUT
5k 5k
GND 20 21 TB4OUT
9 RA2OUT RB2OUT 31
DIP 13 RA3IN RB3IN 27
5k 5k
8 RA3OUT RB3OUT 32
MAX245 FUNCTIONAL DESCRIPTION
14 RA4IN RB4IN 26
10 RECEIVERS
5 A-SIDE RECEIVERS (RA5 ALWAYS ACTIVE)
5 B-SIDE RECEIVERS (RB5 ALWAYS ACTIVE) 5k 5k
8 TRANSMITTTERS
7 RA4OUT RB4OUT 33
4 A-SIDE TRANSMITTERS
15 RA5IN RB5IN 25
2 CONTROL PINS
1 RECEIVER ENABLE (ENR)
5k 5k
1 TRANSMITTER ENABLE (ENT)
6 RA5OUT RB5OUT 34
GND
20
30 ______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
+5V
TOP VIEW
1F
40
VCC
ENA 1 40 VCC +5V +5V
16 TA1OUT TB1OUT 24
TA1IN 2 39 ENB
400k
TA2IN 3 38 TB1IN
2 TA1IN TB1IN 38
TA3IN 4 37 TB2IN +5V +5V
TA4IN 5 36 TB3IN 17 TA2OUT TB2OUT 23
400k
RA5OUT 6 35 TB4IN
3 TA2IN TB2IN 37
RA4OUT 7 MAX246 34 RB5OUT +5V +5V
RA3OUT 8 33 RB4OUT 18 TA3OUT TB3OUT 22
TA1OUT 16 25 RB5IN 5k 5k
TA2OUT 17 24 TB1OUT
10 RA1OUT RB1OUT 30
TA3OUT 18 23 TB2OUT
12 RA2IN RB2IN 28
TA4OUT 19 22 TB3OUT
GND 20 21 TB4OUT 5k 5k
5k 5k
MAX246 FUNCTIONAL DESCRIPTION
10 RECEIVERS 8 RA3OUT RB3OUT 32
5 A-SIDE RECEIVERS (RA5 ALWAYS ACTIVE)
14 RA4IN RB4IN 26
5 B-SIDE RECEIVERS (RB5 ALWAYS ACTIVE)
8 TRANSMITTERS
5k 5k
4 A-SIDE TRANSMITTERS
4 B-SIDE TRANSMITTERS 7 RA4OUT RB4OUT 33
2 CONTROL PINS 15 RA5IN RB5IN 25
ENABLE A-SIDE (ENA)
ENABLE B-SIDE (ENB) 5k 5k
6 RA5OUT RB5OUT 34
GND
20
______________________________________________________________________________________ 31
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
+5V
TOP VIEW
1F
40
1 ENTA VCC ENTB 39
ENTA 1 40 VCC +5V +5V
16 TA1OUT TB1OUT 24
TA1IN 2 39 ENTB
400k
TA2IN 3 38 TB1IN 2 TA1IN TB1IN 38
TA3IN 4 37 TB2IN +5V +5V
17 TA2OUT TB2OUT 23
TA4IN 5 36 TB3IN
400k
RB5OUT 6 35 TB4IN 3 TA2IN TB2IN 37
RA4OUT 7 MAX247 34 RB4OUT +5V +5V
18 TA3OUT TB3OUT 22
RA3OUT 8 33 RB3OUT
400k
RA2OUT 9 32 RB2OUT
4 TA3IN TB3IN 36
RA1OUT 10 31 RB1OUT +5V +5V
19 TA4OUT TB4OUT 21
ENRA 11 30 ENRB
400k
RA1IN 12 29 RB1IN
5 TA4IN TB4IN 35
RA2IN 13 28 RB2IN
6 RB5OUT RB5IN 25
RA3IN 14 27 RB3IN
RA4IN 15 26 RB4IN 5k
TA1OUT 16 25 RB5IN
TA3OUT 18 23 TB2OUT
5k 5k
TA4OUT 19 22 TB3OUT
32 ______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
TOP VIEW +5V
1F
1F
20
21
C1+ VCC 22
TA4OUT
TA3OUT
TA2OUT
TA1OUT
TB1OUT
TB2OUT
TB3OUT
TA4OUT
1F V+
23 C1-
RA3IN
RA4IN
RB4IN
+5V TO +10V VOLTAGE DOUBLER 26
24 V-
C2+ 1F
6 5 4 3 2 1 44 43 42 41 40 1F 25 C2- +10V TO -10V VOLTAGE INVERTER
18 ENTA ENTB 27
+5V +5V
1 TA1OUT TB1OUT 44
RA2IN 7 39 RB3IN 400k
RA1IN 8 38 RB2IN 14 TA1IN TB1IN 31
ENRA 9 37 RB1IN +5V +5V
RA1OUT 10 36 ENRB 2 TA2OUT TB2OUT 43
RA2OUT 11 35 RB1OUT 400k
RA3OUT 12
MAX248 34 RB2OUT 15 TA2IN TB2IN 30
RA4OUT 13 33 RB3OUT +5V +5V
3 TA3OUT TB3OUT 42
TA1IN 14 32 RB4OUT
TA2IN 15 31 TB1IN 400k
16 TA3IN TB3IN 29
TA3IN 16 30 TB2IN
TA4IN 17 29 TB3IN
+5V +5V
4 TA4OUT TB4OUT 41
400k
18 19 20 21 22 23 24 25 26 27 28
17 TA4IN TB4IN 28
ENTA
GND
C1+
V+
C1-
C2+
C2-
V-
ENTB
TB4IN
VCC
8 RA1IN RB1IN 37
PLCC
5k 5k
5k 5k
13 RA4OUT RB4OUT 32
9 ENRA ENRB 36
GND
19
______________________________________________________________________________________ 33
+5V-Powered, Multichannel RS-232
Drivers/Receivers
MAX220MAX249
+5V
TOP VIEW 1F
1F
20
21
C1+ VCC 22
TA3OUT
TA2OUT
TA1OUT
TB1OUT
TB2OUT
TB3OUT
1F V+
23 C1-
RA3IN
RA4IN
RA5IN
RB5IN
RB4IN
+5V TO +10V VOLTAGE DOUBLER 26
24 V-
C2+ 1F
6 5 4 3 2 1 44 43 42 41 40 1F 25 C2- +10V TO -10V VOLTAGE INVERTER
18 ENTA ENTB 27
+5V +5V
1 TA1OUT TB1OUT 44
RA2IN 7 39 RB3IN 400k
RA1IN 8 38 RB2IN 15 TA1IN TB1IN 30
ENRA 9 37 RB1IN +5V +5V
RA1OUT 10 36 ENRB 2 TA2OUT TB2OUT 43
RA2OUT 11 35 RB1OUT 400k
RA3OUT 12
MAX249 34 RB2OUT 16 TA2IN TB2IN 29
RA4OUT 13 33 RB3OUT +5V +5V
3 TA3OUT TB3OUT 42
RA5OUT 14 32 RB4OUT
TA1IN 15 31 RB5OUT 400k
17 TA3IN TB3IN 28
TA2IN 16 30 TB1IN
8 RA1IN RB1IN 37
TA3IN 17 29 TB2IN
18 19 20 21 22 23 24 25 26 27 28 5k 5k
ENTA
GND
C1+
V+
C1-
C2+
C2-
V-
ENTB
TB3IN
VCC
10 RA1OUT RB1OUT 35
7 RA2IN RB2IN 38
PLCC
5k 5k
11 RA2OUT RB2OUT 34
MAX249 FUNCTIONAL DESCRIPTION
6 RA3IN RB3IN 39
10 RECEIVERS
5 A-SIDE RECEIVERS
5k 5k
5 B-SIDE RECEIVERS
6 TRANSMITTERS 12 RA3OUT RB3OUT 33
3 A-SIDE TRANSMITTERS 5 RA4IN RB4IN 40
3 B-SIDE TRANSMITTERS
4 CONTROL PINS
5k 5k
ENABLE RECEIVER A-SIDE (ENRA)
ENABLE RECEIVER B-SIDE (ENRB) 13 RA4OUT RB4OUT 32
ENABLE RECEIVER A-SIDE (ENTA) 4 RA5IN RB5IN 41
ENABLE RECEIVER B-SIDE (ENTB)
5k 5k
14 RA5OUT RB5OUT 31
9 ENRA ENRB 36
GND
19
34 ______________________________________________________________________________________
+5V-Powered, Multichannel RS-232
Drivers/Receivers
___________________________________________Ordering Information (continued)
MAX220MAX249
PART TEMP. RANGE PIN-PACKAGE MAX232AC/D 0C to +70C Dice*
MAX222CPN 0C to +70C 18 Plastic DIP MAX232AEPE -40C to +85C 16 Plastic DIP
MAX222CWN 0C to +70C 18 Wide SO MAX232AESE -40C to +85C 16 Narrow SO
MAX222C/D 0C to +70C Dice* MAX232AEWE -40C to +85C 16 Wide SO
MAX222EPN -40C to +85C 18 Plastic DIP MAX232AEJE -40C to +85C 16 CERDIP
MAX222EWN -40C to +85C 18 Wide SO MAX232AMJE -55C to +125C 16 CERDIP
MAX222EJN -40C to +85C 18 CERDIP MAX232AMLP -55C to +125C 20 LCC
MAX222MJN -55C to +125C 18 CERDIP MAX233CPP 0C to +70C 20 Plastic DIP
MAX223CAI 0C to +70C 28 SSOP MAX233EPP -40C to +85C 20 Plastic DIP
MAX223CWI 0C to +70C 28 Wide SO MAX233ACPP 0C to +70C 20 Plastic DIP
MAX223C/D 0C to +70C Dice* MAX233ACWP 0C to +70C 20 Wide SO
MAX223EAI -40C to +85C 28 SSOP MAX233AEPP -40C to +85C 20 Plastic DIP
MAX223EWI -40C to +85C 28 Wide SO MAX233AEWP -40C to +85C 20 Wide SO
MAX225CWI 0C to +70C 28 Wide SO MAX234CPE 0C to +70C 16 Plastic DIP
MAX225EWI -40C to +85C 28 Wide SO MAX234CWE 0C to +70C 16 Wide SO
MAX230CPP 0C to +70C 20 Plastic DIP MAX234C/D 0C to +70C Dice*
MAX230CWP 0C to +70C 20 Wide SO MAX234EPE -40C to +85C 16 Plastic DIP
MAX230C/D 0C to +70C Dice* MAX234EWE -40C to +85C 16 Wide SO
MAX230EPP -40C to +85C 20 Plastic DIP MAX234EJE -40C to +85C 16 CERDIP
MAX230EWP -40C to +85C 20 Wide SO MAX234MJE -55C to +125C 16 CERDIP
MAX230EJP -40C to +85C 20 CERDIP MAX235CPG 0C to +70C 24 Wide Plastic DIP
MAX230MJP -55C to +125C 20 CERDIP MAX235EPG -40C to +85C 24 Wide Plastic DIP
MAX231CPD 0C to +70C 14 Plastic DIP MAX235EDG -40C to +85C 24 Ceramic SB
MAX231CWE 0C to +70C 16 Wide SO MAX235MDG -55C to +125C 24 Ceramic SB
MAX231CJD 0C to +70C 14 CERDIP MAX236CNG 0C to +70C 24 Narrow Plastic DIP
MAX231C/D 0C to +70C Dice* MAX236CWG 0C to +70C 24 Wide SO
MAX231EPD -40C to +85C 14 Plastic DIP MAX236C/D 0C to +70C Dice*
MAX231EWE -40C to +85C 16 Wide SO MAX236ENG -40C to +85C 24 Narrow Plastic DIP
MAX231EJD -40C to +85C 14 CERDIP MAX236EWG -40C to +85C 24 Wide SO
MAX231MJD -55C to +125C 14 CERDIP MAX236ERG -40C to +85C 24 Narrow CERDIP
MAX232CPE 0C to +70C 16 Plastic DIP MAX236MRG -55C to +125C 24 Narrow CERDIP
MAX232CSE 0C to +70C 16 Narrow SO MAX237CNG 0C to +70C 24 Narrow Plastic DIP
MAX232CWE 0C to +70C 16 Wide SO MAX237CWG 0C to +70C 24 Wide SO
MAX232C/D 0C to +70C Dice* MAX237C/D 0C to +70C Dice*
MAX232EPE -40C to +85C 16 Plastic DIP MAX237ENG -40C to +85C 24 Narrow Plastic DIP
MAX232ESE -40C to +85C 16 Narrow SO MAX237EWG -40C to +85C 24 Wide SO
MAX232EWE -40C to +85C 16 Wide SO MAX237ERG -40C to +85C 24 Narrow CERDIP
MAX232EJE -40C to +85C 16 CERDIP MAX237MRG -55C to +125C 24 Narrow CERDIP
MAX232MJE -55C to +125C 16 CERDIP MAX238CNG 0C to +70C 24 Narrow Plastic DIP
MAX232MLP -55C to +125C 20 LCC MAX238CWG 0C to +70C 24 Wide SO
MAX232ACPE 0C to +70C 16 Plastic DIP MAX238C/D 0C to +70C Dice*
MAX232ACSE 0C to +70C 16 Narrow SO MAX238ENG -40C to +85C 24 Narrow Plastic DIP
MAX232ACWE 0C to +70C 16 Wide SO * Contact factory for dice specifications.
______________________________________________________________________________________ 35
+5V-Powered, Multichannel RS-232
Drivers/Receivers
___________________________________________Ordering Information (continued)
MAX220MAX249
Maxim cannot assume responsibility for use of any circuitry other than circuitry entirely embodied in a Maxim product. No circuit patent licenses are
implied. Maxim reserves the right to change the circuitry and specifications without notice at any time.
36 __________________Maxim Integrated Products, 120 San Gabriel Drive, Sunnyvale, CA 94086 (408) 737-7600
1997 Maxim Integrated Products Printed USA is a registered trademark of Maxim Integrated Products.
TECHNICAL SPECIFICATION
FOR
G83-6000
Revision: 01
Page 1 of 32
LAB
TBE
QS-T
VKT
Technical Specification G83-6000
Page 2 von 32
Rev: 01
MODIFICATIONS
Rev. Modification Date revised by
--------------------------------------------------------------------------------------------------------------------------------------------
-------------
a First Issue 04.05.1994 Mr. Greiner
g Pkt. 1.3. Weight with the original packaging approx 1193g changed to
1190g
Pkt. 1.6. Keyboard designation G80-6000LAD changed G80-6000LAADE
Pkt. 2.4.2. .....and lower grid added
Pkt. 2.4.3. PET, 100m thick changed to textured PET, 125m thick
Pkt. 2.7. Type plate legends changed to Name plate legends
Pkt. 3. Electronic reworked
Pkt. 4.1.1. Operation min. 0 to 40C, desired 0 to 50C changed to desired 0 to 50C
Pkt. 4.2.1. 10 to 85 degree changed to 10 to 85%
Pkt. 4.2.2. 10 to 95 degree changed to 10 to 95%
Pkt. 4.2.3. 10 to 95 degree changed to 10 to 95%
Pkt. 4.3.1. .....85 degree changed to 85%
Pkt. 4.4.1. 10 to 22,5 Hz, travel.... changed to 10 to 22,5 Hz, displacement.......
Pkt. 4.4.2. 10 to 16 Hz: travel.... changed to 10 to 16 Hz, displacement
Pkt. 4.5.1. (halfsine wave) added
Technical Specification G83-6000
Page 3 von 32
Rev: 01
Rev. Modification Date revised by
--------------------------------------------------------------------------------------------------------------------------------------------
-------------
CONTENTS
1.0 GENERAL
1.1. DESCRIPTION
1.2. KEYBOARD COMPONENTS
1.3. WEIGHT
1.4. OPERATING LIFE
1.5. FORCE/TRAVEL DIAGRAM
1.6. KEYBOARD DESIGNATION
1.7. HOUSING/LEGEND VERSIONS
1.8. TECHNICAL DESIGN
1.9. LANGUAGE/COUNTRY VERSIONS
1.10. GENERAL REQUIREMENTS AS PER DIN/ISO
1.11. ERGONOMICS
1.12. UL RECOGNITION
1.12.1. Plastic parts
1.12.2. PCB
1.12.3. Cables
1.12.4. Membranes
1.12.5. Rubber sheet
1.13. ADDITIONAL DOCUMENTS
2.1. HOUSING
2.1.1. Colour
2.1.2. Dimensions
2.1.3. Materials
2.1.4. Surface
2.1.5. Adjustable feet
2.1.6. Antislip pads
2.1.7. Inclination
2.1.8. Cleaning
2.2. KEYCAPS
2.2.1. Shape
2.2.2. Colour
2.2.3. Number, sizes
2.2.4. Material
2.2.5. Surface
2.2.6. Legends
2.2.6.1 Type of top legend
2.2.6.2. Colour of top legend
2.2.6.3. Type of front legend
2.2.6.4. Colour of front legend
2.2.6.5. Type style
2.2.7. Layout, position
2.2.7.1. Height of C row
2.2.7.2. Alphanumeric field
2.2.7.3. Deviation from baseline
Technical Specification G83-6000
Page 5 von 32
Rev: 01
2.2.7.4. Gap between adjacent keycaps
2.2.8. Pull-out force
2.3. RUBBER SHEET
2.3.1. Material
2.3.2. Tactile feedback
2.4. MEMBRANE
2.4.1. Material
2.4.2. Printing
2.4.3. Spacer
2.5. PCB
2.5.1. Design
2.5.2. Colour of solder mask
2.5.3. Dimensions
2.5.4. Material
2.6. CABLES
2.6.1. Design
2.6.2. Colour
2.6.3. Length
2.6.4. Plug
2.7. NAME PLATE LEGENDS
2.8. LED LEGENDS
2.9. PACKAGING
2.9.1. Design
2.9.2. Colour
2.9.3. Printing
2.9.4. Materials
2.9.5. Dimensions
2.9.6. Labels
3.0. ELECTRONICS
4.1. TEMPERATURE
4.1.1. Operation
4.1.2. Storage
4.1.3. Transport
4.2. HUMIDITY
4.2.1. Operation
4.2.2. Storage
4.2.3. Transport
4.3. CLIMATE
4.3.1. Operation
4.4. VIBRATION
4.4.1. Operation
4.4.2. Storage
4.5. SHOCK
4.5.1. Operation
4.5.1. Storage and transport
Technical Specification G83-6000
Page 7 von 32
Rev: 01
4.6. Drop resistance
4.6.1. Operation
4.6.2. Storage and transport
4.7. Altitude
4.7.1. Operation
4.7.2. Storage and transport
5.1. RFI/EMI
5.2. ESD susceptibility
5.3. Immunity to radiated fields
5.4. Burst requirements
6.0 RELIABILITY
6.1. MCBF
6.2. MTBF
6.2.1. Electronics
6.2.2. Keyboard
7. APPROVALS
8.1. Safty
8.2. Electro-Magnetic Compatibility
8.2.1. RFI
8.2.2. Susceptibility
Technical Specification G83-6000
Page 8 von 32
Rev: 01
1.0. GENERAL
This is a keyboard with 101/102 or 104/105 keys in a housing with Cherry adjustable
feet. No options are planned.
G83 -------> Rubber sheet technology
The upper housing is snapped onto the lower housing. The printed wiring board,
the rubber sheet and the membrane are placed in the lower housing. The
membrane contacts the PCB by being pressed against it.
1.3. WEIGHT
Kraft
force
f (cN)
(CN)
70 Druckpunkt / tactilepoint
60
50
40 DF
30
20
10 Vorlaufweg / pretravel
Weg
travel
s (mm)
1 2 3 3,7
4
Nominal values:
Technical Specification G83-6000
Page 9 von 32
Rev: 01
G83-6000 L AA DE
Country/language version
Technical version
Housing/legend version
Keyboard number
2.1. HOUSING
2.1.1. Colour pearl white
2.1.2. Dimensions 458 x 170 mm
2.1.3. Material S/B Styrene / butadiene
2.1.4. Surface as per VDI 3400 No. 36; Ra 6,3 m
2.1.5. Adjustable feet: 2, with antislip pads
2.1.6. Anti-slip pads 2 pcs.
2.1.7. Inclination 6 and 10
2.2. KEYCAPS
2.2.1. Shape: cylindrical ("cyln"), type unilevel
2.2.2. Colour/colour code white-grey/beige-grey / 6A/6B
2.2.3. Number, sizes: Version with 101 keys:
83x 1x1 6A/6B
3x 1x1 with dimple (F/J/5) 6A
6x 1x1,5 6A/6B
1x 1x1,75 stepped 6B
2x 1x2 6A/6B
2x 1x2,25 6B
2x 1x2 vertical 6B
1x 1x2,75 6B
1x 1x7 6A
2.4. MEMBRANE
2.4.1. Membrane material: PET, 100 m thick
2.4.2. Printing: Tracks with conductive silver
ink approx 7 mthick, plus carbon
printing on outside of upper
membrane and lower grid
2.4.3. Spacer: PET, 100 m thick textured /
embossed up to 125 m
thickness
Technical Specification G83-6000
Page 12 von 32
Rev: 01
2.5. PCB
2.5.1. Type: one side with Cu 35/00 m chem. nickel 4 - 5 m
chem. gold 0,1 - 0,3 m
2.5.2. Colour: solder resist, green, on solder side
2.5.3. Dimensions: 59 x 27,5 x1,5 mm
2.5.4. Material: FR2 (UL 94 V-0) or
FR1 (UL 94 V-0) or
FR3 (UL 94V-0) or
FR4 (UL 94V-0)
2.6. CABLES:
2.6.1. Type: round with and without coil
2.6.2. Colour: gravel-grey (RAL 7032)
2.6.3. Length: 1750 mm from housing in version without coil
2.6.4. Connector: 5-pin shielded DIN connector or mini-DIN
connector other end plug connected
2.9. PACKAGING
2.9.1. Type: single packaging; corrugated collapsible box
board
2.9.2. Colour: brown
2.9.3. Printing: none
2.9.4. Material: corrugated board
Minimum requirement:
Outer layer: 125 Kraftliner
Corrugation: 110
Inner layer: 140 Testliner
2.9.5. Labels: printed paper
2.9.6. Dimensions: 495 x 210 x 47
Technical Specification G83-6000
Page 13 von 32
Rev: 01
3. ELECTRONICS
1 __________________Clock ___________________5
2 __________________Data ___________________1
3 __________________nc ___________________2/6
4 __________________Ground __________________3
5 __________________+5 Volt __________________4
Shell _____________Shield __________________Shell
2
4 5
5 6
1 3 4
3
DIN MINI
Connectorpins DIN
Front-View 1 2
3.2 INTERFACE
1 Startbit (always 0)
8 Databits
1 Paritybit odd
1 Stopbit (always 1)
The keyboard and the system communicate over the clock and data lines. The
source of each of theses lines is an open-drain device on the keyboard that allows
either the keyboard or the system to force a line to low level. When no
communication is occurring, the clock and datalines are on high level kept by pull-up
resistors.
When the system sends data to the keyboard, it forces the data line to low level
until the keyboard starts to clock the data stream.
The keyboard clock line provides the clocking signals used to clock serial data to and
from the keyboard. If the host system forces the clock line to an low level, keyboard
transmission is inhibited.
When the keyboard sends data to or receives data from the system it generates the
clock signal to time the data. The system can prevent the keyboard from sending
data by forcing the clock line to low level, the data line may be high or low during
this time.
During the BAT, the keyboard allows the clock and data line to go to high level.
T1
Send T2
T5
T3 T4
Data
Start Bit0 Bit1 Bit2 Bit3 Bit4 Bit 5 Bit6 Bit7 Parity Stop
Technical Specification G83-6000
Page 15 von 32
Rev: 01
Clock
T1
Receive T2
T6
T4
Data Start Bit0 Bit1 Bit2 Bit3 Bit4 Bit5 Bit6 Bit7 Parity
Line Control
Bit
T1 30<50s
T2 30<50s
T3 5<25s
T4 5<T2-5s
T5 0<50s
T6 5<25s
When the keyboard is ready to send data, it first checks for a keyboard-inhibit or
system request-to-send status on the clock and data lines. If the clock line is low,
data is stored in the keyboard buffer. If the clock line is high and the data line is low
(request-to send), data is stored in the keyboard buffer, and the keyboard receives
system data.
If the clock and data lines are both high the keyboard sends the (0) start bit, 8 data
bits, the parity bit and the stop bit. Data will be valid before the trailing edge and
beyond the leading edge of the clock pulse. During transmission, the keyboard
checks the clock line for low level at least every 60 seconds. If the system lowers
the clock line after the keyboard starts ending data, a condition known as line
contention occurs, and the keyboard stops sending data. If line contention occurs
before the leading edge of the 10th clock signal (parity bit), the keyboard buffer
returns the clock and data lines to high level. If contention does not occur by the
10th clock signal, the keyboard completes the transmission. Following line
contention, the system may or may not request the keyboard to resend the data.
Following a transmission, the system can inhibit the keyboard until the system
processes the input or until it requests that a response be sent.
Technical Specification G83-6000
Page 16 von 32
Rev: 01
3.2.6 Keyboard receives data
When the system is ready to send data to the keyboard, it first checks to see
if the keyboard is sending data. If the keyboard is sending, but has not
reached the 10th clock signal, the system can override the keyboard output
by forcing the keyboard clock line to low level. If the keyboard transmission is
beyond the 10th clock signal, the system must receive the transmission.
If the keyboard is not sending or if the system elects to override the keyboard's
output, the system forces the keyboard clock line to low level for more than 60
microseconds while preparing to send data. When the system is ready to send the
start bit (the data line will be low), it allows the clock line to got to high level.
The keyboard checks the state of the clock line at intervals of no more than
10 milliseconds. If a system request-to-send (RTS) is detected, the keyboard counts
11 bits. After the 10th bit, the keyboard checks for high level on the data line, and if
the line is high forces it low, and counts one more bit. This action signals the system
that the keyboard has received its data. Upon receipt of this signal, the system
returns to a ready state, in which it can accept keyboard output or goes to the
inhibited state until it is ready.
If the keyboard data line is found at low level following the 10th bit, a framing error
has occurred, and the keyboard continues to count until the data line becomes high.
The keyboard then makes the data line low and sends a Resend.
A 16-byte first-in-first-out (FIFO) buffer in the keyboard stores the scan codes until
the system is ready to receive them.
A buffer-overrun condition occurs when more than 16 bytes are placed in the
keyboard buffer. An overrun code replaces the 17th byte. If more keys are pressed
before the system allows keyboard output, the additional data is lost.
When the keyboard is allowed to send data, the bytes in the buffer will be sent as in
normal operation, and new data entered is detected and sent. Response codes
no occupy a buffer position.
If keystrokes generate a multiple-byte sequence, the entire sequence must fit into
Technical Specification G83-6000
Page 17 von 32
Rev: 01
the available buffer space or the keystroke is discarded and a buffer-overrun
condition occurs.
3.3. POWER-ON-ROUTINE
The keyboard logic generates a 'power-on-reset' signal (POR) when power is first
applied to the keyboard. POR occurs a minimum of 150 milliseconds and a
maximum of 2.0 seconds from the time power is first applied to the keyboard.
+ 5 Volts
Clock
Data
The basic assurance test (BAT) consists of a keyboard processor test, a checksum
of the read-only memory (ROM), and a random-access memory (RAM) test. During
the BAT, activity on the "clock" and "data" lines is ignored. The LEDs are turned on at
the beginning and off at the end of the BAT. The BAT takes a minimum of
300 milliseconds and a maximum of 500 milliseconds. This is in addition to the time
required by the POR.
Upon satisfactory completion of the BAT, a completion code (hex AA) is sent to the
system, and keyboard scanning begins. If a BAT failure occurs, the keyboards sends
an error code to the system. The keyboard is then disabled pending command input.
Completion codes are sent between 450 milliseconds and 2.5 seconds after POR,
and between 300 and 500 milliseconds
after a Reset command is acknowledged.
Technical Specification G83-6000
Page 18 von 32
Rev: 01
3.4 COMMANDS
The following table shows the command that the system may send and their
hexadecimal values.
The Commands may be sent to the keyboard at any time. The keyboard will respond
within 20 milliseconds, except when performing the basic assurance test (BAT), or
executing a Reset command.
The Default Disable command resets all conditions to the power-on default state.
The keyboard responds with ACK, clears its output buffer, sets the default key types
(scan code set 3 operation only) and typematic rate/delay, and clears the last
typematic key. The keyboard stops scanning and awaits further instructions.
Echo is a diagnostic aid. When the keyboard receives this command, it issues a hex
EE response and, if the keyboard was previously enabled, continues scanning.
Upon receipt of this command, the keyboards responds with ACK, clears its output
buffer, clears the last typematic key, and starts scanning.
Hex EF and hex F1 are invalid commands and are not supported. If one of these is
Technical Specification G83-6000
Page 19 von 32
Rev: 01
sent, the keyboard does not acknowledge the command, but returns a Resend
command and continues in its prior scanning state. No other activities occur.
This command requests identification information from the keyboard. The keyboard
responds with ACK, discontinues scanning and sends the two keyboard ID bytes.
The second byte must follow completion of the first by no more than
500 microseconds. After the output of the second ID byte, the keyboard resumes
scanning.
The system sends this command when it detects an error in any transmission from
the keyboard. It is sent only after a keyboard transmission and before the system
allows the next keyboard output. When a Resend is received, the keyboard sends
the previous output again (unless the previous output was Resend, in which case
the keyboard sends the last byte before the Resend command).
The system issues a Reset command to start a program reset and a keyboard
internal self test. The keyboard acknowledges the command with an ACK and
ensures the system accepts ACK before executing the command. The system
signals acceptance of ACK by raising the clock and data lines for a minimum of
500 microseconds. The keyboard is disabled from the time it receives the Reset
command until ACK is accepted or until another command is sent that overrides the
previous command.
Following acceptance of ACK, the keyboard is re-initialized and performs the BAT.
After returning the completion code, the keyboard defaults to scan code set 2.
This command instructs the keyboard to select one of three sets of scan codes.
The keyboard acknowledges receipt of this command with ACK, clears both the
output buffer and the typematic key (if one is active). The system then sends the
option byte and the keyboard responds with another ACK. An option byte value of
hex 01 selects scan code set 1, hex 02 selects set 2 and hex 03 selects set 3.
An option byte value of hex 00 causes the keyboard to acknowledge with ACK and
send a byte telling the system which scan code set is currently in use.
After establishing the new scan code set, the keyboard returns to the scanning state
it was in before receiving the Select Alternate Scan Codes command.
These commands instruct the keyboard to set all keys to the type listed below:
Technical Specification G83-6000
Page 20 von 32
Rev: 01
The keyboard responds with ACK, clears its output buffer, sets all keys to the type
indicated by the command and continues scanning (if it was previously enabled).
Although these commands can be sent using any scan code set, they affect only
scan code set 3 operation.
The Set Default command resets all conditions to the power-on default state. The
keyboard responds with ACK, clears its output buffer, sets the default key types
(scan code set 3 operation only) and typematic rate/delay, clears the last typematic
key and continues scanning.
These commands instruct the keyboard to set individual keys to the type listed
below:
The keyboard responds with ACK, clears its output buffer and prepares to receive
key identification. Key identification is accomplished by the system identifying each
key by its scan code value as defined in scan code set 3. Only scan code set 3
values are valid for key identification. The type of each identified key is set to the
value indicated by the command.
These commands can be sent using any scan code set, but affect only scan code
set 3 operation.
Three status indicators on the keyboard - Num Lock, Caps Lock and Scroll Lock - are
accessible by the system. The keyboard activates or deactivates these indicators
when it receives a valid command-code sequence from the system. The command
sequence begins with the command byte (hex ED). The keyboard responds to the
command byte with ACK, discontinues scanning and waits for the option byte from
the system. The bit assignments for this option byte are as follows:
Technical Specification G83-6000
Page 21 von 32
Rev: 01
Bit Indicator
0 Scroll Lock Indicator
1 Num Lock Indicator
2 Caps Lock Indicator
3-7 Reserved (bust be 0s)
If a bit for an indicator is set to 1, the indicator is turned on. If a bit is set to 0, the
indicator is turned off.
The keyboard responds to the option byte with ACK, sets the indicators and, if the
keyboard was previously enabled, continues scanning. The state of the indicators
will reflect the bits in the option byte and can be activated or deactivated in any
combination. If another command is received in place of the option byte, execution
of the Set/Reset Mode Indicators command is stopped, with no change to the
indicator states and the new command is processed.
Immediately after power-on, the lights default to the Off state. If the Set Default and
Default Disable commands are received, the lamps remain in the state they were in
before the command was received.
The system issues the Set Typematic Rate/Delay command to change the typematic
rate and delay. The keyboard responds to the command with ACK, stops scanning
and waits for the system to issue the rate/delay value byte. The keyboard responds
to the Rate/delay value byte with another ACK, sets the rate and delay to the
values indicated and continues scanning (if it was previously enabled). Bits 6
and 5 indicate the delay and bits 4, 3, 2, 1 and 0 (the least-significant bit) the rate. Bit
7, the most-significant bit, is always 0. The delay is equal to 1 plus the binary value
of bits 6 and 5, multiplied by 250 milliseconds + 20 %.
Technical Specification G83-6000
Page 22 von 32
Rev: 01
The typematic rate (make codes per second) is 1 for each period and are listed in the
following table.
The execution of this command stops without change to the existing rate if another
command is received instead of the rate/delay value byte.
The following table shows the commands that the keyboard may send to the
system and their hexadecimal values.
The commands the keyboard sends to the system are described below, in
alphabetic order.
Technical Specification G83-6000
Page 23 von 32
Rev: 01
3.4.2.1 Acknowledge (Hex FA)
The keyboard issues Acknowledge (ACK) to any valid input other than an Echo or
Resend command. If the keyboard is interrupted while sending ACK, it discards ACK
and accepts and responds to the new command.
Following satisfactory completion of the BAT, the keyboard sends hex AA. Any
other code indicates a failure of the keyboard.
If a BAT failure occurs, the keyboard sends this code, discontinues scanning and
waits for a system response or reset.
The Keyboard ID consists of 2 bytes, hex 83AB. The keyboard responds to the Read
ID with ACK, discontinues scanning, and sends the 2 ID bytes. The low byte is sent
first followed by the high byte. Following output of Keyboard ID, the keyboard
begins scanning.
The keyboard sends a key detection error character if conditions in the keyboard
make it impossible to identify a switch closure. If the keyboard is using scan code
set 1, the code is hex FF. For sets 2 and 3, the code is hex 00.
An overrun character is placed in the keyboard buffer and replaces the last code
when the buffer capacity has been exceeded. The code is sent to the system when
it reaches the top of the buffer queue. If the keyboard is using scan code set 1, the
code is hex FF. For sets 2 and 3, the code is hex 00.
The keyboard issues a Resend command following receipt of an invalid input or any
input with incorrect parity. If the system sends nothing to the keyboard, no response
is required.
Technical Specification G83-6000
Page 24 von 32
Rev: 01
3.5 KEYCODES
110 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
1 2 3 4 5 6 7 8 9 10 11 12 13 15 75 80 85 90 95 100 105
16 17 18 19 20 21 22 23 24 25 26 27 28 29 76 81 86 91 96 101 106
30 31 32 33 34 35 36 37 38 39 40 41 43 92 97 102
44 46 47 48 49 50 51 52 53 54 55 57 83 93 98 103 108
58 60 61 62 64 79 84 89 99 104
110 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
1 2 3 4 5 6 7 8 9 10 11 12 13 15 75 80 85 90 95 100 105
16 17 18 19 20 21 22 23 24 25 26 27 28 43 76 81 86 91 96 101 106
30 31 32 33 34 35 36 37 38 39 40 41 42 92 97 102
44 45 46 47 48 49 50 51 52 53 54 55 57 83 93 98 103 108
58 60 61 62 64 79 84 89 99 104
110 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
1 2 3 4 5 6 7 8 9 10 11 12 13 15 75 80 85 90 95 100 105
16 17 18 19 20 21 22 23 24 25 26 27 28 29 76 81 86 91 96 101 106
30 31 32 33 34 35 36 37 38 39 40 41 43 92 97 102
44 46 47 48 49 50 51 52 53 54 55 57 83 93 98 103 108
58 59 60 61 62 63 65 64 79 84 89 99 104
110 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
1 2 3 4 5 6 7 8 9 10 11 12 13 15 75 80 85 90 95 100 105
16 17 18 19 20 21 22 23 24 25 26 27 28 43 76 81 86 91 96 101 106
30 31 32 33 34 35 36 37 38 39 40 41 432 92 97 102
44 45 46 47 48 49 50 51 52 53 54 55 57 83 93 98 103 108
58 59 60 61 62 63 65 64 79 84 89 99 104
Technical Specification G83-6000
Page 25 von 32
Rev: 01
3.5.2 Codetable
* If the left Shift key is held down, the F0 AA/2A shift make and break
is sent with the other scan codes. If the right Shift key is held
down, B6/36 is sent. If both Shift Keys are down, both sets of
codes are sent with the other scan codes.
Drawing 617-1284
Drawing 617-1300
Drawing 617-1301
Technical Specification G83-6000
Page 30 von 32
Rev: 01
3.6.5 Coiled cable with DIN-connector
Drawing 617-1302
Drawing 620-0818
4.1. Temperature
4.1.1. Operation: 0 to 50 C
4.1.2. Storage: -20 to + 60 C
4.1.3. Transporation: -20 to + 65 C
4.2. Humidity
4.2.1. Operation: 10 to 85 % r.h. non-condensing
4.2.2. Storage: 10 to 95 % r.h. non-condensing
4.2.3. Transport: 10 to 95 % r.h. non-condensing
4.3. Climate
4.3.1. Operation: DIN IEC 721-3 class 3K3 40 C, 85% r.h.
(corresponding to a dew point at plus 37 C)
4.4. Vibration
4.4.1. Operation: 10 to 22,5 Hz: displacement 0,25 mm (peak to peak)
22,5 to 300Hz: acceleration 0,25 g peak
4.4.2. Storage and transport (in original packaging):
10 to 16 Hz: displacement 3 mm (peak to peak)
16 to 500 Hz: acceleration 1,5 g
4.5. Shock
4.5.1. Operation: acceleration: 10 g for duration of 16 ms (halfsine wave)
4.5.2. Storage: acceleration: 25 g for duration of 6 ms (halfsine wave)
4.7. Altitude
4.7.1. Operation: height of 2,4 km (8000 feet), equivalent to 665 mbars
4.7.2. Storage: height of 9,1 km (30.000 feet), equivalent to 280 mbars
Technical Specification G83-6000
Page 31 von 32
Rev: 01
5.1. RFI/EMI
FCC part 15, subpart B, Class B (margin 6dB)
EN 55022 class B (margin 6dB)
6. RELIABILITY
6.1. MCBF
10 9 actuations
6.2. MTBF
6.2.1. Electronics: 1.000.000 h
7.0. APPROVALS
UL 1950
CSA C22.2 No. 950
FCC Part 15, subpart B, class B
VDE/GS
CE certification
Novell Unix Ware
Novell Net Ware
Technical Specification G83-6000
Page 32 von 32
Rev: 01
End of list
Time and Standard Frequency Station DCF77 (Germany)
This is just a local copy of a document translation carried out by Peter Lamb, July 1993.
It has been slightly modified and shorted to provide a compact document.
To view the original document, please have a look at http://www.eecis.udel.edu/~mills/ntp/dcf77.html
Another convenient source of DCF77 information is http://www.hw-server.com/docs/dcf/dcf.html
Abstract
DCF77 is a long-wave radio transmitter at 77.5 kHz for precise time information. It is located near Frankfurt,
Germany in Central Europe and available across most of Europe. It serves as exact time source for a lot of
applications, starting from simple radio clocks and numerous public clocks (including churchs) up to demanding
scientific experiments.
Translation
Original in German available from the address below.
Translation errors courtesy of Peter Lamb,
Swiss Federal Institute of Technology, Zurich, Switzerland
July 1993
The 1978 law on time standards defines legal time in Germany on the
basis of Coordinated World Time (UTC) and gives the PTB responsibility
for the keeping and broadcasting of legal time. As well as this, the
time standards law empowers the Federal government to issue regulations
for the introduction of Summer Time.
Legal time in the FRG is either Middle European Time (MEZ - German
abbreviation) or, in case of its introduction Middle European Summer
Time (MESZ). The following relationships hold between UTC and MEZ and
MESZ.
MEZ(D) = UTC(PTB) + 1h
MESZ(D) = UTC(PTB) + 2h
DCF77 Specifications:
---------------------
Encoding Scheme:
----------------
Mark number(s)
Additional information:
-----------------------
Since July 1983, the DCF77 carrier has been phase modulated in a test
configuration. The phase modulation is a pseudorandom binary sequence
sent twice each second. The clock frequency of the binary sequence is
645.833...Hz and the phase shift \Delta\tau about 3% of the period
(\^{=} 10\deg). Equal numbers of shifts of +\Delta\tau and -\Delta\tau
are always sent, so that the mean frequency remains unchanged, and the
use of DCF77 as a frequency standard is unaffected. The timecode is
encoded in the sequence by inverting the sequence or not. Not inverted
sequence corresponds to a 0 bit. The sequence is alleged to be generated
by a 9 bit shift register which is coupled back on positions 5 and 9.
The polynomial might be: x^9 + x^4 + 1.
Literature:
-----------
#!# !""$! "!
! "$# !""$!
#"
#
!#$! "#
!# INTEGRATED
PRESSURE SENSOR
The Motorola MPX4100A/MPXA4100A series Manifold Absolute Pressure (MAP) 15 to 115 kPa (2.2 to 16.7 psi)
sensor for engine control is designed to sense absolute air pressure within the intake 0.2 to 4.8 Volts Output
manifold. This measurement can be used to compute the amount of fuel required for each
cylinder. The small form factor and high reliability of onchip integration makes the
Motorola MAP sensor a logical and economical choice for automotive system designers.
The MPX4100A/MPXA4100A series piezoresistive transducer is a stateoftheart, UNIBODY PACKAGE
monolithic, signal conditioned, silicon pressure sensor. This sensor combines advanced
micromachining techniques, thin film metallization, and bipolar semiconductor processing
to provide an accurate, high level analog output signal that is proportional to applied
pressure.
Figure 1 shows a block diagram of the internal circuitry integrated on a pressure
sensor chip.
MPX4100A
Features CASE 867
1.8% Maximum Error Over 0 to 85C
Specifically Designed for Intake Manifold Absolute
Pressure Sensing in Engine Control Systems
Temperature Compensated Over 40C to +125C
Durable Epoxy Unibody Element or Thermoplastic SMALL OUTLINE PACKAGE
(PPS) Surface Mount Package
Application Examples
Manifold Sensing for Automotive Systems
Ideally suited for Microprocessor or Microcontroller
Based Systems MPX4100AP
MPXA4100A6U CASE 867B
Also Ideal for NonAutomotive Applications
CASE 482
*'
Motorola
Motorola, Inc.Sensor
2001 Device Data 1
MAXIMUM RATINGS(NOTE)
Parametrics Symbol Value Units
Maximum Pressure (P1 P2) Pmax 400 kPa
Storage Temperature Tstg 40 to +125 C
Operating Temperature TA 40 to +125 C
NOTE: Exposure beyond the specified limits may cause permanent damage or degradation to the device.
OPERATING CHARACTERISTICS (VS = 5.1 Vdc, TA = 25C unless otherwise noted, P1 > P2. Decoupling circuit shown in Figure 3
required to meet electrical specifications.)
Characteristic Symbol Min Typ Max Unit
Pressure Range(1) POP 20 105 kPa
Supply Voltage(2) VS 4.85 5.1 5.35 Vdc
Supply Current Io 7.0 10 mAdc
Minimum Pressure Offset(3) (0 to 85C) Voff 0.225 0.306 0.388 Vdc
@ VS = 5.1 Volts
Full Scale Output(4) (0 to 85C) VFSO 4.870 4.951 5.032 Vdc
@ VS = 5.1 Volts
Full Scale Span(5) (0 to 85C) VFSS 4.59 Vdc
@ VS = 5.1 Volts
Accuracy(6) (0 to 85C) 1.8 %VFSS
Sensitivity V/P 54 mV/kPa
Response Time(7) tR 1.0 ms
Output Source Current at Full Scale Output Io+ 0.1 mAdc
WarmUp Time(8) 20 ms
Offset Stability(9) 0.5 %VFSS
NOTES:
1. 1.0 kPa (kiloPascal) equals 0.145 psi.
2. Device is ratiometric within this specified excitation range.
3. Offset (Voff) is defined as the output voltage at the minimum rated pressure.
4. Full Scale Output (VFSO) is defined as the output voltage at the maximum or full rated pressure.
5. Full Scale Span (VFSS) is defined as the algebraic difference between the output voltage at full rated pressure and the output voltage at the
minimum rated pressure.
6. Accuracy (error budget) consists of the following:
Linearity: Output deviation from a straight line relationship with pressure over the specified pressure range.
Temperature Hysteresis: Output deviation at any temperature within the operating temperature range, after the temperature is
cycled to and from the minimum or maximum operating temperature points, with zero differential pressure
applied.
Pressure Hysteresis: Output deviation at any pressure within the specified range, when this pressure is cycled to and from the
minimum or maximum rated pressure, at 25C.
TcSpan: Output deviation over the temperature range of 0 to 85C, relative to 25C.
TcOffset: Output deviation with minimum rated pressure applied, over the temperature range of 0 to 85C, relative to
25C.
Variation from Nominal: The variation from nominal values, for Offset or Full Scale Span, as a percent of VFSS, at 25C.
7. Response Time is defined as the time for the incremental change in the output to go from 10% to 90% of its final value when subjected to
a specified step change in pressure.
8. Warmup Time is defined as the time required for the product to meet the specified output voltage after the Pressure has been stabilized.
9. Offset Stability is the products output deviation when subjected to 1000 hours of Pulsed Pressure, Temperature Cycling with Bias Test.
MECHANICAL CHARACTERISTICS
Characteristics Typ Unit
Weight, Basic Element (Case 867) 4.0 grams
Weight, Small Outline Package (Case 482) 1.5 grams
*
)#&# ' #" '(" ''
#( '( $
#)($)(
$ *9>=
+& #" *<
(&!#$ '(
' $'
&!
"
:
Figure 2. Cross Sectional Diagram SOP Figure 3. Recommended power supply decoupling
(not to scale) and output filtering.
For additional output filtering, please refer to
Application Note AN1646.
Figure 2 illustrates the absolute sensing chip in the basic Figure 3 shows the recommended decoupling circuit for
chip carrier (Case 482). interfacing the output of the integrated sensor to the A/D in-
put of a microprocessor or microcontroller. Proper decoup-
ling of the power supply is recommended.
*' *0/
(-$
(!$
=9
#)($)(*96=<
5$. (#
5$.
!$,
!"
Figure 4 shows the sensor output signal relative to pres- MPX4100A/MPXA4100A series pressure sensor operat-
sure input. Typical, minimum, and maximum output curves ing characteristics, and internal reliability and qualification
are shown for operation over a temperature range of 0 to tests are based on use of dry air as the pressure media.
85C. The output will saturate outside of the specified pres- Media, other than dry air, may have adverse effects on
sure range. sensor performance and longterm reliability. Contact the
A fluorosilicone gel isolates the die surface and wire factory for information regarding media compatibility in
bonds from the environment, while allowing the pressure your application.
signal to be transmitted to the sensor diaphragm. The
#$ '"&!$"! %
(17:1;.=>;1
=9
;;9;
./=9;
(17:1;.=>;1 48
NOTE: The Temperature Multiplier is a linear response from 0C to 40C and from 85C to 125C.
;;9; 474=< 29; $;1<<>;1
$;1<<>;1;;9;5$.
$;1<<>;1 48 5$.
A
A
Motorola designates the two sides of the pressure sensor pressure sensor is designed to operate with positive differen-
as the Pressure (P1) side and the Vacuum (P2) side. The tial pressure applied, P1 > P2.
Pressure (P1) side is the side containing fluorosilicone gel The Pressure (P1) side may be identified by using the table
which protects the die from harsh media. The Motorola MPX below:
Pressure (P1)
Part Number Case Type Side Identifier
MPX4100A 867 Stainless Steel Cap
MPX4100AP 867B Side with Port Marking
MPX4100AS 867E Side with Port Attached
MPXA4100A6U/T1 482 Stainless Steel Cap
MPXA4100AC6U 482A Side with Port Attached
(-$,
(-$,
(-$, 48/3
77 '
C
R "#('
!"'#"" " (# &"" $& "'
POSITIVE PRESSURE
(P1) - !
M #"(&# " !"'#" "
!"'#" ' " )'* # ( !#
'(#$ &" !# '(#$ &" "#( (# ,
B A
N
PIN 1
L
T
J G
' '
S F
D 6 PL
! ( !
"#!
"#!
'(- '(- '(-
$" *#)( $" #$" $" #$"
&#)" &#)" &#)"
*
*#)(
*#)(
* *')$$ - *')$$ -
* *#)( *#)(
*, #$" #$"
CASE 86708
ISSUE N
BASIC ELEMENT
"#('
A !"'#"' & " ! !(&'
T
U !"'#"' " (# &"' $& '!
- !
L
R
V
Q
N
Q '
B
K
P
PIN 1 S
'
C P
G 6X D
! ( % !
F
J
! ( $ ' % ' '(-
$" *#)(
&#)"
*
*
*
*,
CASE 867B04
ISSUE F
"#('
C A !"'#"" " (# &"" $& "'
- !
#"(&# " !"'#" "
B V
PIN 1
PORT #1
' '
POSITIVE
PRESSURE
(P1) K
S
J G
F '(-
N E D 6 PL $" *#)(
&#)"
T
! ( !
*
*
*
*,
CASE 867E03
ISSUE D
A D 8 PL
! ( ' ' "#('
!"'#"" " (# &"" $& "'
- !
#"(&# " !"'#" "
B
!"'#" " # "#( " ) !#
$&#(&)'#"
G !,!)! !# $&#(&)'#"
*&( ')&' (-$ &(
S
N
' '
C H
J
T
PIN 1 IDENTIFIER
M
K
CASE 48201
ISSUE O
A D 8 PL "#('
!"'#"" " (# &"" $& "'
! ( ' ' - !
#"(&# " !"'#" "
!"'#" " # "#( " ) !#
$&#(&)'#"
N B !,!)! !# $&#(&)'#"
*&( ')&' (-$ &(
G
S
W
' '
V
C
H
J
T
PIN 1 IDENTIFIER
M
K
CASE 482A01
ISSUE A
Motorola reserves the right to make changes without further notice to any products herein. Motorola makes no warranty, representation or
guarantee regarding the suitability of its products for any particular purpose, nor does Motorola assume any liability arising out of the
application or use of any product or circuit, and specifically disclaims any and all liability, including without limitation consequential or incidental
damages. Typical parameters which may be provided in Motorola data sheets and/or specifications can and do vary in different applications
and actual performance may vary over time. All operating parameters, including Typicals must be validated for each customer application
by customers technical experts. Motorola does not convey any license under its patent rights nor the rights of others. Motorola products are
not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications
intended to support or sustain life, or for any other application in which the failure of the Motorola product could create a situation where
personal injury or death may occur. Should Buyer purchase or use Motorola products for any such unintended or unauthorized application,
Buyer shall indemnify and hold Motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs,
damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated
with such unintended or unauthorized use, even if such claim alleges that Motorola was negligent regarding the design or manufacture of the
part. Motorola and are registered trademarks of Motorola, Inc. Motorola, Inc. is an Equal Opportunity/Affirmative Action Employer.
Technical Information Center: 18005216274 ASIA/PACIFIC: Motorola Semiconductors H.K. Ltd.; Silicon Harbour Centre,
2, Dai King Street, Tai Po Industrial Estate, Tai Po, N.T., Hong Kong.
85226668334
In addition, a change bar appears in the left margin of every page in this selector guide that contains new or revised information.
If products are discontinued, a What's EOL? page is included at the end of this guide. The What's EOL? page lists end-of-life products along with their respective last order date, last
ship date, and suggested possible replacement information.
NEW PRODUCT
New Product Page Number Description
MPVZ5010 SG101014 Integrated pressure sensor designed with a robust axial port
MPVZ5004 SG101014 Integrated pressure sensor designed with a robust axial port
MPVZ4006 SG101014 Integrated pressure sensor designed with a robust axial port
MPXHZ6250A SG1010-14 Media resistant and high temperature accuracy integrated pressure sensor
MPXHZ6400A SG1010-14 Media resistant and high temperature accuracy integrated pressure sensor
SG10102
SG1010Q42005
ACCELERATION SENSORS
Low g Acceleration Sensors
Product Acceleration Sensing Axis Sensitivity Rolloff Frequency VDD Zero g Output Packaging
(g) (mV/g) (Hz) Supply Voltage (Typ) (V)
(Typ) (V)
SG10103
SG1010Q42005
ACCELERATION SENSORS
ACCELERATION SENSORS
SG10104
SG1010Q42005
PRESSURE SENSORS
Integrated Pressure Sensors
Product Family Pressure Rating Pressure Rating Pressure Rating Pressure Rating Pressure Rating Over Pressure Full Scale Sensitivity Accuracy Pressure Type Note
Maximum Maximum Maximum Maximum Maximum (kPa) Span (mV/kPa) 0C to 85C
(PSI) (kPa) (in H2O) (cm H2O) (mm Hg) (Typ) (% of VFSS) A D G V
(Vdc)
MPX5500 72.5 500 2000 5100 3750 2000 4.5 9.0 2.5
MPX5700 102 700 2810 7140 5250 2800 4.5 6.0 2.5
MPX5999 150 1000 4150 10546 7757 4000 4.5 5.0 2.5
SG10105
SG1010Q42005
PRESSURE SENSORS
PRESSURE SENSORS
MPX2053 7.0 50 201 510 375 200 1.0 40 0.8 -0.6 0.4
MPX2102 14.5 100 400 1020 750 200 2.0 40 0.4 -1.0 1.0
14.5 100 400 750 200 1.0 40 0.4 -0.6 0.4
MPX2202 29 200 800 2040 1500 400 1.0 40 0.2 -1.0 1.0
29 200 800 1500 400 1.0 40 0.2 -0.6 0.4
MPX2050 7.0 50 201 510 375 200 1.0 40 0.8 -0.3 -0.3
MPX2100 14.5 100 400 1020 750 200 2.0 40 0.4 -1.0 -1.0
14.5 100 400 750 200 1.0 40 0.4 -0.3 -0.3
MPX2200 29 200 800 2040 1500 400 1.0 40 0.2 -1.0 -1.0
29 200 800 1500 400 1.0 40 0.2 -0.3 -0.3
Note: A = Absolute, D = Differential, G = Gauge, V = Vacuum
MPX2300 5.8 40 161 408 300 6.0 0.75 5.0 -2.0 2.0
MPXY8021A 92.4 637.5 6.4 8-bit 2.5 20.0 kPa 7.5 kPa 4C 2.1 to 3.6
MPXY8040A 130.5 900 9.0 8-bit 5.0 25 kPa 20.0 kPa 4C 2.1 to 3.6
kiloPascals
inches H2O
0 100 200 300 400 500 600 700 800
millibars
0 200 400 600 800 1000 1200 1400 1600 1800 2000
mm Hg
0 200 400 600 800 1000 1200 1400 1600
PSI
0 5 10 15 20 25 30
SG10107
SG1010Q42005
PRESSURE SENSORS
SAFETY AND ALARM
Smoke Photo
Product Operating Voltage Horn Tone Interconnectable Primary Power Source Ordering Suffix Note
(V)
MC145012 6 to 12 Temporal - New Tone - NFPA Tone Yes AC/DC P, DW, DWR2
Comparator
Product Description Operating Voltage Horn Modulation Primary Power Source Ordering Suffix Note
(V)
MC14578 Micro-Power Comparator Plus Voltage Follower 3.5 to 14 No Horn Driver AC/DC P
General Alarm
Product Description Operating Voltage Horn Tone(ms) Primary Power Source Ordering Suffix Note
(V)
MC14600 Alarm Detection, Horn Driver, Low Battery Detection, LED Driver 6.0 to 12 Continuous - Old Tone - 4/6 AC/DC P, DW, DWR2
Note: P or P1 = 16-pin DIP, DW = SOIC 16-pin, DWR2 = SOIC 16-pin tape & reel
SG10108
SG1010Q42005
SIGNAL CONDITIONING AND SENSING SOLUTIONS E-FIELD SENSING
Product Description Main Characteristics No. of Channels Current Limit Max Voltage Communications Packaging Status
(mA)
MC33794 Electric Field Imaging Devices 125 kHz generator, shield driver, 9 electrodes + 2 VREF outputs, 11 75 40 ISO-9141 44-pin HSOP Production
detector, 5 V regulator, MCU support 54-pin SOICW EVB
ZIGBEE-COMPLIANT PLATFORM
Zigbee-Compliant and Proprietary RF Transceivers
Product Data Operating Band MCU Packaging Status Additional Information
Rate Voltage (MHz) Interface
(kbps) (V)
MC13193FCR2 250 (max) 2.0 to 3.4 2.4 -2.5 GHz SPI 32-pin QFN 5x5 Available 2.4 GHz RF transceiver data modem for ZigBee applications (tape and reel)
MC13192FCR2 250 (max) 2.4 to 3.4 2.4 GHz SPI 32-pin QFN 5x5 Available 2.4 GHz RF transceiver data modem for ZigBee applications
MC13191FCR2 250 (max) 2.4 to 3.4 2.4 GHz SPI 32-pin QFN 5x5 Available 2.4 GHz Proprietary RF transceiver data modem for Point-to-Point and Star applications
SG10109
SG1010Q42005
13192DSK-A00 MC13191/92 Developers Starter Kit used to implement wireless network designs compatible with the IEEE 802.15.4 standard Available
13192RFC-A00 A low-cost development board that provides a simple interface to Freescales MC13192 transceiver Available
KIT1925MMA6231Q Evaluation Kit for 10g, 300Hz XY-axis Evaluation Board Available
KIT1925MMA6233Q Evaluation Kit for 10g, 900Hz XY-axis Evaluation Board Available
KIT1925MMA6260Q Evaluation Kit for 1.5g, 50Hz XY-axis Evaluation Board Available
KIT1925MMA6261Q Evaluation Kit for 1.5g, 300Hz XY-axis Evaluation Board Available
KIT1925MMA6262Q Evaluation Kit for 1.5g, 150Hz XY-axis Evaluation Board Available
KIT1925MMA6263Q Evaluation Kit for 2.5g, 900Hz XY-axis Evaluation Board Available
RD1986MMA2260D 3-Axis Acceleration Sensing Reference Design Using Three Components 2 X-axis with 1 Device Rotated 90, 1 Z-axis Available
RD1986MMA6260Q 3-Axis Acceleration Sensing Reference Design Using Two Components 1 XY-axis, 1 Z-axis Available
RD3112MMA7260Q Sensing Triple Axis Reference Design (STAR) Using One Component 1 XYZ-axis Available
SG101010
SG1010Q42005
PRODUCT NUMBERING SYSTEM FOR PRESSURE SENSORS
M PX A 2 XXX A P X T1
PRESSURE SENSORS
LEADFORM OPTIONS
PACKAGE TYPE NONE NO LEADFORM
NONE UNIBODY 0 OPEN
AH SSOP MEDIA RESISTANT PACKAGE 12 (CONSULT FACTORY)
CATEGORY 35 OPEN
SHIPPING METHOD
M QUALIFIED STANDARD A/V SMALL OUTLINE PACKAGE NONE TRAYS
(SOP) 67 SOP ONLY
S CUSTOM DEVICE T1 TAPE AND REEL
AZ/VZ SMALL OUTLINE MEDIA (6 = GULL WING/SURFACE MOUNT)
P, X PROTOTYPE DEVICE 1 INDICATES PART
RESISTANT PACKAGE (7 = 87 DEGREES/DIP)
ORIENTATION IN
C CHIP PAK TAPE
H SUPER SMALL OUTLINE U RAIL
PACKAGE (SSOP)
HZ SUPER SMALL OUTLINE
MEDIA RESISTANT PACKAGE
M M-PAK
Y SUPER SMALL OUTLINE
PACKAGE (TPM)
TYPE OF DEVICE
A ABSOLUTE
G GAUGE
D DIFFERENTIAL
V VACUUM/GAUGE
Actual product marking may be abbreviated due to space constraints but packaging label will reflect full part number.
Note: Only applies to qualified and prototype products. This does not apply to custom products.
Examples:
MPX10DP 10 kPa uncompensated, differential device in minibody package, ported, no leadform, shipped in trays.
MPXA4115A6T1 115 kPa automotive temperature compensated and calibrated device with signal conditioning, SOP surface mount with gull wing leadform, shipped in tape and reel.
A change bar appears in the left margin to mark the location of new or revised information.
SG101011
SG1010Q42005
PACKAGING
(Sizes not to scale)
Preferred Pressure Sensor Packaging Options
SOP SOP Axial Port SOP SOP Axial Port SOP Industrial MPAK MPAK Axial Port
Case 482 Case 482A Case 482B Case 482C Case 1320 Case 1320A
Suffix AC6/GC6 Grade Axial Port Suffix A/D
Suffix A6/G6 Suffix G7U Suffix GC7U Case 1735-01 Suffix AS/GS
Suffix GW6U/GW7U
SOP Side Port SOP Dual Port SOP Vacuum Port SSOP SSOP Axial Port SSOP Tire Pressure Monitor
Case 1369 Case 1351 Case 1368 Case 1317 Case 1317A Case 1352
Suffix AP/GP Suffix DP Suffix GVP Suffix A6 Suffix AC6 Suffix A6
A change bar appears in the left margin to mark the location of new or revised information. SG101012
SG1010Q42005
PACKAGING (continued)
(Sizes not to scale)
Acceleration Sensors Packaging
Quad Flat No-Lead Quad Flat No-Lead 16-Pin SOIC 20-Pin SOIC
Case 1622-01 Case 1477-01 Case 475 Case 475A
QFN Suffix QFN Suffix D Suffix D Suffix
16
16
1
1
Note: P or P1 = 16-pin DIP, DW = SOIC 16-pin, DWR2 = SOIC 16-pin tape and reel
SG101013
SG1010Q42005
PACKAGING
PRESSURE SENSOR ORDERABLE PART
NUMBERS
SG101015
SG1010Q42005
How to Reach Us:
Home Page: Japan: For Literature Requests Only:
www.freescale.com Freescale Semiconductor Japan Ltd. Freescale Semiconductor Literature Distribution Center
Headquarters P.O. Box 5405
E-mail: ARCO Tower 15F Denver, Colorado 80217
support@freescale.com 1-8-1, Shimo-Meguro, Meguro-ku 1-800-441-2447 or 303-675-2140
Tokyo 153-0063 Fax: 303-675-2150
USA/Europe or Locations Not Listed: Japan LDCForFreescaleSemiconductor@hibbertgroup.com
Freescale Semiconductor 0120 191014 or +81 3 5437 9125
Technical Information Center, CH370 support.japan@freescale.com
1300 N. Alma School Road
Chandler, Arizona 85224 Asia/Pacific:
+1-800-521-6274 or +1-480-768-2130 Freescale Semiconductor Hong Kong Ltd.
support@freescale.com Technical Information Center
2 Dai King Street
Europe, Middle East, and Africa: Tai Po Industrial Estate
Freescale Halbleiter Deutschland GmbH Tai Po, N.T., Hong Kong
Technical Information Center +800 2666 8080
Schatzbogen 7 support.asia@freescale.com
81829 Muenchen, Germany
+44 1296 380 456 (English)
+46 8 52200080 (English)
+49 89 92103 559 (German)
+33 1 69 35 48 48 (French)
support@freescale.com
Information in this document is provided solely to enable system Freescale Semiconductor does not convey any license under its
and software implementers to use Freescale Semiconductor patent rights nor the rights of others. Freescale Semiconductor
products. There are no express or implied copyright licenses products are not designed, intended, or authorized for use as
granted hereunder to design or fabricate any integrated circuits or components in systems intended for surgical implant into the body,
integrated circuits based on the information in this document. or other applications intended to support or sustain life, or for any
other application in which the failure of the Freescale
Freescale Semiconductor reserves the right to make changes Semiconductor product could create a situation where personal
without further notice to any products herein. Freescale injury or death may occur. Should Buyer purchase or use Freescale
Semiconductor makes no warranty, representation or guarantee Semiconductor products for any such unintended or unauthorized
regarding the suitability of its products for any particular purpose, application, Buyer shall indemnify and hold Freescale
nor does Freescale Semiconductor assume any liability arising out Semiconductor and its officers, employees, subsidiaries, affiliates,
of the application or use of any product or circuit, and specifically and distributors harmless against all claims, costs, damages, and
disclaims any and all liability, including without limitation expenses, and reasonable attorney fees arising out of, directly or
consequential or incidental damages. Typical parameters that may indirectly, any claim of personal injury or death associated with such
be provided in Freescale Semiconductor data sheets and/or unintended or unauthorized use, even if such claim alleges that
specifications can and do vary in different applications and actual Freescale Semiconductor was negligent regarding the design or
performance may vary over time. All operating parameters, manufacture of the part.
including Typicals, must be validated for each customer
application by customers technical experts.
Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners.
Freescale Semiconductor, Inc. 2005. All rights reserved.
SG1010Q42005
Rev 0
09/2005
Order this document
SEMICONDUCTOR APPLICATION NOTE by AN1646/D
Prepared by Ador Reodique, Sensor and Systems Applications Engineering and Warren Schultz, Field Engineering
INTRODUCTION Noise can also come from external circuits. In a sensor sys-
tem, power supply, grounding and PCB layout is important and
Motorola Integrated Pressure Sensors (IPS) have trimmed needs special consideration.
outputs, builtin temperature compensation and an amplified The following discussion presents simple techniques for
singleended output which make them compatible with Ana- mitigating these noise signals, and achieving excellent results
log to Digital converters (A/Ds) on low cost microcontrollers. with high resolution A/D converters.
Although 8bit A/Ds are most common, higher resolution
A/Ds are becoming increasingly available. With these higher
EFFECTS OF NOISE IN SENSOR SYSTEM
resolution A/Ds, the noise that is inherent to piezoresistive The transducer bridge produces a very small differential
voltage in the millivolt range. The onchip differential amplifier
bridges becomes a design consideration.
amplifies, level shifts and translates this voltage to a single
The two dominant types of noise in a piezoresistive inte-
ended output of typically 0.2 volts to 4.7 volts. Although the
grated pressure sensor are shot (white) noise and 1/f (flicker
transducer has a mechanical response of about 500 Hz, its
noise). Shot noise is the result of nonuniform flow of carriers noise output extends from 500 Hz to 1 MHz. This noise is am-
across a junction and is independent of temperature. The sec- plified and shows up at the output as depicted in Figure 1.
ond, 1/f, results from crystal defects and also due to wafer There is enough noise here to affect 1 count on an 8 bit A/D,
processing. This noise is proportional to the inverse of fre- and 4 or 5 counts on a 10 bit A/D. It is therefore important to
quency and is more dominant at lower frequencies3. consider filtering. Filtering options are discussed as follows.
REV 2
This filter has been tested with an HC05 microcontroller nical data sheet if input impedance is a concern. In applica-
which has a successive approximation A/D converter. tions where the A/D converter is sensitive to high source
Successive approximation A/Ds are generally compatible impedance, a buffer should be used. The integrated pressure
with the DC source impedance of the filter in Figure 2. Results sensor has a railtorail output swing, which dictates that a
are shown in Figure 4. railtorail operational amplifier (op amp) should be used to
Some A/Ds will not work well with the source impedance of avoid saturating the buffer. A railtorail input and output op
a single pole RC filter. Please consult your A/D converter tech- amp works well for this purpose (see Figure 3).
Averaging is also effective for filtering sensor noise. Averag- number of samples gives the best results. For example, a roll-
ing is a form of low pass filtering in software. A rolling average ing average of 4 samples combined with the RC filter in Figure
of 8 to 64 samples will clean up most of the noise. A 10 sample 2 results in a noise output on the order of 1 mV peak to peak.
average reduces the noise to about 2.5 mV peak to peak and Another important consideration is that the incremental ef-
a 64 sample average reduces the noise to about 1 mV peak fectiveness of averaging tends to fall off as the number of sam-
to peak (see Figures 5 and 6). ples is increased. In other words, the signaltonoise (S/N)
This method is simple and requires no external compo- ratio goes up more slowly than the number of samples. To be
nents. However, it does require RAM for data storage, extra more precise, the S/N ratio improves as the square root of the
computation cycles and code. In applications where the mi- number of samples is increased. For example, increasing the
crocontroller is resource limited or pressure is changing rela- number of samples from 10, in Figure 5, to 64, in Figure 6, re-
tively rapidly, averaging alone may not be the best solution. In duced noise by a factor of 2.5.
these situations, a combination of RC filtering and a limited
Figure 8. Minimizing Loop Areas
CONCLUSION
Piezoresistive pressure sensors produce small amounts
of noise that can easily be filtered out with several methods.
These methods are low pass filtering with an RC filter, averag-
ing or a combination of both which can be implemented with
minimal hardware cost.
In a mixed sensor system, noise can be further reduced by
following recommended power supply, grounding and layout
SENSOR/ANALOG POWER techniques.
GROUND GROUND
REFERENCES
Figure 9. Ground Partitioning [1] AN1626 Noise Management in Motor Drives, Warren
Schultz, Motorola, Inc.
In addition to grounding, the digital portion of a system [2] Noise Reduction Techniques In Electronic Systems 2nd
benefits from attention to avoiding 90 degree angles, since Edition, Henry W. Ott, John Wiley & Sons.
there are generally a lot of high speed signals on the digital [3] Noise: Comparing Integrated Pressure Sensors and Op
portion of the board. Routing with 45 degree angles or curves Amps, Ira Basket, Motorola Sensor Products Division
minimizes unwanted reflections, which increases noise immu- internal paper.
Motorola reserves the right to make changes without further notice to any products herein. Motorola makes no warranty, representation or guarantee regarding
the suitability of its products for any particular purpose, nor does Motorola assume any liability arising out of the application or use of any product or circuit, and
specifically disclaims any and all liability, including without limitation consequential or incidental damages. Typical parameters which may be provided in Motorola
data sheets and/or specifications can and do vary in different applications and actual performance may vary over time. All operating parameters, including Typicals
must be validated for each customer application by customers technical experts. Motorola does not convey any license under its patent rights nor the rights of
others. Motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other
applications intended to support or sustain life, or for any other application in which the failure of the Motorola product could create a situation where personal injury
or death may occur. Should Buyer purchase or use Motorola products for any such unintended or unauthorized application, Buyer shall indemnify and hold Motorola
and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees
arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that
Motorola was negligent regarding the design or manufacture of the part. Motorola and are registered trademarks of Motorola, Inc. Motorola, Inc. is an Equal
Opportunity/Affirmative Action Employer.
JAPAN: Motorola Japan Ltd.; SPS, Technical Information Center, 3201, MinamiAzabu. Minatoku, Tokyo 1068573 Japan. 81334403569
ASIA/PACIFIC: Motorola Semiconductors H.K. Ltd.; Silicon Harbour Centre, 2 Dai King Street, Tai Po Industrial Estate, Tai Po, N.T., Hong Kong. 85226668334
Home
Products
Design
Sales
Sample
Buy Online
Corporate
What's New
http://buy.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=6412/02/2008 17:32:06
http://www.electronic-engineering.ch/microchip/faq/Readme%20for%20PICSTART%20Plus.txt
-----------------------------------------------------------------
Table of Contents
-----------------------------------------------------------------
1. Device Support List
2. PC Operating System Support List
3. Reference Documents
4. What's New or Updated
5. Known Problems
6. Important Notes
7. Programming PIC10F2XX Devices
8. Programming rfPIC12C509Ax Devices
9. Programming PIC16C55A/C57C/F57 Devices
10. Programming PIC16F818/819 Devices
11. Programming PIC18C658/858 and PIC18F6x20/8x20 Devices
12. Programming PIC18F2331/2431 Devices
13. Universal Programming Module (AC162049)
-----------------------------------------------------------------
1. Device Support List
-----------------------------------------------------------------
Supported in Supported in
Device OS (FW) Version Device OS (FW) Version
------------- --------------- ------------- ---------------
PIC10F200! (04.30.00) PIC16F688 (04.10.00)
PIC10F202! (04.30.00) PIC16F716 (04.10.00)
PIC10F204! (04.30.00) PIC16F72 (02.10.01)
PIC10F206! (04.30.00) PIC16F73 (02.10.01)
PIC12C508 (02.01.00) PIC16F737 (04.10.00)
PIC12C508A (02.01.00) PIC16F74 (02.10.01)
PIC12C509 (02.01.00) PIC16F747 (04.10.00)
PIC12C509A (02.01.00) PIC16F76 (02.10.01)
PIC12C671 (02.01.00) PIC16F767 (04.10.00)
PIC12C672 (02.01.00) PIC16F77 (02.10.01)
PIC12CE518 (02.01.00) PIC16F777 (04.10.00)
-----------------------------------------------------------------
2. PC Operating System Support List
-----------------------------------------------------------------
-----------------------------------------------------------------
3. Reference Documents
-----------------------------------------------------------------
-----------------------------------------------------------------
4. What's New or Updated
-----------------------------------------------------------------
None.
-----------------------------------------------------------------
5. Known Problems
-----------------------------------------------------------------
The following is a list of known problems. For information on
common problems, error messages and limitations, please see
Troubleshooting in the online help file for PICSTART Plus
(hlpPSPlus.chm).
SSR 18615: A failed Verify in MPLAB IDE does not report all
erroneous memory areas found when a PIC18Fxx20 device is in use.
* If all options are included in the Verify, only errors in the
program memory are reported.
* If the program memory is excluded and an individual or
combination of any of the remaining areas is included, errors
found in those areas are reported.
SSR 19753: EEPROM is not being erased on some devices, such as the
PIC16F62X, PIC16F8X, PIC16F87X and PIC16F87XA.
-----------------------------------------------------------------
6. Important Notes
-----------------------------------------------------------------
- For all memory except configuration bits (that are not code
protected), you may program from 1 to 0, but not from 0 to 1, i.e.,
you must erase and then program.
-----------------------------------------------------------------
7. Programming PIC10F2XX Devices
-----------------------------------------------------------------
PIC10F2xx devices are currently available in a 6-pin SOT 23 and
8-pin DIP packages. The following setup is required for use with
the PicStart Plus:
-----------------------------------------------------------------
8. Programming rfPIC12C509Ax Devices
-----------------------------------------------------------------
You can program rfPIC12C509Ax devices using PICSTART Plus by
creating an adapter that will connect the top 8 pins (4 pins on
each side) to the PICSTART Plus (socket pins 1-4 and 37-40). This
will allow you to program the PIC12C509A part of the device.
ONLY connect the top 8 pins for proper operation. Once you have
created the adapter, you will be able to select the rfPIC12C509Ax
part from the PICSTART Plus programming dialog on MPLAB IDE.
-----------------------------------------------------------------
9. Programming PIC16C55A/C57C/F57 Devices
-----------------------------------------------------------------
From ETN #22:
-----------------------------------------------------------------
10. Programming PIC16F818/819 Devices
-----------------------------------------------------------------
When programming a PIC16F818 or PIC16F819, you must add a 1kohm
resistor between MCLR and GND. This can be placed in the socket
with the device.
-----------------------------------------------------------------
11. Programming PIC18C658/858 and PIC18F6x20/8x20 Devices
-----------------------------------------------------------------
To program these devices using the PICSTART Plus programmer, you
need to build an adapter that will make the part look like the
40-pin PIC18CXXX devices. The device pins below should be
attached to the PICSTART Plus as noted. (ETN #23)
-----------------------------------------------------------------
12. Programming PIC18F2331/2431 Devices
-----------------------------------------------------------------
All power supply (Vdd and AVdd) and ground (vss and AVss) pins
must be used in order for these devices to program. PICSTART Plus
will handle Vdd, Vss and AVss properly, but you must place a wire
must be securely placed between pin 7 (AVdd) and pin 11 in the
socket with the device for proper operation.
-----------------------------------------------------------------
13. Universal Programming Module (AC162049)
-----------------------------------------------------------------
*****************************************************************
IMPORTANT: Do not allow Windows(R) OS to pick a default USB driver;
MPLAB ICD 2 will not work with this driver. You must follow the
procedure specified at MPLAB IDE software installation for
USB driver set-up. If you did not set up the port during
MPLAB IDE installation, see the section in this readme file on
USB Port Setup.
*****************************************************************
-----------------------------------------------------------------
Table of Contents
-----------------------------------------------------------------
1. Device Support List
2. PC Operating System Support List
3. Reference Documents
4. What's New/Updated
5. USB Port Setup
6. Powering the MPLAB ICD 2 and Target Board
7. Setting Up the MPLAB ICD 2 and Target Board
8. PIC18C601/801 Users
9. Known Problems
10. Important Notes
11. Universal Programming Module (AC162049)
12. Reserved Resources
-----------------------------------------------------------------
1. Device Support List
-----------------------------------------------------------------
Debugger
--------
dsPIC30F2010 PIC16F767 PIC18F248 PIC18F4610
dsPIC30F2011* PIC16F777 PIC18F2510 PIC18F4620
dsPIC30F2012* PIC16F785* PIC18F2515 PIC18F4680
dsPIC30F3010 PIC16F818 PIC18F252 PIC18F6310
dsPIC30F3011 PIC16F819 PIC18F2520 PIC18F6390
dsPIC30F3012 PIC16F87 PIC18F2525 PIC18F6410
dsPIC30F3013 PIC16F870 PIC18F2539 PIC18F6490
dsPIC30F3014 PIC16F871 PIC18F2550 PIC18F6520
dsPIC30F4011 PIC16F872 PIC18F258 PIC18F6525
dsPIC30F4012 PIC16F873 PIC18F2580 PIC18F6585
dsPIC30F4013 PIC16F873A PIC18F2585 PIC18F6620
dsPIC30F5011 PIC16F874 PIC18F2610 PIC18F6621
dsPIC30F5013 PIC16F874A PIC18F2620 PIC18F6627
dsPIC30F6010 PIC16F876 PIC18F2680 PIC18F6680
dsPIC30F6011 PIC16F876A PIC18F4220 PIC18F6720
dsPIC30F6012 PIC16F877 PIC18F4320 PIC18F6722
dsPIC30F6013 PIC16F877A PIC18F4331 PIC18F67J10*
dsPIC30F6014 PIC16F88 PIC18F4410 PIC18F8310
PIC12F629! PIC16F913* PIC18F442 PIC18F8390
PIC12F635! PIC16F914* PIC18F4420 PIC18F8410
PIC12F675! PIC16F916 PIC18F4431 PIC18F8490
PIC12F683 PIC16F917 PIC18F4439 PIC18F8520
PIC16F627A! PIC18C601 PIC18F4455 PIC18F8525
PIC16F628A! PIC18C801 PIC18F448 PIC18F8585
PIC16F630! PIC18F1220 PIC18F4510 PIC18F8620
PIC16F636! PIC18F1320 PIC18F4515 PIC18F8621
PIC16F639* PIC18F2220 PIC18F452 PIC18F8627
PIC16F648A! PIC18F2320 PIC18F4520 PIC18F8680
PIC16F676! PIC18F2331 PIC18F4525 PIC18F8720
PIC16F684! PIC18F2410 PIC18F4539 PIC18F8722
PIC16F688! PIC18F242 PIC18F4550 PIC18F87J10*
PIC16F716! PIC18F2420 PIC18F458
PIC16F737 PIC18F2431 PIC18F4580
PIC16F747 PIC18F2439 PIC18F4585
Programmer
----------
dsPIC30F2010 PIC16F648A PIC18C801 PIC18F452
dsPIC30F2011* PIC16F676 PIC18F1220 PIC18F4520
dsPIC30F2012* PIC16F684 PIC18F1320 PIC18F4525
dsPIC30F3010 PIC16F685* PIC18F2220 PIC18F4539
dsPIC30F3011 PIC16F687* PIC18F2320 PIC18F4550
dsPIC30F3012 PIC16F688 PIC18F2331 PIC18F458
dsPIC30F3013 PIC16F689* PIC18F2410 PIC18F4580
dsPIC30F3014 PIC16F690* PIC18F242 PIC18F4585
dsPIC30F4011 PIC16F716 PIC18F2420 PIC18F4610
dsPIC30F4012 PIC16F72 PIC18F2431 PIC18F4620
dsPIC30F4013 PIC16F73 PIC18F2439 PIC18F4680
dsPIC30F5011 PIC16F737 PIC18F2455* PIC18F6310
dsPIC30F5013 PIC16F74 PIC18F248 PIC18F6390
dsPIC30F6010 PIC16F747 PIC18F2480 PIC18F6410
dsPIC30F6011 PIC16F76 PIC18F2510 PIC18F6490
dsPIC30F6012 PIC16F767 PIC18F2515 PIC18F6520
dsPIC30F6013 PIC16F77 PIC18F252 PIC18F6525
dsPIC30F6014 PIC16F777 PIC18F2520 PIC18F6585
PIC10F200!! PIC16F785 PIC18F2525 PIC18F6620
PIC10F202!! PIC16F818 PIC18F2539 PIC18F6621
PIC10F204!! PIC16F819 PIC18F2550 PIC18F6627
PIC10F206!! PIC16F84A PIC18F258 PIC18F6680
PIC12F508 PIC16F87 PIC18F2580 PIC18F6720
PIC12F509 PIC16F870 PIC18F2585 PIC18F6722*
PIC12F510* PIC16F871 PIC18F2610 PIC18F67J10*
PIC12F629 PIC16F872 PIC18F2620 PIC18F8310
PIC12F635 PIC16F873 PIC18F2680 PIC18F8390
PIC12F675 PIC16F873A PIC18F4220 PIC18F8410
PIC12F683 PIC16F874 PIC18F4320 PIC18F8490
PIC16F505 PIC16F874A PIC18F4331 PIC18F8520
PIC16F54 PIC16F876 PIC18F4410 PIC18F8525
PIC16F57 PIC16F876A PIC18F442 PIC18F8585
PIC16F59 PIC16F877 PIC18F4420 PIC18F8620
PIC16F627 PIC16F877A PIC18F4431 PIC18F8621
PIC16F627A PIC16F88 PIC18F4439 PIC18F8627
PIC16F628 PIC16F913 PIC18F4455 PIC18F8680
PIC16F628A PIC16F914 PIC18F448 PIC18F8720
PIC16F630 PIC16F916 PIC18F4480 PIC18F8722
PIC16F636 PIC16F917 PIC18F4510 PIC18F87J10*
PIC16F639 PIC18C601 PIC18F4515
-----------------------------------------------------------------
2. Operating System Support List
-----------------------------------------------------------------
This tool has been tested using the following operating systems:
Windows(R) 98 SE, Windows ME, Windows NT 4.0 SP6a Workstations
(NOT Servers), Windows 2000 SP4, Windows XP
-----------------------------------------------------------------
3. Reference Documents
-----------------------------------------------------------------
-----------------------------------------------------------------
4. What's New/Updated
-----------------------------------------------------------------
-----------------------------------------------------------------
5. USB Port Setup
-----------------------------------------------------------------
-----------------------------------------------------------------
6. Powering the MPLAB ICD 2 and Target Board
-----------------------------------------------------------------
NOTE: MPLAB ICD 2 must be powered BEFORE power is applied to the
target application.
-----------------------------------------------------------------
7. Setting Up the MPLAB ICD 2 and Target Board
-----------------------------------------------------------------
Self Tests
----------
If any of the self tests on the Status tab of the Settings dialog
do not say pass, you will not be able to erase and program your
device. Exception: if Vpp says low, you may still be able to
program if the voltage is more than the low value for the device
programming range listed in the device programming spec.
-----------------------------------------------------------------
8. PIC18C601/801 Users
-----------------------------------------------------------------
There is a folder called \ICD2 that was copied into the MPLAB IDE
installation directory. This folder has two files which can be
When using PICDEM 18R, you must use one of the files above in the
"Location of WriteProgramWord and EraseProgramMemory" dialog on
the MPLAB ICD 2 Advanced Dialog. Also, you must remember to do an
erase before programming as this is not done automatically.
-----------------------------------------------------------------
9. Known Problems
-----------------------------------------------------------------
The following is a list of known problems. For information on
common problems, error messages and limitations, please see
Troubleshooting in the online help file for MPLAB ICD 2
(hlpMPLABICD2.chm).
* Communications
* General Issues
* SSR's
Communications
--------------
- If you are using MPLAB ICD 2 with USB communications AND a power
supply, plug in the USB first, then power supply.
NOTE: You should have the FIFO disabled and hardware handshaking
enabled on the PC COM port properties.
- If you do not use the included cable, make sure the cable you
use is not longer than the included cable or communication
errors could result.
- Do not plug both the USB cable and RS-232 cable into the MPLAB
ICD 2 pod. This will cause errors. Choose one form of ICD-to-PC
communication.
General Issues
--------------
You may want to disable suspend mode while using the MPLAB ICD 2.
From Control Panel, select Power Options and disable suspend mode.
- Care should be taken when programming the PLL. The PLL only
changes when power is first applied to the chip. If you are
programming the PLL for the first time, remove power from the
PIC18Fxxxx part after programming and reapply for the PLL to
SSR's
-----
SSR 24936: For dsPIC30F devices, do not use power (Vdd) from ICD
unit. The power (Vdd) provided from MPLAB ICD 2 to the target
device is not sufficient for all programming operations of the
dsPIC30F device family. It is recommended that you provide power
on your own board and not to use power from the ICD.
-----------------------------------------------------------------
10. Important Notes
-----------------------------------------------------------------
- For PIC18Fxx20 devices, you must connect the AVDD and AVSS pins
for the devices to program.
- In low voltage mode, bulk erase will not erase code protect
bits.
Firmware
--------
dsPIC30F Devices
----------------
3) User RAM Usage: You must not use the following memory region
while using MPLAB ICD 2; 0x800 - 0x84F (i.e., the first 80
bytes of RAM). If the ICD is to be used for a particular
project, open the "Project>>Build Options>>Linker" dialog box
and check the "Link for ICD2" check-box.
5) Programming Range:
On enabling MPLAB ICD 2, the Program End Address (Debugger>>
Settings>>End Address) is automatically set as low as possible
based on the Program Memory usage of each MPLAB IDE project.
This helps minimize the programming time.
8) Interrupts:
(a) In general, single-stepping an instruction will not generate
an interrupt or trap, because the corresponding interrupt/trap
status flag bit would not get set. Essentially, the interrupt
or trap condition would be ignored.
(b) However, if the user has explicitly set an interrupt/trap
11) The CAN module, unlike the other peripherals, does not get
frozen in the following situations:
(a) during a Halt
(b) during a stop on a Breakpoint
(c) after a Single-Step
For example, if you set a Breakpoint and run to it, the CAN
module continues to run in the background, and it may seem
that data transmissions and receptions have completed
immediately.
-----------------------------------------------------------------
11. Universal Programming Module (AC162049)
-----------------------------------------------------------------
J3 Connector
-------------------
Vpp - Program Power
Vdd - Power
Vdd - Power
GND - Ground
GND - Ground
PGD - Program Data
PGC - Program Clock
Make sure that the programmer options are correct for your target
device.
-----------------------------------------------------------------
12. Reserved Resources
-----------------------------------------------------------------
Refer to the on-line help for the most up-to-date list of resources
used by the MPLAB ICD 2.
http://www.piclist.com/techref/microchip/pages.htm12/02/2008 17:32:14
Freeware Microchip PIC C Compiler
HI-TECH FOR MICROCHIP COMPANY NEWS PRODUCTS SUPPORT DOWNLOADS PURCHASE RESOURCES
LATEST NEWS
2008-02-09
Beta Release: HI-TECH C
PRO for the PIC32 MCU
Family
2007-12-19
HI-TECH Software in EDN
Microchip's most popular PIC microcontrollers have a powerful Hot 100 Products of 2007
FREE ANSI C compiler.
Soon to be available is the fully-featured HI-TECH C PRO for the PIC10/12/16 MCU Family ANSI C
Visit HI-TECH Software at
Compiler that comes with Omniscient Code Generation. booth 935.
HI-TECH Software has provided this freeware HI-TECH PICC-Lite compiler as a tool for hobbyists and
students, but the licence allows its use for commercial purposes as well. It is ideal as a teaching tool for an
introduction into the 'C' language and embedded programing on a Microchip device. The selected
processors were chosen for this compiler due to their popularity.
standard libraries is not provided. The supported processors and their limitations (if any) are shown below.
Due to program memory constraints, support for printing floating-point and long data types via printf family
functions is not included.
Microcontroller Limitations
All Baselines
No Limitations
New!
12F629 No Limitations
12F675 No Limitations
16C84 No Limitations
16F627 2 RAM banks supported CUSTOMERS FEEDBACK
16F627A 2 RAM banks supported Your support has been
16F684 1 RAM banks, 1K program memory supported helpful as usual. I've never
16F690 2 RAM banks, 2K program memory supported regretted our purchase of ...
R.A.S.
16F84A No Limitations
16F877 2 RAM banks, 2K program memory supported
16F877A 2 RAM banks, 2K program memory supported
16F887 New! 2 RAM banks, 2K program memory supported More from our customers...
New to this release of HI-TECH PICC-Lite is our powerful integrated development environment, HI-TIDE 3.
HI-TIDE 3 has been designed to seamlessly integrate with HI-TECH PICC-Lite and provides a total HI-TECH Software proudly
development system complete with project manager, editor, code creation tool and debugger. HI-TECH supports the Microchip brand
Software provides HI-TIDE 3 free of charge for use with HI-TECH PICC-Lite. For more information about HI- with high quality C compilers.
TIDE 3, please see the HI-TIDE 3 product page. Visit the Microchip
Technology website for more
information.
HI-TECH PICC-Lite vs HI-TECH PICC STD Comparison Table
In effort to help customers identify and understand the differences between our HI-TECH
PICC-Lite and HI-TECH PICC STD compilers, we have developed a comparison table.
http://microchip.htsoft.com/products/compilers/PICClite.php (2 of 7)12/02/2008 17:32:22
Freeware Microchip PIC C Compiler
To determine which compiler best suits your project's needs, simply compare the two against
the features listed below.
Downloads
You may copy and redistribute this software, providing it remains in the same archive file. You may use this
software for any purpose. No warranty of any kind is provided, and all use is entirely at your own risk. Full
details of the licence under which it is supplied are provided within the download.
To install the Mac OS X version; save the demo to your system, then run the self installing archive file. For
further information, please refer to our support forum.
Compiler
Linux
HI-TIDE 3
HI-TIDE 3
(x86_64)
HI-TECH (compiler
(compiler
PICC-LITE not
not
V9.60PL1 included)
included)
(6.3 MB) V3.13 (52.8
V3.13 (52.4
MB)
MB)
Mac OS X
Manual
Release Notes
Conditions of Use
HI-TECH Software has provided this freeware HI-TECH PICC-Lite compiler as a low-cost tool for hobbyists
and students, however the licence allows its use for commercial purposes as well. It is ideal as a teaching
tool for an introduction into the 'C' language and embedded programing on a Microchip device. The selected
processors were chosen for this compiler due to their popularity.
You may copy and redistribute this software, providing it remains in the same archive file. You may use this
software for any purpose. No warranty of any kind is provided, and all use is entirely at your own risk. Full
details of the licence under which it is supplied are provided within the download.
StaccatoTM for
PICkit 2 Debug
Express (purchase
from Mapletech
Productions)
Mapletech Productions has collaborated with Microchip Technology Inc and HI-TECH Software to provide
http://microchip.htsoft.com/products/compilers/PICClite.php (6 of 7)12/02/2008 17:32:22
Freeware Microchip PIC C Compiler
Staccato for Microchip's PICkit 2 Debug Express (purchased separately). Harness the power of Staccato
for your PIC Micro-based embedded products, using HI-TECH's PICC C Compilers, with either Microchip's
MPLAB IDE or HI-TECH's HI-TIDE IDE. Learn this powerful C-Language method of programming your PIC
Microcontrollers now!
PIC-FAQ
This Version Produced: 29 Jun 1995 01:28:42 GMT
Last Modified: 29 Jun 1995 01:27:23 GMT
The following topics are addressed:
6.0) Attributions
------------------------------
------------------------------
Many moons ago, on an internet far away, the cry went out out;
Your humble scribe heard the cry and thought "Hey, while I'm growing
this beard, I've got *bags* of spare time. I mean, not shaving must
save *hours* a month. I'll give it a try."
[Filed under..yet another triumph for enthusiasm over experience.]
I had been lurking on the PIC mailing list for a while, when Jory Bell
asked if anyone would care to sort through the info he had archived and
produce an FAQ file from it and I volunteered, thinking that as the list
was relatively low-volume there would not be much involved.
Hah !
If not, write and tell me what changes you would like to see.
------------------------------
------------------------------
sci.electronics
comp.robotics
comp.realtime
sci.answers
comp.answers
news.answers
------------------------------
listserv@mitvma.mit.edu
------------------------------
Subject: Robotics
Newsgroups: comp.robotics
Subject: Electronics
Newsgroups: sci.electronics
Comments: There are a number of FAQs available in this newsgroup
on various subjects. Among some of the subjects covered
are: LCDs, stepper motors, etc.
------------------------------
REMEMBER ! If you choose to upload this FAQ to any BBS or ftp site,
then *YOU* are responsible for updating it regularly.
------------------------------
------------------------------
During the early 80s, GI took a long hard look at their business, and
restructured, leaving them to concentrate on their core activities, which is
essentially power semiconductors. Indeed they are still doing this very
successfully now. GI Microelectronics Division became GI Microelectronics Inc
(a wholly owned subsidiary), which in 85 was finally sold to venture capital
investors, including the fab in Chandler, Arizona. The venture capital
people took a long hard look at the products in the business, and got rid of
most of it - all the AY3- and AY5- parts and a whole bunch of other stuff,
leaving the core business of the PIC and the serial and parallel EEPROMs and
the parallel EPROMs. A decision was taken to restart the new company, named
Arizona Microchip Technology, with embedded control as its differentiator
from the rest of the pack.
As part of this strategy, the PIC165x NMOS family was redesigned to use one
of the other things that the fledgling company was good at, i.e. EPROM - the
concept of the CMOS based, OTP and eraseable EPROM program memory PIC16C5x
family was born.
Prior to that, the architecture had been a scientific curiosity since its
invention by Harvard University in a Defense Department funded competition
that pitted Princeton against Harvard.
Princeton won the competition because the MTBF of the simpler single memory
architecture was much better, albeit slower, than the Harvard submission.
With the development of the transistor and IC's the Harvard Architecture is
finally coming into its own.
------------------------------
Notes:
------------------------------
Protel tel:1-800-544-4186
Builder of EASYTRAX, which is a free-ware bbs:1-408-243-0125
PCB drawing Package
Call Ext 225 ask for Louise Markham.
..............................
Australia
Microchip Technology tel:61 03 890 0970
Product information
..............................
Czech Republic
MITE tel:42 49 5813 252
Hradek Kralove fax:42 49 5813 260
Stamp Products
..............................
Denmark
High Tech Horizon
Asbogatan 29 C fax: +46 431 108 81
S-262 51 Angelholm e-mail: cj@aristotle.algonet.se
SWEDEN
WWW : http://www.algonet.se/~cj/catalog.html
Stamp Products
..............................
Finland
High Tech Horizon
Asbogatan 29 C fax: +46 431 108 81
S-262 51 Angelholm e-mail: cj@aristotle.algonet.se
SWEDEN
WWW : http://www.algonet.se/~cj/catalog.html
Stamp Products
..............................
France
Arizona Microchip Technology SARL tel:33 01 6930 9090
2, Rue Du Buisson aux Fraises fax:33 01 6930 9079
F-91300 Massy, France
Product information
Selectronic tel:33 20 52 98 52
Lille Cedex fax:33 20 52 12 04
Stamp Products
..............................
Germany
Arizona Microchip Technology GMBH tel:49 089 609 6072
Alte Landstrasse 12-14 fax:49 089 609 1997
D-8012 Ottobrunn, Germany
Product information
Metronik GmbH
Leonhardweg 2 Tel: +49 89 61108 0
D-82008 Unterhaching Fax: +49 89 6117686
Rutronik GmbH
..............................
Greece
Peter Caritato & Associates tel:30 1 902 0115
Athens fax:30 1 901 7024
Stamp Products
..............................
Hong Kong
Microchip Technology Inc. tel:852 410 2716
Unit No. 2520-2525 fax: 852 418 1600
Tower 1, Metroplaza
Hing Fong Road, Kwai Fong
N.T., Hong Kong
Product information
..............................
Hungary
HUMANsoft tel:36 1163 2879
Budapest fax:36 1251 3673
Stamp Products
..............................
India
AL Systems tel:91 422 232 561
Coimbatore fax:91 422 213 849
Stamp Products
..............................
Israel
Elina Electronic Ltd tel:972 3 498 543
Tel Aviv fax:972 3 498 745
Stamp Products
..............................
Italy
Microchip Technology tel:39 039 689 9939
Product information
No further information is available at this time
..............................
Japan
Microchip Technology International Inc. tel:81 45/471-6166
Shinyokohama Gotoh Bldg. 8F, 3-22-4 fax:81 45/471-6122
Shinyokohama, Kohoku-Ku, Yokohama-Shi
Kanagawa 222 Japan
Product information
..............................
Netherlands
Antratek tel:31 1803 17666
Nieuwerkerk A/D ljssel fax:31 1803 16664
Stamp Products
..............................
Norway
High Tech Horizon
Asbogatan 29 C fax: +46 431 108 81
S-262 51 Angelholm e-mail: cj@aristotle.algonet.se
SWEDEN
WWW : http://www.algonet.se/~cj/catalog.html
Stamp Products
..............................
Portugal
DIGICONTROLE tel: 351-1-80 57 30
Av. Eng. Arantes e Oliveira 5 2D 351-1-848 4542
OLAIAS 1900 LISBOA fax: 351-1-849 0373
Electronic Distributor, including PIC's
..............................
Singapore
Microchip Technology tel: 65 222 4962
Product information
No further information is available at this time
..............................
South Africa
..............................
South Korea
Prochips tel:82 2 849 8567
Seoul fax:82 2 849 8659
Stamp Products
..............................
Switzerland
Wilke Technology tel:49 241 15 4071
Aachen fax:49 241 15 8475
Stamp products
..............................
Sweden
High Tech Horizon
Asbogatan 29 C fax: +46 431 108 81
S-262 51 Angelholm e-mail: cj@aristotle.algonet.se
SWEDEN
WWW : http://www.algonet.se/~cj/catalog.html
Stamp Products
..............................
Taiwan
..............................
U.K.
Arizona Microchip Technology Ltd tel:44 062-885-1077
Unit 3, Meadow Bank, Furlong Rd fax:44 062-885-0178
Bourne End, Bucks SL8 5AJ
Product information
..............................
U.S.
FAI tel:1-800-303-5701
Ask for Chris
Electronics distributor, carry PIC's,
------------------------------
2.4)
------------------------------
3) PIC Utilities
PICSTART-16B-1
Features
Supports only 16C5x, 16C71, and 16C84
comes with chips to play with.
has a zif socket
PICSTART-16C
Features
Same as 16B except *only* for 16C64 and 16C74.
------------------------------
PARALLAX
--------
Features
Parallax's own instruction set Their assembler takes either the
standard instructions or parallax 's 8051-like pseudo instructions.
needs only a 360k floppy, MS DOS 2.1, 128K RAM, mono.
simulator software.
These assemblers work with many other programmers.
PASM (5x), PASMX (xx), & PSIM, the emulator, are available free,
via the BBS, FTP & WWW sites.
------------------------------
ftp.ultranet.com /biz/mchip
alias ftp.ultranet.com/microchip
This is Microchip's own FTP site
Mirrored on;
ftp.mrc-bbc.ox.ac.uk /pub/microchip
wpi.wpi.edu /stamp
ftp.luth.se /pub/misc/microchip
ftp.oak.oakland.edu
ftp.uni-erlangen.de,
directory
[ /mounts/epix/public/pub/Multimedia/VideoCrypt
/microcontroller/microchip.bbs ]
Maintained by:
Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
http://www.lancs.ac.uk/people/cpaame/pic/pic.htm
http://www.lancs.ac.uk/people/cpaame/cpaame.htm
Both pages are 'under construction' and may include references to things
that don't exist, as yet.
------------------------------
Microchip BBS
Contact by dialling the same number you would use to get to
Compuserve at 19200,n,8,1, except that you press +<CR> at the
(garbage) prompt, followed by MCHIPBBS as the host (instead of CIS).
Parallax BBS,
(U.S.) (916) 624-7101.
------------------------------
Host m/c PC
Prog. Name ASPIC Shareware PIC assembler (reg = $100 CDN ($69 US))
**DESIGNED** for embedded controller design
the shareware license has an unusual clause absolving
those who only use it for non-commercial purposes
..............................
Host m/c PC i386 /MS DOS/SunOS 4.1.1/NeXTSTEP 3.0.
..............................
Host m/c Macintosh
Supplier
Micro Dialects Inc,
PO Box 190,
Loveland, OH 45140,
Ph: 513/271-9100.
Features:
An integrated text editor, assembler
and communications modules. fully supports macros,
automatic labels, local labels, conditionally assembly,
includes to 10 level deep.
The editor supports up to 10 open files at a time, full
search and replace including grep searches,
file size limited only by RAM available.
The emulator supports data transfer up to 38,400 baud.
..............................
Host m/c PC ?
Features
-libraries for RS232 serial I/O and precision delays
-allow call trees deeper than the hardware stack
Supplier
CCS 414-781-2794 ext.30
PO Box 11191
Milwaukee, WI 53211
(you leave your message on an answering machine)
Also from
Parallax Inc. <ftp.parallaxinc.com> fax:(916) 624-8003
3805 Atherton Road, Ste. 102 bbs:(916) 624-7101
Rocklin, CA 95765 USA Help 916-624-8333
Byte Craft Limited supply a C compiler for the PICs. A demo version for
the 17C42 is available ( assembly file generation only ).
MPC.ZIP <ftp.parallaxinc.com>
pricing:
GBP 695 / GBP 660 for members of the PIC owners club.
$795(US)
Contact:
Byte Craft Ltd., tel. (519) 888 6911
421 King Street North, fax (519) 746 6751
Waterloo,
Ontario,
Canada N2J 4E4
Also from
Parallax Inc. <ftp.parallaxinc.com> fax:(916) 624-8003
3805 Atherton Road, Ste. 102 bbs:(916) 624-7101
Rocklin, CA 95765 USA Help 916-624-8333
..............................
Host m/c PC
name: PSIM
Product programmer
Model Microburner 512
Supplier Baradine Products Ltd, tel:604 988-9853
PO Box 86757,
North Vancouver, BC CANADA V7L 4L3
Contact Garry Anderson <baradine@mindlink.bc.ca>
Features:
RS-232 terminal serial port compatible programmer
Supports communications up to 38,400 baud,
stand-alone or host operation, which can be from a 12VDC battery,
ie. if you're out at a remote site, standard 6 or 12 volt
batteries will do (even a car battery, but that's overkill!)
..............................
Product: emulators from GBP 350
programmers from GBP 200
Contact:
SMART Communications, tel:44 (0)81 441 3890
2 Field End, fax:44 (0)81 441 1843
Arkley, Barnet, Herts EN5 3EZ
England
..............................
Product Dataman Softy 4
Features:
With optional PIC module supports entire PIC16/17 range
Programs all chip specific features
Supports PICSEE
Programs from 1 word to whole memory
Disk of PIC support utilities included
Supports EPROMS, EEPROMS and Flash upto 8Mbits
Supports 16 bit EPROMS, EEPROMS and Flash upto 4Mbits
Supports serial EE 93 and 24 series
Easy to use
Free Support via Dataman BBSs in UK and USA
3 year warranty
Product Information:
The Dataman Softy 4 is the world's best selling handheld programmer.
With up to 4Mbit of internal memory, S4 can program EPROM, EEPROM and
FLASH devices of up to 8Mbit and 32 pins without adapters. The onboard
serial port can transfer files at up to 115200 baud from a host computer.
S4 also emulates memory devices of up to 4 MBit without additional hardware.
Using the optional PIC adapter set, all current members of the PIC16/17
..............................
Product M2L EZ-EP Programmer and EP-PIC Adapter
Product Information:
The EZ-EP is the world's best programmer for less than $200 (US). The
base unit programs E/EE/Flash EPROMs from 2716-27080. The EZ-EP is small
(3" x 6" x 1.5") and light (8 oz) so it is quite portable. It hooks to a PC
parallel port and adapters are available to do various microcontrollers
and etc. (68hc11, PIC, 8751, 16bit eproms, plcc eproms, serial eeproms).
Fastest programming modes are fully supported. Programs 27c010 in 23
seconds.
Pricing:
EZ-EP base unit $149.95
PIC adapter $49.95 (16c54,55,56,57,58,71,84)
..............................
PIC16C5x Real-time Emulator List Price: $599.00US
They also advertise gang programmers, etc. and may have a PIC17C42
product. It's worth a try, maybe, but if no-one tells *me* ? <shrug>
..............................
The Parallax Range
PIC16Cxx Programmer
Supports: 16C5x, 16C64, 16C71, 16C74, and 16C84.
Comes with Parallax and Microchip assemblers, a software simulator
and 18 and 28 pin LIF sockets.
Pricing:
Programmer (with docs. on disk only) $99
Optional
All cables, psu, and printed docs. $100
Adaptors
18/28-pin ZIF $69
40-pin ZIF (use with 16C64/74) $49
18/28-pin SOIC $129
20/28-pin SSOP $109
In-Circuit-Emulators
Features:
Both emulators allow the user to run code in-circuit at speeds
from 32-kHz to 20-MHz.
The user can set breakpoints, step through code and modify registers,
all while the code runs in-circuit.
The user interface is the same as the software simulator
but all execution occurs in hardware in real-time.
Pricing:
ClearView '5x $499
ClearView 'xx $499
Personality modules $100-$150
Filenames:
programmers
PEP.EXE (16C5x)
PEPX.EXE (16Cxx)
PEP17.EXE (17C42)
emulator
PSIM.EXE
All are included with the hardware products, and all
are available on the BBS and ftp site.
..............................
BP Microsystems tel:800-225-2102
Programmer CP-1128 tel:713-461-4958
No further information is available at this time
------------------------------
Microchip BBS:
In 3rd party library as PIC84PGM.ZIP
ftp://bode.ee.ualberta.ca
/pub/cookbook/comp/ibm/pic84pgm.zip
ftp://ftp.luth.se
/pub/misc/microchip/16c84/pic84pgm.zip
..............................
A programmer designed by Henk Schaer.
Host: faui43.informatik.uni-erlangen.de
Location:
/mounts/epix/public/pub/Multimedia/VideoCrypt/microcontroller
..............................
A design by Mark Cox:
Host ftp://baldrick.eia.brad.ac.uk:
Location:
/pub/blowpic.zip
..............................
A design by Russ Reiss appeared in the article "Programming PICs on a Budget"
in the June 1994 issue (i.e. #47) of "Circuit Cellar Ink".
..............................
A Design published in ETI (Electronics Today International) magazine
SPEC: Reads, programs, and verifies PIC 16C54, 55, 56, 57,
58, 64, 71, 74, 84 and any other upcoming 18, 28, or
40 pin PIC device which conform to the current PIC
serial programming specification.
Reads and programs EEPROM device data areas.
Fully supports user data area and configuration fuses.
Serial interface to host PC.
Windows host software available.
Loads and saves Intel hex , hex text and binary file
formats produced by Microchip Assembler (MPPASM).
(If you (can) order the article alone (not the entire magazine) bear )
( in mind that the PCB foils are usually at the back of the magazine,)
( and not in the article itself. )
If you send a blank 16C57XT/16C57JW and a cheque for the sum of 20GBP,
together with a SAE, the author will return the PIC programmed and a
3.5" high density floppy disk with the host software suitable for
Windows 3.1 or 3.11.
..............................
PROTO-TYPING BOARDS
------------------------------
------------------------------
Computer Design
industry announcements and trends
One Technology Park Drive,
P.O. Box 990, Westford, MA 01886
(508)692-0700
Electronics Now
- construction articles
- Box 55115, Boulder, CO 80321-5115
- $19.97 one year
Elektor Electronics
- programming and construction articles
- World Wide Subscription Service Ltd
Unit 4, Gibbs Reed Farm, Pashley Road
Ticehurst TN5 7HE, England
- 27 UK pounds
or
- Old Colony Sound Lab,
- P.O. Box 243, Peterborough, NH 03458
- Tel. (603) 924-6371, 924-6526
Midnight Engineering
- 1700 Washington Ave., Rocky Road, CO 81067
- (719)254-4553
------------------------------
------------------------------
ED Teck. Pubs
Fred Eady
407-454-9905
BBS 407-454-3198
Writes articles for popular magazines. Has a PIC programmer kit for $70.
BBS available, good source of information, very helpful.
Parallax
Stamps and programmer, etc.
BBS 916-624-7101
Help 916-624-8333
AP Circuits
BBS 1-403-291-9342 (Canada)
Can download EASYTRAX(V2.06), various utilities, GERBER file proofers, etc.
------------------------------
All PIC instructions take a single instruction cycle (four oscillator cycles)
to execute, unless a conditional test is TRUE or the program counter is
changed as a result of an instruction, in this case the execution takes two
instruction cycles. For example:
movlw 37
goto next
next: movwf porta
The goto instruction takes two cycles (1 to get the value of label "next" and 1
to load that value into the program counter) This is useful as a two-cycle NOP,
and is often written as "goto .+1" to avoid the need for a label.
If you want the result in both W and the register, you can use either:
incf foo,w
mowwf foo
or:
incf foo,f
movf foo,w
The stack is not accessible to the programmer in any way other than the
call and return instructions. There is no way to push or pull data, or even
to examine the stack pointer. On the 16C5x family the stack has only two
levels, so it is frequently necessary to write code in a different style than
would be used on a typical processor; you can only call subroutines from your
main code, or from a subroutine called from main, but no deeper. If you try
to make a 3rd CALL, the 2nd return address is over-written so that the return
from the 3rd CALL is OK but the return from the 2nd CALL ends up where the
1st CALL should return to.
The 16C5x family doesn't have a normal return instruction; instead it has
RETLW, which stands for RETurn Literal Word. RETLW loads an eight bit
constant into W (just as a MOVLW instruction would), then returns from the
subroutine. This can be useful, but is aggravating if you want to return a
computed value. On the newer PIC families there is a normal RETURN
instruction.
With the exception of the 17Cxx family, there is no way for software to read
an arbitrary location of program memory. In order to implement lookup tables,
it is necessary to combine the use of the ADDWF and RETLW instructions. For
example, the following code implements a lookup table of the first four odd
prime numbers:
To use the table, load the appropriate index (in this case, 0 to 3) into W,
and "call primes". The addwf instruction adds the contents of W to the PC,
which has already been incremented to point to the "retlw 3". The table will
return with the value in W. The total time taken is 6 instruction cycles, or
24 oscillator cycles.
Note that while on most processors the use of an out-of-range index will
result in the use of incorrect data, but the program execution will continue
normally, on the PIC a bad index value will cause the execution of arbitrary
instructions!
Normally the index would range from 0 to the size of the table minus one,
but it is possible to use other ranges by putting the retlw instructions
somewhere other than immediately following the "addwf pcl". It is also
possible to implement tables using a "subwf pcl", or perhaps other
instructions with pcl as the destination.
The subtract instructions (SUBWF and SUBLW) work differently than most people
expect. SUBWF subtracts W *from* the contents of the register, and SUBLW
subtracts W *from* the literal. (SUBLW is not available on the 16C5x family.)
addlw 0feh ; w := w - 2
addlw -2
There is no instruction to take the two 's complement of W (like the NEG
instruction on Motorola processors), but because of the way the subtract
instructions work you can use:
sublw 0
On the 16C5x family, the CALL instruction can only address the first 256 words
of a bank of program memory. It is common practice to use "call extenders",
which are simply GOTO instructions in the first 256 words with a target in
the last 256 words.
On the 16C57 and 16C58, if you plan to use indirect addressing (via the FSR
and IND registers), it is vitally important that your reset code clear FSR
before using any other RAM locations. Otherwise you may start up in an
arbitrary bank, and as soon as you change FSR all your carefully set up
variables will effectively disappear.
------------------------------
------------------------------
------------------------------
DATA 010010100000B+STATUS+256*((LABEL>>9)&00000001B)
DATA 010011000000B+STATUS+256*(LABEL>>10)
CALL LABEL
DATA 010010100000B+STATUS+256*((($+2)>>9)&00000001B)
DATA 010011000000B+STATUS+256*(($+1)>>10)
ENDM
------------------------------
DATA 010010100000B+STATUS+256*((LABEL>>9)&00000001B)
DATA 010011000000B+STATUS+256*(LABEL>>10)
GOTO LABEL
ENDM
------------------------------
Swapping W with a File (RAM) register (PIC 16Cxx) Sometime you need to swap
the data in W with that in RAM, a port, or a special purpose register (i.e.
W<->F). This may appear to be easy with a few MOV instructions and a
temporary RAM location, but when you sit down to code it you'll see that
it'll take *two* temporary locations and 6 instructions to shuffle the data
around using only MOVs. So, like many things with a PIC program, an
unconventional technique can be really useful... like this:
XORWF file,w
XORWF file,f
XORWF file,w
Try it on paper until you're convinced it will work. Remember that XORing
the W+F+F leaves a result of the original value of W (the two xors with the
same data cancel out, so the final result is W xor 0 = W). The sequence
affects the Z flag, of course (one that had a MOVFW in it would as well), but
not in a particularly useful way.
This will work as-is with a port which is set for all output. The port will
be read 3 times, but written to only once during the second instruction. If
the port has some bits set for input, the result left in W for the input bits
is probably going to be wrong. (I'll leave it to you to analyze the
situations when it happens to be right) A correct read of the input bits can
be done with a conventional MOVFW after the routine is used to update the
output bits.
Understanding this, I now present the logical extension: swapping two file
registers. This is tremendously useful to indirectly index two data sets at
the same time (didn't think that was do-able, eh?)
The obvious approach is to use the routine above three times, assuming
you wrote it as a macro:
swapwf FSR
swapwf fsr2
swapwf FSR
So this is 9 instructions, but W is not affected, and no temporary RAM is
required. If you can tolerate losing the value in W while swapping the
files, then this shorter version will also work:
MOVFW FSR
swapwf fsr2
MOVWF FSR
This is a total of only 5 instructions, 1 less than the conventional method.
Allocating a temporary location to store W during the swap would add 2 more.
Everything is a trade-off, I suppose.
------------------------------
This trick concerns multiple precision addition (i.e. 16, 24, etc. numbers)
The ADDWF instruction adds two numbers, and sets the C flag if there is a
carry out. But there is no instruction that adds W+F+C to carry the carry
throught the higher bytes. There is an easy work-around for 16 bit numbers:
simply increment one of the numbers before adding if the C bit is set. This
is adequately detailed in the Microchip application notes, but I'll show it
here for reference:
The problem with this technique is that it cannot be used for numbers larger
than 16 bits because the C flag will not be set properly at the conclusion
of the last 3 instructions. In particular, if resulth is FF and C is set
going in, C will be incorrectly clear at the conclusion of the operation.
(Don't you wish it was YOU and not your customer who was the first to try
that?) No big problem with the 16 bit add, the result will still be correct,
but the overflow won't be indicated.
The best way around this I could think of was to use this 4-instruction
sequence instead of the 3-instruction one above. I think there are other
4-instruction sequences that do essentially the same thing. Then a 24, 32,
etc. bit add can be carried out (pun intended?) by using this sequence for
the "middle" bytes. The faster skpnc/inc/add above can be used for the last
byte if having a proper carry out of the whole operation is not required.
------------------------------
6) Attributions
Thanks are due to the following who have contributed to this documention.
------------------------------
Disclaimer: Inclusion of any code samples in this document does NOT imply
any approval or guarantee as to the suitability of said samples for any
purpose whatsoever other than as a self-training aid. I.E. If it blows your
ICE, trashes your hard disc, wipes your backup, burns your building down or
just plain don't work, #### IT AIN'T MY FAULT #### In the event of judicial
ruling to the contrary, any liability shall be limited to the sum charged on
you by me for the aforementioned document OR nothing, whichever is the lower.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Except where otherwise stated, this document Copyright (c) 1994,95 by
T.A.Kellett, [T.A.K.DesignS Warrington UK ] all rights reserved.
This FAQ may be posted to any USENET newsgroup, on-line service, or BBS as
long as it is posted in its entirety including this copyright statement.
This FAQ may not be distributed for financial gain.
This FAQ may not be included in commercial collections or compilations
without express permission from the author(s).
_______________________________________________________________________________
Tom Kellett < Tom@takdsign.demon.co.uk >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Welcome! You've just entered WebRing, a pioneer in social networking. Since 1994, our members have created over 40,000
communities visited by three million people a month. What can you do with WebRing?
Visit our new WebRing Member Blogs! Create your own blog!
Search Search our communities The Shoutbox: Connect with Others - Most all of you have
noticed the WebRing Shoutbox by now. Whether logging in to your
account or checking the homepage, there is a gray box that says, "Let
Business Arts & Entertainment your words be heard."We... 25 minutes ago
What Is an Activity Score? - If you've logged into your
WebRing account lately, you probably noticed a new stat on your
account page: Activity Score! 25 minutes ago
Multiple URLs Require Multiple NavBars - In our last
Health Pets Tech Tip, we shar... 25 minutes ago
1 NavBar, Multiple Rings - When it comes to placing SSNB
NavBars on your web page (URL), ONCE IS ENOUGH!The SSNB is
Browse all communities the version of the NavBar that we at WebRing prefer youto use. It is
built with JavaScript, a ... 25 minutes ago
Kingdom Hearts
Christmas Cheer
Nigel Olsson
New Haiti
Camotes Island
American Beauty
Spirituality
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
Judging Your challenge for this round is to create your choice of a single page or a website with up to three
Prizes pages that explores the theme of Valentine's Day. Likely topics include:
Romantic Getaways
Cupid
Love Advice
Take our
Survey Of course, these are just suggestions. Ultimately, you should let your love and creativity guide you.
Judges (public and celebrity alike) are sure to award extra points for originality.
One last note: Round 2 is for competitors and audience of all-ages, so entries including erotica will
be flagged.
Specs
Here are the specific requirements for your Show Us Some Love entry:
Create a new folder under public_html, IWM2, to store your website. The website file name
must be love.htm or index.htm (or php, etc) . So your website will be found at
http://www.ironwebmaster.com/~IWMID/IWM2/love.htm (replace the IWMID with your ID,
and index.htm/php if you use that).
You are not currently registered as an Iron WebMaster competitor. If you wish to be, please
register now.
Designing has begun for round 2, but we're still accepting regsitrations until February 4.
To register please SIGN UP using the link to your left, or SIGN IN if you already have an Iron
WebMaster id.
Copyright 2008 Iron WebMaster, All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy.
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
http://dir.webring.com/dir12/02/2008 17:32:56
http://dir.webring.com/help?search&searchterms=hub
If you are unable to find a question that fits your issue, try searching our help documents below:
Go!
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
http://dir.webring.com/help?search&searchterms=hub12/02/2008 17:32:59
login
Password:
Remember my ID on this computer
Sign In
New to WebRing?
Sign up now to be a part of WebRing
WebRing - Follow, join or create a ring of your own!
Elevate your web site's search ranking with mainstream search engines.
Drive highly targeted people to your web site.
Network with your selected Community.
Track your favorite Communties with your WebRing User ID.
Participate in other WebRing Communities with your WebRing User ID.
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
http://o.webring.com/login?login12/02/2008 17:33:06
http://o.webring.com/cgi-bin/mailafriend?url=http%3A%2F%2FC%2Ewebring%2Ecom%2Fhub%3Fring%3Dpicmicro
Note: WebRing does not store these email addresses after sending.
Friend:
Friend:
Friend:
Friend:
Friend:
From:
Message:
The following URL will be listed at the bottom of the email for your friends to visit:
http://C.webring.com/hub?ring=picmicro
Send Cancel
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
Add to Google
PICmicro Sites
A collection of websites about the Microchip PIC microcontroller and related projects.
http://O.webring.com/hub?ring=picmicro&rss
Google offers two different ways to keep up-to-date with your favorite sites:
Your Google homepage brings together Google Google Reader makes it easy to keep up with the
functionality and content from across the web, on a latest content from a large number of sites, all on a
single page. single reading list.
Add to Google homepage Add to Google Reader
or
http://www.google.com/ig/add?feedurl=http%3A//O.webring.com/hub%3Fring%3Dpicmicro%26rss12/02/2008 17:33:36
My Yahoo! - Add PICmicro Sites
PICmicro Sites
- 3 months ago
Prefer updates via your mobile phone, email, or instant message? Add an Alert
http://e.my.yahoo.com/config/cstore?.opt=content&.url=http%3A//O.webring.com/hub%3Fring%3Dpicmicro%26rss12/02/2008 17:33:39
http://f.webring.com/profile?y=uandmekids
Member: uandmekids, last active: 1.91 day(s) ago. Email status: verified Has unread wrmail: , wrmail last read: 20080210, wrmail last received:
20080211 Contact member
If you hold membership in a Ring managed by this ID, please do not use the link on this form to make contact. Due to way
these Rings are administered, it is imperative that members contact us through the Contact Ring Manager link in site management.
You will find that by clicking on your site's title when you are viewing the list of Rings you have joined.
If you are not a member, but need to contact the RingMaster, we need your help. Too many vague inquiries are being
received and we cannot answer these. Please be sure, if asking about a Ring, to include the hub URL, not just a title, please. If you have a
concern about a member, include the specific URL, please. And be as precise in your description as possible. Don't worry about being
brief, shoot for being thorough.
We really need your cooperation in order to answer your inquiry accurately and promptly.
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
http://f.webring.com/profile?y=uandmekids12/02/2008 17:33:42
addsite
Continue >
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
http://c.webring.com/cgi-bin/drive?done=http%3A%2F%2FC%2Ewebring%2Ecom%2Fwrman%3Fring%3Dpicmicro%26addsite?ring=picmicro&addsite12/02/2008 17:33:45
Ads by Google
Advertising Programs
Ads by Google are contextually relevant advertisements that appear beside related content on the page. The web publishers who display Ads by Google are part of the
Google AdSense program, and the ads come from Google's base of AdWords advertisers.
Want your business to appear in Ads by Google? Try AdWords Want to serve Ads by Google on your site? Try
AdSense
Reach people who are interested in information related to your products and
services Get paid for displaying Google ads that are relevant to your
Drive new customers to your site in minutes site's content
Easily control costs - pay only for clicks that bring customers to your website Customize ads to complement the look and feel of your site
Track the success of different formats and locations with online
reports
Send Google your thoughts on the site or the ads you just saw
http://services.google.com/feedback/abg?url=http://o.webring.com/hub%3Fring%3D...amming+solutions&adU=www.LuminaryMicro.com&adT=Luminary+Micro+Stellaris&done=112/02/2008 17:33:54
FlexiPanel Ltd
Creativity in Silicon
TEAclippers
TEAclippers
Programming PICs & Stamps Is So Easy!
device programmed.
Powered in-situ by target circuit Buy from DigiKey
TEAclipper USB adapter used for
charging TEAclippers with firmware. Buy from Mouser
Supported Microcontrollers
TEAclipper/ HexWax
TEAclipper/StampTEAclipper/USB
PIC Explorer
TEAclipper/
How to Make Your Products
USB
TEAclipper-Ready at Zero Cost
drivers
The last date for registration on the second (and final) phase of the RapidiTTy Builder "Early Bird programme" is 14 March.
('EB2' provides you with approx. 2000.00 of RapidiTTy software - incl. RapidiTTy Professional - for just 395.00 + VAT)
Places on this programme are strictly limited (100 seats). A product brochure is available.
RapidiTTy Education
http://www.tte-systems.com/products.php?gclid=CMyH9fOJv5ECFRjaXgod9ltV4Q (2 of 18)12/02/2008 17:34:06
TTE Systems
RapidiTTy Preview
February 2008
RapidiTTy Builder: Registration for "Early bird" (Phase 2) opens (closes 14 March)
March 2008
RapidiTTy Builder 0.9: Product update (Early Bird). Adds support for Cortex M3
RapidiTTy Lite 1.1: Product update. Adds further sEOS examples, improved installer
April 2008
May 2008
June 2008
July
October
They can choose to implement their design using a "field-programmable gate array" (FPGA) and a "soft" processor core.
For developers interested in the COTS option, RapidiTTy Lite provides an excellent starting point.
As the cost of FPGAs continues to fall, the opportunity to implement embedded systems using soft processor cores is becoming of increasing interest. For developers who wish
to use such cores, RapidiTTy FPGA 1.1 has the following key features:
Includes the PH 03 soft processor core with an architecture that is familiar to many developers
Minimises the effort involved in precise timing analysis (including worst-case execution time measurements)
Has a familiar, flexible RapidiTTy IDE, helping to ease the transition between COTS- and FPGA-based development
We say more about the features of RapidiTTy FPGA 1.1 below. However, you don't need to take our word for it: you can download RapidiTTy FPGA Lite (free of charge from
our storefront or directly from this website) and explore the features of our RapidiTTy FPGA products for yourself.
The RapidiTTy FPGA package includes a license for the full VHDL source code for the PH 03 "soft processor core".
The PH 03 soft core is a 32-bit design with 32 registers and a 5-stage pipeline.
Predictable instruction execution time (each pipeline takes a single clock cycle)
Low cost
Hardware specifications
UART
Information about education versions of the PH core is available on our Education page.
Product brochure
For further information about RapidiTTy FPGA 1.1, please refer to the brochure for this product.
For further information about RapidiTTy FPGA 1.1, please refer to the User Guide for this product.
RapidiTTy FPGA provides partial support for the examples in PART G of the RD-DES book project.
Licensing options
Our most popular licensing arrangement is what we call the "12-month / 1000-core" license. Briefly, this provides access to RapidiTTy FPGA 1.1 (including the PH 03
source) for use on a single desktop PC. The license lasts for 12 months, or until you have created 1000 products based on the PH 03 core. This cost of this license 1950.00 +
VAT.
The above text provides an informal summary of one of the licensing options for this product. For further details (or to discuss other licensing opportunities) please contact us.
Support
The purchase price of RapidiTTy FPGA 1.1 includes 12 months of e-mail support.
To purchase RapidiTTy FPGA 1.1 (or obtain further information), please contact us.
What's the first thing you do when you install a new compiler or buy a new processor board?
We find that many of our customers tend to start gaining familiarity with a new development environment by setting up code to flash an LED. When we ask them how long it
takes to do this with a new set of tools, the typical answer is "before we had RapidiTTy Builder, it took around a day".
If we then ask them how long this process takes using RapidiTTy Builder, the usual reply is "around a minute".
Of course, RapidiTTy Builder doesn't just help you to flash LEDs. The first release of this product (v0.8) provides:
Full source code for two simple, resource-efficient operating systems (sEOS, TTCos) suitable for use in single-processor embedded systems
Full source code for the SC-TTCos operating system, for use with distributed (multi-processor) embedded systems interconnected using the controller area network
(CAN) bus.
An extensive suite of high-quality library code covering day-to-day tasks such as reading switches, controlling LCD displays, reading analogue-to-digital convertors, RS-
A high-quality, flexible, library for Ethernet communications, fully integrated with the above operating systems
The TTE Builder engine which helps the designer integrate, customise and configure the library code to match the precise needs of the given application.
Full support for the examples in Part A and Part B of the RD-RES book project.
Product brochure
For further information about RapidiTTy Builder, please refer to the brochure for this product.
We believe that RapidiTTy Builder provides a unique set of features which support the rapid development of reliable embedded systems, without requiring large memory or
CPU resources: for our customers, this translates directly into reduced development time and allows use of lower-cost microcontrollers.
You can try out some of features of RapidiTTy Builder by downloading RapidiTTy Lite (without charge and without the need to register).
Please note: RapidiTTy Lite contains a restricted set of code examples (for example, extensive library code for Ethernet and CAN is included with RapidiTTy Builder: these
libraries are not included with RapidiTTy Lite). In addition, RapidiTTy Lite does not include the TTE Builder engine (used in RapidiTTy Builder to support the rapid
creation of reliable custom code from the libraries): instead, code in RapidiTTy Lite must be assembled and tested manually.
The first release of RapidiTTy Builder (v0.8) will be in February 2008, under our "early bird" release programme.
Customers who have registered (and paid for) a place on EB1 will receive their first products in the week beginning 11 February.
Full product pricing for RapidiTTy Builder 1.0 will be 495.00 + VAT per seat. This product will be released in April 2008.
The first release of RapidiTTy Builder (v0.8) is through our "early bird" release programme.
The second (and final) phase of the early-bird programme (EB2) will provide registered customers with access to v0.8 of this product at a cost of 395.00 + VAT per seat.
Under this programme, customers receive what we call "enhanced maintenance" (which includes provision of both minor and major product updates): this maintenance
continues for 12 months after RapidiTTy Builder 1.0 is released. This means that early-bird registrants receive v0.8, v0.9 and v1.0 of RapidiTTy Builder: they also
receive all available product updates and revisions to this product in the year following the release of RapidiTTy Builder 1.0.
Please note: Customers registered on the early-bird programme for RapidiTTy Builder will also receive copies of RapidiTTy Professional 1.0 when it is released in
October 2008. Maintenance of the professional product will also be provided (until the end of enhanced maintenance period). Full product pricing for RapidiTTy Professional
Summaries of the features of the early releases of RapidiTTy Builder are given below.
Full source code for two simple, resource-efficient operating systems (sEOS, TTCos) suitable for use in single-processor embedded systems
Full source code for the SC-TTCos operating system, for use with distributed (multi-processor) embedded systems interconnected using the controller area network
(CAN) bus.
An extensive suite of high-quality library code covering day-to-day tasks such as reading switches, controlling LCD displays, reading analogue-to-digital convertors, RS-
A high-quality, flexible, library for Ethernet communications, fully integrated with the above operating systems
The TTE Builder engine which helps the designer integrate, customise and configure the library code to match the precise needs of the given application.
Full support for the examples in Part A and Part B of the RD-RES book project.
RapidiTTy Builder 0.8 will support a limited number of LPC2xxx (ARM7) targets.
The RapidiTTy Builder early-bird programme provides our customers with an extended period of product evaluation, backed up by excellent technical support. This programme
also provides the opportunity for customers to influence the final feature set of the RapidiTTy Builder product. To encourage participation, we offer this programme at the
lowest possible cost. In return, we will ask for product feedback from members of the programme.
The success of our early bird schemes (for both parties) relies on the fact that we work with a small number of customers: the programme has two phases and there is a strict
Registration for the second (and final) phase of this programme ('EB2') is now open. This phase will close when we reach 100 places (or on 14 March 2008, whichever comes
After EB2 closes, pre-orders for RapidiTTy Builder 1.0 will be accepted at 495.00 + VAT per seat. The orders will be subject to standard maintenance arrangements (details
Places on the EB2 programme can be reserved by e-mail (bookings received by e-mail on the closing date will be honoured if we have space available): however, places will only
Certain restrictions apply to bookings on this programme (for example, we reserve the right to limit the number of places booked by a single company, in order to ensure that
The limit of 100 seats on EB2 will be strictly enforced. To reserve your place on the EB2 programme, please contact us as soon as possible.
RapidiTTy FPGA Lite provides an ideal starting point for developers who wish to explore the use of soft processor cores in the development of reliable embedded systems.
RapidiTTy FPGA Lite has all of the features of RapidiTTy FPGA with the exception that - in RapidiTTy Lite - the PH 03 core is released in encrypted form, under the terms
of a non-commercial license.
For further information about RapidiTTy FPGA Lite, please refer to the RapidiTTy FPGA Lite User Guide.
RapidiTTy FPGA Lite provides partial support for the examples in PART E of the RD-DES book project.
Starter kits and related hardware for use with RapidiTTy FPGA Lite
License
Installation and use of RapidiTTy FPGA Lite requires acceptance of the RapidiTTy FPGA Lite licence agreement.
Support?
Download
RapidiTTy FPGA Lite can be downloaded without charge from our storefront or directly from this website (no registration is required in either case).
RapidiTTy Lite 1.01 is a simple but complete development tool based on the industry-standard Eclipse IDE and incorporating a GCC ARM compiler. The compiler supports a
RapidiTTy Lite 1.01 can be downloaded without charge from our storefront or directly from this website (no registration is required in either case).
A key feature of RapidiTTy Lite 1.01 is that the package includes a number of complete example programs which target the popular NXP LPC2129 processor. The
examples include a simple "real-time operating system" (sEOS). The examples match the cost-effective LPC-P2129 development board from Olimex Ltd: they can be
adapted for use with other boards (and other processors) without difficulty.
Developers who are new to embedded systems will find that RapidiTTy Lite 1.01 provides full support for the examples in Part A of the RD-RES book project. This provides
an easy way to gain familiarity with development techniques suitable for use with modern, resource-constrained embedded processors.
For further information about RapidiTTy Lite 1.01, please refer to the User Guide for this product.
Starter kits and related hardware for use with RapidiTTy Lite 1.01
A complete starter kit for RapidiTTy Lite is available from SK Pang Electronics. This starter kit includes the RapidiTTy Lite CD. It also includes an Olimex LPC-LPCP2129
board plus Olimex USB-based (JTAG) debugger hardware and all necessary cables.
In the Netherlands, you can buy Olimex LPC2129 boards and JTAG debuggers from Van Ooijen Technische Informatica.
In the US, you can buy Olimex LPC2129 boards from MicroController Pros Corporation, or from SparkFun Electronics.
Also in the US, you can buy Olimex JTAG debuggers from SparkFun Electronics.
A full list of the international distributors of Olimex products is available from the Olimex WWW site.
Download
RapidiTTy Lite 1.01 can be downloaded without charge from our storefront or directly from this website (no registration is required in either case).
RapidiTTy Lite 1.01 is also available on a low-cost CD from our storefront. Please note that the contents of the CD (setup files and program documentation) and product
license are identical to those available via the free download (we provide the CD option primarily for customers who have a very slow and / or unreliable internet connect and
RapidiTTy Lite 1.01 is a free evaluation product and has no formal support programme (sorry).
Please refer to our RapidiTTy Lite 'Support and FAQ' page if you are having difficulty downloading, installing or using this product.
Th Support and FAQ page includes a facility for reporting suspected bugs or other issues.
License
Installation and use of RapidiTTy Lite 1.01 requires acceptance of the RapidiTTy Lite licence agreement.
RapidiTTy Professional
RapidiTTy Professional will be based around our new TTE compiler, providing support for both "standard" C and Ctt (a version of the C language with highly-predictable
http://www.tte-systems.com/products.php?gclid=CMyH9fOJv5ECFRjaXgod9ltV4Q (16 of 18)12/02/2008 17:34:06
TTE Systems
timing behaviour). Further details will be released on this web site later this year.
Customers registered on the early-bird programme for RapidiTTy Builder will receive copies of RapidiTTy Professional 1.0 when it is released in October (without charge).
Members of the RapidiTTy Preview programme will have access to the first release of RapidiTTy Professional in June 2008.
Customers who purchase RapidiTTy Builder products this year will have the opportunity (if the wish) to upgrade to RapidiTTy Professional at low cost.
Please note that - while we will offer a cost-effective upgrade path in October 2008 - our "Professional" products are not intended as replacements for our "Builder" products
(indeed we plan to expand both our "Builder" and "Professional" ranges in 2009 and 2010).
The RapidiTTy Education programme provides cost-effective access to RapidiTTy products for universities and colleges.
Please see our education page for further details of this programme as well as related information about course notes, textbooks and presentation slides.
Launched in 2007, the RapidiTTy Preview programme provides registered members with an introduction to the use of time-triggered technology in resource-constrained
embedded systems, free training and access to beta versions of future products from TTE Systems.
The current phase of the RapidiTTy Preview programme will continue to operate until June 2009. However, this programme is no longer open to new members (sorry).
Existing members of the RapidiTTy Preview programme should already have received full information about product releases planned for 2008. If not, they can obtain this
Member
Forgot your password?
Login
Member No Password
Read our
Quick Search
success stories!
I'm a man
Members who
seeking have found
a woman
true love!
Country Any Country Men's Gallery Women's Gallery
About Us | Contact Us | Success Stories | Other Sites | Terms of Use | Privacy Statement | Dating Safety | Site Map | Browse | Corporate | Affiliates
This site also available in: Dutch | Finnish | French | German | Japanese
Visit Our Other Sites - AfroIntroductions.com | AsianEuro.com | BigCupid.com | BrazilCupid.com | ChineseLoveLinks.com | ChristianCupid.com | ColombianCupid.
com | DominicanCupid.com | FilipinaHeart.com | GayCupid.com | HongKongCupid.com | IndonesianCupid.com | InterracialCupid.com | JapanCupid.com |
Cupid Media, the Cupid Media Logo and AsianEuro are trademarks of Cupid Media Pty Ltd.
Asian Women - If you are looking for a site that offers you Asian dating and the chance to meet Asian
singles living around the world, then you have come to the right place! Our online Asian dating community is
full of people of Asian origin looking for different types of relationships ranging from dating or marriage to
friendship and penpals. This a great network to join if you are a single Asian, or someone interested in
dating Asian singles. With AsianEuro.com you can meet Asian women, find your Asian bride, make friends...
its all here at AsianEuro.com.
Asian Mail Order Brides - AsianEuro.com is a top class Asian dating service and not an Asian mail order
bride service. We have created a network of members looking for Asian and Asian American dating with
single people from Asia and all over the world. Our dating service includes numerous chat services where
users will surely find Asian women for marriage, an Asian girlfriend for romance, and most importantly Asian
singles to love and start a lasting loving relationship with. So don't use an Asian mail order bride service to
find your Asian bride, use our sophisticated Asian dating service to find a loving Asian woman for a long
term relationship leading to marriage.
Asian Chat Rooms - If you like to spend time in Asian chat rooms then you have come to the right place!
We specialize in bringing together Asian women and men in search of dating, love and marriage. Our site
allows you to chat with like minded Asian members in our Asian chatroom. Join us today for a fully
interactive asian chat experience..
Asian Wife - If you are looking for an Asian wife then our site is one of the best places to find true love.
Thousands of Asian ladies are seeking loving men to be their husbands at our site. Not only do we have a
large collection of online Asian personal ads, we also feature extensive photo galleries, chat rooms,
translation services and many more features to help you find the perfect Asian bride. What are you waiting
for? Join free today!
Online UK Dating
Find Single In Your Area. Free Membership.
www.MyUKDate.com
TELL A
SEARCH WEBRING: This WebRing All
FRIEND!
Computers & Internet > Hardware Add this feed:
PICmicro Sites Add Your
Manager: uandmekids Web Site.
Join Here!
Iron WebMaster
A collection of websites about the Microchip PIC microcontroller and related projects.
example: jonathan's PIC ASM and PC Programming Project - **Updated 5/17/07** On
Round 2 VOTING
this web site you will find code, libraries, programs, and accompanying projects using PIC
Assembly Language. The keynote project is a PC based Oscilloscope I call the
PPMScope. Get in on the Action!
Ads by Google WebRing Rating Survey
PIC Programmers Responses to: Which of these statements best
Low cost PIC programmers and kits Many PIC chips, kits, books & describes your experience(s) with this Ring?
tools. www.electronics123.com
Easy to navigate with interesting sites.
Hytronic Electronics
44% (138)
Electronic Transformer Various Ballasts and Motion Sensors. www.
hytronik.com Easy to navigate with OK sites.
14% (46)
Amazing PIC programmer
Just $32, most devices supported ICSP, SQTP, copy-limit features. Easy to navigate but poor sites.
www.flexipanel.com 4% (15)
School Bell, Ring Class Change Factory Break or School Bells. www.ats- 12% (39)
usa.com hard to navigate with OK sites.
12% (37)
hard to navigate and poor sites.
10% (32)
picsystems
this group is about PIC projects.
Andy Programming
View and get updates of current and future projects, download source code for both windows and dos.
Robotics UK
Welcome to robotics UK, i'll show you how to use a PIC in robotics
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
Welcome, Guest
Join the Craze!
TopicCraze Search:
Robotics UK
Welcome to robotics UK, i'll show you how to use a PIC
in robotics
EHL elektronika
Free PIC downloader for W95/98/NT compatible with the
HI-TECH or Shane Tolmie bootloader for the PIC16F87x
processors.
GNUPIC
GNUPIC is the open source project that aims to create
PIC developement tools.
Copyright 2008 TopicCraze, Inc. All rights reserved. Terms of Service - Help
http://www.topiccraze.com/topic?topic=picmicro (3 of 4)12/02/2008 17:34:47
PICmicro Sites
PICmicro Sites
Prev | Ring Hub | Join | Rate |
Next
WebRing Inc. Search
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
Make MONEY!
Add
Pay-Per-Play
ads to your website
Make MONEY!
Add
Pay-Per-Play
ads to your website
Details
Date Ttl hits Page Vws Next5 List Next Prev Skip Skip Prv Random Go
20080129 831 480 75 405 33 6 3 14 4 291
20080130 693 406 102 304 46 9 2 13 2 215
20080131 751 399 74 325 39 8 1 3 2 299
20080201 628 366 79 287 26 7 0 3 1 225
20080202 763 448 78 370 55 17 6 15 3 219
20080203 516 318 92 226 32 4 0 3 2 157
20080204 653 354 90 264 80 23 6 10 1 179
20080205 678 402 92 310 17 13 1 7 1 237
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
Iron WebMaster
A collection of websites about the Microchip PIC microcontroller and related projects.
Round 2 VOTING
Ads by Google
PIC Programmers
Low cost PIC programmers and kits Many PIC chips, kits, books & Get in on the Action!
tools. www.electronics123.com
New in: Computers & Internet/Hardware
Amazing PIC programmer
Just $32, most devices supported ICSP, SQTP, copy-limit features. atari 8-bit computer - watler's world
www.flexipanel.com
80x51 microcontrollers - proyek elektronika
Asian Personals dan software - the electronic and so
Asian singles seek love, dating and marriage. Join free today.. www. picmicro sites - free projects with microchip pic
AsianEuro.com micro
commodore ring - nodeal! productions
PIC & AVR C Compilers
Compile, Simulate, Program! IDE's, Programmers & Development. www.
fored.co.uk
Make MONEY!
Add
Pay-Per-Play
ads to your website
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
http://o.webring.com/forum?forum=picmicro (2 of 3)12/02/2008 17:35:13
PICmicro Sites
Calculators Portable
Communications and Security@
Networking@ Storage
Digital Cameras@ Video Cards
Hardware Projects@ Webcams
Internet Appliances@ WebTV
Personal Computers
Personal Digital
Assistants (PDAs)
PC or Mac, desktop, laptop or notebook, Palm Pilot or digital camera. If you sell it, your site belongs in our ring.
Computer Equipment, Parts, Repairs, and Upgrades as well.
Featuring websites dedicated to Electronics as a hobby or business in Australia. This webring features sites with
free schematics, ideas, kit builders, magazines, manufacturers and parts suppliers. If your looking for any of the
above, or similar, within Australia, then this is the right ring for you.
This !tzalist ring is open to all computer hardware-related sites, including sites with computers and hardware
reviews, printers, monitors, cdrw's, cd drives, floppy disk drives, modems, scanners, dvd drives, networking cards
and hubs, graphics and sound cards, information, FAQs, and other resources. JOIN TODAY!!!
List of merchants that sell computer products and accessories. From laptops to desktops. Digital cameras to printers
and scanners. If you sell computer products you belong in this ring so that if anyone is looking to purchase computer
products they will find it from a merchant in this ring.
Computers: New and refurbished PC's, laptops. Computer parts and accessories, computer surplus outlet, boards,
memory, games and more. If you're searching for computers for sale, deals, scratch and dent computers, online
specials and electronic store computer sales, this is the webring for you to find exactly the computer you're looking
for. Computer Safety Tip: From family photos to tax returns, many of the things you value and need most can be
found on your PC. To protect the security of your valuable documents, invest in an ant-virus program that will
automatically scan and clean files, e-mail messages, and downloads, as well as e-mail and instant message
attachments.
Custom Built PCs and Case Modding (4 Sites, 121 Hits) 11/02/2002
A place for sites about case modding, custom built computers, and and hardware hacking.
This ring is for all computer resellers and discounters to list their website business. And for all potential computer
shoppers to browse and comparison shop for computers and computer hardware. Ring Master - Dave - www.
thebusinesstuner.com Computer Repair and Consulting, Abbotsford BC Canada
GBBG Game Boy Beyond Games. A showcase for non game applications using the Nintendo GameBoy (Pocket,
Color and Advance). Tools, Products, Electronic circuits, Applications and Turnkey systems. Everything you need to
develop and deploy your Custom Interface for portable, embedded, networking, data acquisition, RS232, USB,
GPS, NMEA 0183, MIDI, data logger, test and measurement functionality. All in a robust, battery operated,
handheld pocket terminal.
Getting the PIC Microprocessor to Interface with the Net. Sites with Info and up to date Links.
PC/Mac Hardware sites with interest in video, sound, network, and physics cards along with info on printers,
processors, motherboards, and miscellaneous components.
The Sam Coup Web Ring has been created to bring together the on line resources of the finest 8-bit computer
ever to come out of Swansea, UK. Amongst the sites you will find information, downloads and details of shows and
gatherings. There are emulators for Win32, Un*x and MacOS so even if your blue-footed friend is in the attic you
can still have some quality Sam time instead of working :-)
Resources for Zilog microprocessors and compatibles (e.g. Hitachi & Rabbit), and microcontrollers, and related
embedded technologies.
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
TELL A
SEARCH WEBRING: This WebRing All
FRIEND!
Computers & Internet > Hardware Add this feed:
PICmicro Sites Add Your
Manager: uandmekids Web Site.
Join Here!
Iron WebMaster
A collection of websites about the Microchip PIC microcontroller and related projects.
example: PIC development board - PIC development board, supports most families and
Round 2 VOTING
microchip microcontrollers including USB devices.
Ads by Google
Get in on the Action!
PIC Programmers
Low cost PIC programmers and kits Many PIC chips, kits, books &
WebRing Rating Survey
tools. www.electronics123.com Which of these statements best describes your
experience(s) with this Ring?
HI-TECH Software ANSI C Only members who are logged in may register a vote. You
Optimizing compiler for the entire range of Microchip PICmicro & are either not logged in or not a WebRing member. Use the
Sign In link at top to log in or register for a WebRing User ID.
dsPIC. microchip.htsoft.com
Amazing PIC programmer Easy to navigate with interesting sites.
Just $32, most devices supported ICSP, SQTP, copy-limit features.
www.flexipanel.com Easy to navigate with OK sites.
submit my vote
view results without voting
EHL elektronika
Free PIC downloader for W95/98/NT compatible with the HI-TECH or Shane Tolmie bootloader for the
PIC16F87x processors.
FREE C Code examples & interfacing cct for PIC & AVR
Sample C Code examples with interfacing circuits for 8-bit Micros = PIC/AVR/8051 and software & hardware
tools
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
We can handle your PIC or AVR designs for you - Forest Consultancy
Site Map
PICmicro Sites
Prev | Ring Hub | Join | Rate|
Next
WebRing Inc.
Search
Marcas: -----
Descripcin
Productos Destacados
Productos Asociados y Complementarios
Noticias Relacionadas
Seminarios
rea de descarga
Descarga
nuestras marcas
Descripcin
Rabbit Semiconductor ofrece a sus clientes sistemas de desarrollo TCP/IP apropiados, que
proporcionan un modo simple de desarrollar una aplicacin Ethernet 10Base-T 100Base-T
alrededor de los microprocesadores Rabbit. Los mdulos RabbitCore con capacidades Ethernet el
siguiente paso lgico para acelerar el tiempo de desarrollo de los OEM- ha consolidado an ms la
posicin de Rabbit Semiconductor en el mercado de los embebidos.
Productos Destacados
Noticias Relacionadas
Rabbit anuncia su nuevo modulo RabbitCore RCM4300 con soporte de miniSD
RABBIT CORTA EL CABLE: NUEVOS MDULOS CON WI-FI Y ZIGBEE INTEGRADO PIN A PIN
COMPATIBLES CON LOS MDULOS ETHERNET (Oferta especial de lanzamiento)
Rabbit Semiconductor, INC. lanza el kit de aplicacin Zigbee / 802.15.4 para el control
inalmbrico embebido, econmico y de bajo consumo
Rabbit Semiconductor, Inc. ofrece un Kit de Aplicacin con Cmara Embebida para Monitorizacin
Remota, Seguridad, Control de Flotas y otras aplicaciones
Nuevo mdulo software Modbus TCP para los procesadores Rabbit
Seminarios
Seminario de dispositivos embebidos Ethernet / Wi-fi
rea de descarga
Gua de Mdulos RCMXX00
Email:
Search:
Search Entire Site
Automated
Wireless
Overview
About Electronics
Solutions
Kimball
February 05, 2008
Manual Search
Automotive
Device
Careers Solutions
Electronics
Data I/O's FLX500 Desktop Automation Programming "By the way, the FLX500 is really running great. We moved it out into
Press Releases
In-System
Programming
Algorithm Updates
Programming
Centers
Solution Chosen by Major Multi-National Automotive SupplierInvestor production and we are running it almost non-stop on 2 shifts. Having it
Programming
Semiconductor
Manuals Relations
Services
Market
setup on the network is good because I can load the job from my desk and
January 30, 2008 Software
it will permanently be in one place (on the machine) and I dont have to deal
Data I/O Corporatin Announces FlashCORE Boost Technical Library
with any cards!"
Technology Knowledgebase
Data I/O Demonstrates New FlashCore II Programming Whether you use Flash Memory Cards or other flash-based
Technology at Productronica in Munich (November 13-16) memory or microcontroller devices, Data I/O's Flash Media
Duplication (FMD) System is a versatile solution to satisfy all
Read More News..
production programming needs, order and inventory
management in one solution with high-quality and security.
Fred Hume, President and CEO will present at Needham's 10th Annual Growth Stock
Conference Wednesday, January 9th.
A live webcast of the presentaion will be available at 10:30 a.m. Eastern time on January
9th.
Copyright 2007 Data I/O Corporation. All rights reserved. Resolution 1024*768
LoginRegister
Product #
Home
Evaluate
Product Selector Guide
Data Sheets
Try Before You Buy
3rd Party Resources
White Papers
Quick Start
App Notes
Errata
Software Updates
Forums Stellaris the industry's first Cortex-M3
Register Product MCUs.
Buy Now
Luminary Micro is the industry leader in bringing 32-bit capabilities and the full benefits of ARM Cortex-
form and in development systems. Explore the new world of pervasive 32-bit control, communications and
knowledge in the industry. Designers who migrate blazingly-fast responsiveness, Thumb-2 technology
to Stellaris will benefit from great tools, small combines both 16-bit and 32-bit instructions to
code footprint and outstanding performance. deliver the best balance of code density and
Just Announced!
BLDC Reference
Design Kit
unprecedented integration of
Learn More
BLDC Module
applications.
Learn More
engineers!
Systems Conference
Componex Nepcon
Embedded World
Embedded Systems
Conference
All Events
2008 - PPP, NetAudioAds Group. All Rights Reserved | Web Hosting Powered By Config.com
http://www.sellingppp.com/a.cgi?ppp=120747292712/02/2008 17:37:06
WebRing: new
Find out what's new on WebRing: Rings created in the last 14 days, seasonal rings, holiday rings, those based on current events, and
more.
WebRing News -
February Newsletter, 2008
January Newsletter, 2008
December Newsletter December 1, 2007
TopicCraze partnership August 31, 2007
WebRing Toolbar! May 4, 2007
WebRing Blogs! April 25, 2007
WebRing and Yahoo! Groups, April 2, 2007
WebRing 2.0 Email, March 1, 2007
Important News, February 16, 2007
Second Letter from Tim Killeen - January 5, 2007
First Letter from Tim Killeen - November 21, 2006
Some comments from users....
Membership Stats:
12/01/2007
WebRing members: 435,325
WebRIng 2.0 members: 722
Events/Holidays
February 23rd - April 1st
Featured Rings
August is Catfish month. You can Catch 'em, or Keep 'em.
It's
Foot Care month,
and Artist Appreciation month.
It's also Inventors, Water Quality, and Golf month.
New Rings
www.dubrovnik-apartments-bb.com
wholesale bape,Evisu,BBC hoody;Lacoste,polo;Nike
Diet pills Weight loss pills
The Twist-N-Go Modern Scooter Webring
Testdawn
susieschinchillas
Spyro the dragon
Saint John MadMax032777 Michael
Saddler
Redwall Role Playing Ring
more...
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
Explore this list of established rings with the highest traffic in the last few days and recent months as well as those with the highest number
of new and unique sites in the past seven days.
Hot topics:
Kirchenmusik-Webring
Purple Pages for Pagans
Iron WebMaster Round 2
Ancient Military Sites
New Hampshire
Evil Atheist Conspiracy
Dreamontoyz.com's Cartoons WebRing
FREE Advanced Health Plan
Italian Greyhound
The Civil Rights Webring
more...
Highest traffic:
more...
more...
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
Home /
Advice & Support (12) Arts & Entertainment (23) Automotive (5)
Books & Writing (10) Business & Finance (14) Comics & Animation (1)
Computers & Internet (16) Cultures & Community (10) Food & Drink (2)
Genealogy (3) Government & Politics (3) Healthcare (10)
Hobbies (27) Home & Garden (7) Music (8)
Outdoors (3) Pets (7) Photography (6)
Relationships (8) Religion (24) Schools & Education (3)
Science (4) Sports (2)
Popular Blogs
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
Creating communities.
Connecting people.
February 16, 2007
Revised: June 26, 2007
On January 5, 2007, I wrote an open letter to Managers and Members describing all of the improvements to WebRing for 2007.
See my personal letter to refresh your memory. I'm now pleased to introduce our new "Get Started" program.
When you join WebRing as a 2.0 member we will install the WebRing navigation code on your first web site and get you
signed up in your first community for free!
If you have additional web sites, we'll help you get up to 5 of them (including the first) posted in their first community as well.
If you have more than 5 we can help you with those for just $5 each.
Learn more about all of the WebRing 2.0 Member Benefits.
We believe 2007 will be the best year ever for WebRing. Implementing this program will make it easy for you to get started now
and allow even more people with similar interests to connect, share information and complete transactions. As always, we
appreciate, listen and respond to your feedback. Please keep it coming: feedback@webring.com.
Sincerely,
Tim Killeen
WebRing Owner & WebRing Community Manager
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
System Forums
Check out these forums for learning about, working with, and using WebRing:
Top Forums
Discover these popular forums that cover the most talked-about topics in the last eight weeks.
more...
Hot Forums
Explore these forums that cover the hottest WebRing topics in the last three days.
Miniature Dachshunds
Forums & Chat Ring
Natural Cure ~ Natural Remedies ~ Natural Cure For All Disease
Let Freedom Ring
Ultimate Photography
FREE Advanced Health Plan
Advanced Scientific Health Webring
Wandering Daoists
THE JAILHOUSE LAWYER'S WEBRING
The Women's Victory Network
more...
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
Contacting Us At WebRing
The WebRing Service
WebRing is many things: a network of similar web sites, a precise research tool, a web traffic generator. But most
of all, WebRing is an ever-expanding online network of personal and business communities that span every topic
imaginable.
SUPPORT
For all technical issues or specific help requests, please use our WebRing Help system.
Feedback
Your thoughts and ideas are important to us.
For general feedback on WebRing please visit our Forums and post to either the General Members Forum,
or if you're a manager you might wish to use the Community Managers Forum.
Concerns regarding our membership policies? Please email Membership.
Questions regarding the affiliate program should be directed to Affiliate.
Strategic Alliances
Strategic alliances are key to WebRing's enhanced and expanding services on the World Wide Web. If such a
partnership with WebRing might benefit your company, please email Marketing.
Press
WebRing is pleased to cooperate with the press, and has received extensive coverage in online, television and
print media. If your news organization has an interest in WebRing, please contact Pressinfo.
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
http://dir.webring.com/h/contact.html12/02/2008 17:37:46
WebRing: terms
1. ACCEPTANCE OF TERMS
Welcome to WebRing. WebRing provides its service to you, subject to the following Terms of Service
("TOS"), which may be updated by us from time to time without notice to you. You can review the most
current version of the TOS at any time at: http://dir.webring.com/h/terms. In addition, when using
particular WebRing services, you and WebRing shall be subject to any posted guidelines or rules
applicable to such services which may be posted from time to time. All such guidelines or rules are
hereby incorporated by reference into the TOS.
2. DESCRIPTION OF SERVICE
WebRing currently provides users with access to a rich collection of navigation and directory resources,
and personalized content through the site (the "Service"). You also understand and agree that the
Service may include advertisements and that these advertisements are necessary for WebRing to
provide the Service. Unless explicitly stated otherwise, any new features that augment or enhance the
current Service, including the release of new WebRing Services, shall be subject to the TOS. You
understand and agree that the Service is provided "AS-IS" and that WebRing assumes no responsibility
for the timeliness, deletion, mis-delivery or failure to store any user communications or personalization
settings.
You are responsible for obtaining access to the Service and that access may involve third party fees
(such as Internet service provider or airtime charges). You are responsible for those fees, including those
fees associated with the display or delivery of advertisements. In addition, you must provide and are
responsible for all equipment necessary to access the Service.
Please be aware that WebRing has created certain areas on the Service that contain adult or mature
content. You must be at least 18 years of age to access and view such areas. WebRing has the right to
limit your access to certain areas if WebRing is aware or suspects you are not at least 18 years of age.
In consideration of your use of the Service, you agree to: (a) provide true, accurate, current and complete
information about yourself as prompted by the Service's registration form (such information being the
"Registration Data") and (b) maintain and promptly update the Registration Data to keep it true, accurate,
http://dir.webring.com/h/terms (1 of 10)12/02/2008 17:37:50
WebRing: terms
current and complete. If you provide any information that is untrue, inaccurate, not current or incomplete,
or WebRing has reasonable grounds to suspect that such information is untrue, inaccurate, not current or
incomplete, WebRing has the right to suspend or terminate your account and refuse any and all current
or future use of the Service (or any portion thereof). WebRing is concerned about the safety and privacy
of all its users, particularly children. For this reason, WebRing does not allow the creation of accounts by
children under the age of 13. If you are the parent or guardian of a child of any age, it is your
responsibility to determine whether any of the Services and/or Content (as defined in this TOS) are
appropriate for your child.
Registration Data and certain other information about you is subject to our Privacy Policy. For more
information, see our full privacy policy at http://dir.webring.com/h/privacy/.
You will define or receive a password and account designation upon completing the Service's registration
process. You are responsible for maintaining the confidentiality of the password and account, and are
fully responsible for all activities that occur under your password or account. You agree to (a)
immediately notify WebRing of any unauthorized use of your password or account or any other breach of
security, and (b) ensure that you exit from your account at the end of each session. WebRing cannot and
will not be liable for any loss or damage arising from your failure to comply with this Section 5.
6. MEMBER CONDUCT
You understand that all information, data, text or other materials ("Content"), whether publicly posted or
privately transmitted, are the sole responsibility of the person from which such Content originated. This
means that you, and not WebRing, are entirely responsible for all Content that you upload, post, email,
transmit or otherwise make available via the Service. WebRing does not control the Content posted via
the Service and, as such, does not guarantee the accuracy, integrity or quality of such Content. You
understand that by using the Service, you may be exposed to Content that is offensive, indecent or
objectionable. Under no circumstances will WebRing be liable in any way for any Content, including, but
not limited to, for any errors or omissions in any Content, or for any loss or damage of any kind incurred
as a result of the use of any Content posted, emailed, transmitted or otherwise made available via the
Service.
a. upload, post, email, transmit or otherwise make available any Content that is unlawful, harmful,
threatening, abusive, harassing, tortious, defamatory, vulgar, obscene, libelous, invasive of another's
privacy, hateful, or racially, ethnically or otherwise objectionable;
b. harm minors in any way;
c. impersonate any person or entity, including, but not limited to, a WebRing official, forum leader,
guide or host, or falsely state or otherwise misrepresent your affiliation with a person or entity;
d. forge headers or otherwise manipulate identifiers in order to disguise the origin of any Content
transmitted through the Service;
e. upload, post, email, transmit or otherwise make available any Content that you do not have a right to
make available under any law or under contractual or fiduciary relationships (such as inside
information, proprietary and confidential information learned or disclosed as part of employment
relationships or under nondisclosure agreements);
f. upload, post, email, transmit or otherwise make available any Content that infringes any patent,
trademark, trade secret, copyright or other proprietary rights ("Rights") of any party;
g. upload, post, email, transmit or otherwise make available any unsolicited or unauthorized
advertising, promotional materials, or any other form of solicitation, except in those areas (such as
ring Promotions) that are designated for such purpose; it is expressly prohibited on the navigation
code that appears on a member's webiste;
h. upload, post, email, transmit or otherwise make available any material that contains software viruses
or any other computer code, files or programs designed to interrupt, destroy or limit the functionality
of any computer software or hardware or telecommunications equipment;
j. interfere with or disrupt the Service or servers or networks connected to the Service, or disobey any
requirements, procedures, policies or regulations of networks connected to the Service;
k. intentionally or unintentionally violate any applicable local, state, national or international law.
l. "stalk" or otherwise harass another; or
m. collect or store personal data about other users.
n. provide links to or promote non-WebRing services or websites without prior permission.
You acknowledge that WebRing does not pre-screen Content, but that WebRing and its designees shall
have the right (but not the obligation) in their sole discretion to refuse or move any Content that is
available via the Service. Without limiting the foregoing, WebRing and its designees shall have the right
to remove any Content that violates the TOS or is otherwise objectionable. You agree that you must
evaluate, and bear all risks associated with, the use of any Content, including any reliance on the
accuracy, completeness, or usefulness of such Content. In this regard, you acknowledge that you may
not rely on any Content created by WebRing or submitted to WebRing, including without limitation
information in WebRing Message Boards, ring Community Centers, and in all other parts of the Service.
You acknowledge and agree that WebRing may preserve Content and may also disclose Content if
required to do so by law or in the good faith belief that such preservation or disclosure is reasonably
necessary to: (a) comply with legal process; (b) enforce the TOS; (c) respond to claims that any Content
violates the rights of third-parties; or (d) protect the rights, property, or personal safety of WebRing, its
users and the public.
You understand that the technical processing and transmission of the Service, including your Content,
may involve (a) transmissions over various networks; and (b) changes to conform and adapt to technical
requirements of connecting networks or devices.
Recognizing the global nature of the Internet, you agree to comply with all local rules regarding online
conduct and acceptable Content. Specifically, you agree to comply with all applicable laws regarding the
transmission of technical data exported from the United States or the country in which you reside.
WebRing does not claim ownership of Content you submit or make available for inclusion on the Service.
However, with respect to Content you submit or make available for inclusion on publicly accessible areas
of the Service, you grant WebRing the following world-wide, royalty free and non-exclusive license(s), as
applicable:
With respect to Content you submit or make available for inclusion on publicly accessible areas of
WebRing, the license to use, distribute, reproduce, modify, adapt, publicly perform and publicly display
such Content on the Service solely for the purposes of providing and promoting the specific WebRing
ring to which such Content was submitted or made available. This license exists only for as long as you
elect to continue to include such Content on the Service and will terminate at the time you remove or
WebRing removes such Content from the Service.
"Publicly accessible" areas of the Service are those areas of WebRing that are intended by WebRing to
be available to the general public.
9. INDEMNITY
You agree to indemnify and hold WebRing, and its subsidiaries, affiliates, officers, agents, co-branders or
other partners, and employees, harmless from any claim or demand, including reasonable attorneys'
fees, made by any third party due to or arising out of Content you submit, post, transmit or make
available through the Service, your use of the Service, your connection to the Service, your violation of
the TOS, or your violation of any rights of another.
http://dir.webring.com/h/terms (4 of 10)12/02/2008 17:37:50
WebRing: terms
You agree not to reproduce, duplicate, copy, sell, resell or exploit for any commercial purposes, any
portion of the Service, use of the Service, or access to the Service without the express written permission
of WebRing.
You acknowledge that WebRing may establish general practices and limits concerning use of the
Service, including without limitation the maximum number of days that message board postings or other
uploaded Content will be retained by the Service, the maximum number of email messages that may be
sent from or received by an account on the Service, the maximum size of any email message that may
be sent from or received by an account on the Service, the maximum disk space that will be allotted on
WebRing's servers on your behalf, and the maximum number of times (and the maximum duration for
which) you may access the Service in a given period of time. You agree that WebRing has no
responsibility or liability for the deletion or failure to store any messages and other communications or
other Content maintained or transmitted by the Service. You acknowledge that WebRing reserves the
right to log off accounts that are inactive for an extended period of time. You further acknowledge that
WebRing reserves the right to change these general practices and limits at any time, in its sole
discretion, with or without notice.
WebRing, Inc., offers its WebRing 1.0 Members the option of paying a one-time fee to have WebRing
trained staff register your URL, place the WebRing navigation code on that web site, and submit that site
to an appropriate WebRing Community. WebRing 2.0 Members, should they choose to use it, receive the
Get Started Support Service as part of their annual membership fee. WebRing, Inc., reserves the right to
refuse this Service to sites deemed inappropriate, objectionable, unlawful, or dysfunctional, as well as
those sites that do not allow the proper placement and function of the WebRing navigation code.
WebRing, Inc., strives to complete all requests for the Get Started Support Service as soon as possible
based on usual WebRing, Inc. business hours, Monday - Friday 8:00-5:00 PST; however, WebRing, Inc.,
retains the right to delay Services based on Federal holidays, force majeure, and other events that may
occur outside the control of WebRing, Inc.
WebRing, Inc., accepts responsibility for your site only during that time in which the placement of your
web site's navigation code is in process, and only as long as you follow the Get Started Support Service
Member Responsibilities (13). Service does not include any site improvements, repairs, redesign of your
web site, or the creation of a web site.
WebRing reserves the right at any time and from time to time to modify or discontinue, temporarily or
permanently, the Service (or any part thereof) with or without notice. You agree that WebRing shall not
be liable to you or to any third party for any modification, suspension or discontinuance of the Service.
15. TERMINATION
You agree that WebRing, in its sole discretion, may terminate your password, account (or any part
thereof) or use of the Service, and remove and discard any Content within the Service, for any reason,
including, without limitation, for lack of use or if WebRing believes that you have violated or acted
inconsistently with the letter or spirit of the TOS. In the special situation where termination affects ring
Management, WebRing has the right to take over management of ring(s) found to violate the TOS in
letter or spirit. WebRing may also in its sole discretion and at any time discontinue providing the Service,
or any part thereof, with or without notice. You agree that any termination of your access to the Service
under any provision of this TOS may be effected without prior notice, and acknowledge and agree that
WebRing may immediately deactivate or delete your account and all related information and files in your
account and/or bar any further access to such files or the Service. Further, you agree that WebRing shall
not be liable to you or any third-party for any termination of your access to the Service.
Your correspondence or business dealings with, or participation in promotions of, advertisers found on or
through the Service, including payment and delivery of related goods or services, and any other terms,
conditions, warranties or representations associated with such dealings, are solely between you and
such advertiser. You agree that WebRing shall not be responsible or liable for any loss or damage of any
sort incurred as the result of any such dealings or as the result of the presence of such advertisers on the
Service.
17. LINKS
The Service may provide, or third parties may provide, links to other World Wide Web sites or resources.
Because WebRing has no control over such sites and resources, you acknowledge and agree that
WebRing is not responsible for the availability of such external sites or resources, and does not endorse
and is not responsible or liable for any Content, advertising, products, or other materials on or available
from such sites or resources. You further acknowledge and agree that WebRing shall not be responsible
or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection
with use of or reliance on any such Content, goods or services available on or through any such site or
resource.
You acknowledge and agree that the Service and any necessary software used in connection with the
Service ("Software") contain proprietary and confidential information that is protected by applicable
intellectual property and other laws. You further acknowledge and agree that Content contained in
sponsor advertisements or information presented to you through the Service or advertisers is protected
by copyrights, trademarks, service marks, patents or other proprietary rights and laws. Except as
expressly authorized by WebRing or advertisers, you agree not to modify, rent, lease, loan, sell,
distribute or create derivative works based on the Service or the Software, in whole or in part.
http://dir.webring.com/h/terms (7 of 10)12/02/2008 17:37:50
WebRing: terms
a. YOUR USE OF THE SERVICE IS AT YOUR SOLE RISK. THE SERVICE IS PROVIDED ON AN "AS
IS" AND "AS AVAILABLE" BASIS. WebRing EXPRESSLY DISCLAIMS ALL WARRANTIES OF ANY
KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-
INFRINGEMENT.
b. WebRing MAKES NO WARRANTY THAT (i) THE SERVICE WILL MEET YOUR REQUIREMENTS,
(ii) THE SERVICE WILL BE UNINTERRUPTED, TIMELY, SECURE, OR ERROR-FREE, (iii) THE
RESULTS THAT MAY BE OBTAINED FROM THE USE OF THE SERVICE WILL BE ACCURATE
OR RELIABLE, (iv) THE QUALITY OF ANY PRODUCTS, SERVICES, INFORMATION, OR OTHER
MATERIAL PURCHASED OR OBTAINED BY YOU THROUGH THE SERVICE WILL MEET YOUR
EXPECTATIONS, AND (V) ANY ERRORS IN THE SOFTWARE WILL BE CORRECTED.
c. ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED THROUGH THE USE OF THE
SERVICE IS DONE AT YOUR OWN DISCRETION AND RISK AND THAT YOU WILL BE SOLELY
RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT
RESULTS FROM THE DOWNLOAD OF ANY SUCH MATERIAL.
d. NO ADVICE OR INFORMATION, WHETHER ORAL OR WRITTEN, OBTAINED BY YOU FROM
WebRing OR THROUGH OR FROM THE SERVICE SHALL CREATE ANY WARRANTY NOT
EXPRESSLY STATED IN THE TOS.
YOU EXPRESSLY UNDERSTAND AND AGREE THAT WEBRING WILL NOT BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES,
INCLUDING BUT NOT LIMITED TO, DAMAGES FOR LOSS OF PROFITS, GOODWILL, USE, DATA
OR OTHER INTANGIBLE LOSSES (EVEN IF WEBRING HAS BEEN ADVISED OF THE POSSIBILITY
OF SUCH DAMAGES), RESULTING FROM: (i) THE USE OR THE INABILITY TO USE THE SERVICE;
(ii) THE COST OF PROCUREMENT OF SUBSTITUTE GOODS AND SERVICES RESULTING FROM
ANY GOODS, DATA, INFORMATION OR SERVICES PURCHASED OR OBTAINED OR MESSAGES
RECEIVED OR TRANSACTIONS ENTERED INTO THROUGH OR FROM THE SERVICE; (iii)
UNAUTHORIZED ACCESS TO OR ALTERATION OF YOUR TRANSMISSIONS OR DATA; (iv)
STATEMENTS OR CONDUCT OF ANY THIRD PARTY ON THE SERVICE; OR (v) ANY OTHER
MATTER RELATING TO THE SERVICE. IN NO EVENT WILL WEBRING'S TOTAL CUMULATIVE
LIABILITY TO YOU, INCLUDING ANY DIRECT DAMAGES ARISING FROM THIS AGREEMENT,
EXCEED THE SUM YOU PAID TO WEBRING FOR SERVICES YOU PURCHASED HEREUNDER AND
WHICH ARE THE SUBJECT OF AND DIRECTLY AFFECTED BY SUCH CLAIMS.
http://dir.webring.com/h/terms (8 of 10)12/02/2008 17:37:50
WebRing: terms
22. NOTICE
Notices to you may be made via either email or regular mail. The Service may also provide notices of
changes to the TOS or other matters by displaying notices or links to notices to you generally on the
Service.
WebRing, the WebRing logo, and other WebRing logos and product and service names are trademarks
of WebRing Inc. (the "WebRing Marks"). Without WebRing's prior permission, you agree not to display or
use in any manner, the WebRing Marks.
WebRing respects the intellectual property of others, and we ask our users to do the same. If you believe
that your work has been copied in a way that constitutes copyright infringement, or your intellectual
property rights have been otherwise violated, please provide WebRing's Copyright Agent the following
information:
1. an electronic or physical signature of the person authorized to act on behalf of the owner of the
copyright or other intellectual property interest;
2. a description of the copyrighted work or other intellectual property that you claim has been
infringed;
3. a description of where the material that you claim is infringing is located on the site;
4. your address, telephone number, and email address;
5. a statement by you that you have a good faith belief that the disputed use is not authorized by the
copyright owner, its agent, or the law;
6. a statement by you, made under penalty of perjury, that the above information in your Notice is
accurate and that you are the copyright or intellectual property owner or authorized to act on the
copyright or intellectual property owner's behalf.
http://dir.webring.com/h/terms (9 of 10)12/02/2008 17:37:50
WebRing: terms
WebRing's Agent for Notice of claims of copyright or other intellectual property infringement can be
reached as follows:
By email: copyrightisssues@webring.com
By mail: Copyright, WebRing Inc., 500 A street, Suite 2, Ashland, Oregon 97520
By Phone: (541) 488-9895
PLEASE: This number is for copyright issues only. For support related questions use the email submit
form on Help/Support
The TOS constitute the entire agreement between you and WebRing and govern your use of the Service,
superceding any prior agreements between you and WebRing. You also may be subject to additional
terms and conditions that may apply when you use affiliate services, third-party content or third-party
software. The TOS and the relationship between you and WebRing shall be governed by the laws of the
State of Oregon without regard to its conflict of law provisions. You and WebRing agree to submit to the
personal and exclusive jurisdiction of the courts located within the county of Jackson, Oregon. The failure
of WebRing to exercise or enforce any right or provision of the TOS shall not constitute a waiver of such
right or provision. If any provision of the TOS is found by a court of competent jurisdiction to be invalid,
the parties nevertheless agree that the court should endeavor to give effect to the parties' intentions as
reflected in the provision, and the other provisions of the TOS remain in full force and effect. You agree
that regardless of any statute or law to the contrary, any claim or cause of action arising out of or related
to use of the Service or the TOS must be filed within one (1) year after such claim or cause of action
arose or be forever barred.
The section titles in the TOS are for convenience only and have no legal or contractual effect.
26. VIOLATIONS
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
If you still can't find the help you're looking for then use the link below to contact support
immediately.
Video Tutorials
We now provide a number of video tutorials to assist you in getting the WebRing
NavBar on your page.
Help topics (browse this list and click for more detailed help):
Need help with the navigation code, including placing it on your web site?
I need to delete my Account/User ID
Want to learn more about ring navigation, or the Hub page?
Why can't I access management functions for my ring?
I want help with Ring management
Need help managing (one of) your ring membership(s)?
Are you have a problem with the Ring Checker (including sites being moved between
active and suspended)?
I'm Trying to contact a member, Ring Manager, or support.
Questions about the WebRing directory?
Try here if you have questions not covered by the above topics (These include
arbitration, ads, definition of terms and basic WebRing information.)
If you are unable to find a question that fits your issue, try searching our help documents below:
Go!
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
WebRing is concerned about your privacy. Please read the following to learn more about our privacy policy.
NOTICE: Click here for important information about safe surfing from the Federal Trade Commission.
This Privacy Policy covers WebRing's treatment of personal information that WebRing collects when you use the WebRing site, and when you
use WebRing's services. This policy also covers WebRing's treatment of any personal information that WebRing's business partners share
with WebRing or that WebRing may collect on a partner's site.
This policy does not apply to the practices of companies that WebRing does not own or control, or to people that WebRing does not employ
or manage.
WebRing collects personal information when you register for a WebRing account, when you use WebRing products or services, when
you visit WebRing pages. WebRing may also receive personal information from our business partners.
When you register with WebRing, we ask for your email address and birth date. Once you register with WebRing and sign in to our
services, you are not anonymous to us.
WebRing also automatically receives and records information on our server logs from your browser WebRing cookie information and
the page you requested.
WebRing uses information for three general purposes: to customize the advertising and content you see, to fulfill your requests for
certain products and services, and to provide traffic statistics to our ring managers. None of the statistics reported include personal
information about any WebRing user.
We need to share your information to provide the product or service you have requested;
We need to send the information to companies who work on behalf of WebRing to provide a product or service to you. (Unless
we tell you differently, these companies do not have any right to use the personal information we provide to them beyond what is
necessary to assist us.);
We respond to subpoenas, court orders or legal process; or
We find that your actions on our web sites violate the WebRing Terms of Service, or any of our usage guidelines for specific
products or services.
Cookies
Your Ability to Edit and Delete Your Account Information and Preferences
WebRing gives you the ability to edit your WebRing Account Information and preferences at any time.
Security
Your WebRing Account Information is password-protected for your privacy and security.
WebRing may amend this policy from time to time. If we make any substantial changes in the way we use your personal information we
will notify you by posting a prominent announcement on our pages.
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
Learn More:
SimpleNet provides the infrastructure necessary to host WebRing's millions of hits each month. We're
built to be the most reliable web host on the planet. SimpleNet is where your site should be.
If you'd like to join our satisfied customer base, do so by transferring your existing site or building a
Hosting Packages
Our Guarantee
All accounts include 24/7 phone & email support, a 30-day money back guarantee*, free web site building
software, web-based email & POP, a load-balanced & redundant architecture, multiple bandwidth
* 30-day money back guarantee excludes setup fee. ** Secure certificate must be purchased separately.
A free yet reliable invisible web tracker, highly configurable hit counter It's easy and free - just 4 simple steps:
Username:
and real-time detailed web stats. Insert a simple piece of our code on
your web page or blog and you will be able to analyse and monitor all
Password: the visitors to your website in real-time! Register an account
Create a Project
Free, Fast, Responsive, Quick loading and Reliable Service. Insert the code on your website
remember me (Why is it free?)
Analyze your stats!
LOGIN Invisible Tracking - no ads on your website.
forgot password? Accurate real-time website statistics with detailed visitor
tracking and analysis.
RECOMMENDED
Register Now - It's Free (We promise!)
Top 10 Search Listing
Free Website Content View Live Demo
Copyright 1999-2008 StatCounter, All rights reserved. Privacy Policy | Terms and Conditions
homepage 9/1/2006
Welcome to my site
Decode IR
RC5 code PICmicro Sites
Panasonic code Get this free Prev | Ring Hub | Join | Rate|
software Next
Daewoo protocol
WebRing Inc.
Search
Sony code
Pic sourcecode for
You can find on my site:
Sony IR protocol
JVC protocol Information about infrared light:
Tinyserir-RC5
Decode ir: On this page you can find a description about the basics of using infrared light for remote control,
RC5 receiver
what you need to decode it and what you can do with it: for example control you pc, windows, winamp or mp3
pic18f bootloader player.
PIC sourcecodes
Detailed description of the folowing different remote protocols:
Leds
Constant current RC5 protocol: Originally developed by Phillips and the most popular for hobby projects.
source for Leds Sony SIRC protocol:Also popular for hobby but less than the rc5 protocol
Always winning with Panasonic protocol
roulette JVC protocol
Daewoo protocol
Datasheets
Links
Who am I
Control your pc with an infrared remote protocol, Pic sourcecodes and hobby projects:
Pic sourcecode for sony ir protocol: Here you can find the sourcecode and hexfiles to decode infrared signals of
a sony remote control with a pic microcontroller. With the buttons 0..9 you can control the output pins of the
controller.
The code is also serial transmitted on an output pin you can directly connect it to a pc and control windows or
mediaplayer and etc..
Pic sourcecodes:Here you can find different source codes for the microchip pic microcontrollers like the
pic16f84,pic16f628,pic12f629,pic12f675.
Tinyserir chip: A preprogrammed pic microcontroller for decoding RC5 infrared remote controls.
Tinyserirchip: Here you can find the description, the testprogram and datasheets of the tinyserirchip. You can
use this cheap and easy to use chip to control your pc, plc, robot and everything with a serial port. Because
windows is not realtime it can be hard to decode the fast ir signals. Because you need to sample many times it can
also slow down your system many times. But with the use of the tinyserirchip you can solve all these problems.
Bootloader page Yep here you can find how to make your own simple bootloader based on the application note
00851 of microchip, but I changed this a little bit.
Leds: On this page you can find out what leds are, how you can connect it properly without troubles. How you
need to calculate the right value of the series resistor.
Constant current source: Here a detailed descripton of a constant current source with a LM317, how to use and
calculate them and of course the schematic (circuit). You can use it to connect white or blue leds, Luxeon
lumileds
Always winning in the casino with roulette: it's not about cheating or other illegal actions but a simple trick.
Allways winning with roulette: Here you can read a tip for free how you can allways win with a roulette game
in a casino or online casino's. It's simple and pure mathematical not difficult to understand how it works.
Since a long time the consumer electronics industy has been employing infrared remote controls for the
control of television, VCR's and many other products. This same technic is popular In industrial- and
officeapplications like control your pc to eliminate expensive keypads and cables. It's easier to use the
infrared light than cables who always crossing each other.
We humans can't see infrared light because the wavelenght of infrared light is below the visible
spectrum(Some animals can see it and use it as a target for killing the prey). Because we don't see ir
light we use it for remote control purposes. In remote controls the light source is a led but around us
there are many objects who are emitting infrared light. The brighest source is the sun. In fact everything
that radiates heat is also emitting ir light like flames, light bulbs, and even our body.
The infrared layers is the means of transmission. We can't see infrared light because the wavelenght is
too long to see. Altough you cannot see the infrared beam, it behaves the same as light, so if you can't
see the target device, you can't control it with a ir remote control. To control applications through
opaque materials, radiofrequency signals are used.
The modulation layer refers to the fact that each burst of infrared signal is often modulated at a
frequency between 32.75 kHz and 56.8 kHz. This is done to diminish the effects of ambient light. This
layer, however, is optional. Some infrared formats do not modulate their outputs, sending pulses of
unmodulated infrared light instead. This is done to extend the remote controls battery life and to
reduce the cost of the remote control device.
The serial data layer has the information containing a command. This is typically coded in the lengths
of infrared bursts or in the lengths of gaps between infrared bursts. Ex. A long gap or burst is
interpreted as a '1', a short gap or burst is interpreted as a '0'.
Receiving and decoding the signal is a lot harder. The ir light is captured by an ir sensitive photodiode
with the highest spectral sensivity around 950nm.
The output signal is optical filtered, amplified and passed through a signal filter tuned to the frequency
of the emitted signal frequency. The best and most easy to use are the integrated 3 leg ir receivers like
the Vishay TSOP1836 and the Siemens SFH505A. The output of these devices is TTL compatible, the
optical filter, amplifier with automatic gain control, tuned filter, and demodulator are integrated.
A study of different remote control protocols can be found on the other pages of my site.You can also
find the source code for a pic16f628 to decode the sony infrared protocol. With this you can control
you pc with an infrared remote control. It's now only available for the sony code, but I will add in the
future other protocols also. With a program running on the pc it will be easy to control windows,
winamp or other applications.
Back to homepage
Most audio and video systems are equipped with an infrared remote control.
A common used standard protocol for infrared data communication is the RC5 code, originally
developed by Phillips. This code has an instruction set of 2048 different instructions and is divided into 32
address
of each 64 instructions. Every kind of equipment use his own address,
so this makes it possible to change the volume of the TV without change the volume of the hifi.
The transmitted code is a dataword wich consists of 14 bits and is defined as:
The picture under are waveforms from my digital oscilloscope of rc5 codes with pushed buttons 1,2,3,4. You can
good see the startbits and the toggle bit (These are inverted signals because they were captured directly on the
TSOP1836). Read further for more info.
The RC5 code uses the bifase modulation technic which means that every bit consists of 2 parts which are never
the same.
So a bit is always a high/low or a low/high transisition. By the RC5 code a 1 is a low high transisition
and a 0 is high low transisition. For all the bits the most significant bit is transmitted first.
Remember also that the outputsignal of the integrated receivers is inverted:
Detecting an IR signal the output of the integrated receiver will be 0V.
The duration time of each bit is equal to 1,778 ms, and the total time of a full rc5 code is 24,778 ms.
The space between two transmitted codes is 50 bit times or 88,889ms.
To improve noise rejection the pulses are modulated at a carrier frequence
The carrier frequency of the rc5 code is 36 kHz so take always a receiver with a response
frequency of 36 kHz.
There are plenty of Detectors for receiving the bitstream of an IR remote control but the best
I ever used is the TSOP1836 of VISHAY. (Datasheet available on my site).
The TSOP1836 is a 3 pin device that receives the infrared bursts and gives out the demodulated bitstream at the
output. The RC5 code is an easy protocol to decode with a pic mircrocontroller . I will show an example to
control your PC when it's finished
Back to homepage
For the communication a pulse is used with a fixed length, followed by a pause wich represents
the logical state of the bit.
2048 codes are defined in this protocol, divided in 5 bits of custom code and 6 bits of data
code. The custom code is a value wich represents the manufacturer code and the data code
is a value wich represents the pressed button on the remote control.
The full transmitted code is 22 bits: First a header is sent then the custom code (5 bits),
then the data code, followed by the inverse of the custom code and the invers of the data code,
Back to homepage
By the Daewoo protocol a logical 0 bit exists of a high puls with a duration time of 550 s followed
by a low puls of 450 s this means that the total duration time of a logical zero bit is 1ms.
A logical 1 bit is formed by a high on time of 550 s followed by low signal of 1450 s this means
also that the total duration time of a logical one bit is 2 ms.
The carrier frequency of the infrared signal is 38 kHz. When you will decode the signal with an
integrated receiver module you need a receiver module wich is tuned on 38 kHz like the TSOP1838
fabricated by Vishay. It will function also with a 36 kHz module but the sensitivity is less than by a
38 kHz module.
Because the receiver (mostly in hobby applications a microprocessor) needs to trigger on a new
received code the protocol starts with a start bit of 8ms high level pulse and a 4 ms low level pulse.
After this the 7 address bits and 7 command bits are sent. But the two words are divided by a 550s
high level signal and 4ms low level signal. Terminating the protocol is done with an another
Back to homepage
The code exists of 12 bits sent on a 40kHz carrier wave. The code starts with a header of 2,4ms or
4 times T where T is 600S. The header is followed by 7 command bits and 5 adres bits.
The address and commands exists of logical ones and zeros. A logical one is formed by
a space of 600S or 1T and a pulse of 1200 S or 2T. A logical zero is formed by a space of 600 S
The space between 2 transmitted codes when a button is being pressed is 40mS
The bits are transmitted least significant bits first. The total length of a bitstream is always 45ms.
The following bitmaps are waveforms measured with a digital oscilloscope. The signals were transmitted with a sony
remote control
Back to homepage
Today I'm started to write the firmware to decode ir signals because many people asked for it. On this page I will
explain how I'm doing it with a pic16f628. The code will be written in assembler. Maybe later when I have good
reactions on this topic I will publish my code of the tinyserirchip for the Phillips RC5 code.
Because many newbies and also hardcore electronists don't like it to make inmediatly huge printed circuit boards,
so I will keep the hardware to a minimum that you can start with a breadboard (the way I did it to test the
firmware), experimental pcb's.
I will add also a function that sends the data to a computer. So it will be possible to control
your pc with the received infrared code. Then with a program running on the pc it will be
possible to control winamp or other programs. At this moment the program will decode the
sony protocol. When you push a button from 1..8 on a remote control you toggle the bits 0..7
on portB. When you push button 0 all outputs will be cleared.
The power supply is not included in the circuit, do a google websearch with the keyword 7805 voltage regulator
and you will find hundreds of circuits.
The sourcecode
Before you download the sourcecode I'm asking two little things:
You don't rip the code (instead make a link to this page) and don't make money with it
I need to do still some work on the sourcecode, but the sourcecode is working, just I need to add code to send the
received ir codes to a pc.
View the sourcecode:
Download the hexfile:
Many people asked me to change the code that it only responds to a specific address here you find this.
View the sourcecode:
Download the hexfile:
Below you can find a version for the pic16f84 you can activate also control the first four outputs and the last
together with channel buttons.
With the volume buttons you toggle outputs 1,3,5,7 or 2,4,6,8.
View the sourcecode:
Download the hexfile:
Downloading the sourcecode and hexfile is free, but if you appreciate my work you can make a donation via
paypal with the button below or take a look on the ads.
The pictures are send to by users who made this project, please send me your pictures to then I can publish them
and encourage other people to build this nice project.
Back to homepage
The JVC infrared remote protocol is almost equal to the daewoo protocol.
It are just the timings and the spacer between the address and data bits who differs a little bit.
By the JVC protocol a logical 0 bit exists of a high puls with a duration time of 600 s followed
A logical 1 bit is formed by a high on time of 600 s followed by low signal of 1600 s.
The carrier frequency of the infrared signal is 38 kHz. When you will decode the signal with an
integrated receiver module you need a receiver module wich is tuned on 38 kHz like the TSOP1838
fabricated by Vishay. It will function also with a 36 kHz module but the sensitivity is less than by a
38 kHz module.
Because the receiver (mostly in hobby applications a microprocessor) needs to trigger on a new
received code the protocol starts with a start bit of 8ms high level pulse and a 4 ms low level pulse.
After this the 7 address bits and 7 command bits are transmitted.
Terminating the protocol is done with an another high level signal of 600s.
The time between two startbits of bitstreams when the button on the remote control is being pressed =
60 ms but the start header is only once transmitted in the beginning of the keypress.
Back to homepage
Tinyserir-RC5
What is it?
Datasheet: tinyeng.pdf
Tinyserir-RC5 is a tiny microcontroller, it's a pic12f629 microcontroller who has the firmware on board
for decoding RC5 infraredsignals and send them serial to a device with a RS232 communication port,
mostly a PC.
You can ask yourself, what can I realise with this chip, oh they're plenty of applications where you can
use the tinyserirchip, like controlling winamp with your infrared remote control while you are reading a book
There is chosen for the RS232 protocol because with the USB port today, the RS232 port is free and
have no futher function.
Like the name says the tinyserir-RC5 chip can decode infrared signals coming from an infraredreceiver.
The RC5 code is common used protocol originally developped by Philips (C) and still used by plenty of
brands for controlling there devices wireless.
When you don't have a RC5 remote controller you can use a universal remote controller which can be
100% sure programmed to send RC5 codes.
Tinyserir decodes signals coming from an infrared receiver module wich is tuned for 36kHz.
An example of a compatible receiver is a TSOP1836 from Vishay.
The RS232 output pin is a pin who can be wired directly to a Basic stamp or via TTL-RS232
level converter to a free serial port of the PC, and sends messages with a baudrate of 9600bps.
Tinyserir-RC5 sends exists of the following parts: A header wich indicates if it is a reset message or
an infrared message.
If it is a reset message, a header, the name and version number aretransmitted. If it is a message for
a received infrared code a header, the toggle bit, the address of the RC5 code and the command of the
RC5 code are transmitted.
The toggle bit indicates if a button on the remote control is being pressed or released during two
received codes. The address indicates if it is a TV or a satelite receiver or something else, and the
command indicates wich button is pressed on the remote control.
All the data which are transmitted via the rs232 pin are ASCII characters, so it is possible
The transmitted messages are clear and every part is easy to recognize for make it simple to decode the
messages with Delphi or visual basic. Many systems are decoding directly the output of the infrared receiver
but with these method your PC slower and less accurate because your system needs to poll the input in realtime what
becomes a great problem for windows. But with the tinyserirchip your program only needs.
to read the ASCII characters in the serial input buffer of the RS232 port.
So you don't need to take care about the timing of the relative fast pulses (+-889 S) or other processes who
are running on your system who can disturb the measuring of the infrared pulses.
Tinyserir sends only messages when a valid RC5 signal isreceived, this means when the timing of the
bitlengths are between the specifications and the bitphases are inverted, if not simply no message is
transmitted.
Following examples are the messages how they appear in hyperterminal or the input buffer as ascii
characters.
A reset messages looks like :R;Tinyserir-RC5;1.00;
The first character of the message is always the double point. The second is the header R when it's a
reset message. After this a seperator ";" the name of the chip and the version number of the firmware.
All the messages ends with a cariage return and a linefeed.
The header and the separate characters makes it easy to recognize the different parts of the messages.
The reset message is always transmitted as first after a reset of the chip.
A message is also transmitted when a valid RC5 code is decoded.
There are also two ledoutputs who can drive directly led's for some indication: like 1 led that blinks
with a fixed frequentie when the firmware is running and another led flashes when receiving infrared pulses.
How to order?
Order now one or more pieces by clicking on the buy now button.
For the payment you need a Paypal account.
Customers from Belgium and Netherlands can order via the dutch page.
The chips are shipped in the next 3 workdays.
The first steps to see if your hardware works, can be done with hyperterminal or with the
following testprogram for windows 95/98/ME/XP.
Back to homepage
Here you can view pictures of a receiver I made for some friends.
There are 2 versions of it. A version which understand the RC5 protocol and a version who
understand the old panasonic protocol.
The receiver has 7 outputs who are activated or deactivated by pressing one of the corresponding
buttons on the transmitter. Easy with one touch you can control several electronic systems like
your garden spots or the waterfall pump.
The distance between transmitter and receiver is up to 15m.
This version of the receiver has also a light sensor wich can turn off 3 outputs after a programmable
darkness time. This is usefull to save energy in a garden lightning system.
The user has also an indication led on the receiver which is illuminated 3 seconds when the
receiver receives a correct code.
Pictures
The first picture is the receiver. The receiver contains the Infrared sensor, light sensor and
the high efficiency led.
The follow picture is a foto of the whole system built in a vynckier housing
You can see the main processor board and the relais (only 2 ouputs used).
The right foto is build in a general electric housing with the relais placed on a PCB where 4 ouputs
are used
You are searching for a free and easy bootloader? You can find it here.
A bootloader is a small piece of firmware (max 512 bytes for the pic18fx52) in the beginning of the
program memory to quickly and easily download your own developed firmware in the pic micro.
Usually the comport of the pc is used for the communication between your PC and your picmicro
application.
A programmer can do this also. Yeah right but when you are developing an application you need to test
many times the new written code. To do this you need to take the micro out of his socket, place it in the
programmer, programming it and removing it back to place him again in the application socket. After a
few times you have broken pins, painfull fingers and wasted a lot of time. Now you just need to start the
download software. Download your program to the pic and doing a reset. So you have more time to
spent on your project then change all the time the pic micro. Believe me once you did it this way you
will not doing it otherwise again.
I've changed the original sourcecode because when you download it from microchips website it will not
work. The firmware likes to be written for a microcontroller with 2 serial ports. And at the end before
the subroutine waitrise they placed an org 0x00A. Why I don't know, but this is wrong and the code does
not work with this. So I removed it. To start the bootloader software the data on the last internal eeprom
address must be FF, when it is another value it jumps to the new reset vector at 0X0200h.
I changed this and used the RA,0 input pin to select wether to start the bootloader firmware or the
user program. When RA,0 is high it starts the bootloader when low it starts the userprogram. This
way it is easy with a jumper to select this and a reset button to reset the processor.
You just need one more time using your old programmer to programing it into the pic. I'm using an
jdm programmer
with my selfmade adapter for 40pin devices. (don't laugh with me but this is the way i'm doing, see the
foto). But it works and its the cheapest adapter.
You just connect with wires the pins on the 18pin socket to the 40 pin socket.
-----18pin-----40pin-----
MCLR-pin4-------pin1-----
GND--pin5-------pin31----
+5V--pin14------pin32----
Data-pin13------pin40----
Clk--pin12------pin39----
Don't forget also to set the config bytes because they are not included in the hex file: For an Xtal
oscillator of 20Mhz I set, Config 1 (hex) FAFF, config 2 FEFC, config 3 FEFF, config 4 FFFA, config
5,6,7 FFFF
To communicate with the bootloader firmware in the pic, you need also software that runs on your pc.
Microchip added a little and simple but effective program to download the userprogram into the pic.
At this moment the pic18 devices are using the first 512 bytes of program memory as the boot block.
Future devices may expand this but however this bootloader fits in the first 512 bytes. The bootblock
can be write protected to prevent accidental overwriting.
REMAPPED VECTORS
Since the hardware RESET and interrupt vectors lie within the boot area and cannot be edited if the
block is protected, they are remapped through software to the nearest parallel location outside the boot
block. Remapping is simply a branch for interrupts, so PIC18F users should note an additional latency of
2 instruction cycles to handle interrupts. Upon RESET, there are some boot condition checks, so the
RESET latency is use additional instruction cycles.
WRITING CODE The bootloader operates as a separate entity, which means that an application can be
developed with very little concern about what the bootloader is doing. This is as it should be; the
bootloader should be dormant code until an event initiates a boot operation. Under ideal circumstances,
bootloader code should never be running during an applications intended normal operation. When
developing an application with a resident bootloader, some basic principles must be kept in mind:
Writing in Assembly When writing in assembly, the boot block and new vectors must be considered. For
modular code, this is generally just a matter of changing the linker script file for the project. If an
absolute address is assigned to a code section, the address must point somewhere above the boot block.
For those who write absolute assembly, all that is necessary is to remember that for PIC18F devices, the
new RESET vector is at 200h, and the interrupt vectors are at 208h and 218h. For PIC16F87XA devices,
the RESET vector is at 100h and the interrupt vector is at 104h. No code, except the bootloader, should
reside in the boot block.
Writing in C When using the MPLAB C18 C compiler to develop PIC18F firmware for an application,
the standard start-up object (c018.o or c018i.o) must be rebuilt with the new RESET vector. Like
modular assembly, the linker file must be changed to incorporate the protected boot block and new
vectors.
Back to homepage
PICmicro Sites
Prev | Ring Hub | Join | Rate|
Next
WebRing Inc.
Search
Negate 24 bit
Do you want see more code examples like rc5 decode routines type it in and click the search button.
Search
http://users.telenet.be/davshomepage/picsource.htm12/02/2008 17:38:45
The led page
leds
LEDs(Light emitting diodes) are little lights used in many products. You can find them in toys, synoptic panels,
car lights, garden lights, house lights, remote controls etc.
You can find them in the classic colors red, green, yellow,orange,infrared but also the newer colors blue, white,
UV, pink.
Leds are current driven devices. The brightness is proportional to the current through the led. Usually a resistor
connected to a voltage source limits the current in most applications. Mostly this is the easiest and cheapest
solution.
A current of 20mA for a 5mm led is the nominent current for most devices, but always check datasheets or
application notes before connecting leds to power supplies. Because one little mistake can send your led to
heaven. Never go higher then 25mA else the lifetime of your led will be shorter
Also important is the direction of the current thus also the polarity of the voltage. You can compare leds with
diodes. In one direction they conduct current and will be illuminated, in the inversed direction they stop the
current and remain dark. Now how can you see what the positive lead(anode) is and wich the negative lead
(cathode). Well the longest lead is the anode the other the shortest is the cathode(flat side on the package).
A bad connected voltage higher than the backward voltage typical 4 to 5V will damage the led)
The forward voltage of the led differs from color to color. Some typical voltages are:
Red: +-1.8V
yellow: +-2V
Green:+-2.1V
Blue: +-3.2V
White: +-3.2V
Calculate it:
Now the most important formula to connect the led with a series resistor at a voltage:
R = ( U - Uf ) / If
Example:
White led with a nominal current of 20mA and forward voltage of 3.2V will be connected to a voltage of 12V
R= 440 ohm
So the resistors must be at least 440ohm this means we take a real resistor of 470ohm
Some advice: Don't raise the input voltage too high, because all the energy will be wasted in the resistor.
When the power dissipation is high, the resistor needs to be bigger and more expensive.
U: Input voltage
Uf: Forward voltage of the led(s) (sum the forward voltages of all the leds together when more then 1 led)
Pmin: Min power rating of the resistor
Iled: nominal current of the led
Pmin = ( U - Uf ) * If
Example:
When you take the values of the example above, our resistor of 440ohm must be rated:
Pmin= 0.176Watt
This means we take a resistor with a nominal power rating of 1/4 Watt
Back to homepage
Current source
A current source is an electrical or electronic device that delivers or absorbs electric current. A current source is the
dual of a voltage source. Current sources can be theoretical or pratical. I will handle only the practical with the use of a
LM317.
Why using a current source instead of just a simple cheap resistor? In many situations a resistor will be enough but also
some devices need a constant current irrespective of the voltage: ex. a 20mA current loop transmitter. Also LEDs are
current-driven devices that require current limiting when driven from a voltage source. In most applications, it is
desirable to drive leds with a constant current source. The current source is used to regulate the current through the led
regardless of powersupply voltage variations or changes in forward voltage drops(Vf) between LEDs.
LM317
The LM317 is a monolitic integrated circuit. It's a 3 terminal positive
voltage regulator designed to supply more than 1.5A of load current
with an output voltage adjustable over a 1.2 to 37V. It employs
internal current liniting, thermal shut-down and safe area
compensation. The LM317 is cheap, thermal protected, up to 1.5A and
easy available.
The schematic
Power dissipation
Because the LM317 is a linear regulator and needs a voltage drop of about 3V, the dissipated power will be the voltage
drop over the LM317 multiplied by the current of the circuit.
P=power loss
U=supply voltage
Uf=voltage drop device
I=current
P = ( U - Uf ) * I
Tip:
When you have a device with a specific voltage drop and a relative high current(ex. a white lumiled: 3.2V, 0,35A 1W)
keep the input voltage as low as possible, but keep in mindthat the LM317 needs a voltage drop of 3V.
I'm sure the LM317 will become very hot. The LM317 devices have internal shutdown to protect from overheating but
in all working conditions the junction temperature must be within the range of 0 to 125 deg celcius. So a heatsink
maybe required at maximum power loads and maximum ambient temperature.
P = ( U - Uf ) * I
P = 3W
When it's impossible to lower the voltage of the powersupply and the current is high maybe a switched current source
will be better.<> I will explain this in the future.
Current adjustment:
Now we know the needed input voltages but still don't have a constant output current. For this we gone abuse the
voltage regulator. We place a resistor in series with the LM317 and the output device (ex. a led) and connect the adj pin
over the resistor. Because the LM317 will regulate the voltage on the adj input allways to 1.25V, we become a constant
current through the resistor and connected device
How it works: Over the resistor there is always a voltage present of 1.25V
This means when the current decrease, normaly the voltage over the resistor will be lower also but what happens now:
the regulator lets increase his output voltage to adjust a constant voltage over the resistor of 1.2V
So we can calculate with ohms law what resistor is needed to get a specific current.
R=U/I
R = 1.25V / I
Example: We will supply 3 lumileds 1W power rated in serie with a 12V battery. The nominal current for the leds is
0,35A We can find the proper resistor value with the formula above:
R = 1.25V / I
Thus we need a resistor of 3.57 ohm but will not find one with this value. To solve this problem take a value that's
higher. Here in the example we will take one of 3,9 ohm.
The real current will be then I = U / R = 1,25V / 3.9ohm = 0,32A what not will be a problem (it extends the lifetime of
the leds)
Going further:
Back to homepage
Roulette game
I know this sound like music in the ears and it is not relevant with my other electronic pages, but trust
me it works and I tried it many times and it lucks allways. Many sites are asking a lot of money for this
easy method, but I will show it on this little page.
I think everybody knows how you can play roulette, but my method works just with playing on color,
pair, unpair...
Thus all the options where you have one chance on 2 to win and of course they payout two times the bet.
Well when you bet for example 1$ on the color red, and it is red well lucky you receive 2$ and thus wins
inmediatly 1$. No serious now: You bet 1$ on red and it is black. No problem you loose your bet but,
and next game you bet 2$ on red (double your bet).
But again it was black: no problem next game you double again your bet, so this will be now 4$. Now
the roulette choose red.
Bingo:
Why bingo well lets see once we played 3 times and have bet a total of 7$. Last game it was 4$ and
received thus 8$. This means we spent 7$ and received 8$ thus we won 1$.
When you allways double your bet after you lost, at the first time you win, you win your starting
bet.
And this you can apply on all games where they pay 2 times the bet when you win.
But now you will ask what if the zero was played: no problem keep your color and the next time when
it's your color you win your bet.
Will you try it for free you can do it by online casino were you can play for free just for the fun.
Another example: lets start us with 2$ on red and loose 4 games, the fifth game it is red: well we will
win 2$: We lost first game 2$, second game 4$, third game 8$, fourth game 16$, fifth game 32$ so a
total of 62$ but because we receive 64$(32$*2) we are winning 2$ (the beginning bet).
Write it once down on a paper with different situations or colors or try it once with an online free casino
game and you will see that it works, or do a search to find other tips and tricks on the web.
I do it always this way and like it when we go once with the family or friends to the casino to play some
money.
Just the different is the others are allways loosing money and i win. Nice.
Good luck!!!
Back to homepage
Datasheets
PIC16F84
Errata PIC16F84
Programming the pic16f84
TSOP1836
I2C bus specifications
MAX232 Linedriver
Back to homepage
http://users.telenet.be/davshomepage/datasheets.htm12/02/2008 17:38:50
Links to other electronic pages
Links:
Click on the icon to get a copy of the 100% free mozilla firefox webbrowser. It's faster it's safer.
http://users.telenet.be/davshomepage/links.htm12/02/2008 17:38:50
Davshomepage
Hi,
Address: Langemunt 59
City: Aaigem
email: davshomepage@pandora.be
http://users.telenet.be/davshomepage/itsme.htm12/02/2008 17:38:51
BS Club - PIC Interpreters Club
BSSClub
Email us!
New! Basic Stamp 1 divided by four ST1-64 code version 2 available online!
Club Membership
The club will not support any software or hardware development, based on the reverse engineering (i.e.
"poping") of read-protected chips. This prohibited techniques also include using non-standard
environmental conditions (e.g. non standard voltage, frequency, or temperature) for reading otherwise
unreadable data from hardware modules or chips.
The file was downloaded 1511 times until March 22, 2000.
Compiler from source language (currently only BASIC) to the intermediate code of CORE ST1-64. The
compiler ST1.EXE is included in the distribution. The syntax of the input language of this compiler is
compatible with the Basic Stamp I language with some extensions, that will be useful in future types of
core. The compiler after compiling displays the size of compiled programs in bytes, so the STMPSIZE
utility is no longer needed.
This compiler allows compiling the Basic program into the intermediate code (the default action of the
compiler), downloading the program to the ST1-64 chip using parallel port interface (with /l option) or
serial port interface (with /s) option and debugging the program (with /d option).
The compiler also generates the output file with the binary intermediate code named CODE.OBJ. The name
of this file can be changed using the /o command line option.
The ST1 compiler uses in present version for downloading the parallel interface that is vulnerable to
interrupts. For maximal reliability it should be run under clear MS-DOS (not the DOS window under
Windows). You can use it also in the DOS window under Windows, but the downloading is not allways
succesful and sometimes you should repeat it. In near future will be implemented downloading using serial
interface that is not vulnerable to interrupts.
Compiler is written using LEX and YACC tools and is prepared to be multilanguage compiler with multiple
code generation modules. Future versions will support more languages (the BS1 syntax is only moderate
start) and code generation modules for interpreters with more memory and also direct code generation for
microcontroller.
Circuit. The basic circuit for parallel downloading is very simple. The ST1 compiler supports both serial
and parallel port downloading (the original DOS Stamp software downloads only via the printer port).
Serial port downloading requires an 'adapter' to convert the +/- 12V serial signals down to a safe 5V.
This adapter is designed to adapt the original 'printer port cable' for use with the serial port. Naturally you
could also construct a new cable arrangement from scratch. Note that pin 6 and 7 on the serial connector
must be linked. Note also that the adapter requires a 5V power source, which can be sourced from the
Stamp's 5V output pin.
There are two versions of the conversion cable. The first one uses transistors and the second one uses
MAX202 or MAX232 circuit.
You can look at ELECTRONICA ESTUDIO site where is the schematics and PCB
layout of the ST1/64 hardware under the name "Clon Stamp 64". You can also order a
kit here.
Other compilers. If you are not satisfied with the above compiler, other compilers can be obtained from a
number of sources. The currently known possibilities are following:
The first possibility is to use an original Basic Stamp I editor for MS/DOS developed by Parallax
(BASIC Stamp is a registered trademark of Parallax, Inc.). This editor is called STAMP.EXE and is
freely downloadable from the Parallax site or from Parallax FTP server.
The second possibility is to use a BS/4 Editor written by Antti Lukats from Silicon Studio Ltd. that
was developed for the BS/4 project and is freely downloadable from the Dontronics page Basic
Stamp Divided By Four.
Note that this editor uses different downloading protocol than CORE ST1-64, so you have to use the
BSAVE command (see our note to Parallax software) and then download it using BSLOAD.EXE
downloader by Parallax. If there will be enough interest we can maybe develop a CORE ST1-64
version with BS/4 compatible download protocol. When using current version of BS/4 Editor you
cannot use DEBUG command.
The third possibility is to use a nice Windows based sofware created by TEP. The software is
downloadable from TEP site. According to the authors: This Windows software has been developed
because the original Parallax DOS software was not suitable for schools running Windows NT
networks, or for any schools who prevent DOS access for system protection reasons.
This software is fully compatible with programs written in the DOS software, and programs written
in either system can be exchanged without modification. However this software downloads to the
Stamp via the serial port, rather than via the printer port as used with the original DOS software.
See the Download Cable section for further details.
BSSClub note: The serial downloading should be without problems possible also for CORE ST1-64
chip, but we did not check it. We encourage our users to test it and to let us know about results.
If there is available any other suitable compiler, please let us know.
Documentation
For users unfamiliar with the Basic Stamp system we strongly recommend the original Basic Stamp
manual, which is available in pdf format from the Parallax Web site at http://www.parallaxinc.com.
Bug History
You are encouraged to report bugs and errors using the Implementation error report
Distribution
This software is property of BSSClub and you are free to use it for your personal use as you see fit.
However, this software is not public domain and you may not redistribute it in any way with any product or
service. If you would like to mirror the official distribution on your Web or FTP site, contact BSSClub and
we will not unreasonably withold our permission to do so provided you agree not to charge for the software,
not to modify it in any way, and you agree to keep the most current version.
Disclaimers
This software is provided free and is as-is. BSSClub makes no warantee as to its fitness for any purpose
whatsoever. Basic Stamps are a product and registered trademarks of Parallax Inc. BSSClub is in no way
affiliated with Parallax.
Some time ago, Antti Lukats of Sistudios came up with a Basic Stamp divided by four. The original basic
Stamp One has 256 bytes for tokens in an external 256 byte EEPROM (BASIC Stamp is a registered
trademark of Parallax, Inc.). Antti's has just 64, which is the internal data eeprom storage of the PIC16C84
and PIC16F84 EEPROM version PICmicros.
This is an ideal starting point for Students, and Hobbyists, and may well be suitable for small Industrial
Applications.
Schematics of the board for this project is here and the whole PDF document can be downloaded from here.
Important note! If you are going to build this circuit, consider that the circuit for the following
project will be slightly different and this circuit will no be usable for them. We recommend you to
slightly wait and build the circuit suitable for both projects.
It appears that possible additional development on this project is not forthcoming, so this code is placed on
the web free for personal use only and can be downloaded from the Dontronics page Basic Stamp Divided
By Four.
The BS/4 project contains some unimplemented features and some errors.
Known unusual features: loading protocol different from original BS1, using P7 in SERIN and SEROUT
commands will force HOST port to be used instead of P7 Pin.
Firmware v 0.01 (alpha) known bugs: DEBUG not working, POT not working, SLEEP and NAP not
working, SERIN working only partially
You may report further bugs and errors using the Implementation error report
The Jesstec Tiny-51 Interpreter is an adaptation of the old Intel Tiny Basic Interpreter and has been
designed to run out of serial EEPROM, one or two enhancements have been done, and a PC front end
developed which will allow programs to be written without line numbers and downloaded to the system.
Download binaries from Dontronics page.
Here you may report the bugs or errors that you have discovered in our projects.
What project error are you reporting: CORE ST1-64 Error Report
SEND CLEAR
Microchip PIC
Atmel AVR
Handbook of Microcontrollers (Re 8051, 68HC05, Atmel AVR, PIC, Stamp, +CD)
Michael Predko; July 1998; McGraw Hill
Links
AWC Electronics offers the ASP-II prototyping system for Parallax Basic Stamp Microprocessor modules,
the companion ASP-A Lab kit, and Pak-II Math Coprocessor that brings 32-bit floating point math to
almost any microcontroller. Al Williams also maintains the Basic Stamp FAQ.
Dontronics
Introduction to the BASIC Stamp by Peter H. Anderson
Pbasic's Basic Stamp Homepage with copy of original Stamp documentation
Silicon Studio
Microcontroller Development
Continue >
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
http://c.webring.com/cgi-bin/drive?done=http%3A%2F%2FC%2Ewebring%2Ecom%2Fwrman%3Fring%3Dpicmicro%3Bsid%3D11%3Baddsite?sid=11&ring=picmicro&addsite12/02/2008 17:39:03
OneStat Basic - Resumen
292302 -
Davshomepage
Vistas de pgina por hora de 12/02/2008 (Hoy) Imprimir Exportar Info
Per-odo: Hoy
Mostrar: Horas
Per-odo
Resumen
Vistas de pgina
Info de visitante
Pginas ms visitadas
Geograf-a
Referentes
Tecnolog-a Volver arriba
Estad-sticas
Los Charts
Resumen de estad-sticas de 12/02/2008 (Hoy) Imprimir Exportar Info
Estad-sticas
Total de vistas de pgina: 170
Total de visitas: 104
Visitantes nicos por d-a: 91
Visitantes nicos por hora: 103
Visitantes por primera vez: 62
Prom. de vistas de pg. por hora: 9
Vistas de pgina por visita: 1,63
Vistas de pgina hoy: 170
Visitas hoy: 104
Pronstico para hoy: 247
D-a ms activo: 14/02/2007
Volver arriba
Front Door
At Spy Quip World we import, Most of the products on this It could be a co-director or key
manufacture and distribute an site are manufactured to member of staff trying to
extensive range of order and may require secure confidential information
Professional Audio/Video professional installation. If before leaving to start their
surveillance equipment. With a you chose to install yourself, own business. It may be just a
proven track record of many we will guide you but there simple case of deception by a
years standing as specialists in will be no return of the trusted partner.
this field, we pride ourselves goods if the unit is not faulty You may have a strong
on our service and equipment and you fail to get it working. suspicion or just a niggling
which is second to none. Our doubt. Perhaps you just want
excellent reputation has Disloyal or conspiracy is reassurance that you are not
earned respect from all our usually conducted through under attack. Whatever your
clients. discussion. By its very reasons for wishing to establish
We offer confidential advice to nature little is committed to the integrity of another person,
meet each customers needs. writing. It may be positive knowledge of a
In our showroom you will dishonesty, involving fraud situation is preferred to
receive friendly, professional or attempts to exploit uncertainty.
help with demonstrations of situations for personal gain.
our equipment. Alternatively, It might be the theft of trade
we can advise on your secrets from within or
requirements and except outside. It could be a
orders over the internet, competitor conspiring to
telephone, fax or post. subvert employees or
compromise a company's
trading.
INDEX
[A little background on TALKING ELECTRONICS]
Library of Routines:
Page1: library_A-to-bug-1
Page2: library_button-to-2Buttons-2
Page3: library_button-to-carry-3
Page4: library_carry-to-endlessloop-4
Page5: library_equates-to-labels-5
Page6: library_LSB-to-output-6
Page7: library_pageo-to-pgmJumps-7
Page8: library_pgmSpace-to-sleep-8
Page9: library_sound-9
Page10: library_sourcing-to-timeDelays-10
Page11: library_timing-to-z-11
These are the Chapters we have put on the Web for the PIC12C508A and PIC16F84 micros
and the secret behind our programming course lies in the "Library of Routines
Chapter." This full chapter is available on our CD for $10.00 posted.
The way the course works is you are actually programming and down-loading into
a PIC16F84. You then have the option of transferring the program into a PIC12C508A to
make the project as cheap and compact as possible.
We also have a project called "5x7 Video Screen" and this provides a number of
experiments for the PIC16F84, so you have a wide choice of experiments.
Colin.
PROJECTS INDEX
The first project is essential when designing new projects and for trouble-shooting
The second project leads you to a lot of programming.
The third project programs PIC chips including 12c508A and 16F84
The Dial Alarm-1 shows what can be done with a PIC12c508A
DIAL ALARM -1
au$x.xx plus post
A complete dialling alarm the size of a pack of cigarettes using a PIC12c508A
Page 1
Page2
http://users.tpg.com.au/users/talking/index_of_pic_projects.html12/02/2008 17:39:41
Talking Electronics Education
WELCOME
TO
TALKING ELECTRONICS
This is our fast mirror site!
To go to our "old page" click HERE
To go to our other site in Australia, click HERE
Remember our "easy" address: http://all.at/te
The pages below became so popular that they exceeded the download allotment of our web-space
provider, Geocities and were constantly turned off.
They have now been transferred to our new site: TALKING ELECTRONICS Interactive
Edition.
This new site is larger and is accessed on a subscription-basis of $19.95.
TALKING ELECTRONICS is the largest electronics magazine in the US and it now has a totally
separate web edition called TALKING ELECTRONICS Interactive Edition.
Click HERE to go to our new site.
I know you will like it as it is being constantly updated and a new issue is presented every month.
See sample pages by clicking the links on the introductions page.
It also has a new section called FREE Projects where you will find projects to teach programming
of PIC chips and a new range of projects for robots.
Page 8: How the Brushless Motor works - The FAN in your computer!
Types of transistor stages
Page 15:
The voltages on a common-emitter
stage and emitter follower stage.
Page 18:
Touch Switch Circuit
Page 19:
Super-Alpha Pair
Page 20:
Interfacing to Gates
Page 21:
More on interfacing to Gates!
Page 22:
More on interfacing to Gates!
Page 23:
More on interfacing to Gates!
Page 24:
More on interfacing to Gates!
Page 25:
Even more on interfacing to Gates!
This is the end of this course. PIC Projects are HERE
Go to PIC Programming!!!!!!
SEARCH HERE . . .
This Site The Web
[Skip Prev] [Prev] [Next] [Skip Next] [Random] [Next 5] [List Sites]
15-2-2004
TALKING ELECTRONICS
PIC16F84 Data Pages
GOTO: Logic Probe GOTO: 5x7 Display GOTO: PIC LAB-1 GOTO: Multi Chip Programmer
TALKING
ELECTRONICS
This is a full and complete index of everything on all Talking Electronics Sites.
PIC Projects Basic Electronics PIC Theory
TALKING ELECTRONICS
Here are at least 2,500 links:
Jim of Newfound Electronics Links - at least 100 links
David L. Jones of Tronnort Technology Links - quite a number of links
RadioLocman circuits archive - over 9,000 circuits
SatCure Electronics - many links
David Tait's Links
Michaels Links
Simon of "Electronics 2000" links
The EE Compendium Links
101 Electronics Links - 100's of Links
Data Bookshelf Links
Dontronics Links
ePanorama Links - at least 1,000 links
mikroElektronika Magazine Links
Robotics UK Links - lots of electronics links
Larry's Links - 159 great links
Tony van Roon's - Circuits and Links
CIRCUIT LINKS:
Electronic circuits
Robot ideas
OTHER LINKS:
Acronym's. (a word created via the first letters of other words) A B C D E F G H I J K L
M N O P Q R ST U V W X Y Z
Byt grafik kort utan att verka p garantisedeln! - you must see this. How to change the graphics card
on your PC without opening the case (which would ruin the warranty with some computers)? Text in
Swedish, but pictures by themselves tell the story.
http://www.talkingelectronics.com/12/02/2008 17:40:11
http://users.tpg.com.au/users/talking/Logic%20Probe%20with%20Pulser-Intro.html
LoPIC
There are 5 pages
in this project:
Intro (this page)
LOGIC PROBE
Construction&Burning
Using the Probe
Using the Pulser
with PULSER
Going Further
Most Logic Probes are fairly expensive, because they come in a fancy case. The skill is to produce a
cheap probe, and that's what we have done. The only difference is the speed of operation. Some of the
expensive probes will detect very brief pulses. Our probe is only suitable for pulses up to about 1/10
microsecond - that is: circuits with a frequency of 10MHz - or a glitch of a similar duration.
But our probe has other advantages. It has an audible output as well as visual. This means you can hear
what you are doing and speeds up the process of checking a layout when you have a lot of points to
test.
Some time ago Talking Electronics produced a Logic Probe with an audible output. But it required a lot
of components. The '508A micro (or F84) has simplified the project to less than 20 components!
In this article we show how you can build either version and the chip you use will depend on if you want
to burn your own program using a PIC12c508A-blank (a blank or empty '508A) or a PIC16F84 or buy a
ready-programmed chip (PIC12c508A-Logic1).
That decision is covered in other parts of the article. In this section we will explain how the circuit works.
First we have to explain why the circuit is so complex. It's mainly because the PIC chip is not able to
detect a tri-state input and this has necessitated a little extra circuitry.
The tip of the Logic Probe line must be able to detect a HIGH and LOW input as well as when the tip is
not connected to anything. This is a tri-state requirement but the input to the PIC chip can only detect a
HIGH or LOW.
The second problem that has to be addressed is the fact that when the probe is not connected to
anything, none of the tones must be emitted. Most of the Logic Probes using a PIC chip have LEDs as
the indicators and one LED is always glowing before and after a test procedure. This has to be avoided
with tones as it would be quite annoying.
To get around the problem the program was written to take the probe line HIGH and LOW very quickly
and monitor the input to see if it reflected the way the line was being driven.
If it did, the conclusion is the input is not connected to anything.
If the line remains HIGH, the HIGH tone will be produced and if it remains LOW, the LOW tone will be
produced.
To detect a pulse or frequency, the input line is taken HIGH-LOW 8 times and if the high and low values
do not match-up, the conclusion is an input frequency is being detected.
This is the requirement, now it's necessary to put these requirements into a program along with a 2Hz
frequency on the pulser line to test a LED and speaker and a beep after 5-minutes to tell the user to turn
the probe off.
That's the requirement of the project.
Firstly we will look at the circuit in detail.
The front-end consists of an emitter-follower stage (also called a common-collector stage). We have
studied this circuit in our basic electronics course (page15 and page16) and shown how raising the base
causes the emitter to rise. This is the type of stage we need since the input has to rise to nearly rail
voltage for the circuit to detect a HIGH. The stage has another advantage. It creates a high-impedance
input so that the Logic Probe does not "load" the circuit it is testing. (Read about the meaning of LOAD
THE CIRCUIT in the basic electronics course, page 13).
This stage amazingly converts the Logic Probe from a 1MHz Probe to 10MHz Probe. It does this by
charging a delay circuit made up of a 100k resistor and 47p capacitor. When the tip of the Probe detects
a very fast pulse (signal) it passes it to the base and the transistor rises very quickly. The emitter rises
and charges the 47p capacitor and the transistors falls back. The capacitor remains charged for a few
more microseconds (it is discharged by the 100k resistor). The program produces a "window" of about
12 microseconds in which the input is read 5 times. If the pulse or "glitch" occurs during this "window,"
the circuit will pick it up and the program turns on the HIGH LED.
The program produces this window every 22 microseconds for more than 1,000 loops then output a
LOW to the pulser section and repeats the above. If the signal is from a high-frequency oscillator (or
repeated glitches), it will keep charging the capacitor at regular intervals and the program will flash the
HIGH LED.
The 10k resistor on the base of the input transistor prevents damage to the transistor if the voltage is
above 6v.
The Logic Pulser section has a 100R resistor to prevent damage to the output of the micro, if the tip is
placed in a short-circuit condition. The 100R resistor also limits the output current to less than 25mA so
that it will not damage any circuit being tested.
Colin Mitchell recommends the Logic Probe with Pulser-PICF84 version. You can work on the
program and change any of the features.
LoPIC
PARTS LIST with F84 chip
Cost: $25.80 plus postage
LoPIC
PARTS LIST with '508A-logic1 with
pre-programmed chip
Cost $22.60 plus postage
BUY A KIT
THE PROGRAM
The program is basically very simple. But since it has two different features (in the Logic Probe/Pulser
section), running at the same time, the complexity builds up.
There is also another section called "Sounds" on the "Going Further" page. We will not be covering this
section at the moment.
First of all, let's try to simplify the Logic Probe/Pulser program.
When a Low is detected, a LOW tone is emitted from the piezo and the green LED is illuminated. When
a HIGH is detected, the HIGH tone is produced and the red LED is illuminated. When a Pulse or
oscillation is detected, both the HIGH and LOW tones are produced and both the red and green LEDs
are illuminated. Depending on the proportion of the HIGH and LOW signal, the LEDs will have a varying
degree of brightness and if the frequency is very low, the LEDs will oscillate. If a glitch or pulse is
detected, the red LED will flicker.
The program is also required to produce a 2Hz pulse from the PULSER section that is suitable for
testing both a LED and speaker and after 1 minute of non-operation the project sends out a burst to tell
you to turn it OFF.
Both these programs are running at the same time and this can be seen in the Main routine. The Main
routine consists of 4 parts. It starts by producing the LED ON period of time shown in the diagram
below. This takes 1/4sec or 250,000 cycles. The next part of the Main routine produces the LED OFF
time and this also takes 250,000 cycles The third section of the Main routine toggles the Pulser line and
produces an output that produces an on-off waveform at the equivalent of 1,000 times per second. The
final part of the Main routine is identical to the LED OFF section.
These 4 sections are constantly looping and the signal it produces appears on the PULSER line.
But the more-complex section is the LOGIC PROBE. It has a bigger job to do and requires a lot more
thought in programming.
The first complexity is the need for a tri-state input. The Logic Probe must be able to detect a HIGH, a
LOW and when the probe is not connected to anything. But the input of PIC chip is not tri-state. So,
something has to be done to create this feature.
If a tri-state input is not created, when the tip is "floating," the input will detect either a high or low and
one of the LEDs will be illuminated. But more annoying is one of the tones will be produced.
To prevent this, the input is taken HIGH-LOW via another line and if the program detects the tip as
following the high-low signals, it interprets this as a high impedance (floating) state and all tones and
LEDs are turned off.
When probing a digital project, any signal will easily over-ride the signals we are giving the "font end"
and the program will respond by turning ON the tones and LEDs.
Since the program responds very quickly to the signals on the input, the sound from the piezo and the
illumination of the LEDs will provide a variety of effects.
It is very easy to determine if the signal is a constant HIGH or LOW or the amount of activity (frequency)
on the line. Even a 1uS pulse (glitch) will be picked up.
Obviously this is not a 100MHz logic Probe but it is certainly suitable for all the digital projects we will be
describing in the PIC series.
The secret in the design of the Logic Probe is in the front end. We have described the operation of the
transistor in the front end and now we will see how the program uses the information it gets from the
input line (pin9) to turn on the appropriate LEDs and tones.
Take one small portion of the routine where the output line RB4 is HIGH and this sends a HIGH to the
input line (pin 9). If the tip of the probe is not connected to anything, the input will detect a HIGH. If the
tip is connected to a circuit and a HIGH is present, the input will also see this as a HIGH. It is the
"intelligence" of the program that determines if the HIGH is to be counted as "HIGH IMPEDANCE" or a
"HIGH." We will cover this in a moment. One feature of the front end is the "pulse extender" consisting of
the 47p capacitor on the input line. This capacitor is charged every time the line goes high and is
gradually discharged through the 33k or 100k resistor across it. This capacitor extends very brief pulses
so that the micro sees them as a HIGH.
The input line is only open for a period of 1uS at a time and if the pulse is not present at the exact
moment, the micro will not detect a HIGH. Even if the input is open for 2uS, it is only the last 1uS that
records the information as the micro must read the line and during the next few instructions it deals with
Stop NOP
GOTO Stop
Make sure you remove the instructions after use.
If you need to find out if the micro has reached a particular location, introduce a Tone routine.
At any location, insert the following instructions:
MOVWF 15h
LoopX DECFSZ 15h,1
GOTO LoopX
MOVLW 20 ;To toggle GP5
XORWF 06,1 ;Toggle GP5
GOTO Tone1
If you want to check the situation at another location, remove the instructions above and insert the
following at the new location. Use a Tone with a different frequency, so that you know the new location
has been reached:
5x7 DISPLAY
Data Sheets for the INDEX
PIC16F84 chip can be
found HERE
This project consists of 10 Chapters (and over 20 pages):
PIC Pinouts Chapter 1 - Index (this page)
Chapter 2 - Introduction
Chapter 3 - Construction
Chapter 4 - Burning a Chip also called "Programming" or "Downloading"
Click HERE to Chapter 5 - Display Effects a page of .gif files showing the effects you can produce
buy the Chapter 6 - Testing The Test Routine and 3 Testing Routines
5x7 Display Chapter 7 - Experiments 11 Pages of experiments Expts 1 - 28
kit Chapter 8 - Piezo Experiments 2 pages of experiments Expts 1P - 8P
Chapter 9 - EEPROM Experiments - not yet finished
au$59.90 Chapter 10 - Programming Starts Here - helpful hints on how to produce a program
plus post
us$46.25
plus post
If you are starting from "Ground Zero" and know little or nothing about electronics, go to our BASIC
ELECTRONICS course.
You must be able to recognise components such as capacitors, diodes, zeners, transistors and
resistors to build 5x7 Display project. This information is covered in our BASIC ELECTRONICS course
and a complete set of circuit symbols can be found HERE.
If you want some simple books on electronics, see our range of Notebooks and project books by
Talking Electronics at: http://www.talkingelectronics.com
If you have not constructed any electronics projects, you should see the range of simple kits by Talking
Electronics. There are over 200 kits to choose from and they can be found at: http://www.
talkingelectronics.com Build at least two or three of these kits to get your hand into soldering and
working with electronics components, before working on the 5x7 Display project.
There is an enormous amount of information from Talking Electronics to get you up to the stage of
being able to understand electronics jargon as well as being able to read circuit diagrams and
assemble simple projects. Look through this information before starting this project so you can follow
our assembly procedure and be assured it will be assembled without the possibility of dry joints or
damage to the components. .
The 5x7 Display Project starts you at the beginning with programming but the more you understand
about electronics-in-general, the more you will gain from the project.
The project covers three basic areas:
1: The mechanics. The soldering side of the project.
2: The electronics. The creation, reading and understanding of the circuit and creating circuits to suit
your own projects.
3: The program. The programming side.
START HERE:
You are now ready to start.
You will need the 5x7 Display Project. It is available from Talking Electronics for $59.90 plus $4.40
pack and post. While you are waiting for your kit to arrive (It's a same-day mail-out service but the mail
may take 2-7 days for arrival) you can cover the programming section. There's at least 3 days worth of
study in this section and it's all presented on the web with hyperlinks to each section. You can even go
through the experiments before your kit arrives and become familiar with how the programmes are
structured. It has been shown (Cocoa-Cola research) that it takes three exposures (of advertising) to
get 90% acceptance. The first pass gathers 50 - 80%, the second pass increases this to 90% and the
third pass brings retention to 95%.
With programming you have to be very near 100% if you don't want too many mistakes in a program. If
you have 5 mistakes in a 100 line program, it may take hours to trouble-shoot.
That's why electronics is a "perfect science." Things have to be "spot-on" for the project to work.
So, the more you study, the closer you will be to getting a program up-and-running the first time.
On some occasions a program has worked the first time. It's most gratifying and the more you work on
your theory, the more chance you have of getting a routine working. Not only that, increased
experience enables you to create more-complex programs. So it's benefit's all around.
Without any more discussion, here are the steps:
Step 1: Read the Introduction chapter. It will take you to the Display Effects page where you can see
some of the examples that can be created with this project.
Step 2: Read Construction-Part1 chapter. It covers the 5x7 Display section of the circuit including the
PIC chip, the CD 4017 shift-chip, the switches and driver transistors.
Construction-Part2 chapter covers the In-Circuit programmer section of the circuit. These two circuits
are combined on the PC board however they have been described separately to keep the diagrams
simple. These two pages also describe the assembly of the PC board. You can build the whole project
or just fit the first column of LEDs. The first 6 experiments require just the first column of LEDs and the
other experiments require the whole screen.
Step 3: To make sure the project works correctly, we have produced a set of TEST PROGRAMS.
These test the chips, the LEDs and the wiring to the components. They are intended for those who
have built the project on their own board or "Matrix Board" and need diagnostic tests. They are not
needed if you have put the project together from a kit as the "experiments" start you at the beginning of
programming.
We do not recommend you build the project on Matrix Board as the added work in wiring up the
components is considerable. We had to start in this way as no board was available but for the cost of a
PC board, the final result is worth the cost. PC boards are available separately from Talking Electronics.
If you want to try the test programs, they are located at:
Testing Page1,
Testing Page2,
Testing Page3.
The project comes with a pre-programmed PIC chip, containing a TEST ROUTINE. When the chip is
inserted into the project and switched on, it goes through a number of routines to display each of the
LEDs, patterns on the screen and tones from the piezo. When you program this chip, the Test Routine
will be lost. If you don't want to lose it, you can use another chip for your programming. The Test
Routine can be found at: Test Routine.
The only test we have not covered is "Burning." This is the most important (and most complex) of the
tests. The only way this can be checked is by carrying out an actual burning operation and the first
experiment will do this.
Step 4: The next step is to burn a routine into the PIC chip. This is done with the chip "in situ" on the
board. That's the advantage of "in circuit" programming. The chip does not have to be removed from
the board to be programmed.
Simply connect the cable to the serial port of the computer and fit the 4-pin US telephone plug into the
5x7 Display board.
Some of the voltages for the chip are obtained from the computer during programming mode, but the
5v from the computer does not have enough current to drive the transistor on pin 12, so the power
switch on the 5x7 project must be kept ON during programming.
The 13v required by the chip to set it into programming mode is obtained from the serial port of the
computer (as a complex combination of the voltages on two lines!). This arrangement has been
necessary so that almost any serial port will be suitable for connecting to the project.
Before carrying out any "Burning," you need to go to the first page of experiments:
Experiments Page1 and study the first experiment.
After studying it, you can download the .hex file at the end of the experiment, by either copying and
pasting the block of numbers into a text program such as TEXTPAD or NOTEPAD and then using the
burning program (called PIP-02) to load the data into the PIC chip on your 5x7 project. Alternately you
can download a .zip file containing all the .hex files for the project and select Expt-1.hex for
downloading into the PIC chip via the PIP-02 program. For more information see: "Burning a Chip."
To download the burning program (PIP-02) click HERE.
Step 5: As you go through the experiments, they get progressively more complex. We have produced
three different sets of experiments and you should look through them all and carry them out "in
parallel." In other words you can jump from one group to the other as they all cover different features
and they all need to be carried out.
Here is a detailed list of the pages shown above, with the main
features of each experiment / routine:
To download all the .hex files as a .zip: click HERE.
Test Routine. Tests the LEDs on the screen (individually) and the piezo
diaphragm (comes with the PIC chip when purchasing the kit).
Testing Page1 First column of LEDs flash at 3Hz.
First column scanned from bottom to top.
Bottom LED moves from left to right
Testing Page2, Data from "Ghost" files to "Display."
"TE MOVING SIGN." Letters are scrolled across display.
Testing Page3. Turns on a LED when button A is pressed.
Detects buttons A, B and C and turns on LEDs.
Buttons A, B and C (with debounce) and LEDs flash.
Experiments Page4 Expt 12: "RUNNING SIGN" See Testing Page 2. "TE Moving
Sign." Letters run across the display.
Experiments Page5 Expt 13: Single Digit Up-Counter. 0-9 Up counter with button A
to increment the display.
Expt 14: Two Digit up Counter. 00-99 Up counter with button A
to increment the display.
Experiments Page6 Expt 15: Five Digit Up Counter. Button A increments the
display.
Programming Starts Here Page1 - a study of the routines used in this project. You
can access this page at any time and study how the routines are created. In fact it's
a good idea to refer to this page as soon as you start the experiments.
Programming Starts Here Page2 - more routines and how they work
Step 6: Step 6 is all yours. It's the next logical step in this course. By the time you get to this step you
will be able to call yourself a "semi-master" of the PIC chip. You will be able to produce simple
programs for displays, buttons and output devices.
If you are like me, you will want to go further and use some of these skills to produce your own projects.
Already you must have a number of ideas that could be turned into a microprocessor project.
Things like alarms, interfaces, games and counters etc.
And this is where Talking Electronics can help. They have produced a number of projects and
experimental boards suited to getting you into this next phase of development.
They have produced two streams. The first stream uses the PIC16F84 as the main chip and the
second stream uses a smaller version called the 12C508A.
Many of the projects you are thinking about will require only a few input/output lines and the
PIC12C508A will be suited for the job.
For instance, if you want to design a small project and have it mass produced, the cost will have to be
as low as possible. This is where the PIC12C508A comes in. It it less than half the cost of a PICF84
and enables very low-cost projects to be produced and you will be competitive with overseas imports. It
is also available in surface-mount form so very small projects can be produced. But it takes lots of
steps to get from an idea to the finished design and TE has the parts, PC boards and ideas to help
you.
The only problem with the PIC12C508A is it is not as friendly as the PICF84 and it's only by following
our course that you will be able to design economical projects with it. The PIC12C508A course starts
with Chapter 0. Go to this chapter and you are on your way. This chapter will lead you into hundreds of
pages of programming, ideas, projects and theory on both the PIC12C508A and PIC16F84 and they
will keep you up all night for WEEKS!
Send me an email when you finish!
Colin Mitchell,
TALKING ELECTRONICS.
(click on envelope
to send email)
Note: The PIC12C508A has 5 port lines - called in/out lines. The only limitation is: port line GP3 must
be input. If you have a project requiring 4 outputs and 1 input (or 3 outputs and 2 inputs etc) - the
'508A is the one to choose. There are ways to expand the lines or put two different devices on the
same line, so read the pages we have produced before dismissing this amazingly versatile device.
MULTI CHIP
PROGRAMMER
http://www.poptronics.com/interactive/FreeProjects/FreeProjectsIndex.html
http://users.tpg.com.au/users/talking/MultiChipPgmr-Intro.html12/02/2008 17:40:40
http://users.tpg.com.au/users/talking/MultiChipPgmr-Disasm.html
Page1
DISASSEMBLING A PROGRAM
Page2 (Reading the .hex file of a PIC16F84)
Page3 Page 4
This section does not use the Multi-Chip Programmer but it is in this section as it is a part of the
process of programming. If you take a .hex program from a book or magazine, or read a program from
a chip, the block of digits is almost impossible to read. Sometimes it is important to know if the numbers
refer to a particular program and you may wish to know if it is the latest version. You may also need to
make a modification.
The program in this article (the program is called Disasm) will take a .hex file from a PIC16F84 and
convert it back into a layout very similar to the set of instructions in an .asm file. The only difference is
the absence of annotations and labels.
The program is called Disasm (for Dis-assembly program) and the files you need to get this program
up-and-running, are contained in a self-extracting .exe file called 84Disasm.exe
The files are:
About.frm 3k FRM File
Cmdialog.vbx 19k VBX File
Disasm.exe 15k Application File This is the file you use (see below).
Disasm.frm 10k FRM File
Disasm.mak 1k MAK File
Disasm.txt 1k Text Document
To put these files on your computer, create a new Folder (go to Explore) and call it: Disassembler
To download the above 6 files in a 56k self-extracting .exe file, click HERE
Disasm requires an Application Extension File: Vbrun300.dll You may already have it on your
computer. If not, to download a 226k .zip file Vbrun300.zip click HERE
USING DISASM
Disasm will disassemble your .hex files. Firstly you will need a .hex file. Create a new folder and call it:
5x7 Display Files.
To download all the .hex files for the 5x7 Display Project, click HERE.
Unzip them into 5x7 Display Files folder.
To make it easy, you can put them onto a disk and access them in drive A as 84 Disasm only sees the
first 8 letters of each name and this is very difficult to follow!
You will need to unzip 84disasm.exe to get DISASM.EXE
When you access Disasm on the "click HERE" below, you are accessing your own computer , so make
sure the folder is in "C."
INTRODUCTION
Firstly, we will describe the "add-on" version for the 5x7 Display as this is the cheapest version and, quite
frankly, it only deserves a few dollars as a piece of test equipment.
It's "all the rage" to have an Electrolytic Tester for servicing equipment and yet I have serviced over 36,000
appliances without one. Possibly it took me a long time to realise electrolytics have the capability of drying
out because old-style electros were inherently very reliable and, of-course, they were not old when the
equipment was being repaired.
Now . . . it's not impossible to live without one. All you have to do is replace all the electros in a faulty
piece of equipment, then turn it on and see the results.
Charles had a stereo amplifier in for repair recently and he started at one end of the board and replaced
every electro. He tried the amplifier at regular intervals and as the electros were replaced, the output
improved. After replacing the last few, the output was fantastic.
Russell had the same experience. He was servicing a fax machine. After about 50 electros, the screen
came on with the correct start-up instructions, the beep tone was correct, the machine automatically
answered the line and the fax was readable. All these faults gradually developed over the years. And they
were all due to electro's drying out!
Faulty electros create enormously unusual faults. All due to drying out.
Only last week Charles had a 4 watt amplifier (operating from a plug-pack) and the background hum was
excessive. A new 1,000u electro in the power supply reduced the hum to near-zero.
In this case ripple voltage was getting into the amplifier. Exactly the same thing can occur with a more-
complex piece of equipment. The motor and thermal heaters in a fax machine produce glitches and "noise"
on the power rails and this gets into other sections of the circuit. Electrolytics are designed to absorb these
ripples by acting very similar to miniature rechargeable batteries. They absorb the spike when it is higher
than normal, and deliver energy to the power rail when the rail voltage is lower than normal.
Sometimes (very rarely) an electro is designed to pass a signal from one stage to another. If the electro is
dry, the amplitude of the signal delivered by it will be lower than expected and faulty processing may occur.
There are a few other areas where electros are used (such as integrating and separating signals) and it is
not connect to either power rail, but most of the time they are connected across the power rails.
In most cases the circuit surrounding an electro can be classified as low-impedance. This means it is difficult
to test electros while they are "in-circuit" (because components such as chips are closely connected to them
- and they have a low resistance). But if the voltage on the electro is below rail voltage, the effect of the
surrounding components is minimised.
Basically electros cannot be tested with a multimeter unless you provide a voltage to charge them and then
measure how long it takes them to discharge through a known resistance. That's why you need an
Electrolytic Tester.
THE BOARD
The PC board for the Electrolytic Tester is shown below. It is connected to the 5x7 Display project with 4
leads. The termination on the 5x7 Project is a 5-pin plug (one dummy pin for alignment)). Two "test leads"
are taken from the Electrolytic Tester PC board to the electrolytic-under-test. One has an earth clip
(crocodile or alligator clip) and the other has an E-Z clip (a long clip with a very small hook on the end that
clamps around a lead).
The figure below shows the Electrolytic Tester PC board connected to the 5x7 Display. The leads are
identified as positive, RA1, RA0, earth.
TWO WAYS
There are two ways to test an electro "in-circuit."
The first method is to determine the time needed for it to charge to a known voltage.
The other is to charge the electro then discharge it through a known resistance.
Both methods have an inherent inaccuracy due to the surrounding circuit components being connected to
the electro. When the electro is out of circuit, the current from the tester will charge the electro to a certain
value in a known time. From this we determine its value. When the electro is "in-circuit", some of the current
will flow to the surrounding components and the electro will take longer to charge. The test will think a larger
electro is being tested and will produce an over-value.
To avoid this we have opted for the discharge method.
If the surrounding components have a very low impedance, the reading from the tester will be lower than
expected. In this case, the answer is to remove the electro from the circuit and re-test it.
MORE ADD-ONS
This project shows how add-ons can be connected to a project. You have already seen how the 5x7 matrix
can be used to display figures and letters as well as animation. Using this knowledge gives you an
enormous scope for creating a really impressive project by merely adding a front-end. The 4 lines to the
5x7 use two port lines that can be configured as input or outputs and although the lines are already
connected to another device, with clever circuitry you can add other things to these lines. If you need any
more lines, they can be taken from under the 5x7 board via a separate plug-and-socket.
Examples of projects that can be connected to the 5x7 are:
A Heart-Rate monitor, an Ultrasonic Tape Measure and a Blood Alcohol Detector. There are lots of other
ideas and anything that needs a readout can be connected.
PROTO BOARD
No matter what you design, Talking Electronics has made it easy to get you started. We have a small proto
board about 4cm x 3cm containing long pads and a positive and negative rail as shown below. It has no
holes and has been designed for prototyping. It is called Experiment Board MkIII.
Our method of prototyping may be new to many readers, but has been described many times in our 20
years of publishing.
The only real way to prototype a project is on a board shown above. It is very difficult to build a project on a
board with holes and circular lands because you have to turn it over to join up the components and this
takes a lot of complex thinking. You may have seen a lot of "scratch-pad" areas on development systems
consisting of holes and circular lands. But have you tried to use them! They are not really suited for
development work. They are for the next stage in a design. Once you get a circuit working you can transfer
it to an area where it can be added to a micro. But where do you do the actual designing? This is the
purpose of the Experimenter Board. It allows great flexibility and ease in placing components without much
effort. This is important when you are designing something. You don't want to be distracted by the
placement of the components.
With our design, the parts are soldered (with long leads) to the lands and almost no jumper wires are
needed. All the parts sit in a "birds-nest" or "rats-nest" arrangement and you can see exactly how everything
is connected without looking under the board. No only is this quicker, but fewer mistakes are made. At the
end of the development work, the parts can be taken off the board and re-used or fitted onto a "scratch-pad"
as explained above. This is what I used in developing the Electrolytic Tester and it makes prototyping so
much easier.
The next stage in the development process is making the PC board. But firstly a circuit diagram is drawn
and the board is created on one of the PC board drawing packages. An overlay or top-layer is always
included on all our boards and this is one of the things that stand us out from most other magazines and
books. Our overlays include the value of every component and the board has the name of the project. Many
magazines have a code-number on the board and this might be ok for the month of issue, but who can
remember a code number in 2 year's time! That's why so many magazines have fallen over and the same
with kit suppliers, and even manufacturers! It's simple things like this that make your product accepted or
rejected.
You can get PC boards manufactured for as little as $100, on a panel 25cm x 15cm, so it's not impossible to
produce a project yourself and get it fully developed without any outside help.
Obviously our 5x7 concept is very "experimentally orientated" but it's the only way to get an idea up-and-
running. Once you get the concept working, the final design can take a completely different form. But
without prototype-ability, it is very difficult to start.
From start-to-finish, the Electrolytic Tester took 2 full days of programming. Most of the program was taken
from the 5-Digit counter and one of the software items you need to develop a project like this is MPASM.
This program takes your ASCII file (.asm file) and produces a .hex file for loading into PIP-02. To download
MPASM, click HERE.
Buy a kit
DIAL ALARM-1
Page2 A complete dialing alarm the size of a pack of cigarettes.
Page3 - its features will amaze you . . .
Page4 Page 1.
PIC Pinouts
This is the lowest cost dialing alarm on the market and shows what can be done with an 8-pin
microcontroller. The complete circuit is shown below. You cannot see all the features of this project by
looking at the circuit - most of them are contained in the program. So, read on and see what we have
included. . .
Dial Alarm-1 has a single input (although a number of sensors can be placed in parallel on the same
input line). The circuit requires a trigger pulse to turn on a BC 557 transistor. This delivers power to the
microcontroller. The micro starts to execute the program and outputs a high on GP2 to keep the "turn-
on" circuit active. It also turns on the LED in the opto-coupler and this causes the line to be "picked up"
via a high-gain Darlington transistor. The micro then dials two phone numbers and executes a series of
events to alert the called party of an intrusion. The circuit also has a sensitive microphone with a high-
gain amplifier. This is connected to the phone line when the alarm is triggered.
When the first number is dialled, a Hee Haw signal is sent down the line to alert the listener of an
intrusion in the "target" area. Amplified audio of the room is then passed down the line. This signal is
clear enough to detect conversations and/or movement in the target area and the listener can
determine the situation. A second number is then called and the process is repeated. The two numbers
are then called again and the alarm closes down. Simple but brilliant. The flow Diagram for the alarm is
shown below:
of how to do it. But many thieves must be aware of the trick and that's why a back-up system is
essential.
The cheapest back-up system is the use of the phone line. I know what you are going to say. Cutting
the telephone line is an easy matter and offers little security. But finding the line in a premises is
not very easy and if there are two or more incoming lines, it's difficult to know which is connected to the
dialler. Nothing is infallible, but for a lot less than $50 you can build this project and have a back-up to
protect your property.
The other advantage of our design is the "set and forget feature." The alarm is designed to ring your
mobile and if you keep your phone beside you 24 hours a day, you can have this peace of mind,
whether you are in your office, factory, holiday house or quietly dining at your favourite restaurant.
You can protect any area where a telephone line can be installed. This includes houses-under-
construction and outlying sheds.
Talking Electronics has been producing security devices for more than 15 years and this project is a
culmination of those years of experience.
The high-sensitivity amplifier is our development and comes from our highly successful Infinity Bug.
This device connects to the phone line anywhere in the world and when the number is rung, the infinity
bug answers the call and lets you listen in to the activities in the room. It's just like being there. We
have used the same circuit in this project. When it is activated, you can easily work out if it has been
triggered by staff, a family member or an intruder. At least it prevents 90% of false alarms and offers
enormous peace of mind.
The secret lies in the placement of the triggering device. We have provided only one input (trigger
input). And there's a reason for this. The idea is to place the sensor near the target area or on an actual
device, near the microphone.
For instance, it you are protecting a house, a thief always goes to the main bedroom and rummages
through the drawers and cupboards. In this case a drawer that is never used should be wired with a
magnetic switch (reed switch) or a movement detector such as a mercury switch. These switches can
be housed in a plastic case for easy screwing to a wall or door and are very reliable in operation. When
the drawer is pulled out or the door opened, the switch is activated. If you are protecting a wall safe,
the switch is placed near the safe in a clipboard or picture so that when the board or picture is moved,
the alarm is activated. If a room is to be monitored, the switch is placed on the door so that when it is
opened, the alarm is activated. If other valuables are being protected (such as a VCR, scanner etc) a
suggestion is to place a clipboard against the item. The idea is the clipboard has to be moved to get at
the "valuables." The clipboard contains a magnet and the switch is nearby. The clipboard keeps the
switch open (or closed) and when it is moved, the alarm is activated.
The ideal arrangement is to avoid touching the clipboard, drawer, door or other "prop" during normal
activities and this keeps the alarm activated at all times.
Another suitable trigger device is a pressure mat. This is something that can be avoided by "those in
the know" and you can monitor an area during your absence. The alarm can be used for other things
too. You can determine when your business premises are opened up in the morning by placing a
pressure mat or reed switch on a door. The same can apply to a particular room in your establishment.
The purpose of this article is not only to produce the worlds smallest dialling alarm but also show you
how the program runs so you can modify any of the routines to suit your own particular requirements.
The program can be re-written to dial only one number for two rings then hang up, or three rings, then
again after 2 minutes or any combination to suit your requirements. Many mobile phones identify the
caller on the display and you can keep track of the exact time of arrival and departure of different
personnel.
The alarm can be programmed to monitor machinery and dial your mobile when a breakdown occurs. It
can monitor water level or even your mail box. The possibilities are unlimited and it's just a matter of
modifying the program to suit your own needs.
But before you change any of the program you have to understand what the program does and be
capable of changing the instructions without upsetting the operation of the alarm.
Remember: A little knowledge is a dangerous thing. Before doing any re-writing of the program you
need to read our notes on programming and carry out one small modification at a time.
This is really a very advanced project. The fact that is looks simple is the power of the microcontroller.
It's taking the place of at least 10 chips in a normal alarm.
Timing, tones and tunes have all been converted to instructions of a program. And the advantage of a
program is the simplicity of alteration. A time-interval can be changed or a phone number altered with a
few lines of code. Even new features can be added without the need for additional hardware. This
project uses the '508A to its maximum and shows what can be done with an 8-pin microcontroller.
Before we go any further we must state that this project cannot be connected to the public telephone
system. Only approved devices can be connected to the Public Phone System and any experimental
device must be approved for experimentation and connected via a "telephone Line Separating Device."
These are available from Altronic Imports for approx $100.
This is unfortunately the case and when we discuss connecting the project "to the line," we are referring
to an experimental telephone system such as the one we have put together at Talking Electronics, to
test and develop projects such as these.
See the section "Testing The Project" on Page 2 for more details of the Test Circuit. It consists of 27v
derived from 9v batteries, a 12v relay, a telephone and a socket, all in series. The 12v relay is included
to limit the current.
THE CIRCUIT
The circuit consists of 6 building blocks.
1. The turn-on circuit. Click HERE to see the circuit working (or click the red dot in the circuit above).
2. The tone detector. Click HERE to see the circuit working. ( " " " )
3. The DTMF wave-shaping circuit. Click HERE to see the circuit working. ( " " " )
4. The high-gain audio amplifier. Click HERE to see the circuit working. ( " " " )
5. The opto-coupler. Click HERE to see the circuit working. ( " " " )
6. The microcontroller.
5. THE OPTO-COUPLER
The opto-coupler is the device that does the job of a normal phone. In other words it "picks up the
phone line." The micro outputs a LOW on pin 5 (GP2) as soon as the program is activated by the
mercury switch and this keeps the "turn-on" circuit activated. This line also goes to the opto-coupler
and a LED in the opto-coupler is also turned ON. The illumination of the LED turns on a phototransistor
inside the opto-coupler and the resistance between collector and emitter leads of the photo-transistor is
reduced and this pulls the base of a Darlington transistor towards the positive rail.
The Opto-coupler can be connected directly to the phone circuit but the transistor must be turned on
much harder. This requires the LED in the opto-coupler to be driven much harder and puts a very
heavy demand on the battery.
At the conclusion of each "telephone call" pin 5 goes HIGH and this is the same as "hanging up the
phone." The electrolytics in the "turn-on" circuit will keep the micro active during the short period of time
between phone calls.
6. THE MICROCONTROLLER
The heart of the project is the microcontroller. It is an 8-pin chip with 5 input/output lines and one output-
only line. The output lines change from low-to-high-to-low very quickly and each line can deliver a
maximum of 25mA.
The program inside the micro determines what happens on each of the lines and the parts around the
micro are merely interfacing components. In other words they adapt or modify or amplify a signal to suit
the micro or phone line.
The micro never stops "running" and it executes instructions at the rate of one million per second (1
MIPS).
You need to understand PIC language to program the micro and Talking Electronics has produced
PIC Programming pages on the web to help you develop a program.
Most phones drop about 8 - 12v across them when they are working and this voltage can be used by
the phone for the amplifying circuits, tone generators etc. Our design has a separate supply, however it
could be designed to use the phone voltage, if you wish. The 10v across the BC 337 audio output
transistor gives the transistor plenty of voltage for a good output waveform. The audio is sensitive
enough to hear a clock ticking in the target area.
Go to: Page 2
Buy a kit
TAXI PHONE
Page 1
TETRIS
This project is a dedicated device. It dials a single phone number when the handset is lifted. There are
two different modes of operation.. A slide-switch on the PC board allows the project to operate in
automatic or manual mode. If the switch is in "auto dial" mode, a pre-programmed phone number is
AUTOMATICALLY dialled when the phone is lifted. If the switch is in "push to dial," the project dials
the number when the phone is lifted and "push to dial" button is pressed. This allows the phone to be
used as a normal phone.
The complete circuit is shown below:
TAXI PHONE hasn't been designed exclusively as a taxi phone, that's just the name we gave it.
It's the simplest phone dialing project you can get and since the program is so simple, it's an ideal place
to start.
The concept has so many possibilities. Take the example of a "Free Taxi Phone." Imagine a phone at
the front of a night club or restaurant, to ring a taxi.
As soon as you pick up the phone, it automatically dials a nominated taxi company and by quoting a
code number, or sending a DTMF code down the line, the company knows where to pick you up.
Or take the example of a doctor's surgery, police station, fire station or real estate office.
A cheap wall phone can be mounted outside the premises for after-hour's use. By lifting the handset
the call will be directed to an operator, the owner of the business or a representative.
The same can apply at professional suites, or land-development projects. The proliferation of mobile
phones has brought remote communication into the hands of nearly everyone but this project still has
its uses.
It's cheaper and free to the user. A customer would prefer to use the "Company Phone" than his own
mobile.
Take the example of a "House for Sale." By lifting the phone connected to the sale board, you could be
in touch with the agent and arranging a meeting before your enthusiasm is diverted to another property.
Or the example of a Panic Phone for a granny, babysitter convenience store. All they need do is lift the
receiver and the call goes through. This is already available at some exchanges but the emergency
number is only dialed if the exchange does not detect any other number being dialed within 3 seconds.
In the Auto mode, our design prevents the phone being used for any other purpose. This can be an
advantage in some circumstances, such as a boarding house or as a "hot line." It prevents the phone
being used for any other calls.
The commercial advantage is also enormous. Imagine a phone at an airport or railway station linked to
a local hotel or tourist attraction. A small display would highlight the features of the establishment and
the free phone could be used to make a booking.
Even booking mini cruises and tours at the departure points could be made, when no-one is in
attendance.
It all adds to the efficient running of a business and reduces the cost of attendance during the low
periods.
I am sure we can all think of a use for a dedicated phone like this and even one at the front door of your
own house would be "magic."
How many times has a friend dropped by or a delivery been made when you were absent?
Either the goods were left on the door step or brought back three day's later. How inconvenient. A
simple phone call to your mobile could keep you in touch with everything.
The same with business addresses and suites. By providing a phone at the door, the owner will never
miss a prospective client.
Not only that. The image and efficiency will rise in the eye of your customers.
So, after seeing the potential of this project, why not put it together and use it yourself or sell it to others.
The only problem is a project like this has to be approved by the authorities for connection to a public
telephone system. The cost of approval could be anything up to $5,000 to $10,000 or more and
the delay in approval could be 6 months or more.
Lots of ideas like this have not seen the marketplace, for this very reason. The cost of compliance is
enormous. That's why we have presented the article as an idea, mainly to show what can be done with
the '508A microcontroller.
Once you build the project, you can modify it to suit almost any requirement.
We have included a number of ideas but it's certain we haven't thought of everything.
COMPONENTS
Some of the components used in the project are identified in the diagram below:
CONSTRUCTION
As with all the projects designed by Talking Electronics, the PC board has an overlay that identifies all
the components and their orientation. This is an essential part of a good design as you may be
repairing the project at a later date and need to know the value or type of a component. All the boards
also have a solder mask to assist in keeping the solder to the surrounding land. And the boards are roll-
tinned to make soldering a very quick process. Naturally the boards are fibre-glass based and this
helps you to work with a first-class product.
Anything you design should come up to this standard as it smartens up the project and finishes off the
presentation.
It's an easy job to solder the components to the board, making sure the resistors, phone sockets, slide
and push switch, bridge, IC socket and zener diode fit against the board while the transistor, LED,
crystal and electrolytics are mounted slightly above the board to prevent heat-damage. The ceramic
capacitors and choke can be fitted up to the board or slightly above it - there is no fixed rule for this
type of component.
Take care when soldering and snip the lead very close to the joint after the soldering has been carried
out. One project came in for repair and it took 30 minutes for us to realise one of the leads of a resistor
had been snipped off close to the board before the soldering had been done. The resistor was sitting in
position via one lead and the solder hadn't taken to the other lead. That's why we insist on soldering
before cutting the lead.
If you hold a finger on the component while soldering you will know how hot each part is getting. If you
can't hold your finger on it, you are taking too long.
A constant-heat soldering iron improves the quality of the soldering 100%. Keeping the temperature at
about 320C will prevent overheating any of the parts.
The last thing that makes a neat connection is the use of fine solder. That's why we have included it in
the kit. You will never go back to thick solder again.
There are only two things that will prevent the project from working. Faulty soldering and the wrong
placement of a component. The circuit works and the PC board has been tested. Take a little care with
checking the value of the resistors and even use a multimeter to check the resistance as it is very easy
to mistake a 100R resistor for 10k.
Don't forget, the positive lead of the electro is identified on the board while the negative lead is
identified on the body of the component.
The short lead of the LED is the cathode and this corresponds with the line on the symbol on the board.
The IC socket has a cut-out at one end and the bridge must match-up with the markings on the board.
The crystal and choke can be placed around either way but the tactile switch has legs that are spaced
wider in one direction to assist in placement. The zener diode has a line or stripe at one end and this
corresponds with the line on the board.
Finally, the transistor has an outline on the board to help with placement. A little bit of care during
assembly will save hours of frustration and checking. The board looks easy to assembly because it is
neatly laid-out. That's why you have to be doubly-careful. After building 10 or more of our projects you
will find it easy to place the components.
But start slowly because we use only the best and smallest components on the market and some of the
parts-identification is very difficult to read.
Taxi Phone
PARTS LIST
Cost: $xx.80 plus $2.20 postage
4 - 100R
1 - 220R
1 - 3k3
3 - 10k
1 - BC547 transistors
2 - 18p ceramics
1 - 4MHz crystal
1 - 100n monoblock or ceramic
2 - 1u 16v electrolytics
1 - 100u electrolytic
1 - 10mH choke
1 - 8 pin IC socket
1 - 3v3 400mW zener
(or 3v9Z and 3mm red LED)
1 - 3mm green LED
1 - DF04 diode bridge
2 - SPDT slide switches
1 - PC mount push-switch
2 - 4-pin modular telephone sockets
1 - PIC12c508A microcontroller chips
1 - TAXIPHONE PC board
TABLES
The Taxi Phone program uses three tables. The first stores the telephone number, the second holds
the delay value for the low frequency of the DTMF tone and table3 holds the high tone delay value.
A table is the only way to hold data for a routine - it cannot be stored within the program.
reset the Program Counter to address zero. If this does not happen, the micro will jump to a random
part of the program and begin executing code.
If it does not come across a CLRWDT instruction, the watchdog timer will count down 2.3 seconds and
cause a reset. The program will then GOTO the main routine and look for NOP's in the table, to find the
beginning of the phone number.
It will then GOTO Dial1 sub-routine. This routine picks up the first digit to be dialed from Table1 and
uses the value from the table to jump down Table2 to find the delay value for the low tone. It loads
the low-tone file with the value and then goes to Table3 and jumps down the table for the high-tone
value. The micro then goes to the DTMF routine where the low and high tone files are decremented and
when the count is zero, the appropriate output line is toggled and decrementing continues. This
process continues for A0h (160) loops to produce a dual tone for approx 1/10th second.
A short delay is then executed and the jump counter for table 1 is incremented so that the next digit is
picked up. This process continues until the End of Table marker (E) is detected. The micro then goes to
a closed loop and continues in this loop until the handset is replaced.
The 10k across the supply rail makes sure the 100u is fully discharged so that the micro detects a LOW
and starts at address 000 when power is applied. This feature, along with the watchdog timer, ensures
the micro starts correctly. Each feature was omitted in a test run and it was proven that they were
necessary.
This project has a number of different applications and the circuit can be modified to suit different
requirements.
One of the features of the circuit is to dial a number when a button is pressed. This gives the phone a
dual role and the number is only dialed when the button is pressed. The button could be for a Taxi
service, a hot line to a visa card approval centre or a pre-dial access number such as 1478 to a long-
distance low-cost telephone company such as One Tel. The only components required are a push-
switch and pull-up resistor.
A few lines of code are needed so that the micro detects the state of GP3. When GP3 is high, the
button is not pressed and the program waits in a loop until the button is pressed. If GP3 is LOW, the
micro automatically dials the number.
The 100u across the zener regulator provides a reservoir of current for the times when the micro draws
a higher current when producing the DTMF tones.
The 100n across the chip prevents high frequency instability in a project such as this where the supply
rail is not a low impedance supply.
In this case the supply is fed via a dropper resistor and all sorts of high-frequency oscillations can start
up when the supply rails cannot supply a very high current. This is what we mean by a low impedance
supply.
Go to Page 2
All sizes can be purchased in full rolls of 250 metres or cut to any length.
The articles on the following pages concentrate on the 2.3mm size however the information can be
used for all sizes.
requires an AC voltage of approx 100v @600Hz to produce a very good brightness. This
can be obtained via a miniature inverter and these are available from 3v to 12v operation. For the
3v inverter supplied in the kits described below, up to 1 metre of can be illuminated.
The supply current requirement is 45mA.
can be bent and twisted to any shape and can be used to create all types of signs, from
miniature lighting effects on pictures and prints to signs for "in-store" advertising such as
"EXIT," "WELCOME" or "OPEN". comes in a range of 12 colours, here are a few:
When supplied in short lengths, it comes in a loose coil. For long lengths, it comes on a spool.
When creating a sign, it is normally placed in a groove in a sheet of clear perspex to create a
"mystical" effect, where everything seems to be "hanging" in space. can be glued in
position with clear silicon sealant. Some glues, such as "super glue" become white when set and
detract from the clearness of the sign. Of course can be wrapped around items or
threaded through holes in a sheet of foam or simply hung by fine threads to give a "spiders web"
effect. A more-open display will create more intrigue. It can also be used under water or in
automobiles, around or outside a house to produce the house-number or to highlight the outline of
a window or door. It can also be used to identify a dangerous step or illuminate a keyhole -
anything decorative to safety to security. The possibilities are limitless.
is almost identical to working with a miniature version of neon. All the advertising signs,
effects and displays you have seen using neon, can now be made in a miniature form with
. The final result is almost identical but the cost is considerably less and the voltages
are not the very high voltages required for neon.
Both and Neon signs can be constantly illuminated or placed in "flashing" mode.
has one additional advantage. It can be put into a "dimming" mode as shown in the
example below.
Place your mouse over the display to so see it dim:
GETTING STARTED
To get you started in this "Wonderful World of Illumination," we have 5 kits available:
GOING FURTHER
Once you have put together a kit and seen the effects you can produce, you will want to go
further. You can buy the electroluminescent by the metre and we will assist you
with the type of inverter needed for the length of .
LABORATORIES
Specialists in electroluminescence since 1965
564 Glen Huntly Rd., Elsternwick, 3185
Victoria, Australia.
Tel: +61 3 9532 9990
Fax:
+61 3 9532 9998
Click HERE for page stats. Login No: 96941 Password: colin
free counter web hit counter, real time count service, coolest web counter on the web, its a great resource for your web site
CounterBot.com
Sat Feb 28, Counters are down. They will be back shortly
Server Status
1. Rules
2. Get a Counter!
3. Get Help
4. Advertise
Join
Powered by: MessageBot.com
Thanks!
FreeStuffCenter - cool
http://yahoo.com/
http://www.markwelch.com/bannerad/ba_counter.htm
http://www.thefreesite.com/
http://www.fg-a.com/counter.htm
Other Services!
Some graphics on this and other sites by: Alien and Adam
Archivos de Correo
Archivos listados desde el ms reciente hasta el ms antiguo.
Programacion de PIC
Ver archivos en groups.google.com.
ar
PICmicro Sites
Prev | Ring Hub | Join | Rate|
Next
WebRing Inc.
Search
Visit a complete list of WebRing memberships here
Powered by WebRing.
http://www.unixlan.com.ar/listas/html/12/02/2008 17:42:40
Sage
Sage
Embedded Systems,
Publishers
From their Australian offices in Perth, Western Australia, the Sage group provides hardware / software design,
specialist electronic components, electronic modules and desktop publishing services.
Sage Telecommunications is our specialist electronic design division. We provide quality hardware and software
engineering solutions. We offer design packages from concept through to manufactured product.
DonTronics range of
SimmStick products.
Electronic components,
PIC processors, LCD's.
Sage Pages is our publishing division. As well as general desktop publishing we publish specialist interest books. We are currently
http://www.sages.com.au/ (1 of 5)12/02/2008 17:43:11
Sage
reprinting Australian Aviation history books that have been out of print for a number of years.
Authors, Sage Pages is constantly looking for new titles. If you have written, know of an author or are interested in an out of print book
about Australian Aviation history contact Sage Pages. We would be most interested in talking to you.
Contact Information
Sales:
sales@sages.com.au
Support:
support@sages.com.au
Information:
info@sages.com.au
Time Zone:
Australian Western Standard time (UTC - 8)
Telephone:
+61 (0) 8 9246-9543
FAX:
+61 (0) 8 9246-9270
Postal address:
PO Box 2171 Warwick, Western Australia 6024
Previous 5 Sites | Skip Previous | Previous| Next [ Previous | List Sites | Next | Random Site] [Skip Prev][Prev][Next][Skip Next]
Skip Next | Next 5 Sites | Random Site| List Sites [ Previous 5 Sites | Next 5 Sites | Join ] [Random][Next 5][List Sites][Join Ring]
SiteInspector
Approved
Send mail to webmaster@sages.com.au with questions or comments about this web site.
Copyright 1998-2004 Sage Telecommunications Pty Ltd
Last modified: January 06, 2004
MICROCONTROLADORES
Hola. Antes que nada quiero dejar bien claro lo siguiente:
De todo lo que all haba baje lo siguiente: hoja de datos del PIC16F84,
MPLAB 4.0 y varias notas de aplicacin. Con esto fue suficiente para que
luego de unos meses mi proyecto pase del diseo a la fase de testeo de
hardware.
Site Navigation
Duetronix Services and product offering listed below: Last Update : December 2007
Product Resources Profile Sales and Distribution
Development Systems Project Examples / Documentation About Duetronix Ordering
ProtoPro 18 FAQ Standards & Compliance 2008 Pricing
ProtoPro 20 Contact Distributors
ProtoPro 28
ProtoPro 40
Products Under Development -
Coming Soon!
ProtoProXCL TM
ProtoDEV TM
The ProtoPro Series of products is designed to enable a developer or hobbyist to develop new products and
systems rapidly. The system includes the most common and useful tracked in circuitry that enables the
developer to focus on writing the application rather than be side tracked by hardware issues.
Using the ProtoPro Series in your projects offers the following advantages
Duetronix offers Embedded Design tools for the hobbyist and professional. The products are quality
manufactured and designed with the intention of enabling system design that is easy and effective.
Product Resources
Project Examples
PICmicro Sites
Prev | Ring Hub | Join | Rate|
Next
WebRing Inc. Search
Powered by WebRing.
TELL A
SEARCH WEBRING: This WebRing All
FRIEND!
Computers & Internet > Hardware Add this feed:
Australian Electronics WebRing Add Your
Manager: downunderrm Web Site.
Join Here!
Iron WebMaster
Featuring websites dedicated to Electronics as a hobby or business in Australia. This
webring features sites with free schematics, ideas, kit builders, magazines, manufacturers
Round 2 VOTING
and parts suppliers. If your looking for any of the above, or similar, within Australia, then
this is the right ring for you.
Ads by Google
Get in on the Action!
Hytronic Electronics Australian Electronics WebRing Poll
Electronic Transformer Various Ballasts and Motion Sensors. www. Which description best describes what you are
hytronik.com looking for?
Only members who are logged in may register a vote. You
Flexible printed circuits are either not logged in or not a WebRing member. Use the
Get a flex circuits in 24 hrs. Specializing in small to medium. www. Sign In link at top to log in or register for a WebRing User ID.
uniflexcircuits.com
A Hobbyist looking for circuit ideas
School or Factory Bells
School Bell, Ring Class Change Factory Break or School Bells. www.ats- Need someone to help me design a product
usa.com
Just curious in Electronics
Mobile IDE (development)
I am a Ring Member checking my site
WinDev Mobile: RAD, IDE, 5GL, free database. For Windows mobile &
CE. www.windev.com/mobile Just surfing, nothing in particular
submit my vote
view results without voting
Talking Electronics
Designers of simple educational electronic projects.
Jennaron Research
Specialising in Embedded Systems and Controllers, Jennaron Research is an Australian company based in
Melbourne with a long history of electronic systems hardware and software design.
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
TELL A
SEARCH WEBRING: This WebRing All
FRIEND!
Computers & Internet > Hardware Add this feed:
Australian Electronics WebRing Add Your
Manager: downunderrm Web Site.
Join Here!
Iron WebMaster
Featuring websites dedicated to Electronics as a hobby or business in Australia. This
webring features sites with free schematics, ideas, kit builders, magazines, manufacturers
Round 2 VOTING
and parts suppliers. If your looking for any of the above, or similar, within Australia, then
this is the right ring for you.
Ads by Google
Get in on the Action!
Hytronic Electronics Australian Electronics WebRing Poll
Electronic Transformer Various Ballasts and Motion Sensors. www. Which description best describes what you are
hytronik.com looking for?
Only members who are logged in may register a vote. You
Flexible printed circuits are either not logged in or not a WebRing member. Use the
Get a flex circuits in 24 hrs. Specializing in small to medium. www. Sign In link at top to log in or register for a WebRing User ID.
uniflexcircuits.com
A Hobbyist looking for circuit ideas
Electronic India
Custom electronic design and development service in India.. www.mansi. Need someone to help me design a product
ws
Just curious in Electronics
Circuit Simulation
I am a Ring Member checking my site
Find Electronics Solutions For Your Business. Get It Done Now!. www.
business.com Just surfing, nothing in particular
submit my vote
view results without voting
Sage Telecommunications
Sage Telecommunications ( Hardware / Software Engineers, distributers of Dontronic's SimmStick products,
LCD's and RF data modules ) and Sage Pages ( Republishers of Fred Hoinville's classic 'Halfway to
Heaven' )
Copyright 2001-2008 WebRing, Inc. All rights reserved. Terms of Service - Help
Notice: We collect personal information on this site.
To learn more about how we use your information, see our Privacy Policy
WebRing server hosting provided by SimpleNet.
Sage
Embedded Systems,
Publishers
Sage Telecommunications is a specialist electronic design house. We provide quality hardware and software engineering solutions. We
offer design packages from concept through to manufactured product. See our summary of services.
We have developed the Sentinel and RCU remote monitoring system and firmware for various professional audio consoles for
Elan Audio.
We have also developed queuing systems for Queue Systems WA.
We have also had significant input into the design and development of several PMR base station control units for a number of
major equipment manufacturers.
Currently providing upgrade, development and maintenance services to a major gas pipeline operator.
Previous 5 Sites | Skip Previous | Previous| Next [ Previous | List Sites | Next | Random Site] [Skip Prev][Prev][Next][Skip Next]
Skip Next | Next 5 Sites | Random Site| List Sites [ Previous 5 Sites | Next 5 Sites | Join ] [Random][Next 5][List Sites][Join Ring]
Send mail to webmaster@sages.com.au with questions or comments about this web site.
Copyright 1998-2004 Sage Telecommunications Pty Ltd
Last modified: January 06, 2004
Links
Dieting News - get away from your desk and get fit.
We also belong to
Search Ring
2001-2005 WebRing Inc. - Help - Browse WebRing
Electronics by nsfetcu
[ Join Now | Ring Hub | Random | << Prev | Next >> ]
Link to us via
Electronics for Beginners - A Beginners guide to electronics, information and a place to have your
questions answered.
:020000040000FA
:020000006E2868
:0800080045288C0081018316DC
:100010000313C030810508008C008101831603138F
:10002000C030810501308104831203130B110B1DB5
:1000300017288C0B162808009900051208308C0030
:100040002D2019180516191C0512990C2D208C0B42
:10005000212805162D202D2008000C308D00332876
:1000600001308D0033288D0B332808009A01642855
:100070001011950303193F2802301C2091019301B0
:100080009401950112081C2008008B138B1B452836
:100090009C00030E9D0083010A089E008A018313C1
:1000A00004089F000B1C6528861B5C28101C642814
:1000B00010109014910A6428101864281014101558
:1000C0009201901C920A90100B101F0884001E08C9
:1000D0008A001D0E83009C0E1C0E0900831603135C
:1000E00081010512831203130516910192019301F8
:1000F000940195018B018B158B17832849300520BE
:1001000002301320901001309307031C8A289407B3
:0E0110000318950A90187E28101938208328AD
:02400E00F13F80
:00000001FF
http://www.trash.net/~luethi/microchip/projects/dcf77_test/dcf_test.hex12/02/2008 18:26:08
Circuit Design Inc. Radio technical reference Design guide
Technical Reference
This document was prepared as guidance for those who intend to design radio systems using RF radio modules.
We hope you find this document useful for acquiring background information. We believe it will result in shortening
the time required for design, and will help you to develop an attractive product.
Introduction Radio control
What is a radio module? Knowledge required for design
What are radio waves? Radio transmission terminology
What is an antenna?
Electric field intensity at the receiving point < Fresnel zone and height pattern >
Difference between Wide band and Narrow band Radio Module (173 KB)
RF module for sending audio signal in European 863-865 MHz band (1448 KB)
Natural disaster monitoring and warning system using SRD (842 KB)
Status
July 2007
Getting started with uClinux Greg Ungerer has been posting patches against the dist
for those wishing to follow the mid-release updates. The
FAQ Patches can be found at the following link: http://www.
uclinux.org/pub/uClinux/dist/patches/ Feed back on
uCsimm Hardware Project these patches can be posted to the uClinux-dev mailing
list. If you wish to subscribe to the mailling list you can
uClinux Ports do it here https://mailman.uclinux.org/mailman/listinfo/
uclinux-dev/.
The Developers
July 2007
E-Mail Forum The current uClinux-dist release is dated January 30,
2007. Here is a quick links to the tar.gz and tar.bz2
packages.
Contact us
http://www.uclinux.org/uClinux/dist/uClinux-
HTTP download
dist-20070130.tar.gz
CVS repository http://www.uclinux.org/uClinux/dist/uClinux-
dist-20070130.tar.bz2
Sponsor Links
June 2007
Again this year several uClinux developers will all be at
the Ottawa Linux Symposium (Ottawa Canada June 27-
30). Checkout the sessions that Robin Getz will be
presenting at the conference.
June 2007
The Freescale Technolgy Forum is holding many
session on embedded Linux / uClinux this year
(Orlando Florida June 25-28).
This Open Source Project Sponsored By: Hands on Workshop "Getting Started with
uClinux on Cost-Effective 32 bit Devices
(MCF5207/MCF5208)" with Tatiana Orofino on
June 26.
Hands on Workshop "Introduction to Embedded
Linux on ColdFire Processors (MCF5475/
MCF5485)" with Cory Tate on June 27th.
Hands on Workshop "Configuring and Use of
Coldfire Embedded Voip Kit with uClinux
(MCF5328/MCF5329)" with Michael Durrant on
June 27th.
ANI Technologies Corp. Hands on Workshop "Building an MP3 Player
on the uClinux Operating System Using the
ColdFire MCF5249)" with Fabio Estevam on
June 28th.
Copyright 1998 - 2002 D. Jeff Dionne and Michael Durrant Copyright 2001 - 2007 Arcturus Networks Inc.
uClinux, Clinux, uCsimm, Csimm, uCdimm, Cdimm, Arcturus and the logos versions are Trademarks of Arcturus
Networks Inc.
home
Welcome to the USB Hub, where our crack team of nerds are chained to
the office
computers with lots of USB ports trying out every USB device we can find.
your home
We let you know what we think of them and give you a place to share your
hotlists
thoughts on them as well.
search
with a plastic pig that lets you listen to your favourite radio station
have gone for the one button push-to-scan radio carcass that
say find
The LaCie Huby is the best looking usb hub I have ever
that consumers are after useful things that look good on the desk.
created our favourite port, but I truly believe that it is the very
USB Massager
when the box arrived in the mail, and, truth be told I was s
current).
Home
About The Program
Course Contents
Advanced Standings
FAQs
Prerequisites
Career Prospects
Cost
News
Support
Contact
Search
This self-paced, interactive PLC Technician Certificate training program allows you to work, when you
want, where you want, at your own pace.
Welcome to PLCtechnician.com. Our PLC Technician home study program allows students the
opportunity to complete PLC Technician training courses and receive a PLC Technician certificate,
while taking our home training courses using an interactive learning package.
Our distance education program is also valuable for on-the-job technician training, with hundreds of
companies presently sponsoring employees in the program.
"I am an electrician at Ford Motor Company and took the PLC Technician course to upgrade in 2005. I
found it very good. The flexibility to take it at your own pace is great for shift workers and people with
small kids. I would highly recommend it."
Kelly Green, Ford Motor Company
Our distance education program provides easy-to-use home study courses since all you need is the CD-
ROM and an internet connection. No expensive books or lab equipment are required. Because of the
flexible delivery format, students can complete the home study training in less time or more time. The
PLC Technician training program is designed to meet your schedule not ours, so you decide how much
time you will take to complete the training. We provide you with the training support but leave the
scheduling of studying and completion time up to you. Average completion time for the entire PLC
Technician Certificate Training program is 32 weeks. Previous electronics and/or PLC experience,
education and time spent may reduce that time significantly.
Electronics Technician
Electromechanical Technician
Site Map
Terms & Conditions
Privacy Policy
Copyright PLCTechnician.com 2007
| Home Page |
|Duetronix - Project Assistance|
To assist the hobbyist the following projects and code samples are available for download. These applications are available without charge for non comercial use.
Adobe Acrobat 6.0 or higher is required to view the files below.
Application Notes
001 - Hello World Beginner's Project: Discusses basic details about PIC Microcontrollers, includes sample code that toggles single LED.
002 - PIC I/O Basics Beginner's Project: Introduction for beginners to PIC I/O.
Project Code
Project samples under development
QAG 20 ProtoPro Quick Assembly Guide (Assembly Instructions): Discusses assembly details. Includes circuit diagram.
QAG 28 ProtoPro Quick Assembly Guide (Assembly Instructions): Discusses assembly details. Includes circuit diagram.
QAG 40 ProtoPro Quick Assembly Guide (Assembly Instructions): Discusses assembly details. Includes circuit diagram.
Disclaimer: The following code samples are provided without waranty. They may be used entirely for educational purposes and may not be used for comercial purposes.
Use them entrirely at your own risk.
| CONTACT DETAILS |
email info@duetronix.co.za
http://www.duetronix.co.za/projects.htm12/02/2008 19:31:40
http://www.trash.net/~luethi/microchip/projects/adc_test/nsc12130.asm
;***************************************************************************
;
; NSC ADC12130 Software Interface on PIC 16F84 V1.02
; ===================================================
;
; written by Peter Luethi, 31.7.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 19.04.2004
;
; V1.02: Added LCDcflag (LCD command/data flag) to comply with
; latest LCD modules.
; (19.04.2004)
;
; V1.01: Updated to latest revision of m_lcd_bf.asm
; (31.12.2000)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock: 4.00 MHz XT
; Throughput: 1 MIPS
; Required Hardware: NSC ADC12130, dot matrix LCD display
;
;
; DESCRIPTION:
; ============
; This is a communication test routine between the PIC16F84 and
; the NSC ADC12130 12 bit A/D Converter based on the software-
; implemented SSP (Synchronous Serial Port) interface.
; The following features are implemented:
; - Setup of SSP communication and control lines to A/D converter
; - Auto Calibration and Mode Configuration of A/D converter
PROCESSOR 16F84
#include "p16F84.inc"
;*** CH0 : CH0 vs CH1, df : differential mode, format, first bit ***
CONSTANT CH0df12MSB = b'00000000'
CONSTANT CH0df16MSB = b'00010000'
CONSTANT CH0df12LSB = b'00010000'
CONSTANT CH0df16LSB = b'00010100'
#include "..\m_bank.asm"
#include "..\m_wait.asm"
#include "..\m_lcd_bf.asm"
#include "..\m_lcdb16.asm"
ADinit macro
BANK1
movlw b'11110000' ; set A/D control lines I/O direction
movwf TRISA
BANK0
ADenable macro
movlw b'11111100' ; select chip & enable conversion
andwf PORTA,1
endm
ADdisable macro
movlw b'00000011' ; deselect chip & disable conversion
iorwf PORTA,1
endm
ad_loop
;*** TRANSMISSION : MSB out on pin DO ***
btfss SSPSR,7 ; check MSB, skip if set
bcf DO
btfsc SSPSR,7 ; check MSB, skip if cleared
bsf DO
; btfss/btfsc used due to illegal consecutive write cycles
; on output pins and to prevent unnecessary spikes:
; only one write cycle is performed
decfsz AD_cnt,1
goto ad_loop
RETURN
MAIN LCDinit
ADinit
LCDchar 'N'
LCDchar 'S'
LCDchar 'C'
LCDchar ' '
LCDchar 'A'
LCDchar 'D'
LCDchar 'C'
LCDchar '1'
LCDchar '2'
LCDchar '1'
LCDchar '3'
LCDchar '0'
LCDchar ' '
LCDchar 'C'
LCDchar 'I'
LCDchar 'N'
LCDline 2
LCDchar 'T'
LCDchar 'e'
LCDchar 's'
LCDchar 't'
LCDchar '-'
LCDchar 'I'
LCDchar 'n'
LCDchar 't'
LCDchar 'e'
LCDchar 'r'
LCDchar 'f'
LCDchar 'a'
LCDchar 'c'
LCDchar 'e'
WAITX d'16',d'7'
ADenable
ADcmd StatusRead
ADdisable
LCDcmd LCDCLR
LCDchar 'S'
LCDchar 't'
LCDchar 'a'
LCDchar 't'
LCDchar 'u'
LCDchar 's'
ADenable
ADcmd Unsigned
movfw SSPSR
movwf HI ; get upper 8 bits of status data
; get remaining bit of status data :
bsf SCK ; clock high
nop ; settle time for clock high
clrf LO
btfsc DI
bsf LO,7 ; store remaining status bit
bcf SCK ; clock low
ADdisable
WAITX d'25',d'7'
ADenable
ADcmd AT34 ; wait at least 34 tck
ADdisable ; = 0.0085 ms @ 4 MHz
WAIT 0x01
ADenable
ADcmd AutoCal ; wait at least 4944 tck
ADdisable ; = 1.232 ms @ 4 MHz
WAIT 0x03
ADenable
ADcmd AutoZero ; wait at least 76 tck
ADdisable ; = 0.019 ms @ 4 MHz
WAIT 0x01
ADenable
ADcmd StatusRead ; Note: the returned bit length
ADdisable ; corresponds to the preceeding command
WAIT 0x01
ADenable
;*****************
ADcmd CH0se16MSB ; CH0, single-ended, 16 bit, MSB first
;ADcmd CH1se16MSB ; CH1, single-ended, 16 bit, MSB first
;*****************
movfw SSPSR
movwf HI ; get upper 8 bits of status data
; get remaining bit of status data :
bsf SCK ; clock high
nop ; settle time for clock high
clrf LO
btfsc DI
bsf LO,7 ; store remaining status bit
bcf SCK ; clock low
ADdisable
ADenable
;*****************
ADcmd CH0se16MSB ; CH0, single-ended, 16 bit, MSB first
;ADcmd CH1se16MSB ; CH1, single-ended, 16 bit, MSB first
;*****************
movfw SSPSR
movwf HI
bsf CONV ; disable conversion (for safety reasons)
ADcmd DummyCmd
movfw SSPSR
movwf LO
ADdisable
;***************************************************************************
;
; LCD TEST ROUTINE for demonstration of LCD animation V1.03
; =========================================================
;
; written by Peter Luethi, 16.05.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 31.12.2004
;
; V1.03: Added line test and 'walking square'.
; (06.06.2004)
;
; V1.02: Improved animation.
; (19.04.2004)
;
; V1.01: Added user-defined characters, defined in macro
; LCDspecialChars in assembler module file m_lcdx.asm.
; (x.x.1999?)
;
; V1.00: Initial release, for Hitachi HD44780 LCD controllers
; and compatibles.
; (16.05.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16X84
; Clock Frequency: 4.00 MHz (HS mode)
; Throughput: 1 MIPS
; LCD Transmission Mode: 4 Bit on D4 - D7 (MSB),
; uses high nibble of the LCD port
; LCD Connections: 7 Wires
; (4 Data, 3 Command)
;PROCESSOR 16F84
;#include "p16f84.inc"
PROCESSOR 16F84a
#include "p16f84a.inc"
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
;*** LCD module versions for fixed ports (e.g. PortB) ***
LCDtris equ TRISB
LCDport equ PORTB
; #include "..\..\m_lcd.asm"
#include "..\..\m_lcdx.asm" ; with user-defined characters
; #include "..\..\m_lcd_bf.asm"
; #include "..\..\m_lcdxbf.asm" ; with user-defined characters
;*** configurable LCD module versions for modular ports (e.g. PortA & PortB) ***
; LCDtris equ TRISA ; LCD data on low nibble of portA
; LCDport equ PORTA
; #define LCD_ENtris TRISB,0x01 ; EN on portB,1
; #define LCD_EN PORTB,0x01 ; Enable Output / "CLK"
; #define LCD_RStris TRISB,0x02 ; RS on portB,2
; #define LCD_RS PORTB,0x02 ; Register Select
; #define LCD_RWtris TRISB,0x03 ; RW on portB,3
; #define LCD_RW PORTB,0x03 ; Read/Write
; #include "..\..\m_lcde.asm"
; #include "..\..\m_lcde_bf.asm"
; #include "..\..\m_lcdexbf.asm" ; with user-defined characters
MAIN
LCDinit ; LCD Initialization
LCDchar 'C'
LCDchar 'h'
LCDchar 'a'
LCDchar 'r'
LCDchar 'a'
LCDchar 'c'
LCDchar 't'
LCDchar 'e'
LCDchar 'r'
LCDchar 's'
LCDchar ':'
LCDchar ' '
LCDchar 0xE0
LCDchar 0xE1
LCDchar 0xE2
LCDchar 0xE3
LCDchar 0xE4
LCDchar 0xE5
LCDchar 0xE8
LCDchar 0xEF
LCDchar 0xF3
LCDchar 0xF4
LCDchar 0xF5
LCDchar 0xF6
LCDchar 0xF7
LCDchar 0xF8
LCDchar 0xFD
WAITX d'20',d'7'
LCDcmd LCDCLR
LCDchar 'P'
LCDchar 'I'
LCDchar 'C'
LCDchar '1'
LCDchar '6'
LCDchar 'F'
LCDchar '8'
LCDchar '4'
LCDchar ' '
LCDchar 'L'
LCDchar 'C'
LCDchar 'D'
LCDchar 't'
LCDchar 'e'
LCDchar 's'
LCDchar 't'
WAIT 0x80
LCDchar '*'
WAIT 0x80
LCD_DDAdr 0x44
LCDchar ' '
LCDchar ' '
LCDchar ' '
LCDchar ' '
LCDchar ' '
LCDchar ' '
LCDchar ' '
decfsz TEMP1,f
goto INTRO
WAITX d'8',d'7'
LCDcmd LCDCLR
LCDcmd LCDL4
LCDchar 'L'
LCDchar 'i'
LCDchar 'n'
LCDchar 'e'
LCDchar ' '
LCDchar '4'
LCDcmd LCDL3
LCDchar 'L'
LCDchar 'i'
LCDchar 'n'
LCDchar 'e'
LCDchar ' '
LCDchar '3'
LCDcmd LCDL2
LCDchar 'L'
LCDchar 'i'
LCDchar 'n'
LCDchar 'e'
LCDchar ' '
LCDchar '2'
LCDcmd LCDL1
LCDchar 'L'
LCDchar 'i'
LCDchar 'n'
LCDchar 'e'
LCDchar ' '
LCDchar '1'
WAITX d'16',d'7'
movwf TEMP1
LOOP2 movlw d'40' ; inner loop
movwf TEMP2
LOOP2b WAIT 0xA0
LCDcmd LCDSR ; 'walking square' on line 1
decfsz TEMP2,f
goto LOOP2b
LCDcmd LCDCH ; cursor home
LCDchar 0xFF
LCDcmd LCDL2 ; 'walking sqare' on line 2
LCDchar 0xFE
decfsz TEMP1,f
goto LOOP2
LCDcmd LCDCLR ; clear LCD
WAIT 0xFF
LCD_DDAdr 0x00
LCDchar 'H'
LCDchar 'e'
LCDchar 'r'
LCDchar 'e'
LCDchar b'00100111'
LCDchar 's'
WAIT 0xFF
LCD_DDAdr 0x41
LCDchar 'P'
LCDchar 'I'
LCDchar 'C'
LCDchar '1'
LCDchar '6'
LCDchar 'F'
LCDchar '8'
LCDchar '4'
movlw 0x07
movwf TEMP1
LO_2 WAIT 0xC0
LCDcmd LCDSL ; shift left LCD display content
decfsz TEMP1,f
goto LO_2
goto LOOP3
END
:020000040000FA
:020000003A289C
:080008003A288C0081018316E7
:100010000313C030810508008C008101831603138F
:10002000C030810501308104831203130B110B1DB5
:1000300017288C0B162808008E00E13086050E0D5F
:100040001E398604080086132628861706138F009B
:100050000F080F0E1C2033200F081C203320E13026
:1000600086058613080001300C20861686120130A2
:100070000C20080083160313013086058312031336
:10008000861206138613E130860504300C200330F7
:100090001C20332001300C2008301C20332001307C
:1000A0000C2002301C20332001300C20283023206B
:1000B0000C3023200130232008300C204030232036
:1000C00006302520413023200830252042302320CF
:1000D00004302520433023200A30252044302320BB
:1000E0001130252045302320113025204630232093
:1000F0000E30252047302320003025204830232093
:100100000E30252049302320113025204A3023206D
:10011000113025204B302320113025204C30232056
:10012000113025204D3023200A3025204E30232049
:100130001B3025204F302320003025208030232005
:10014000433025206830252061302520723025205D
:10015000613025206330252074302520653025202E
:1001600072302520733025203A302520203025207C
:100170000030252001302520C0302320E03025200C
:10018000E1302520E2302520E3302520E430252011
:10019000E5302520E8302520EF302520F3302520DC
:1001A000F4302520F5302520F6302520F7302520A5
:1001B000F8302520FD30252014300520073013208D
:1001C0000130232050302520493025204330252080
:1001D0003130252036302520463025203830252066
:1001E00034302520203025204C3025204330252058
:1001F000443025207430252065302520733025209B
:100200007430252003309200C43023202A3025206A
:1002100080300C202A30252080300C202A302520E8
:1002200080300C202A30252080300C202A302520D8
:1002300080300C202A30252080300C202A302520C8
:1002400080300C202A30252080300C20C430232020
:10025000203025202030252020302520203025204A
:100260002030252020302520203025200430232058
:100270002A30252080300C202A30252080300C2088
:100280002A30252080300C202A30252080300C2078
:100290002A30252080300C202A30252080300C2068
:1002A0002A30252080300C202A30252080300C2058
:1002B000CB30232020302520203025202030252041
:1002C00020302520203025202030252020302520DA
:1002D00006302320920B04292030252008300520E9
:1002E0000730132001302320D43023204C30252028
:1002F000693025206E3025206530252020302520CE
:1003000034302520943023204C302520693025209E
:100310006E302520653025202030252033302520E3
:10032000C03023204C302520693025206E30252018
:1003300065302520203025203230252080302320B4
:100340004C302520693025206E3025206530252051
:100350002030252031302520103005200730132093
:100360000230232050309200FF302520920BB42918
:10037000103005200730132002302320FE302520C6
:100380000230920028309300A0300C201C30232033
:10039000930BC42902302320FF302520C0302320B6
:1003A000FE302520920BC22901302320FF300C2083
:1003B0008030232048302520653025206C302520D2
:1003C0006C3025206F30252020302520FF300C2078
:1003D000C13023202030252020302520203025202A
:1003E000573025206F302520723025206C30252095
:1003F0006430252007309200C0300C201C302320B0
:10040000920BFC29FF300C2080302320483025201F
:1004100065302520723025206530252027302520A5
:1004200073302520FF300C20C13023205030252090
:1004300049302520433025203130252036302520F5
:1004400046302520383025203430252007309200D2
:0E045000C0300C2018302320920B282AD62909
:02400E00F23F7F
:00000001FF
;***************************************************************************
;
; LCDv16 Test Routine for PIC 16XXX V1.02
; =======================================
;
; written by Peter Luethi, 26.03.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 05.01.2005
;
; V1.02: Added binary representation of counter value
; (05.01.2005)
;
; V1.01: Clean up and adaptation to latest module versions
; (31.12.2000)
;
; V1.00: Initial release
; (26.03.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16C84, PIC 16F84
; Clock: 4.00 MHz XT
; Throughput: 1 MIPS
; Code Size of entire Program: approx. 203 instruction words
; Required Hardware: HD44780 compatible dot matrix LCD
; (2x16, 2x20 or 2x40 characters)
;
;
; DESCRIPTION:
; ============
; Developed on PIC 16C84, but executeable on all PIC 16XXX.
; Demonstrates LCD initialization and the use of some LCD commands, as
PROCESSOR 16F84
#include "p16f84.inc"
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
#include "..\..\m_lcd.asm"
#include "..\..\m_lcdv16.asm" ; 16 bit binary to decimal conversion
#include "..\..\m_lcdb16.asm" ; 16 bit binary debug output on LCD
MAIN
LCDinit ; LCD Initialization
clrf HI
clrf LO
LCDchar 'C'
LCDchar 'n'
LCDchar 't'
LCDchar '-'
LCDchar 'V'
LCDchar 'a'
LCDchar 'l'
LCDchar 'u'
LCDchar 'e'
LCDchar ':'
; no jumps necessary !
WAIT 0x40
goto m_loop
END
:020000040000FA
:0200000087284F
:0800080087288C00810183169A
:100010000313C030810508008C008101831603138F
:10002000C030810501308104831203130B110B1DB5
:1000300017288C0B162808008E00E13086050E0D5F
:100040001E398604080086132628861706138F009B
:100050000F080F0E1C2033200F081C203320E13026
:1000600086058613080001300C20861600008612D3
:1000700001300C20080011089300120894001010A1
:1000800010308D0027308E005D202520E8308D0057
:1000900003308E005D20252064308D008E015D20B0
:1000A00025200A308D008E015D20252001308D0035
:1000B0008E0110145D20252008008C010E0814020A
:1000C000031C7128031D68280D081302031C7128E6
:1000D0000E0894020D089302031C94038C0A10145A
:1000E0005E2830300C07101C203008001414120851
:1000F0009300083095003030931B31302520930D4C
:10010000950B7B28141C08001410110878288316FE
:100110000313013086058312031386120613861318
:10012000E130860504300C2003301C2033200130E0
:100130000C2008301C20332001300C2002301C2001
:10014000332001300C20283023200C3023200130B4
:10015000232008300C2092019101433025206E307D
:100160002520743025202D30252056302520613063
:1001700025206C30252075302520653025203A302B
:1001800025208B3023203B20C030232076200130D7
:0C01900091070318920A40300C20C1288F
:02400E00F13F80
:00000001FF
http://www.trash.net/~luethi/microchip/projects/counter/counter.hex12/02/2008 19:45:32
http://www.trash.net/~luethi/microchip/projects/debug/debug.asm
;***************************************************************************
;
; LCDb16 Test Routine for PIC 16XXX V1.01
; =======================================
;
; written by Peter Luethi, 02.08.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 05.01.2005
;
; V1.01: Clean up and adaptation to latest module versions
; (05.01.2005)
;
; V1.00: Initial release
; (02.08.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16C84, PIC 16F84
; Clock: 4.00 MHz XT
; Throughput: 1 MIPS
; Code Size of entire Program: approx. 146 instruction words
; Required Hardware: HD44780 compatible dot matrix LCD
; (2x16, 2x20 or 2x40 characters)
;
;
; DESCRIPTION:
; ============
; Developed on PIC 16C84, but executeable on all PIC 16XXX.
; Demonstrates LCD initialization and the use of some LCD commands, as
; well as 16 bit binary LCD output module m_lcdb16.asm (for debugging).
;
;***************************************************************************
PROCESSOR 16F84
#include "p16f84.inc"
LO equ BASE+d'5'
HI equ BASE+d'6'
LO_TEMP set BASE+d'7'
HI_TEMP set BASE+d'8'
b16_cnt equ BASE+d'9' ; counter
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
#include "..\..\m_lcd.asm"
#include "..\..\m_lcdb16.asm" ; 16 bit binary debug output on LCD
MAIN
LCDinit ; LCD Initialization
clrf HI
clrf LO
LCD_DDAdr 0x02
LCDchar 'L'
LCDchar 'C'
LCDchar 'D'
LCDchar 'b'
LCDchar '1'
LCDchar '6'
LCDchar '-'
LCDchar 'T'
LCDchar 'e'
LCDchar 's'
LCDchar 't'
LCDchar ':'
incfsz LO,1
goto IN_1
incf HI,1
END
:020000040000FA
:020000004C288A
:080008004C288C0081018316D5
:100010000313C030810508008C008101831603138F
:10002000C030810501308104831203130B110B1DB5
:1000300017288C0B162808008E00E13086050E0D5F
:100040001E398604080086132628861706138F009B
:100050000F080F0E1C2033200F081C203320E13026
:1000600086058613080001300C20861600008612D3
:1000700001300C2008001414120893000830950079
:100080003030931B31302520930D950B4028141CE4
:100090000800141011083D2883160313013086054B
:1000A00083120313861206138613E130860504308B
:1000B0000C2003301C20332001300C2008301C2081
:1000C000332001300C2002301C20332001300C2062
:1000D000283023200C3023200130232008300C202E
:1000E00092019101823023204C302520433025207D
:1000F000443025206230252031302520363025201F
:100100002D302520543025206530252073302520C2
:10011000743025203A302520C03023203B20910F19
:0A0120009228920A40300C208C282F
:02400E00F13F80
:00000001FF
http://www.trash.net/~luethi/microchip/projects/debug/debug.hex12/02/2008 19:46:02
http://www.trash.net/~luethi/microchip/projects/keyboard/scan_deb/scan_deb.asm
;***************************************************************************
;
; AT Keyboard Scan Code Debug Interface V1.02
; ===========================================
;
; written by Peter Luethi, 12.07.2000, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 25.03.2005
;
; V1.02: Re-structured entire ISR and RS232 echo sub-routines
; (18.04.2004)
; V1.01: Changed keyboard data pin to PORTA,4 (open-collector).
; (16.08.2003)
; V1.00: Initial release (12.7.2000)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock Frequency: 4.00 MHz XT
; Throughput: 1 MIPS
; RS232 Baud Rate: 19200 baud (depends on the module included)
; Serial Output: 19200 baud, 8 bit, no parity, 1 stopbit
; Keyboard Routine Features: Capability of uni-directional
; communication between microcontroller
; and keyboard
; Acquisition Methodology: Non-preemptive, interrupt-based
; keyboard scan pattern acquisition
; Code Size of entire Program: 208 instruction words
; Required Hardware: AT Keyboard, MAX 232
; Required Software: RS232 terminal (recommended: Excel 97
; RS232-Debug-Interface)
;
; DESCRIPTION:
; ============
; Developed and tested on PIC 16F84.
; Any key stroke on the keyboard connected to the PIC will send the
; corresponding key scan code to the computer terminal via the RS232
; connection.
; Verification of keyboard scan patterns and to get the scan code of
; unknown keys on non-english or non-german keyboards.
;
; The keyboard scan code capture and decoding is done by an interrupt
; service routine. The event, which triggers the interrupt is a falling
; edge on the keyboard clock line at the KBDclkpin (PORTB,0).
; The keyboard data (scan code) will be fetched at the KBDdatapin
; (PORTA,4).
; There is only RS232 transmission, so only the TXport is connected.
; No reception is necessary because there aren't any output devices
; attached to the microcontroller and PORTB,0 is already used by the
; keyboard clock line. The configuration of the KBDclkpin (PORTB,0)
; interrupt is done by the RS232init procedure (although used by the
; keyboard), because all settings are the same.
;
;
; IMPORTANT:
; ==========
; To get all parts of a complete scan pattern, it is recommended to
; use this code in compliance with the above specifications.
; Otherwise, consecutive interrupt calls are launched before the
; termination of the ISR. As a consequence, parts of scan patterns
; will not be displayed or in worst case, a system crash will happen.
; Of course, it is possible to use this code with a faster crystal
; and/or with RS232 modules specified for higher baud rates.
;
;
; CREDITS:
; ========
; - Craig Peacock, the author of the excellent page about keyboards
; "Interfacing the PC's Keyboard" available at his website:
; http://www.beyondlogic.org/keyboard/keybrd.htm
; - Steve Lawther for inspirations concerning the scan code fetch
; routine.
;
;***************************************************************************
PROCESSOR 16F84
#include "p16f84.inc"
ORG 0x50
#include "..\..\m_bank.asm" ; standard macros
#include "..\..\m_wait.asm"
;#include "..\..\m_rs096.asm" ; 9600 baud, not recommended
#include "..\..\m_rs192.asm" ; 19200 baud @ 4 MHz
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
;*** Until now, already 16 cycles (16 us) have been passed ***
btfsc KBDdatapin ; test start bit of keyboard data input
goto KBDabort ; no valid start bit, abort
movlw 0x08 ; 8 data bits to receive / counter
movwf ISRtmp1
waitHI btfss KBDclkpin ; loop, wait for kbd clk HIGH transition
goto waitHI
waitLO btfsc KBDclkpin ; loop, wait for kbd clk LO transition
goto waitLO
btfss KBDdatapin
goto KBD_1
bsf KBD,0x07
goto KBD_2
KBD_1 bcf KBD,0x07
KBD_2 decfsz ISRtmp1,W ; skip if ISRtmp1 == 1
rrf KBD,F ; do this only 7 times
decfsz ISRtmp1,F
goto waitHI ; loop 8 times
;*** ignore parity bit, check stop bit: ***
movlw 0x02 ; set counter
movwf ISRtmp1
waitHIp btfss KBDclkpin ; loop, wait for kbd clk HIGH transition
goto waitHIp
waitLOp btfsc KBDclkpin ; loop, wait for kbd clk LO transition
goto waitLOp
decfsz ISRtmp1,F
goto waitHIp
btfsc KBDdatapin ; check if stop bit is valid
goto KBD_3 ; if valid, continue execution of ISR
KBDabort clrf KBD ; else, abort / invalid data
goto ISRend ; terminate execution of ISR
movfw KBD
SENDw ; send actual pressed keyboard character
;***********************************
;*** CLEARING OF INTERRUPT FLAGS ***
;***********************************
_ISR_RS232error
_ISR_RS232end
bcf INTCON,INTF ; clear RB0/INT interrupt flag
;goto ISRend ; terminate execution of ISR
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
ORG 0xB0
MAIN BANK1
clrf OPTION_REG ; PORTB pull-ups enabled
bsf KBDclktris
bsf KBDdatatris
BANK0
RS232init ; RS232 initialization
WAIT d'5'
WelcomeTable
addwf PCL,F
DT "PIC 16F84 Keyboard Decoder connected" ; create table
retlw CR ; Carriage Return
retlw LF ; Line Feed
WTableEND retlw LF ; Line Feed
END
:020000040000FA
:02000000B02826
:080008008B138B1B04289200EE
:10001000030E930083010A0894008A0183130408E5
:100020009500051A2C2808309600061C152806187D
:100030001728051E1D2898171E289813160B980CB4
:10004000960B152802309600061C24280618262830
:10005000960B2428051A2E2898013C288316031392
:100060000610831203130610180867208316031363
:100070000614831203138B101508840014088A00D9
:0A008000130E8300920E120E090009
:1000A0008C00810183160313C030810508008C0089
:1000B000810183160313C03081050130810483124E
:1000C00003130B110B1D62288C0B61280800900094
:1000D000051008308C00782010180514101C05102D
:1000E000900C78208C0B6C28051478207820080060
:1000F0000C308D007E2801308D007E288D0B7E28EF
:06010000080091013B28FC
:1001600083160313810106140516831203138316E5
:1001700003130510061401138312031305148B10C7
:100180000B168B170530572027308E0000308A0061
:100190000E08273CD32067208E0BC628FF30502046
:1001A00007305E20C4288207503449344334203459
:1001B0003134363446343834343420344B346534B6
:1001C000793462346F3461347234643420344434AA
:1001D000653463346F34643465347234203463348A
:1001E0006F346E346E34653463347434653464341F
:0601F0000D340A340A344C
:02400E00F13F80
:00000001FF
http://www.trash.net/~luethi/microchip/projects/keyboard/scan_deb/scan_deb.hex12/02/2008 19:46:36
1 2 3 4
VDD
11
32
6
C3_1 MAX232
U1_1 CON6
RS232.sch
13 14
VDD
VDD
VSS 4n7 OSC1/CLKIN OSC2/CLKOUT
1 15
MCLR/VPP RC0/T1OSO/T1CKI
2 16 PIC TXD
RA0 RC1/T1OSI/CCP2
3 17 PIC RXD
C RA1 RC2/CCP1 C
PAD_OUT 4 18
RA2 RC3/SCK/SCL
5 23 VDD VDD
RA3 RC4/SDI/SDA Dot Matrix LCD Display
6 24 VSS VSS
KBD_Data RA4/T0CKI RC5/SDO LCD.sch
7 25
RA5/SS RC6/TX/CK
33 26
KBD_Clk RB0/INT RC7/RX/DT LCD RS
34 19 LCD RS
RB1 RD0/PSP0 LCD R/W
35 20 LCD D4 LCD R/W
RB2 RD1/PSP1 LCD E
36 21 LCD D5 LCD E
RB3 RD2/PSP2
37 22 LCD D6
RB4 RD3/PSP3 LCD D4
38 27 LCD D7 LCD D4
RB5 RD4/PSP4 LCD D5
39 28 LCD E LCD D5
RB6 RD5/PSP5 LCD D6
40 29 LCD R/W LCD D6
PAD_IRQ RB7 RD6/PSP6 VDD LCD D7
8 30 LCD RS LCD D7
RE0/RD//AN5 RD7/PSP7
VSS
VSS
B 9 10 VDD B
U2_1 C5_1 RE1/WR/AN6 RE2/CS/AN7
C4_1 VDD VDD
PIC16C74-04/JW(40) VSS VSS
100n
VSS
12
31
220n
VSS
PIEZO-BUZZER
VSS Dot Matrix LCD Display
VSS
Digital Power Supply Numeric Foil Keypad (HD44780 compatible)
PowerSupply.sch Keypad.sch
1 2 3 4
1 2 3 4
CON1_2
D VDD LCD_CON14 D
R1_2
10k
Contrast
VDD
R/W
VSS
D0
D1
D2
D3
D4
D5
D6
D7
RS
E
1
10
11
12
13
14
1
2
3
4
5
6
7
8
9
POT1_2
VSS
C 2 C
10k R2_2
10k R3_2
10k R4_2
10k R5_2
Contrast VDD
Contrast
5k
LCD D7
3
LCD RS LCD D6
B B
VDD VDD
1 2 3 4
1 2 3 4
VDD
CON1_3 VDD VDD VDD
D D
Key5
Key3 13
Key3
Key6 12
Key9 11 R4_3
R3_3
Key# 10 10k
16k
R1_3 R2_3 Key2 9
8
1k 1k Key5 8 PAD_IRQ
U1_3A
Key8 7
Vref 2 C1_3
Key0 6
Key6 Key8 1 int 5n
Key1 5
Vkeypad3
Key4 4 R9_3
Key7 3 1k VSS
R5_3 R7_3 Key* 2 TLC393
4
1k 1k 1
C The comparator serves for interrupt C
CON13 pulse generation: Whenever a key
Key9 Key0 is hit, the comparator input
VSS VSS difference is positive and a 5 V
interrupt pulse is generated at the
R6_3 R8_3 output (PAD_INT).
Vsin
1k 1k According to Microchip, minimum
charging time for A/D converter
Key7 input (Rs = 10 k, Cin = 51 pF) is 12
Key# Key1 us.
VDD
8
V1_3 1k 1k 1k
B B
VSIN U1_3B C2_3
DC Magnitude * 6 5n
Key2 Key4 Key* VDD
AC Magnitude * 7
AC Phase * R16_3 5 VSS
100k VSS
VSS Offset 2.35
R11_3 R13_3 R15_3 VDD VDD
Amplitude 2.35 TLC393
Frequency 1000 1k 1k 5k V2_3
4
Delay * +5V
Damping Factor *
VSS VSS
Phase Delay * VSS
* Title
* VSS VSS
* Numeric Foil-Keypad Decoding Circuitry
A * A
Written by Date
* 7-Oct-2003
* Peter Luethi
* Revision Page
Dietikon, Switzerland 1.00 3 of 5
*
1 2 3 4
1 2 3 4
D D
PIC16C74A RS232
(Direction seen from controller) (Direction seen from host)
RS232 DTR
RS232 TXD VSS
PIC TXD 5V TXD
PIC RXD 5V RXD
JP1_4 RS232 RXD
RS232 DSR
1
JMP 5V DSR
VSS JP2_4 5V DTR
VDD
C C
1
6
2
7
3
8
4
9
5
1
JMP VSS
1
JP3_4
C1_4 C2_4 JMP
10u 10u
CON1_4
DB9
16
2
6
U1_4
13 12
V+
VCC
V-
RS232 TXD R1 IN R1 OUT 5V RXD
RS232 8 9 5V
RS232 DTR R2 IN R2 OUT 5V DTR
11 14
5V TXD T1 IN T1 OUT RS232 RXD
B 5V 10 7 RS232 B
5V DSR T2 IN T2 OUT RS232 DSR
1 4
GND
C1+ C2+
3 5
C1 - C2 -
C3_4 MAX232CPE(16) C4_4
10u 15 10u
VDD
VDD
VSS
C5_4
100n
VSS Title
VSS RS232 Interface using MAX232
A A
Written by Date
7-Oct-2003
Peter Luethi
Revision Page
Dietikon, Switzerland 1.00 4 of 5
1 2 3 4
1 2 3 4
D D
SW1_5
SWITCH
VDD
1
2
3
J1_5 U1_5 VDD
7805
VIN1 VIN2 1 3
GND
VVIN VOUT
V
IN OUT
PHONEJACK STEREO C1_5 GND C2_5 C3_5
2
C C
VSS
5 Volt digital power supply for VSS
digital logic: PIC16C74A,
MAX232, AT Keyboard.
VDD
R1_5
332
B B
D1_5
LED
VSS
Title
Power Supply
A A
Written by Date
7-Oct-2003
Peter Luethi
Revision Page
Dietikon, Switzerland 1.00 5 of 5
1 2 3 4
0.000ms 1.000ms 2.000ms 3.000ms 4.000ms 5.000ms
vref 294.15mV
293.90mV
vkeypad 2.000 V
0.000 V
vsin 5.000 V
0.000 V
vkeypad-vref 1.500
-0.500
int 5.000 V
-3.000 V
http://www.trash.net/~luethi/microchip/projects/adc_test/nsc12130.hex
:020000040000FA
:02000000762860
:0800080076288C0081018316AB
:100010000313C030810508008C008101831603138F
:10002000C030810501308104831203130B110B1DB5
:1000300017288C0B162808008E00E13086050E0D5F
:100040001E39860408009214262892108F003A2048
:10005000921C86170F080F0E1C2036200F081C203C
:100060003620E13086058613061308008616000048
:100070008612080086131214831603131E3086049A
:100080008312031306178616061E1210861200002E
:10009000362012184328061383160313E130860511
:1000A00083120313080017141508980008309300F2
:1000B0003030981B31302520980D930B5828171C91
:1000C0000800171016085528990008309400991F49
:1000D0000511991B0515990D0000851500001910D3
:1000E000051A19148511940B672808008316031349
:1000F0000130860583120313861206138613E1303E
:10010000860504300C2003301C20362001300C20E2
:1001100008301C20362001300C2002301C203620F4
:1001200001300C20283023200C30232028302320BD
:100130000130232083160313F0308500831203134C
:10014000033085004E3025205330252043302520B4
:1001500020302520413025204430252043302520E3
:1001600031302520323025203130252033302520F4
:1001700030302520203025204330252049302520CF
:100180004E302520C03023205430252065302520D6
:1001900073302520743025202D302520493025202E
:1001A0006E302520743025206530252072302520C2
:1001B00066302520613025206330252065302520DC
:1001C0001030052007301320FC30850530306420C6
:1001D000033085040130232053302520743025203E
:1001E000613025207430252075302520733025207E
:1001F000FC30850534306420190895008515000011
:100200009601051A9617851103308504873023203F
:1002100053201930052007301320FC308505F830B5
:1002200064200330850401300C20FC30850520302B
:1002300064200330850403300C20FC308505243015
:1002400064200330850401300C20FC3085053030FB
:1002500064200330850401300C20FC308505843097
:10026000642019089500851500009601051A961757
:1002700085110330850487302320532001300C2062
:10028000FC30850584306420190895008514003001
:1002900064201908960003308504C03023205320C1
:0202A0003E29F5
:02400E00F13F80
:00000001FF
14
C1_1
16
9
IC_PIC1_1
16 15 IC_AD1_1
VDD
VSS 4n7 OSC1/CLKIN OSC2/CLKOUT
4 7 D4 15 5
AV+
DV+
MCLR RB1 CCLK EOC
/CS 17 8 D5 SCKL 14 4
RA0 RB2 SCLK DOR
/CONV 18 9 D6 DOUT 13 12
C RA1 RB3 D IN D OUT C
DOUT 1 10 D7 /CONV 10
RA2 RB4 CONV
SCKL 2 11 E /CS 11
RA3 RB5 CS
DIN 3 12 R/W 1
RA4/T0CKI VSS RB6 CH0
6 13 RS 2
RB0/INT RB7 CH0 CH1
3 A_GND VREF-
CH1 COM
DGND
PIC16F84-04/P(18) 6
V REF-
7
5
V REF+
ADC12130CIN(16) CB1_1
CIRCUIT BREAKER
8
VSS
VREF- VREF+
1
VREF+ VREF+
D4
C2_1 C4_1 LCD D4
Dot Matrix LCD Display
B D5 VSS VSS B
LCD D5
1u 100n D6 (HD44780 compatible)
VREF- VREF- LCD D6
D7 VDD VDD
LCD D7 XT2_1
VDD VDD E XTAL-OSCILLATOR C5_1 C6_1
LCD E C7_1
10u 100n
R/W 10n
C3_1 LCD R/W
VSS VSS
100n RS
VDD
CLK
LCD RS
VSS
VSS VSS
1 2 3 4
http://www.trash.net/~luethi/microchip/projects/dcf77_test/dcf_test.asm
;***************************************************************************
;
; Test routine for DCF77 bit stream decoding V1.01
; ================================================
;
; written by Peter Luethi, 18.01.2003, Germany
; http://www.electronic-engineering.ch
; last update: 27.04.2004
;
; V1.01: Updated to comply with latest m_rsxxx.asm modules
; (27.04.2004)
;
; V1.00: Initial release (20.01.2003)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock: 4.00 MHz XT
; Throughput: 1 MIPS
; Serial Output: 19200 baud, 8 bit, no parity, 1 stopbit
; Acquisition Methodology: Preemptive, interrupt-based
; DCF77 PWM data decoding
; Required Hardware: PWM based DCF77 decoder,
; RS232 level shifter (MAX232)
; Required Software: DCF77_Visualizer.xls (Excel)
; or equivalent RS232 terminal
;
;
; DESCRIPTION:
; ============
; Developed and tested on PIC 16F84.
; The DCF77 bit stream decoder delivers PWM data specified to be
PROCESSOR 16F84
#include "p16f84.inc"
; general
FLAGreg equ BASE+d'4' ; register containing various flags
#define DCFprev FLAGreg,0x00 ; previous state of DCF_IN
#define BUSYflag FLAGreg,0x01 ; flag for DCF busy wait
#define XMITflag FLAGreg,0x02 ; flag for RS232 transmission
; RS232
TXD equ BASE+d'13' ; used for transmission
RXD equ BASE+d'14' ; received value
#include "..\m_bank.asm"
#include "..\m_wait.asm"
#include "..\m_rs192.asm"
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
;**********************
;*** DCF77 DECODING ***
;**********************
_ISR_DCF
btfsc DCF_IN ; check DCF input, skip if cleared
goto _DCF_rise ; DCF_IN = 1
;goto _DCF_fall ; DCF_IN = 0
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
MAIN BANK1
clrf OPTION_REG ; enable portB pull-ups
bcf TXtris ; set output
; RS232 reception not used
;bsf RXtris ; set input with weak pull-up
;bcf OPTION_REG,INTEDG ; RS232 interrupt on falling edge
BANK0
bsf TXport ; set default state: logical 1
clrf CNT ; initialize bit counter
clrf DAT ; initialize DCF data register
clrf LO ; clear 24 bit counter registers
clrf MED
clrf HI
clrf INTCON ; disable all interrupt sources, clear flags
bsf INTCON,RBIE ; enable portB change interrupt
bsf INTCON,GIE ; global interrupt enable
goto m_loop ; start within main loop
END
http://www.trash.net/~luethi/microchip/projects/alti/CDP-TX02.pdf12/02/2008 20:00:44
Circuit Design Inc. Embedded industrial radio modem Low power module 434 MHz 869 MHz 863 MHz
CDP-TX-01 / CDP-RX-01S
The crystal-controlled single frequency radio data module CDP-TX-01 (transmitter) and CDP-RX-01S (receiver)
are suitable for various application fields, such as wireless data communication, remote control, telemetry or
wireless security systems.
The small size and low power consumption of the CDP-01 make it ideal for mobile applications where its interference
resistance and effective range are far superior to that of similar RF modules based on wide band SAW-resonator
frequency generators.
Feature
European I-ETS 300 220 compliance
Very small compact integrated device with
robust metal housing
Low current consumption
FM narrow band modulation and
high frequency stability
High sensitivity 300m range
Application
Remote control systems
Security systems
Alarms
Telemetry systems
Common Item
Communication form
Specification
One way
Oscillation system Crystal
Frequency range 433.920MHz, 434.075MHz
Number of RF channels Single (fixed)
Frequency stability +/-2.5kHz (-10 to +55 degree C)
Baud rate 300 to 4800bps
Operating temp. range -10 - +60 degrees C
Im Gree 79, CH-8566 Ellighausen, Fon +41(71)698 6480, Fax +41(71)698 6481, e-mail: info@awirelessworld.ch, www.wirelessworldag.com
Electronics / RC Modeling
Piper Cherokee
Wingspan: 1.60 m
Engine: Super Tigre .91
Control: Engine, Elevator, Ailerons, Rudder
Description: This model is currently under construction.
It's going to be an evaluation platform for my electronic applications to be
checked. I intend to put my digital altimeter on it.
Back to Index
C1_3
C5_3
33n
C3_3
470n
A_GND A_GND
150n
11
11
C U1_3A U1_3B C
IN R1_3 A R2_3 3 R3_3 R4_3 5
IN0
95k 95k 1 B 87k 87k 7 OUT
CH0
2 6
V1_3
For Simulation C2_3 LM324N(14) C4_3 LM324N(14)
VPULSE
4
4
1 2 3 4
1 2 3 4
C1_4
C5_4
33n
C3_4
470n
A_GND A_GND
150n
11
11
C U1_3C U1_3D C
IN R1_4 A R2_4 10 R3_4 R4_4 12
IN1
95k 95k 8 B 87k 87k 14 OUT
CH1
9 13
4
4
150n 68n
B B
After having carried out only slight alterations on the
filter characteristics and its components (changed
from Chebyshev to Butterworth filter characteristics),
The op-amp LMC660 is specified as single supply,
the initially used LMC660 quad op-amp started
rail-to-rail quad op-amp up to 15 Volt VCC.
oscillating. So I had to replace the LMC660 with a
But there shows up a very bad non-linear
LM324 quad op-amp. Conclusion: 'Analog circuitry
characteristic: If the input voltage is in the range .85
that has not been tested explicitely does not work.'
VCC - 1.0 VCC, the output quickly jumps to 1.0 VCC.
This behavior destroys the whole filter characteristic in
the upper voltage range.
Therefore, to cope with this problem, either the supply
voltage has to be increased or it has to be assured Title
VA_2 VA_2
that the input signals never reach the critical level. In 4th Order Butterworth Filter Stage
this case, the supply voltage level has been lifted.
A A_GND A_GND A
Written by Date
23-Apr-2001
Peter Luethi
Revision Page
Dietikon, Switzerland 1.03 4 of 8
1 2 3 4
1 2 3 4
14
C2_5 PIC TXD
9
U1_5 16
16 15 U2_5
VSS 1n OSC1/CLKIN OSC2/CLKOUT
4 7 RB1 D4 15 5
MCLR RB1 CCLK EOC
VDD
/CS 17 8 RB2 D5 SCKL 14 4
AV+
DV+
VSS
RB0/INT RB7 CH0 CH1
3
CH1 COM
PIC16F84-04/P(18) 6
V REF-
5
7
DGND
VSS
2 LCD D5
VDD
RB2
3 D6
RB3 LCD D6 VDD VDD
4 XT2_5
VDD VDD RB4 D7
5 LCD D7 XTAL-OSCILLATOR C10_5 C11_5
RB5 C12_5
6 E 10u 100n
C3_5 RB6 LCD E 10n
7
100n RB7 R/W VSS VSS
8 LCD R/W
CON3X8_PWR
VSS VSS
RS
VDD
VSS
CLK
CON1_5 LCD RS
1 2 3 4
1 2 3 4
LCD1_6
D VDD LCD CONNECTOR D
R1_6
10k
VSS
VDD
Contrast
RS
R/W
E
D0
D1
D2
D3
D4
D5
D6
D7
1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
POT1_6
VSS
C 2 C
Contrast VDD
Contrast
10k R2_6
10k R3_6
10k R4_6
10k R5_6
5k
LCD D7
3
LCD RS LCD D6
B B
1 2 3 4
1 2 3 4
D D
PIC16F84 RS232
(Direction seen from controller) (Direction seen from host)
RS232 DTR
RS232 TXD VSS
PIC TXD 5V TXD
PIC RXD 5V RXD
JP1_7 RS232 RXD
RS232 DSR
1
JMP 5V DSR
VSS JP2_7 5V DTR
VDD
1
6
2
7
3
8
4
9
5
C 1 C
JMP VSS
1
JP3_7
C2_7 C4_7 JMP
10u 10u
CON1_7
DB9
2
6
16
U1_7
13 12
RS232 TXD R1 IN R1 OUT 5V RXD
V-
V+
RS232 8 9 5V
VCC
RS232 DTR R2 IN R2 OUT 5V DTR
11 14
5V TXD T1 IN T1 OUT RS232 RXD
B 5V 10 7 RS232 B
5V DSR T2 IN T2 OUT RS232 DSR
1 4
C1+ C2+
3 5
GND
C1 - C2 -
C3_7 MAX232CPE(16) C5_7
10u 15 10u
VDD_RS
VDD
VSS
C1_7
100n
VSS Title
VSS RS232 Interface using MAX232
A A
Written by Date
23-Apr-2001
Peter Luethi
Revision Page
Dietikon, Switzerland 1.03 7 of 8
1 2 3 4
1 2 3 4
GND
GND
GND GND
C1_8
2
2
VDD
10u
The positive and negative reference voltages for
A_GND D2_8 the NSC ADC12130 adjust the input range of
C R1_8 1N4001 the AD converter according to the signals being C
C6_8 C7_8
332 converted. So the maximum resolution is
A_GND
achieved for the input signals.
D3_8 10u 100n In our case, the minimum voltage is the analog
1N4001 ground potential and the maximum voltage is the
maximum output level of the pressure sensor, 5
D1_8 D4_8 V, therefore we connect the positive reference
5 Volt digital power supply for
LED 1N4001 input to VA_1.
digital logic (PIC16F84,
MAX232,...) and A/D
converter (digital supply input).
VA_1
VDD
VSS A_GND
VREF+
B B
C8_8 C9_8
U2_8 VDD
VBAT
78L05
1u 100n
1 V 3
VBAT VVIN VOUT
OUT
IN VBAT 8 - 10 Volt VREF-
GND
GND C2_8 C3_8 Do not exceed 10 Volt
because of the
A_GND
2
10u 100n wireless transmitter !
+
BAT1_8 C4_8 C5_8
BATTERY
100u 100n
I
VSS Title
VSS
CB1_8
1 Power Supplies & Reference Voltage
A CBrk A_GND A
Written by Date
23-Apr-2001
Peter Luethi
A_GND A_GND Revision Page
Dietikon, Switzerland 1.03 8 of 8
1 2 3 4
http://www.trash.net/~luethi/microchip/projects/alti/alti_tx.hex
:02000000F728DF
:0800080069288C0081018316B8
:10001000C030810508008C0081018316C030810545
:100020000130810483120B110B1D14288C0B132833
:1000300008009A00861008308C002A201A188614AE
:100040001A1C86109A0C2A208C0B1E2886142A2033
:100050002A2008001D308D0030280B308D003028FC
:100060008D0B302808002D200618452808308C00FC
:100070002A2006189B17061C9B130C0B9B0C8C0B41
:1000800038282A20061C9B0108009B01EE289500B9
:1000900008309400951F0511951B0515950D00005E
:1000A000851500001510051A15148511940B4A28A2
:1000B00008001908840017088000840A18088000C6
:1000C000840A04089900283C031D08002030990088
:1000D00008008B138B1B69289C00030E9D00830175
:1000E0000A089E008A01831304089F000D3019201E
:1000F0000A3019200A3019205030192052301920A6
:100100004530192043301920493019205330192027
:10011000493019204F3019204E3019202030192035
:10012000443019204930192047301920493019200E
:1001300054301920413019204C301920203019201A
:10014000413019204C3019205430192049301920E1
:100150004D301920453019205430192045301920D0
:10016000523019200D3019200A3019203130192051
:100170003930192039301920393019202D30192003
:100180003230192030301920303019203130192008
:1001900020301920623019207930192020301920A0
:1001A000503019206530192074301920653019201D
:1001B00072301920203019204C3019207530192048
:1001C00065301920743019206830192069301920E1
:1001D0000D3019200A3019200A3019201F08840018
:1001E0001E088A001D0E83009C0E1C0E090083163B
:1001F0008610061401138312861490308B04831624
:10020000F03085008312033085006620FC308505C0
:10021000343047200330850401300B20FC30850545
:10022000F83047200330850401300B20FC30850571
:10023000203047200330850403300B20FC30850537
:10024000243047200330850401300B20FC30850525
:100250008430472085140030472003308504103057
:1002600096009701980101300B20FC308505843001
:10027000472015088E0085140030472015088F0090
:10028000033085040F0897070318980A0E0898078B
:10029000960B3329F0309705970E980E18059704A2
:1002A0000F309805592097019801203084000008EC
:1002B00097070318980A840A00089807840A040814
:1002C000283C031D5729970C970C1713181817175C
:1002D000971398189717980C980C181398131708D9
:1002E000910018089000FC308505C4304720851423
:1002F00000304720033085041030960097019801A4
:1003000001300B20FC308505C430472015088E00D5
:1003100085140030472015088F00033085040F082E
:1003200097070318980A0E089807960B8029F03053
:100330009705970E980E180597040F309805170823
:1003400093001808920054301920553019201008D5
:1003500019201108192012081920130819202F300C
:0803600019203F301920262965
:02400E00F13F80
:00000001FF
;***************************************************************************
;
; Precision Digital Altimeter Transmitter with NSC ADC12130
; =========================================================
;
; written by Peter Luethi, 25.12.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 18.04.2004
;
; V1.02: Re-structured entire ISR and RS232 echo sub-routines
; to comply with latest LCD modules.
; (18.04.2004)
;
; V1.01: Some refinements (23.04.2001)
;
; V1.00: Initial release (25.12.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock: 4.00 MHz XT
; Throughput: 1 MIPS
; Required Hardware: NSC A/D Converter ADC12130
; Motorola MPXS4100 A
; Quad Op-Amp LM324
; - for remote use: Wireless Transmitter 9600 bps
; - for use with PC: RS232 level shifter (MAX232)
; Serial Output: 9600 baud, 8 Bit, No Parity, 1 Stopbit
;
;
; DESCRIPTION:
; ============
; This program has been designed for the Precision Digital Altimeter
; transmitter based on the PIC 16F84, the NSC ADC12130 12 bit A/D
; converter and the Motorola MPXS4100 A absolute pressure sensor.
; For further processing and visualization of the acquired data,
; there is another PIC with LCD display or a personal computer
; necessary. The serial output data of this transmitter has common
; RS232 format, so you can either use it directly connected to a
; personal computer or in conjunction with a wireless interface.
; If used with a personal computer, make sure there is a RS232
; level shifter (MAX232) between the PIC and the computer.
;
; The whole transmitter consists of 4 sections:
;
;
; 1. Data Acquisition & Analog Pre-Processing:
; ============================================
; The MPXS4100 A absolute pressure sensor is connected to A/D
; input channel 0. Two fourth order Butterworth active low pass
; filters (fc = 10 Hz) are implemented in front of the A/D channels
; 0 and 1 - realized with a quad Op-Amp - to minimize noise and to
; prevent aliasing.
;
; 2. A/D Conversion:
; ==================
; To convert the analog to digital data with adequate resolution,
; the NSC ADC12130 12 bit A/D converter has been used here.
; The communication between the A/D converter and the PIC is done with
; a software based SSP (Synchronous Serial Port) interface.
; Output format: Sign bit, MSB <12 bit data> LSB, X X X
;
; 3. Digital Data Processing:
; ===========================
; After analog filtering and A/D conversion, the data has still some
; noise, what results in slightly toggling values.
; If we want to get rid of that, we have to implement a math routine,
; which calculates the actual value out of the actual sample and the
; previous ones.
; In this program it has been realized with a four stage ring buffer,
; which stores four 16 bit values (12 valid bits). Each of these values
; is the average calculated from 16 previously acquired 12 bit A/D
; samples. The current output value results from the average of this
; ring buffer. So one output value will be calculated every 16 A/D
; samples, with a history of 48 (=64-16) samples. The last acquired
PROCESSOR 16F84
#include "p16F84.inc"
; general
HI equ BASE+d'2' ; high nibble of data
LO equ BASE+d'3' ; low nibble of data
CH0_HI equ BASE+d'4'
CH0_LO equ BASE+d'5'
CH1_HI equ BASE+d'6'
CH1_LO equ BASE+d'7'
; A/D converter
AD_cnt equ BASE+d'8' ; counter
SSPSR equ BASE+d'9' ; SSP Shift Register
; various flags
FLAGreg equ BASE+d'10'
#define RSflag FLAGreg,0x00 ; RS232 data reception flag
; average routine
; ring buffer
RB_pnt equ BASE+d'14' ; pointer, BufferBASE offset
; RS232
TXD equ BASE+d'15' ; used for transmission
RXD equ BASE+d'16' ; received value
#include "../m_bank.asm"
#include "../m_wait.asm"
#include "../m_rs096.asm"
ADinit macro
BANK1
movlw b'11110000' ; set A/D control lines I/O direction
movwf TRISA
BANK0
movlw b'00000011' ; set A/D control lines :
movwf PORTA ; disable chip select & conversion,
endm ; SCK low
ADenable macro
movlw b'11111100' ; select chip & enable conversion
andwf PORTA,1
endm
ADdisable macro
movlw b'00000011' ; deselect chip & disable conversion
iorwf PORTA,1
endm
RBinit macro
call RB_init
endm
decfsz AD_cnt,1
goto ad_loop
RETURN
SEND 'I'
SEND 'T'
SEND 'A'
SEND 'L'
SEND ''
SEND 'A'
SEND 'L'
SEND 'T'
SEND 'I'
SEND 'M'
SEND 'E'
SEND 'T'
SEND 'E'
SEND 'R'
SEND CR
SEND LF
SEND '1'
SEND '9'
SEND '9'
SEND '9'
SEND '-'
SEND '2'
SEND '0'
SEND '0'
SEND '1'
SEND ''
SEND 'b'
SEND 'y'
SEND ''
SEND 'P'
SEND 'e'
SEND 't'
SEND 'e'
SEND 'r'
SEND ''
SEND 'L'
SEND 'u'
SEND 'e'
SEND 't'
SEND 'h'
SEND 'i'
SEND CR
SEND LF
SEND 'E'
SEND 'c'
SEND 'h'
SEND 'o'
SEND ':'
SEND TAB
movfw RXD ; get RS232 data
SENDw ; transmit across RS232
SEND CR
SEND LF
SEND LF
; end of RS232 service (echo & display)
bcf RSflag ; reset RS232 data reception flag
bsf INTCON,INTE ; re-enable RB0/INT interrupt
RETURN
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
; catch-all
goto ISRend ; unexpected IRQ, terminate execution of ISR
;******************************
;*** RS232 DATA ACQUISITION ***
;******************************
_ISR_RS232
; first, disable interrupt source
bcf INTCON,INTE ; disable RB0/INT interrupt
; second, acquire RS232 data
RECEIVE ; macro of RS232 software reception
bsf RSflag ; enable RS232 data reception flag
goto _ISR_RS232end ; terminate RS232 ISR properly
;***********************************
;*** CLEARING OF INTERRUPT FLAGS ***
;***********************************
; NOTE: Below, I only clear the interrupt flags! This does not
; necessarily mean, that the interrupts are already re-enabled.
; Basically, interrupt re-enabling is carried out at the end of
; the corresponding service routine in normal operation mode.
; The flag responsible for the current ISR call has to be cleared
; to prevent recursive ISR calls. Other interrupt flags, activated
; during execution of this ISR, will immediately be served upon
; termination of the current ISR run.
_ISR_RS232error
bsf INTCON,INTE ; after error, re-enable IRQ already here
_ISR_RS232end
bcf INTCON,INTF ; clear RB0/INT interrupt flag
;goto ISRend ; terminate execution of ISR
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
MAIN ;**************************************************************
;*** INITIALIZATION ***
;**************************************************************
RS232init
ADinit
RBinit
WAIT 0x01
;**************************************************************
;*** MAIN LOOP ***
;**************************************************************
LOOP
;**************************************************************
;*** A/D CHANNEL 0 READOUT (get the samples) ***
;*** 12 bit data unsigned, MSB first: <0000 MSB - LSB> ***
;**************************************************************
ADenable
ADcmd CH0se16MSB ; CH0, single-ended, 16 bit, MSB first
movfw SSPSR
movwf HI ; store high nibble in HI
bsf CONV ; disable conversion (for safety reasons)
ADcmd DummyCmd
movfw SSPSR
movwf LO ; store low nibble in LO
ADdisable
; result in HI, LO
;*** END OF READOUT ***
;**************************************************************
;*** FILL IN RING BUFFER & CALCULATE AVERAGE ***
;**************************************************************
;*****************************************************************
;*** You have to adapt the following division routine by hand, ***
;*** if you alter the amount of buffer registers. ***
;*** Default: divide by 4 (BufferLENGTH = 8 bytes) ***
;*****************************************************************
rrf sum_LO,1 ; divide by 2
rrf sum_LO,1 ; divide by 2
movfw sum_LO
movwf CH0_LO
movfw sum_HI
movwf CH0_HI
;**************************************************************
;*** A/D CHANNEL 1 READOUT ***
;*** 12 bit data unsigned, MSB first: <0000 MSB - LSB> ***
;**************************************************************
ADenable
ADcmd CH1se16MSB ; CH1, single-ended, 16 bit, MSB first
movfw SSPSR
movwf HI ; store high nibble in HI
bsf CONV ; disable conversion (for safety reasons)
ADcmd DummyCmd
movfw SSPSR
movwf LO ; store low nibble in LO
ADdisable
; result in HI, LO
;*** END OF READOUT ***
movfw sum_LO
movwf CH1_LO
movfw sum_HI
movwf CH1_HI
;**************************************************************
;*** SEND DATA TO PC, MSB FIRST ***
;**************************************************************
Eigenbau-Datenlogger V1.5
http://www.rconline.net/magazin-2000/daten-logger/daten-logger.shtml
(sorry, an english description is only for the new Logger available -> Logger-V2_english )
Diese Seite hier soll die oben genannte Seite ergnzen (zuerst bitte die oben angegebene Seite lesen).
Also ab und zu mal hier vorbeischauen, denn wenn's was neues ber den Datenlogger gibt, dann ist es hier zu finden.
folgend die Anschlubelegung des Steckers zur seriellen Schnittstelle zum PC:
Hier noch eine etwas vereinfachte Schaltung des Loggers, welche sich auf der gleichen Platine unterbringen lt und mit ein paar Bauelementen weniger auskommt:
(hierfr die Softwareversionen "Dlog_v8i" oder "Dlog_v9x" verwenden)
Eine Leiterplatte mit etwas verndertem Layout, dadurch noch etwas kleiner und sogar durchkontaktiert, kann von Jonas Romblad unter folgender Adresse bezogen
werden:
Jonas Romblad
Sensoren:
Folgend ein paar Anregungen zu Sensoren welche man an den, noch freien analogen Eingang des Loggers anschlieen kann:
Dazu kann man z.B. die zweite Hlfte des noch freien Operationsverstrkers nutzen.
Das Layout ist zwar nicht dafr optimal vorbereitet, aber mit ein paar Brcken (lten bzw. durchritzen) bekommt man das schon noch auf der Platine unter.
Bei den Schaltungen habe ich versucht mit je einem Verstrker pro Sensor auszukommen.
Fr einige Sensoren wrde vielleicht eine aufwendigere Schaltung bessere Ergebnisse liefern. Mein Motto dazu lautet aber:
"NICHT SO GENAU WIE MGLICH MESSEN, SONDERN SO GENAU WIE NTIG"
http://home.arcor.de/d_meissner/d_logger.htm (4 of 15)12/02/2008 20:05:29
Datenlogger
Spannungssensor:
Wenn jemand die Akkuspannung interessiert, kann er einfach einen Widerstand als "Sensor"
benutzen.
Je nach dem, wie gro die zu messende Spannung ist, kann die Gre des Widerstand entsprechend
angepat werden.
Die angegebene Dimensionierung geht bis etwas ber 40V.
Temperatursensor:
Motor-Speedsensor:
Eine sehr einfache Mglichkeit die Geschwindigkeit zu messen ist, einen Motor als Genarator zu
betreiben, welcher von einem kleinen Flgelrad angetrieben wird.
Als Motoren eignen sich z.B. Motoren aus defekten Servos.
Falls der Motor nicht bei geringen Geschwindigkeiten anluft kann man mit einem richtig
dimensionierten Widerstand nach Plus etwas nachhelfen.
Wer die Geschwindigkeit nicht mit dem Minipropeller messen mchte, kann natrlich
ein Staurohr an den Logger anschlieen.
Sicher ist ein Staurohr kleiner als der Minipropeller und auch mechanisch nicht so
anfllig gegen Beschdigungen.
Man mu allerding 2 Schluche vom Sensor zum Staurohr verlegen.
Ich persnlich bevorzuge den Minipropeller, weil da nur 3 Drhte zum Logger verlegt
werden mssen.
Die Dimensionierung ist fr ca. 60m/s ausgelegt, (der Drucksensor kann wesentlich
mehr). Wer schneller fliegt, sollte den 1M-Widerstand entsprechend verkleinern.
Fr Geschwindigkeiten unter 8m/s halte ich den Sensor allerdings nicht fr sonderlich
brauchbar.
Das Staurohr kann relativ einfach aus den Elementen alter Teleskopantennen
gefertigt werden.
Die Elemente sind dnnwandig, in mehreren Durchmessern verfgbar und gut
ltbar.
Wer wissen mchte wieviel Strom sein E-Motor im Flug bentigt, sollte mal
den Stromsensor ausprobieren.
Den Shunt (0,001 Ohm) bekommt man nicht auf die Platine des Loggers.
Ich habe den einfach eingeschrumpft und in der Nhe des Motorstellers
untergebracht. Einfach 2 Drhte zum Logger verlegen und los gehts.
Auch wenn das nicht unbedingt jeder brauchen kann, hier eine Schaltung mit
der man den Servostrom loggen kann.
Die ursprngliche Idee war, mal rauszubekommen welche Krfte/Momente
im Flug auf ein Servo wirken (der Servostrom ist proportional zur Belastung).
Man kann die Schaltung ntrlich auch dazu benutzen, um mal zu sehen, wie
sich der Einsatz zustzlicher Gerte z.B. Kreisel auf die Stromaufnahme
auswirkt.
DMS-Sensor (DMS=Dehnungsmestreifen):
Wer gern Fahrad fhrt, kann vielleicht mal ein DMS auf den Pedalhebel kleben und
mir dann die geloggten Daten schicken :-).
Magnetischer Drehzahl-Sensor:
Der Drehzahlsensor kann anstelle des Speedsensors mit Kodescheibe an den Logger angeschlossen
werden.
Um die relativ geringen Frequenzen messen zu knnen, sollte die Loggersoftware in der Version "_v9i"
oder "_v9x" verwendet werden.
Bei diesen beiden Versionen werden nicht die Impulse in einer definierten Zeit gezhlt
(Frequenzmessung) , sondern es wird die Zeit fr eine Umdrehung gemessen (Periodendauermessung).
Die Drehzahl bzw. Frequenz kann dann nachtrglich berechnet werden (f=1/t).
Optischer Drehzahl-Sensor:
Dieser Drehzahlsensor kann wie der magnetische Drehzahlsensor benutzt werden. Der
Vorteil gegenber dem magnetischen Sensor ist, dass kein Magnet an den Motor adaptiert
werden mu. Es reicht den Sensor in der Nhe der Luftschraube anzubringen, oder noch
besser einen Lichtleiter zwischen Sensor und Luftschraube einzubauen.
Linearer Beschleunigungs-Sensor:
Ein Windowsprogramm zum Konfigurieren des Datenlogger und Auslesen der Daten kann unter folgender URL downloadbar:
http://www.sprut.de/electronic/soft/logger.htm
Logger_prc.zip (10k)
Das Programm dient der bertragung der Loggerdaten in den Palm und Speicherung dieser.
Es knnen beliebig viele Datenstze (Flge) im Palm gespeichet werden, bis halt der Speicher im Palm voll ist (ein Flug belegt dabei max. 32kb,
normalerweise aber viel weniger).
Des weiteren werden die wichtigten Daten grafisch dargestellt und knnen vermessen werden.
Dadurch ist es bereits auf dem Flugplatz mglich, Aussagen zu den einzelnen Flugabschnitten zu treffen.
Die verwendeten Sensoren knnen durch Eingabe von entsprechenden Konstanten angpat werden.
Zuhause kann der Palm-Pilot anstelle des Loggers an den PC angeschlossen werden (serielle Schnittstelle).
Unter Nutzung des oben erwhnten Windowsprogrammes werden die Flugdaten dann zum PC bertragen.
Wer den Logger als Variometer einsetzen mchte, oder auch nur die Flugdaten live am Boden sehen mchte, sollte das folgende Programm fr den Palm mal
ausprobieren:
Es arbeitet mit dem Loggerprogramm zusammen, d.h. z.B. mit Telemetrie aufgezeichneten Daten knnen bei Bedarf gespeichert und anschlieend mit dem
Loggerprogramm vermessen werden.
Wer neben dem Hhensensor auch den Speedsensor benutzt, kann das Vario auf Energiekompensation (hnlich einer TEK-Dse ("0001")) und/oder auch
Fahrtkompensation (Bercksichtigung der Modellpolaren ("0010"/"0011")) umschalten.
Bei Fahrtkompensation mu die Polare des Flugzeugs natrlich erst eingegeben werden (Palm-Programm dafr liegt bei).
Die jenigen, die sich fr das ganze interessieren, aber noch keinen Logger besitzen, sollten das folgende
Simulationsprogramm auf ihrem PC installieren und anschlieend mal reell aufgezeichnete Flugdaten im Telemetrieformat damit zum Palm senden:
Log_sim_csv.zip (200k)
Da ich immer wieder gefragt werde, woher bestimmte Teile bezogen werden knnen, hier eine paar Links:
Ich bin natrlich nicht der einzige der sich mit Datenloggern bzw. Telemetrie beschftigt.
Folgend noch ein paar Anregungen zum Thema:
http://www.kapelec.com/altiose1.htm
http://www.kapelec.com/altivie1.htm
http://home.tiscali.de/luftbild/ep_1.html
http://www.ganzfix.de/MiniLogger/
http://www.k-webdesign.com/modellflug/
http://www.skynavigator.ch/
http://www.lomcovak.cz/eindex.html
http://www.flyheli.de
http://www.eagletreesystems.com
http://www.ulrich-roehr.de/elektronik/telemetrie/telemetrie.html
http://home.arcor.de/d_meissner/d_logger.htm (14 of 15)12/02/2008 20:05:29
Datenlogger
http://www.cs.uni-magdeburg.de/~hsteinha/index.html
http://www.electronic-engineering.ch/microchip/projects/alti/alti.html
http://www.taniwha.com/~paul/fc/
http://www.rocznik.de/Marko/electronic/project/projekte.html
(falls Ihr noch Links zum Thema findet, bitte Mail an mich )
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Why would you want to interface the Keyboard? The IBM keyboard can be a cheap alternative to a keyboard on a
Microprocessor development system. Or maybe you want a remote terminal, just couple it with a LCD Module.
Maybe you have a RS-232 Barcode Scanner or other input devices, which you want to use with existing software which only
allows you to key in numbers or letters. You could design yourself a little box to convert RS-232 into a Keyboard
Transmission, making it transparent to the software.
An interfacing example is given showing the keyboard's protocols in action. This interfacing example uses a 68HC705J1A
MCU to decode an IBM AT keyboard and output the ASCII equivalent of the key pressed at 9600 BPS.
Note that this page only deals with AT Keyboards. If you have any XT keyboards, you wish to interface, consider placing them
in a museum. We will not deal with this type of keyboard in this document. XT Keyboards use a different protocol compared to
the AT, thus code contained on this page will be incompatible.
PC Keyboard Theory
The IBM keyboard you most probably have sitting in front of you, sends scan codes to your computer. The scan codes
tell your Keyboard Bios, what keys you have pressed or released. Take for example the 'A' Key. The 'A' key has a scan
code of 1C (hex). When you press the 'A' key, your keyboard will send 1C down it's serial line. If you are still holding it
down, for longer than it's typematic delay, another 1C will be sent. This keeps occurring until another key has been
pressed, or if the 'A' key has been released.
However your keyboard will also send another code when the key has been released. Take the example of the 'A' key
again, when released, the keyboard will send F0 (hex) to tell you that the key with the proceeding scan code has been
released. It will then send 1C, so you know which key has been released.
Your keyboard only has one code for each key. It doesn't care it the shift key has been pressed. It will still send you the
same code. It's up to your keyboard BIOS to determine this and take the appropriate action. Your keyboard doesn't
even process the Num Lock, Caps Lock and Scroll Lock. When you press the Caps Lock for example, the keyboard will
send the scan code for the cap locks. It is then up to your keyboard BIOS to send a code to the keyboard to turn on the
Caps lock LED.
Now there's 101 keys and 8 bits make 256 different combinations, thus you only need to send one byte per key, right?
Nop. Unfortunately a handful of the keys found on your keyboard are extended keys, and thus require two scan code.
These keys are preceded by a E0 (hex). But it doesn't stop at two scan codes either. How about E1,14,77,E1,F0,14,
F0,77! Now that can't be a valid scan code? Wrong again. It's happens to be sent when you press the Pause/break key.
Don't ask me why they have to make it so long! Maybe they were having a bad day or something?
When an extended key has been released, it would be expect that F0 would be sent to tell you that a key has been
released. Then you would expect E0, telling you it was an extended key followed by the scan code for the key pressed.
However this is not the case. E0 is sent first, followed by F0, when an extended key has been released.
Keyboard Commands
Besides Scan codes, commands can also be sent to and from the keyboard. The following section details the function
of these commands. By no means is this a complete list. These are only some of the more common commands.
Host Commands
These commands are sent by the Host to the Keyboard. The most common command would be the setting/
resetting of the Status Indicators (i.e. the Num lock, Caps Lock & Scroll Lock LEDs). The more common and
useful commands are shown below.
ED Set Status LED's - This command can be used to turn on and off the Num Lock,
Caps Lock & Scroll Lock LED's. After Sending ED, keyboard will reply with ACK
(FA) and wait for another byte which determines their Status. Bit 0 controls the
Scroll Lock, Bit 1 the Num Lock and Bit 2 the Caps lock. Bits 3 to 7 are ignored.
EE Echo - Upon sending a Echo command to the Keyboard, the keyboard should reply
with a Echo (EE)
F0 Set Scan Code Set. Upon Sending F0, keyboard will reply with ACK (FA) and
wait for another byte, 01-03 which determines the Scan Code Used. Sending 00
as the second byte will return the Scan Code Set currently in Use
F3 Set Typematic Repeat Rate. Keyboard will Acknowledge command with FA and wait
for second byte, which determines the Typematic Repeat Rate.
F4 Keyboard Enable - Clears the keyboards output buffer, enables Keyboard
Scanning and returns an Acknowledgment.
F5 Keyboard Disable - Resets the keyboard, disables Keyboard Scanning and returns
an Acknowledgment.
FE Resend - Upon receipt of the resend command the keyboard will re- transmit
the last byte sent.
FF Reset - Resets the Keyboard.
Commands
Now if the Host Commands are send from the host to the keyboard, then the keyboard commands must be sent
from the keyboard to host. If you think this way, you must be correct. Below details some of the commands which
the keyboard can send.
FA Acknowledge
AA Power On Self Test Passed (BAT Completed)
EE See Echo Command (Host Commands)
FE Resend - Upon receipt of the resend command the Host should re-transmit the last
byte sent.
00 Error or Buffer Overflow
FF Error or Buffer Overflow
Scan Codes
The diagram below shows the Scan Code assigned to the individual keys. The Scan code is shown on the bottom of
the key. E.g. The Scan Code for ESC is 76. All the scan codes are shown in Hex.
As you can see, the scan code assignments are quite random. In many cases the easiest way to convert the
scan code to ASCII would be to use a look up table. Below is the scan codes for the extended keyboard &
Numeric keypad.
The PC's AT Keyboard is connected to external equipment using four wires. These wires are shown below for the 5 Pin
DIN Male Plug & PS/2 Plug.
1. KBD Clock
1. KBD Clock
2. GND
2. KBD Data
3. KBD Data
3. N/C
4. N/C
4. GND
5. +5V (VCC)
5. +5V (VCC)
5 Pin DIN PS/2 6. N/C
A fifth wire can sometimes be found. This was once upon a time implemented as a Keyboard Reset, but today is left
disconnected on AT Keyboards. Both the KBD Clock and KBD Data are Open Collector bi-directional I/O Lines. If
desired, the Host can talk to the keyboard using these lines.
Note: Most keyboards are specified to drain a maximum 300mA. This will need to be considered when powering your
devices
Keyboard to Host
As mentioned before, the PC's keyboard implements a bi-directional protocol. The keyboard can send data to the Host
and the Host can send data to the Keyboard. The Host has the ultimate priority over direction. It can at anytime
(although the not recommended) send a command to the keyboard.
The keyboard is free to send data to the host when both the KBD Data and KBD Clock lines are high (Idle). The KBD
Clock line can be used as a Clear to Send line. If the host takes the KBD Clock line low, the keyboard will buffer any
data until the KBD Clock is released, ie goes high. Should the Host take the KBD Data line low, then the keyboard will
prepare to accept a command from the host.
The transmission of data in the forward direction, ie Keyboard to Host is done with a frame of 11 bits. The first bit is a
Start Bit (Logic 0) followed by 8 data bits (LSB First), one Parity Bit (Odd Parity) and a Stop Bit (Logic 1). Each bit
should be read on the falling edge of the clock.
The above waveform represents a one byte transmission from the Keyboard. The keyboard may not generally change
it's data line on the rising edge of the clock as shown in the diagram. The data line only has to be valid on the falling
edge of the clock. The Keyboard will generate the clock. The frequency of the clock signal typically ranges from 20 to
30 Khz. The Least Significant Bit is always sent first.
Host to Keyboard
The Host to Keyboard Protocol is initiated by taking the KBD data line low. However to prevent the keyboard from
sending data at the same time that you attempt to send the keyboard data, it is common to take the KBD Clock line low
for more than 60us. This is more than one bit length. Then the KBD data line is taken low, while the KBD clock line is
released.
The keyboard will start generating a clock signal on it's KBD clock line. This process can take up to 10mS. After the first
falling edge has been detected, you can load the first data bit on the KBD Data line. This bit will be read into the
keyboard on the next falling edge, after which you can place the next bit of data. This process is repeated for the 8 data
bits. After the data bits come an Odd Parity Bit.
Once the Parity Bit has been sent and the KBD Data Line is in a idle (High) state for the next clock cycle, the keyboard
will acknowledge the reception of the new data. The keyboard does this by taking the KBD Data line low for the next
clock transition. If the KBD Data line is not idle after the 10th bit (Start, 8 Data bits + Parity), the keyboard will continue
to send a KBD Clock signal until the KBD Data line becomes idle.
Normally in this series of web pages, we connect something to the PC, to demonstrate the protocols at work. However
this poses a problem with the keyboard. What could be possibly want to send to the computer via the keyboard
interface?
Straight away any devious minds would be going, why not a little box, which generates passwords!. It could keep
sending characters to the computer until it finds the right sequence. Well I'm not going to encourage what could
possibly be illegal practices.
In fact a reasonably useful example will be given using a 68HC705J1A single chip microcontroller. We will get it to read
the data from the keyboard, convert the scan codes into ASCII and send it out in RS-232 format at 9600 BPS. However
we won't stop here, you will want to see the bi-directional use of the KBD Clock & Data lines, thus we will use the
keyboards status LEDS, Num Lock, Caps Lock and Scroll Lock.
This can be used for quite a wide range of things. Teamed up with a reasonably sized 4 line x 40 character LCD panel,
you could have yourself a little portable terminal. Or you could use it with a microcontroller development system. The
68HC705J1A in a One Time Programmable (OTP) is only a fraction of the cost of a 74C922 keyboard decoder chip,
which only decodes a 4 x 4 matrix keypad to binary.
The keyboard doesn't need to be expensive either. Most people have many old keyboards floating around the place. If
it's an AT Keyboard, then use it (XT keyboards will not work with this program.) If we ever see the introduction of USB
keyboards, then there could be many redundant AT keyboards just waiting for you to hook them up.
Features
Before we start with the technical aspects of the project, the salesman in me wants to tell you about the features
packed into the 998 bytes of code.
Use of the keyboard's bi-directional protocol allowing the status of the Num Lock, Caps Lock and Scroll Lock to
be displayed on the Keyboards LEDs.
External Reset Line activated by ALT-CTRL-DEL. If you are using it with a Microcontroler development system,
you can reset the MCU with the keyboard. I've always wanted to be able to use the three fingered solute on the
HC11!
Scroll Lock and Num Lock toggles two Parallel Port Pins on the HC705. This can be used to turn things on or off,
Select Memory Pages, Operating Systems etc
"ALTDEC" or what I call the Direct Decimal Enter Routine. Just like using a PC, when you enter a decimal
number when holding down one of the ALT keys the number is sent as binary to the target system. E.g. If you
press and hold down ALT, then type in 255 and release ALT, the value FF (Hex) will be sent to the system. Note.
Unlike the PC, you can use both the numeric keypad or the numbers along the top of the keyboard.
"CTRLHEX" or you guessed it, Direct Hexadecimal Enter Routine. This function is not found with the PC. If you
hold CTRL down, you can enter a Hexadecimal number. Just the thing for Development Systems or even
debugging RS-232 Comms?
Output is in ASCII using a RS-232 format at 9600 BPS. If using it with a development System, you can tap it in
after the RS-232 Line Transceivers to save you a few dollars on RS-232 Level Converters.
The schematic below, shows the general connections of the keyboard to the HC705.
The TXD pin, while it transmits in RS-232 format, is not at RS-232 Voltage Levels. If you want to connect it to RS-232
Devices then you will need to attach a RS-232 Level Converter of some kind. If you are using it with a development
system, you can bypass both RS-232 Level Converters and connect it directly to the RXD pin of the MCU. However the
keyboard can't be a direct replacement for a terminal on a development system, unless you want to type in your code
each time! You may want to place a jumper or switch inline to switch between your RS-232 Port and the Keyboard.
The Keyboard requires open collector/open drain outputs. This is achieved by using the Data Direction Register (DDR).
A zero is written to the port which is internally latched. The DDR is then used to toggle the line from logic 0 to high
impedance. If the port pin is an output, a logic zero will be present on the pin, if the port is set to be an input, the port
will be high impedance which is pulled high by the external resistors.
The circuit is designed to run on a 4Mhz crystal (2Mhz Bus Speed). The timing for the RS-232 transmission is based on
the bus speed, thus this crystal has to be 4 Mhz. If you are lucky enough to have a 4 Mhz E Clock on your development
system you can use it.
The power supply can also create a slight problem. A standard keyboard can drain about 300mA max, thus it would be
recommended to use it's own regulator rather than taking a supply from elsewhere. Decoupling capacitors are not
shown on the general schematic but are implied for reliable operation. Consult your MC68HC705J1A Technical Data
Now it is time to look at the code. I cannot include a description of all the code in this article. The list file is just on 19
pages. Most of it (hopefully) is easy to follow. (Just like other good code, count the number of spelling errors while you
are at it!)
Remember the KBD Clock line? If you take it low, the keyboard will buffer any keys pressed. The Keyboard will only
attempt to send when both the Data and Clock lines are idle (high). As it can take considerable time to decode the keys
pressed, we must stop the keyboard from sending data. If not, some of the data may be lost or corrupted.
The program, will keep the KBD Clock line low, unless it is ready to accept data. We will use a loop to retrieve the data
bits from the keyboard, thus we will load index register X with the number of bits be want to receive. PAR will be used to
verify the parity bit at the end of the transmission. We must clear this first.
We can then place the KBD Clock line in the idle state so that the keyboard will start transmitting data if a key has been
pressed. The program then loops while the clock line is Idle. If the KBD clock goes low, the loop is broken and the KBD
Data pin is read. This should be the start bit which should be low. If not we branch to the start of the receive routine and
try again.
Once the start bit has been detected, the 8 data bits must follow. The data is only valid on the falling edge of the clock.
The subroutine highlow shown below will wait for the falling edge of the clock.
After the falling edge we can read the level of the KBD Data line. If it is high we can set the MSbit of the byte or if it is
clear, we can clear it. You will notice if the bit is set, we also increment PAR. This keeps track of the number of 1's in
the byte and thus can be used to verify the Parity Bit. Index register X is decremented as we have read a bit. It then
repeats the above process, until the entire 8 bits have been read.
beq r_error
After the 8 data bits, comes the dreaded parity bit. We could ignore it if we wanted to, but we may as well do something
about it. We have been keeping a tally of the number of 1's in PAR. The keyboard uses odd parity, thus the parity bit
should be the complement of the LSbit in memory location, PAR. By exclusive OR-ing PAR with the Parity Bit, we get a
1 if both the bits are different. I.e a '1' if the parity bit checks out.
As we are only interested in the LSbit we can quite happy XOR the accumulator with PAR. Then we single out the LSb
using the AND function. If the resultant is zero, then a parity error has occurred and the program branches to r_error.
jsr highlow
brclr data,PORTA,r_error ;Stop Bit Detection
After the Parity Bits comes the Stop Bit. Once again we can ignore it if we desire. However we have chosen to branch
to an error routine if this occurs. The stop bit should be set, thus an error occurs when it is clear.
What you do as error handling is up to you. In most cases it will never be executed. In fact I don't yet know if the above
error handling routine works. I need to program another HC705 to send a false parity bit. I've tried it out in close
proximity to the Washing Machine, but I really need a controlled source!
When an error occurs in the Parity or Stop Bit we should assume that the rest of the byte could have errors as well. We
could ignore the error and process the received byte, but it could have unexpected results. Instead the keyboard has a
resend command. If we issue a resend (FE) to the keyboard, the keyboard should send the byte back again. This is
what occurs here.
You may notice that we branch to the error routine which transmits a resend command straight away, without waiting
for the corrupt transmission to finish. This is not a problem, as the keyboard considers any transmission to be
successful, if the 10th bit is sent, i.e. the parity bit. If we interrupt the transmission before the parity bit is sent, the
keyboard will place the current byte in it's buffer for later transmission.
Reading a byte doesn't really require bi-directional data and clock lines. If you can process the byte fast enough then no
handshaking (RTS) is required. This means you no longer need to fiddle with the Data Direction Register. I have
successfully done this with the HC705, outputting only scan codes on a parallel bus. But as you can imagine, you must
be quick in order to catch the next transmission.
The following routine given here is a generic one which can be used for your own purposes. During normal execution of
this program the KBD clock line should be low, to prevent data being sent when the MCU isn't ready for it. However in
this example, we take low the KBD clock line and wait for the 64uS which is pointless as the line is already low and has
been like this for quite some time, since the end of the last transmission or reception.
The program then initiates the Host to Keyboard transmission by taking the KBD data line low and releasing the KBD
clock line. We must then wait for a high to low transition on the KBD clock, before we load the first bit on the KBD data
line.
The loading of the individual bits on the KBD data line is done in very similar fashion to the read cycle. The X register is
used to keep track of the number of bits sent. Also simular to the read cycle, we increment the accumulator so we can
calculate the parity bit later on.
and #$01
bne clr_par
set_par bclr data,DDRA
jmp tr_ackn
clr_par bset data,DDRA
tr_ackn jsr highlow
After the data bits have been sent, it is now time to send the parity bit. Unlike the read cycle, we can't ignore the parity
bit. If we do the keyboard will issue a resend (FE) command if the parity bit is incorrect, a 50% probability!
Once the Parity bit has been set and the falling edge of the KBD clock detected, we must release the KBD data line,
and wait for another falling edge of the KBD clock to see if the Keyboard has acknowledged the byte. The keyboard
does this by pulling the KBD data line low. If it is not low, then the program branches to an error handler. If all has been
successful, the MCU pulls down the KBD clock, to prevent it from transmitting.
We have taken a harsher approach to handing any transmit errors. Ideally we should wait for the keyboard to send a
resend command and then retransmit the byte. However what we have done is to issue a reset to the keyboard. So far
I've never had an error, however if this starts to become a problem, then a better error handler could be written.
Two Line Mini- Roger Schaefer has developed a Mini RS-232 Terminal using the 68HC11. As an
Terminal input device the terminal uses a standard IBM compatible PC keyboard. In a
normal full duplex mode the controller converts the keyboard scan codes to ASCII
and transmits them to the RS-232 output. Input from the RS-232 is displayed on the
LCD.
;***************************************************************************
;
; AT Keyboard Interface V1.04
; ===========================
;
; written by Peter Luethi, 12.07.2000, Switzerland
; http://www.electronic-engineering.ch
; last update: 19.04.2004
;
; V1.04: Re-structured ISR to comply with latest modules, added
; label _ISR_RS232error
; (19.04.2004)
;
; V1.03: Improved AT keyboard and RS232 initialization,
; fixed RBIF/INTF interrupt initialization issue.
; Changed keyboard data pin to PORTA,4 (open-collector).
; (16.08.2003)
;
; V1.02: Made forward compatible (yes, this is feasible) by
; implementing/completing ALT and CTRL flags. Added
; labels to support non-implemented ALT and CTRL
; enhancements. (3.1.2002)
;
; V1.01: Changed from non-preemptive to preemptive interrupt-based
; keyboard scan pattern acquisition scheme.
; Now only the scan pattern acquisition is carried out
; during the interrupt service routine, the decoding
; happens during normal operation mode when the flag
; "KBDflag" has been set after having completed the entire
; scan pattern reception. (16.7.2001)
;
; V1.00: Initial release (12.7.2000)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock Frequency: 4.00 MHz XT
; Throughput: 1 MIPS
; RS232 Baud Rate: 9600 baud (depends on the module included)
; Serial Output: 9600 baud, 8 bit, no parity, 1 stopbit
; Keyboard Routine Features: Capability of uni-directional
; communication between microcontroller
; and keyboard
; Acquisition Methodology: Preemptive, interrupt-based
; keyboard scan pattern acquisition
; routine, with decoding to ASCII
; characters during normal operation
; Code Size of entire Program: 523 instruction words
; Required Hardware: AT Keyboard, MAX 232
; Required Software: RS232 terminal
;
;
; ABSTRACT:
; =========
; This routine converts AT keyboard scan patterns to ASCII characters
; and transmits them afterwards to the target device by using the
; RS232 transmission protocol.
; Support of english (QWERTY) and modified swiss-german (QWERTZ)
; 'codepages'. This implementation features no visual interface.
; Unidirectional data flow: Transmission only for characters typed on
; the local keyboard.
;
;
; DESCRIPTION:
; ============
; Developed and tested on PIC 16F84.
; Any key stroke on the keyboard connected to the PIC will send the
; corresponding scan code from the keyboard to the microcontroller.
; Afterwards, the microcontroller converts the keyboard scan code to
; ASCII characters and sends them to the computer terminal via the
; RS232 connection.
;
; The keyboard scan pattern capture and decoding is done by an
; interrupt service routine. The event, which triggers the interrupt
; is a falling edge on the keyboard clock line at the KBDclkpin
; (PORTB,0). The keyboard data (scan code) will be fetched at the
; KBDdatapin (PORTA,4).
; NOTE:
; =====
; This program needs 'ORG' directives to locate tables within entire
; memory pages. To allow for slight modifications, the code has not
; been optimized to the utmost extent regarding program memory
; placement. This can be carried out using the program memory window
; of MPLAB showing the hexadecimal representation of the code.
;
;
; CREDITS:
; ========
; - Craig Peacock, the author of the excellent page about keyboards
; "Interfacing the PC's Keyboard" available at his website:
; http://www.beyondlogic.org/keyboard/keybrd.htm
; - Steve Lawther for inspirations concerning the scan code fetch
; routine (for bring-up version 1.00 of this program).
;
;***************************************************************************
PROCESSOR 16F84
#include "p16f84.inc"
TEMP1 set
BASE+d'0' ; Universal temporary register
TEMP2 set
BASE+d'1' ; ATTENTION !!!
TEMP3 set
BASE+d'2' ; They are used by various modules.
TEMP4 set
BASE+d'3' ; If you use them, make sure not to use
; them concurrently !
FLAGreg equ BASE+d'4' ; register containing keyboard and other flags
TXD equ
BASE+d'5' ; RS232 TX-Data register
RXD equ
BASE+d'6' ; RS232 RX-Data register (not used here, but m_rs232
; requires its declaration)
KBDcnt equ BASE+d'7' ; IRQ based keyboard scan pattern counter
KBD equ BASE+d'8' ; keyboard scan code & ascii data register
KBDcopy equ BASE+d'9' ; keyboard scan code register
#define RELflag FLAGreg,0x00 ; release flag (0xF0)
#define SHIflag FLAGreg,0x01 ; shift flag (0x12 / 0x59)
#define SPEflag FLAGreg,0x02 ; special code flag (0xE0)
#define CAPflag FLAGreg,0x03 ; caps lock flag (0x0D)
#define ALTflag FLAGreg,0x04 ; ALT flag (0x11)
#define CTRLflag FLAGreg,0x05 ; CTRL flag (0x14)
#define KBDflag FLAGreg,0x06 ; keyboard data reception flag
ORG 0x190
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
#include "..\..\m_rs096.asm" ; 9600 baud @ 4 MHz
KEYBOARDinit macro
BANK1
bsf KBDclktris ; set keyboard clock line to input explicitely
bsf KBDdatatris ; set keyboard data line to input explicitely
bcf OPTION_REG,INTEDG ; keyboard interrupt on falling edge
BANK0
bsf INTCON,INTE ; enable RB0/INT interrupts
endm
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
;*****************************************
;*** KEYBOARD SCAN PATTERN ACQUISITION ***
;*****************************************
;***********************************
;*** CLEARING OF INTERRUPT FLAGS ***
;***********************************
; NOTE: Below, I only clear the interrupt flags! This does not
; necessarily mean, that the interrupts are already re-enabled.
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
KBDdecode
;**********************************************************
;*** KEYBOARD SCAN CODE PRE-DECODING, SET / CLEAR FLAGS ***
;**********************************************************
;****************************************************
;* The following table has to be located within one *
;* page to allow for correct lookup functionality. *
;* Therefore, additional ISR code has been moved *
;* further down. *
;****************************************************
;*********************************************************************
;* LOOKUP TABLE FOR KEYBOARD-SCAN-CODE TO ASCII-CHARACTER CONVERSION *
;*********************************************************************
;****************************************************
;* The following code belongs also to the interrupt *
;* service routine and has been moved down to this *
;* place to allow the main keyboard decode lookup *
;* table to be located within one page. *
;* The code below may be arranged on another page, *
;* but that doesn't matter. *
;****************************************************
;********************************
;*** SCAN CODE RANGE CHECKING ***
;********************************
_KBD_2 ;*** check if special code (0xE0) has been submitted previously ***
btfss SPEflag
goto _KBD_3
;*** decoding of scan code with preceding special code (0xE0) ***
; (decoding currently only necessary for 'E0 4A' = '/')
movfw KBD
sublw 0x4A ; 0x4A - w
bnz _NOSUP ; branch on non-zero
movlw '/' ; store '/' in KBD
movwf KBD
goto _OUTP
_NOSUP ;*** check if scan code 0x5A or smaller has occurred ***
movfw KBD
sublw 0x5A ; 0x5A - w
bc _KBD_3 ; carry if result positive or zero, branch
;*** range exceeded (above 0x5A) ***
; it's one of the following keys: arrow button, 'Home', 'Del',
; 'PageUp', 'PageDown', 'Insert', 'End'
; these keys are currently not used, so
goto _ClrStall
_KBD_3 ;*** check if scan code 0x61 or smaller has occurred ***
movfw KBD
sublw 0x61 ; 0x61 - w
bc KBD_dec ; carry if result positive or zero, goto table
movlw d'14'
subwf KBD,F ; KBD = KBD - d'14'
;*** check if scan code 0x61 (0x6F-d'14') or smaller has occurred ***
movfw KBD
sublw 0x61 ; 0x61 - w
bnc _KBD_4 ; no carry if result negative, goto _KBD_4
movlw d'25'
addwf KBD,F ; KBD = KBD + d'25'
goto KBD_dec
_KBD_4 ;*** check if scan code 0x78 (0x86 - d'14') or higher has occurred ***
movfw KBD
sublw 0x77 ; 0x77 - w
bc KBD_dec ; carry if result zero or positive, branch
;*** no character to display: ***
;*** check for special code (0xE0): 0xD2 = 0xE0 - d'14' ***
movfw KBD
sublw 0xD2 ; 0xD2 - w
skpnz ; skip if not zero
bsf SPEflag ; special code occurred, set flag
goto _ClrStall ; abort with nothing to display
;*******************************************************
;*** SCAN CODE DECODING & ASCII CHARACTER CONVERSION ***
;*******************************************************
;*************************************
;*** KEYBOARD DATA OUTPUT TO RS232 ***
;*************************************
;************************************************
;*** SPECIAL COMMANDS I (with special output) ***
;************************************************
;**********************************************************
;*** STALL RELEASE & CLEAR KEYBOARD DATA RECEPTION FLAG ***
;**********************************************************
_ClrStall
BANK1
bsf KBDclktris ; set clk line back to input (and goes high)
BANK0 ; (release stall)
bcf KBDflag ; clear keyboard data reception flag
bsf INTCON,INTE ; re-enable interrupt RB0/INT
RETURN
;****************************************************
;*** SPECIAL COMMANDS II (without special output) ***
;****************************************************
;***********************************************
;*** ALT-DEC & CTRL-HEX STORING & CONVERSION ***
;***********************************************
; store typed numbers in CTRLreg1 - CTRLreg3
_CTRLstr ; /not implemented, enhancement/
_ALTstr ; /not implemented, enhancement/
;*****************************************************************
;*** SCAN CODE DECODING & ASCII CONVERSION FOR 'SHIFT' ENTRIES ***
;*****************************************************************
_SHICHR ;*** special character decoding typed with shift button active ***
; check for active shift button, if not active, branch
btfss SHIflag
goto _OUTP ; branch
; check for 'backspace', 'tab', 'linefeed' and 'carriage return' :
; (here, KBD has already been converted to ASCII character values)
movfw KBD
sublw d'13' ; d'13' - w
bc _OUTP ; carry if result zero or positive, branch
;*******************************************************
;* The following table has also to be located within *
;**********************************************************************
;* LOOKUP TABLE FOR SPECIAL CHARACTERS TYPED WITH SHIFT BUTTON ACTIVE *
;**********************************************************************
BANK1
clrf OPTION_REG ; PORTB pull-ups enabled
goto _MAIN
ORG 0x1E0
;******************************
_MLOOP btfsc KBDflag ; check scan pattern reception flag
call KBDdecode ; if set, call decoding routine
goto _MLOOP
;******************************
WelcomeTable
addwf PCL,F ; add offset to table base pointer
DT "PIC 16F84 AT Keyboard Decoder connected" ; create table
retlw CR ; Carriage Return
retlw LF ; Line Feed
WTableEND retlw LF ; Line Feed
END
;**********************************************************************
;
; AT Keyboard Lookup Table
; ========================
;
; written by Peter Luethi, 12.7.2000, Switzerland
; last update: 28.01.2003
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; VERSION:
; ========
; English keyboard layout (QWERTY 'codepage')
;
;
; DESCRIPTION:
; ============
; Keyboard lookup table
;
;**********************************************************************
KBDtable ; (not used for characters typed with shift button active)
addwf PCL,F
retlw 0 ; invalid entry
retlw A'9' ; F9 -> 9 0x01
retlw 0 ;
retlw A'5' ; F5 -> 5
retlw A'3' ; F3 -> 3
retlw A'1' ; F1 -> 1
retlw A'2' ; F2 -> 2
retlw A'2' ; F12 -> 2
retlw 0 ;
retlw A'0' ; F10 -> 0
retlw A'8' ; F8 -> 8 0x0A
retlw A'6' ; F6 -> 6
retlw A'4' ; F4 -> 4
retlw A']' ;
retlw 0 ;
retlw A'|' ;
retlw 0 ;
retlw 0 ;
retlw 0 ;
retlw A'<' ; 0x61
;*** begin compression (scan code - d'14') ***
DT "0.2568"
retlw 0 ; ESCAPE 0x76
retlw 0 ; NUM LOCK
DT "1+3-*9"
retlw 0 ; SCROLL LOCK 0x7E
;*** begin compression (scan code - d'14' + d'35') ***
retlw 0x08 ; BACKSPACE
retlw 0 ;
retlw 0 ;
retlw A'1' ; 0x82
;*** begin compression (scan code - d'14') ***
retlw A'7' ;
;*** begin compression (scan code - d'14' + d'35') ***
retlw A'4'
KBDtableEND retlw A'7'
;**********************************************************************
;
; AT Keyboard Main Lookup Table
; =============================
;
; written by Peter Luethi, 12.07.2000, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 28.01.2003
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
; VERSION:
; ========
; English keyboard layout (QWERTY 'codepage')
;
; DESCRIPTION:
; ============
; Keyboard lookup table, 'main' refers to decoding of all keys
; typed without any shift key active.
;
;**********************************************************************
KBDtable ; (not used for characters typed with shift button active)
addwf PCL,F
retlw 0 ; invalid entry
retlw A'9' ; F9 -> 9 0x01
retlw 0 ;
retlw A'5' ; F5 -> 5
retlw A'3' ; F3 -> 3
retlw A'1' ; F1 -> 1
retlw A'2' ; F2 -> 2
retlw A'2' ; F12 -> 2
retlw 0 ;
retlw A'0' ; F10 -> 0
retlw A'8' ; F8 -> 8 0x0A
retlw 0 ;
retlw 0 ;
retlw 0 ; CAPS LOCK, check and alter CAPflag on key release
goto _SHIFT ; SHIFT
goto _CRLF ; CR,LF 0x5A
retlw A']' ;
retlw 0 ;
retlw A'|' ;
retlw 0 ;
retlw 0 ;
retlw 0 ;
retlw A'<' ; 0x61
;*** begin compression (scan code - d'14') ***
DT "0.2568"
retlw 0 ; ESCAPE 0x76
retlw 0 ; NUM LOCK
DT "1+3-*9"
retlw 0 ; SCROLL LOCK 0x7E
;*** begin compression (scan code - d'14' + d'35') ***
retlw 0x08 ; BACKSPACE
retlw 0 ;
retlw 0 ;
retlw A'1' ; 0x82
;*** begin compression (scan code - d'14') ***
retlw A'7' ;
;*** begin compression (scan code - d'14' + d'35') ***
retlw A'4'
KBDtableEND retlw A'7'
;**********************************************************************
;
; AT Keyboard Lookup Table
; ========================
;
; written by Peter Luethi, 12.7.2000, Switzerland
; last update: 3.1.2002
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; VERSION:
; ========
; Modified SWISS-GERMAN keyboard layout (QWERTZ 'codepage')
;
;
; DESCRIPTION:
; ============
; Keyboard lookup table
;
;**********************************************************************
KBDtable ; (not used for characters typed with shift button active)
addwf PCL,F
retlw 0 ; invalid entry
retlw A'9' ; F9 -> 9 0x01
retlw 0 ;
retlw A'5' ; F5 -> 5
retlw A'3' ; F3 -> 3
retlw A'1' ; F1 -> 1
retlw A'2' ; F2 -> 2
retlw A'2' ; F12 -> 2
retlw 0 ;
retlw A'0' ; F10 -> 0
retlw A'8' ; F8 -> 8 0x0A
retlw A'6' ; F6 -> 6
retlw A'4' ; F4 -> 4
retlw 0 ;
retlw A'$' ;
retlw 0 ;
retlw 0 ;
retlw 0 ;
retlw A'<' ; 0x61
;*** begin compression (scan code - d'14') ***
DT "0.2568"
retlw 0 ; ESCAPE 0x76
retlw 0 ; NUM LOCK
DT "1+3-*9"
retlw 0 ; SCROLL LOCK 0x7E
;*** begin compression (scan code - d'14' + d'35') ***
retlw 0x08 ; BACKSPACE
retlw 0 ;
retlw 0 ;
retlw A'1' ; 0x82
;*** begin compression (scan code - d'14') ***
retlw A'7' ;
;*** begin compression (scan code - d'14' + d'35') ***
retlw A'4'
KBDtableEND retlw A'7'
;**********************************************************************
;
; AT Keyboard Main Lookup Table
; =============================
;
; written by Peter Luethi, 12.07.2000, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 28.01.2003
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
; VERSION:
; ========
; Modified SWISS-GERMAN keyboard layout (QWERTZ 'codepage')
;
; DESCRIPTION:
; ============
; Keyboard lookup table, 'main' refers to decoding of all keys
; typed without any shift key active.
;
;**********************************************************************
KBDtable ; (not used for characters typed with shift button active)
addwf PCL,F
retlw 0 ; invalid entry
retlw A'9' ; F9 -> 9 0x01
retlw 0 ;
retlw A'5' ; F5 -> 5
retlw A'3' ; F3 -> 3
retlw A'1' ; F1 -> 1
retlw A'2' ; F2 -> 2
retlw A'2' ; F12 -> 2
retlw 0 ;
retlw A'0' ; F10 -> 0
retlw A'8' ; F8 -> 8 0x0A
retlw 0 ;
retlw 0 ; CAPS LOCK, check and alter CAPflag on key release
goto _SHIFT ; SHIFT
goto _CRLF ; CR,LF 0x5A
retlw A'!' ;
retlw 0 ;
retlw A'$' ;
retlw 0 ;
retlw 0 ;
retlw 0 ;
retlw A'<' ; 0x61
;*** begin compression (scan code - d'14') ***
DT "0.2568"
retlw 0 ; ESCAPE 0x76
retlw 0 ; NUM LOCK
DT "1+3-*9"
retlw 0 ; SCROLL LOCK 0x7E
;*** begin compression (scan code - d'14' + d'35') ***
retlw 0x08 ; BACKSPACE
retlw 0 ;
retlw 0 ;
retlw A'1' ; 0x82
;*** begin compression (scan code - d'14') ***
retlw A'7' ;
;*** begin compression (scan code - d'14' + d'35') ***
retlw A'4'
KBDtableEND retlw A'7'
;**********************************************************************
;
; AT Keyboard SHIFT Lookup Table
; ==============================
;
; written by Peter Luethi, 12.7.2000, Switzerland
; last update: 28.01.2003
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; VERSION:
; ========
; English keyboard layout (QWERTY 'codepage')
;
;
; DESCRIPTION:
; ============
; Keyboard lookup table for special characters typed with SHIFT
; button active.
;
;**********************************************************************
KBDSHIFTtable ; some of the items are located here with 'compressed' offset
addwf PCL,F
DT "&*$#<" ; 0x3D - 0x41
retlw 0 ; invalid entry
retlw 0 ;
retlw 0 ;
DT ")(" ; 0x45 - 0x46
retlw 0 ;
DT "%>/" ; 0x48 - 0x4A
retlw 0 ;
retlw A':' ; "\" 0x4C
retlw 0 ;
DT "_`^" ; 0x4E - 0x50
retlw 0 ;
retlw A'"' ; 0x52
retlw 0 ;
DT "{=" ; 0x54 - 0x55
retlw 0 ;
retlw A'!' ; 0x57
retlw 0 ;
retlw 0 ;
retlw 0 ;
retlw A'}' ; 0x5B
retlw 0 ;
retlw 0x5C ; 0x5D
retlw 0 ;
retlw A'@' ; 0x5F
retlw 0 ;
KBDSHIFTtableEND retlw A'>' ; 0x61 (not used in english but left for completion)
;**********************************************************************
;
; AT Keyboard Shift Lookup Table
; ==============================
;
; written by Peter Luethi, 12.07.2000, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 28.01.2003
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
; VERSION:
; ========
; English keyboard layout (QWERTY 'codepage')
;
; DESCRIPTION:
; ============
; Keyboard lookup table for special characters typed with SHIFT
; button active.
;
;**********************************************************************
KBDSHIFTtable ; some of the items are located here with 'compressed' offset
addwf PCL,F
DT "&*$#<" ; 0x3D - 0x41
retlw 0 ; invalid entry
retlw 0 ;
retlw 0 ;
DT ")(" ; 0x45 - 0x46
retlw 0 ;
DT "%>/" ; 0x48 - 0x4A
retlw 0 ;
retlw A':' ; "\" 0x4C
retlw 0 ;
DT "_`^" ; 0x4E - 0x50
retlw 0 ;
retlw A'"' ; 0x52
retlw 0 ;
DT "{=" ; 0x54 - 0x55
retlw 0 ;
retlw A'!' ; 0x57
retlw 0 ;
retlw 0 ;
retlw 0 ;
retlw A'}' ; 0x5B
retlw 0 ;
retlw 0x5C ; 0x5D
retlw 0 ;
retlw A'@' ; 0x5F
retlw 0 ;
KBDSHIFTtableEND retlw A'>' ; 0x61 (not used in english but left for completion)
;**********************************************************************
;
; AT Keyboard SHIFT Lookup Table
; ==============================
;
; written by Peter Luethi, 12.07.2000, Switzerland
; last update: 14.08.2003
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; VERSION:
; ========
; Modified SWISS-GERMAN keyboard layout (QWERTZ 'codepage')
;
;
; DESCRIPTION:
; ============
; Keyboard lookup table for special characters typed with SHIFT
; button active.
;
;**********************************************************************
KBDSHIFTtable ; some of the items are located here with 'compressed' offset
addwf PCL,F
DT "/(#*;" ; 0x3D - 0x41
retlw 0 ; invalid entry
retlw 0 ;
retlw 0 ;
DT "=)" ; 0x45 - 0x46
retlw 0 ;
DT "%:_" ; 0x48 - 0x4A
retlw 0 ;
retlw 0x5C ; "\" 0x4C
retlw 0 ;
DT "?@&" ; 0x4E - 0x50 (replaced by #)
retlw 0 ;
;**********************************************************************
;
; AT Keyboard Shift Lookup Table
; ==============================
;
; written by Peter Luethi, 12.07.2000, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 28.01.2003
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
; VERSION:
; ========
; Modified SWISS-GERMAN keyboard layout (QWERTZ 'codepage')
;
; DESCRIPTION:
; ============
; Keyboard lookup table for special characters typed with SHIFT
; button active.
;
;**********************************************************************
KBDSHIFTtable ; some of the items are located here with 'compressed' offset
addwf PCL,F
DT "/(#*;" ; 0x3D - 0x41
retlw 0 ; invalid entry
retlw 0 ;
retlw 0 ;
DT "=)" ; 0x45 - 0x46
retlw 0 ;
DT "%:_" ; 0x48 - 0x4A
retlw 0 ;
retlw 0x5C ; "\" 0x4C
retlw 0 ;
DT "?@&" ; 0x4E - 0x50 (replaced by @)
retlw 0 ;
retlw '{' ; 0x52
retlw 0 ;
DT "[~" ; 0x54 - 0x55
retlw 0 ;
retlw A'+' ; 0x57
retlw 0 ;
retlw 0 ;
retlw 0 ;
retlw A']' ; 0x5B
retlw 0 ;
retlw A'}' ; 0x5D
retlw 0 ;
retlw A'"' ; 0x5F
retlw 0 ;
KBDSHIFTtableEND retlw A'>' ; 0x61
:020000040000FA
:10000000831603138101E0298B138B1B04289600B0
:10001000030E970083010A0898008A0183130408DD
:1000200099009308031D1728051A3328362813084A
:10003000083C031C2328051E9413051A9417031962
:100040003628940C36281308093C031C2828362827
:10005000051E33281017831603130610831203138B
:1000600006100B123428940193013728930A8B1041
:100070001908840018088A00170E8300960E160EC1
:10008000090014089500F03C031D492810141011B4
:100090002829101CE32810101408123C03195328B7
:1000A0001408593C031990101408583C031D5E288D
:1000B000901D5C2890112829901528291408113CBE
:1000C000031D6428101236291408143C031D282926
:1000D00090123629820700343934003435343334F1
:1000E0003134323432340034303438343634343409
:1000F00009347E3400340034322930290034342964
:10010000713431340034003400347A34733461345F
:1001100077343234003400346334783464346534F2
:100120003434333400340034203476346634743458
:1001300072343534003400346E34623468346734D9
:10014000793436340034003400346D346A34753414
:1001500037343834003400342C346B3469346F3421
:1001600030343934003400342E343F346C343B3472
:1001700070342D34003400340034273400345B34C0
:100180002B34003400340034302924295D34003409
:100190007C340034003400343C3430342E34323477
:1001A0003534363438340034003431342B3433347D
:1001B0002D342A34393400340834003400343134D6
:1001C000373434343734101DF12814084A3C031DE9
:1001D000EC282F309400212914085A3C0318F128E8
:1001E00028291408613C031807290E3094021408CA
:1001F000613C031CFE281930940707291408773C3A
:10020000031807291408D23C0319101528290030B7
:100210008A0014086A2094009408031928291408F5
:10022000603C0318372914087A3C031C372914084A
:1002300090191D29901C21291F2990182129E03E81
:1002400094001408A72128290D30A7210A3008009E
:100250008316031306148312031310130B160800DE
:100260009014003410160034901600342829901C85
:10027000212914080D3C031821291508613C031C91
:10028000212915083C3C031848293D309502512985
:100290001508243C03184F292330950251290430B6
:1002A000950701308A0015085721940021298207FB
:1002B00026342A34243423343C34003400340034CB
:1002C00029342834003425343E342F3400343A3471
:1002D00000345F3460345E340034223400347B34C4
:1002E0003D34003421340034003400347D34003493
:0A02F0005C340034403400343E3426
:100320008C00810183160313C030810508008C0006
:10033000810183160313C0308105013081048312CB
:1003400003130B110B1DA2298C0BA129080091008E
:10035000051008308C00B82111180514111C051067
:10036000910CB8218C0BAC290514B821B8210800D8
:100370001D308D00BE2908308D00BE298D0BBE2991
:060380000800920137287D
:1003C0000510831203130514831603130614051670
:1003D0000113831203130B1693019001F8308B0560
:1003E0008B172A308E0002308A000E082A3C102219
:0C03F000A7218E0BF329101B4120FB29D4
:10042000820750344934433420343134363446342E
:100430003834343420344134543420344B3465342B
:10044000793462346F346134723464342034443427
:10045000653463346F346434653472342034633407
:100460006F346E346E34653463347434653464349C
:060470000D340A340A34C9
:02400E00F13F80
:00000001FF
:020000040000FA
:10000000831603138101E0298B138B1B04289600B0
:10001000030E970083010A0898008A0183130408DD
:1000200099009308031D1728051A3328362813084A
:10003000083C031C2328051E9413051A9417031962
:100040003628940C36281308093C031C2828362827
:10005000051E33281017831603130610831203138B
:1000600006100B123428940193013728930A8B1041
:100070001908840018088A00170E8300960E160EC1
:10008000090014089500F03C031D492810141011B4
:100090002829101CE32810101408123C03195328B7
:1000A0001408593C031990101408583C031D5E288D
:1000B000901D5C2890112829901528291408113CBE
:1000C000031D6428101236291408143C031D282926
:1000D00090123629820700343934003435343334F1
:1000E0003134323432340034303438343634343409
:1000F0000934A7340034003432293029003434293B
:100100007134313400340034003479347334613460
:1001100077343234003400346334783464346534F2
:100120003434333400340034203476346634743458
:1001300072343534003400346E34623468346734D9
:100140007A3436340034003400346D346A34753413
:1001500037343834003400342C346B3469346F3421
:1001600030343934003400342E342D346C34F634C9
:1001700070342734003400340034E4340034FC3468
:100180005E34003400340034302924292134003412
:1001900024340034003400343C3430342E343234CF
:1001A0003534363438340034003431342B3433347D
:1001B0002D342A34393400340834003400343134D6
:1001C000373434343734101DF12814084A3C031DE9
:1001D000EC282F309400212914085A3C0318F128E8
:1001E00028291408613C031807290E3094021408CA
:1001F000613C031CFE281930940707291408773C3A
:10020000031807291408D23C0319101528290030B7
:100210008A0014086A2094009408031928291408F5
:10022000603C0318372914087A3C031C372914084A
:1002300090191D29901C21291F2990182129E03E81
:1002400094001408A72128290D30A7210A3008009E
:100250008316031306148312031310130B160800DE
:100260009014003410160034901600342829901C85
:10027000212914080D3C031821291508613C031C91
:10028000212915083C3C031848293D309502512985
:100290001508243C03184F292330950251290430B6
:1002A000950701308A0015085721940021298207FB
:1002B0002F34283423342A343B34003400340034BF
:1002C0003D342934003425343A345F3400345C340E
:1002D00000343F344034263400347B3400345B3403
:1002E0007E3400342B340034003400345D34003468
:0A02F0007D340034223400343E3423
:100320008C00810183160313C030810508008C0006
:10033000810183160313C0308105013081048312CB
:1003400003130B110B1DA2298C0BA129080091008E
:10035000051008308C00B82111180514111C051067
:10036000910CB8218C0BAC290514B821B8210800D8
:100370001D308D00BE2908308D00BE298D0BBE2991
:060380000800920137287D
:1003C0000510831203130514831603130614051670
:1003D0000113831203130B1693019001F8308B0560
:1003E0008B172A308E0002308A000E082A3C102219
:0C03F000A7218E0BF329101B4120FB29D4
:10042000820750344934433420343134363446342E
:100430003834343420344134543420344B3465342B
:10044000793462346F346134723464342034443427
:10045000653463346F346434653472342034633407
:100460006F346E346E34653463347434653464349C
:060470000D340A340A34C9
:02400E00F13F80
:00000001FF
PIC16F84 MAX232
D D
VDD
XT1
R1 VDD
14
C5
16
2
6
U1
16 15 U2
VDD
VSS 4n7 OSC1/CLKIN OSC2/CLKOUT
4 7 13 12
V+
VCC
V-
MCLR RB1 R1 IN R1 OUT
17 8 RS232 8 9 5V
C PIC TXD RA0 RB2 R2 IN R2 OUT C
18 9 11 14
RA1 RB3 PIC TXD T1 IN T1 OUT RS232 RXD
1 10 5V 10 7 RS232
RA2 RB4 T2 IN T2 OUT
2 11 1 4
GND
RA3 RB5 C1+ C2+
3 12 3 5
KBD_Data RA4/T0CKI RB6 C1 - C2 -
VSS
6 13
KBD_Clk RB0/INT RB7
C6 MAX232CPE(16) C7
PIC16F84-04/P(18) 10u 10u
15
5
VDD
VDD
VSS VSS
VDD
C8
B 100n VDD B
VSS
C9
VSS
100n
VDD VSS
VSS
PS/2 Connector R2
RS232 SUB1
10k 5
VSS
R3 9
J1
10k 4
1 KBD_Data (Direction seen from host) 8
2 3
3 VSS 7 Title
4 VDD
RS232 RXD
2 AT Keyboard Interface with PIC16F84
5 KBD_Clk 6
A 6 1 A
Written by Date
16-Aug-2003
CON6 Peter Luethi
DB9 Revision Page
Dietikon, Switzerland 1.03 1 of 1
1 2 3 4
http://www.trash.net/~luethi/microchip/projects/keyboard/v2xx/kbd_2xx.asm
;***************************************************************************
;
; AT Keyboard Interface V2.04 (with LCD Display)
; ===============================================
;
; written by Peter Luethi, 25.12.2000, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 17.04.2004
;
; V2.04: Added LCDcflag (LCD command/data flag) to comply with
; latest LCD modules. Re-structured ISR, added label
; _ISR_RS232error
; (17.04.2004)
;
; V2.03: Improved AT keyboard and RS232 initialization,
; fixed RBIF/INTF interrupt initialization issue.
; Changed keyboard data pin to PORTA,4 (open-collector).
; Fixed ALT-DEC and CTRL-HEX issue on right side keys.
; Added special LCD treatment for 'tabulator' key.
; (14.08.2003)
;
; V2.02: Implemented support for ASCII conversion from direct ALT-DEC
; and CTRL-HEX entries. Accepts both keypad and keyboard
; numbers, as well as upper and lower case letters [a..f].
; (02.01.2002)
;
; V2.01: Implemented host to keyboard transmission. Bi-directional
; communication between controller and keyboard is now
; possible, for configuration purposes and to control the
; keyboard LEDs. (31.03.2001)
;
; V2.00: Initial release (25.12.2000)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock Frequency: 4.00 MHz XT
; Throughput: 1 MIPS
; RS232 Baud Rate: 9600 baud (depends on the module included)
; Serial Output: 9600 baud, 8 bit, no parity, 1 stopbit
; Keyboard Routine Features: Capability of bi-directional
; communication between microcontroller
; and keyboard (keys & LEDs)
; Acquisition Methodology: Preemptive, interrupt-based
; keyboard scan pattern acquisition
; routine, with decoding to ASCII
; characters during normal operation
; (incl. LCD display and RS232 activities)
; Code Size of entire Program: 967 instruction words
; Required Hardware: AT Keyboard, MAX 232,
; HD44780 compatible dot matrix LCD
; (2x16, 2x20 or 2x40 characters)
; Required Software: RS232 terminal
;
;
; ABSTRACT:
; =========
; This routine converts AT keyboard scan patterns to ASCII characters
; and transmits them afterwards to the target device by using the
; RS232 transmission protocol. Support of english (QWERTY) and modified
; swiss-german (QWERTZ) 'codepages'. This implementation features a dot
; matrix LCD display as visual interface, but only for transmitted
; characters typed on the local keyboard (unidirectional data flow).
;
;
; DESCRIPTION:
; ============
; Developed and tested on PIC 16F84.
; Any key stroke on the keyboard connected to the PIC will send the
; corresponding scan code from the keyboard to the microcontroller.
; Afterwards, the microcontroller converts the keyboard scan code to
; ASCII characters and transmits them to the personal computer across
; the RS232 link.
; This program features also the capability of bi-directional
; communication between controller and keyboard for configuration
; purposes and to control the keyboard LEDs.
;
PROCESSOR 16F84
#include "p16f84.inc"
ORG 0xC0
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
KEYBOARDinit macro
BANK1
bsf KBDclktris ; set keyboard clock line to input explicitely
bsf KBDdatatris ; set keyboard data line to input explicitely
bcf OPTION_REG,INTEDG ; keyboard interrupt on falling edge
BANK0
bsf INTCON,INTE ; enable RB0/INT interrupts
endm
KBDexp macro _KBDresp ; keyboard expect function: busy wait for kbd response
movlw _KBDresp ; load expected kbd response
call KBDexpt
endm
KBDexpt ;*** keyboard expect function: busy wait for kbd response ***
movwf KBDexpval ; load expected kbd response to KBDexpval
bsf KBDexpf ; set flag
_KBDexp btfsc KBDexpf ; wait loop: poll for completion
goto _KBDexp ; not yet completed, loop
RETURN
goto _cl_1
LCD_DDAdr 0x00 ; reset cursor to beginning of line
clrf LCDpos ; reset LCD position counter
RETURN
_line2 LCD_DDAdr 0x40 ; move cursor to beginning of second line
bsf LCD_ln ; set flag
_cl_2 LCDchar ' ' ; put subsequent blanks on LCD to clear line
decfsz LCDpos,F ; decrement counter
goto _cl_2
LCD_DDAdr 0x40 ; reset cursor to beginning of line
clrf LCDpos ; reset LCD position counter
RETURN
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
;******************************************
;*** HOST TO KEYBOARD DATA TRANSMISSION ***
;******************************************
_ISR_KBDxmit
;*** data transmission ***
movfw KBDcnt ; get kbd scan pattern acquisition counter
sublw d'7' ; w = d'7' - KBDcnt (*)
bnc _KBDparo ; branch if negative (carry == 0)
btfss KBD,0x00 ; serial transmission of keyboard data
bcf KBDdatapin
btfsc KBD,0x00
bsf KBDdatapin
rrf KBD,F ; rotate right keyboard TX data register
goto _INCF ; exit
;*** data and parity transmission completed, turn around cycle ***
_KBDrel movfw KBDcnt ; get kbd scan pattern acquisition counter
sublw d'9' ; w = d'9' - KBDcnt
bnc _KBDack ; branch if negative (carry == 0)
BANK1
bsf KBDdatatris ; release keyboard data line, set to input
BANK0
goto _INCF ; exit
;*****************************************
;*** KEYBOARD SCAN PATTERN ACQUISITION ***
;*****************************************
_ISR_KBDacq
;*** check start bit ***
tstf KBDcnt ; check
bnz _KBDdat ; branch on no zero
btfsc KBDdatapin ; test start bit of keyboard data input
goto _KBDabort ; no valid start bit, abort
goto _INCF ; exit
;***********************************
;*** CLEARING OF INTERRUPT FLAGS ***
;***********************************
; NOTE: Below, I only clear the interrupt flags! This does not
; necessarily mean, that the interrupts are already re-enabled.
; Basically, interrupt re-enabling is carried out at the end of
; the corresponding service routine in normal operation mode.
; The flag responsible for the current ISR call has to be cleared
; to prevent recursive ISR calls. Other interrupt flags, activated
; during execution of this ISR, will immediately be served upon
; termination of the current ISR run.
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
KBDdecode
;**********************************************************
;*** KEYBOARD SCAN CODE PRE-DECODING, SET / CLEAR FLAGS ***
;**********************************************************
;****************************************************
;* The following table has to be located within one *
;* page to allow for correct lookup functionality. *
;* Therefore, additional ISR code has been moved *
;* further down. *
;****************************************************
;*********************************************************************
;* LOOKUP TABLE FOR KEYBOARD-SCAN-CODE TO ASCII-CHARACTER CONVERSION *
;*********************************************************************
;****************************************************
;* The following code belongs also to the interrupt *
;* service routine and has been moved down to this *
;********************************
;*** SCAN CODE RANGE CHECKING ***
;********************************
_KBD_2 ;*** check if special code (0xE0) has been submitted previously ***
btfss SPEflag
goto _KBD_3
;*** decoding of scan code with preceding special code (0xE0) ***
; check for ALT-DEC or CTRL-HEX activity
btfsc ALTflag
goto _KBD_3
btfsc CTRLflag
goto _KBD_3
; (decoding currently only necessary for 'E0 4A' = '/')
movfw KBD
sublw 0x4A ; 0x4A - w
bnz _NOSUP ; branch on non-zero
movlw '/' ; store '/' in KBD
movwf KBD
goto _OUTP
_NOSUP ;*** check if scan code 0x5A or smaller has occurred ***
movfw KBD
sublw 0x5A ; 0x5A - w
bc _KBD_3 ; carry if result positive or zero, branch
;*** range exceeded (above 0x5A) ***
; it's one of the following keys: arrow button (up, dn, rt, lt), 'Home',
; 'Del', 'PageUp', 'PageDown', 'Insert', 'End'
; these keys are currently not used, so
goto _ClrStall
_KBD_3 ;*** check if scan code 0x61 or smaller has occurred ***
movfw KBD
sublw 0x61 ; 0x61 - w
bc KBD_dec ; carry if result positive or zero, goto table
movlw d'14'
subwf KBD,F ; KBD = KBD - d'14'
;*** check if scan code 0x61 (0x6F-d'14') or smaller has occurred ***
movfw KBD
sublw 0x61 ; 0x61 - w
bnc _KBD_4 ; no carry if result negative, goto _KBD_4
movlw d'25'
addwf KBD,F ; KBD = KBD + d'25'
goto KBD_dec
_KBD_4 ;*** check if scan code 0x78 (0x86 - d'14') or higher has occurred ***
movfw KBD
sublw 0x77 ; 0x77 - w
bc KBD_dec ; carry if result zero or positive, branch
;*** no character to display: ***
;*** check for special code (0xE0): 0xD2 = 0xE0 - d'14' ***
movfw KBD
sublw 0xD2 ; 0xD2 - w
skpnz ; skip if not zero
bsf SPEflag ; special code occurred, set flag
goto _ClrStall ; abort with nothing to display
;*******************************************************
;*** SCAN CODE DECODING & ASCII CHARACTER CONVERSION ***
;*******************************************************
movfw KBD
sublw 0x7A ; 0x7A - w
bnc _SHICHR ; no carry if result negative = no letter, exit
;*** there is now a letter in KBD, check conversion to capital letter: ***
movfw KBD
btfsc CAPflag ; check caps lock flag
goto _SHIset ; flag has been set
btfss SHIflag ; check shift flag
goto _OUTP ; no flag, exit
goto _cnvCAP ; flag has been set, convert to capital letter
_SHIset btfsc SHIflag ; check shift flag
goto _OUTP ; flag has been set, exit
_cnvCAP addlw d'224' ; convert to capital letter (+ d'224')
movwf KBD
;goto _OUTP ; (uncomment in case _OUTP will be moved)
;***************************************************
;*** KEYBOARD DATA OUTPUT TO RS232 & LCD DISPLAY ***
;***************************************************
;************************************************
;*** SPECIAL COMMANDS I (with special output) ***
;************************************************
;**********************************************************
;*** STALL RELEASE & CLEAR KEYBOARD DATA RECEPTION FLAG ***
;**********************************************************
_ClrStall
BANK1
bsf KBDclktris ; set clk line back to input (and goes high)
BANK0 ; (release stall)
bcf KBDflag ; clear keyboard data reception flag
bsf INTCON,INTE ; re-enable interrupt RB0/INT
RETURN
;****************************************************
;*** SPECIAL COMMANDS II (without special output) ***
;****************************************************
goto _alt_2
_CTRL bsf CTRLflag ; set CTRL flag
_alt_2 clrf CTRLcnt ; clear counter for CTRL/ALT conversion stuff
clrf CTRLreg1 ; clear storage registers for CTRL-HEX
clrf CTRLreg2 ; and ALT-DEC conversion routines
clrf CTRLreg3
RETLW 0 ; clear w to obtain invalid entry
;***********************************************
;*** ALT-DEC & CTRL-HEX STORING & CONVERSION ***
;***********************************************
; store typed numbers in CTRLreg1 - CTRLreg3
_CTRLstr ; check for capital letter [A..F], i.e. KBD in [0x41..0x46]
movfw KBD
sublw 0x40 ; 0x40 - w
bc _ALTstr ; carry if result >= 0, go to number check
movfw KBD
sublw 0x46 ; 0x46 - w
bnc _CTRLstr2 ; no carry if result negative, go to next check
; valid capital letter [A..F], convert to lower case (+ 0x20)
bsf KBD,0x5 ; KBD += 0x20
goto _CTRLstr3 ; jump for storing
_CTRLstr2 ; check for lower case letter [a..f], i.e. KBD in [0x61..0x66]
movfw KBD
sublw 0x60 ; 0x60 - w
bc _ALTstr ; carry if result >= 0, go to number check
movfw KBD
sublw 0x66 ; 0x66 - w
bc _CTRLstr3 ; carry if result >= 0, valid lower case letter [a..f]
_ALTstr ;*** check for number, i.e. KBD in [0x30..0x39]: ***
movfw KBD
sublw 0x29 ; 0x29 - w
bc _ClrStall ; carry if result >= 0, no number, exit
movfw KBD
sublw 0x39 ; 0x39 - w
bnc _ClrStall ; no carry if result negative, no number, exit
_CTRLstr3 ;*** store letter/number now ***
tstf CTRLcnt
bnz _cnt_1 ; branch if not zero
incf CTRLcnt,F ; increment counter (0->1)
movfw KBD
movwf CTRLreg1 ; store first number
goto _ClrStall ; abort & exit
_cnt_1 decfsz CTRLcnt,W ; decrement counter, don't store
;*******************************************************
;* The following table has also to be located within *
;* one page to allow for correct lookup functionality. *
;*******************************************************
;ORG 0x??
;*****************************************************************
;*** SCAN CODE DECODING & ASCII CONVERSION FOR 'SHIFT' ENTRIES ***
;*****************************************************************
_SHICHR ;*** special character decoding typed with shift button active ***
;*******************************************************
;* The following table has also to be located within *
;* one page to allow for correct lookup functionality. *
;*******************************************************
;**********************************************************************
;* LOOKUP TABLE FOR SPECIAL CHARACTERS TYPED WITH SHIFT BUTTON ACTIVE *
;**********************************************************************
BANK1
clrf OPTION_REG ; PORTB pull-ups enabled
goto _MAIN
ORG 0x2C0
;******************************
_MLOOP btfsc KBDflag ; check scan pattern reception flag
call KBDdecode ; if set, call decoding routine
goto _MLOOP
;******************************
;ORG 0x??
WelcomeTable
addwf PCL,F ; add offset to table base pointer
DT "PIC 16F84 AT Keyboard Decoder connecte" ; create table
WTableEND DT "d"
END
;***************************************************************************
;
; AT Keyboard Interface V2.02b (with LCD Display)
; ================================================
;
; written by Peter Luethi, 25.12.2000, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 19.04.2004
;
; V2.02b: Added LCDcflag (LCD command/data flag) to comply with
; latest LCD modules. Re-structured ISR, added label
; _ISR_RS232error
; (19.04.2004)
;
; V2.01b: Changed keyboard data pin to PORTA,4 (open-collector).
; (14.08.2003)
;
; V2.01a: Made forward compatible (yes, this is feasible) by
; implementing/completing ALT and CTRL flags. Added
; labels to support non-implemented ALT and CTRL
; enhancements. (3.1.2002)
;
; V2.01: Implemented host to keyboard transmission. Bi-directional
; communication between controller and keyboard is now
; possible, for configuration purposes and to control the
; keyboard LEDs. (31.3.2001)
;
; V2.00: Initial release (25.12.2000)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock Frequency: 4.00 MHz XT
; Throughput: 1 MIPS
; RS232 Baud Rate: 9600 baud (depends on the module included)
; Keyboard Routine Features: Capability of bi-directional
; communication between controller
; and keyboard
; Acquisition Methodology: Preemptive, interrupt-based
; keyboard scan pattern acquisition
; routine, with decoding to ASCII
; characters during normal operation
; (incl. LCD display and RS232 activities)
; Code Size of entire Program: 796 instruction words
; Required Hardware: AT Keyboard, MAX 232,
; HD44780 compatible dot matrix LCD
; (2x16, 2x20 or 2x40 characters)
; Required Software: RS232 terminal
;
;
; ABSTRACT:
; =========
; This routine converts AT keyboard scan patterns to ASCII characters
; and transmits them afterwards to the target device by using the
; RS232 transmission protocol. Support of english (QWERTY) and modified
; swiss-german (QWERTZ) 'codepages'. This implementation features an
; LCD display as visual interface, but only for transmitted characters
; typed on the local keyboard (unidirectional data flow).
;
;
; DESCRIPTION:
; ============
; Developed and tested on PIC 16F84.
; Any key stroke on the keyboard connected to the PIC will send the
; corresponding scan code from the keyboard to the microcontroller.
; Afterwards, the microcontroller converts the keyboard scan code to
; ASCII characters and transmits them to the personal computer across
; the RS232 link.
; This program features also the capability of bi-directional
; communication between controller and keyboard for configuration
; purposes and to control the keyboard LEDs.
;
; The keyboard scan pattern capture and decoding is done by an
; interrupt service routine. The event, which triggers the interrupt
; is a falling edge on the keyboard clock line at the KBDclkpin
; (PORTB,0). The keyboard data (scan code) will be fetched at the
; KBDdatapin (PORTA,4).
PROCESSOR 16F84
#include "p16f84.inc"
ORG 0xC0
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
#include "..\..\m_rs096.asm" ; 9600 baud @ 4 MHz
#include "..\..\m_lcd_bf.asm"
KEYBOARDinit macro
BANK1
bsf KBDclktris ; set input with weak pull-up
bsf KBDdatatris ; set input with weak pull-up
bcf OPTION_REG,INTEDG ; keyboard interrupt on falling edge (INTB)
BANK0
movlw b'11111000'
andwf INTCON,F ; clear all interrupt flags
movlw b'10010000'
iorwf INTCON,F ; enable global & RB0/INT interrupts
endm
KBDexp macro _KBDresp ; keyboard expect function: busy wait for kbd response
movlw _KBDresp ; load expected kbd response
call KBDexpt
endm
KBDexpt ;*** keyboard expect function: busy wait for kbd response ***
movwf KBDexpval ; load expected kbd response to KBDexpval
bsf KBDexpf ; set flag
_KBDexp btfsc KBDexpf ; wait loop: poll for completion
goto _KBDexp ; not yet completed, loop
RETURN
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
;******************************************
;*** HOST TO KEYBOARD DATA TRANSMISSION ***
;******************************************
_ISR_KBDxmit
;*** data transmission ***
movfw KBDcnt ; get kbd scan pattern acquisition counter
sublw d'7' ; w = d'7' - KBDcnt (*)
bnc _KBDparo ; branch if negative (carry == 0)
btfss KBD,0x00 ; serial transmission of keyboard data
bcf KBDdatapin
btfsc KBD,0x00
bsf KBDdatapin
rrf KBD,F ; rotate right keyboard TX data register
goto _INCF ; exit
;*** data and parity transmission completed, turn around cycle ***
_KBDrel movfw KBDcnt ; get kbd scan pattern acquisition counter
sublw d'9' ; w = d'9' - KBDcnt
bnc _KBDack ; branch if negative (carry == 0)
BANK1
bsf KBDdatatris ; release keyboard data line, set to input
BANK0
goto _INCF ; exit
;*****************************************
;*** KEYBOARD SCAN PATTERN ACQUISITION ***
;*****************************************
_ISR_KBDacq
;*** check start bit ***
tstf KBDcnt ; check
bnz _KBDdat ; branch on no zero
btfsc KBDdatapin ; test start bit of keyboard data input
goto _KBDabort ; no valid start bit, abort
goto _INCF ; exit
;***********************************
;*** CLEARING OF INTERRUPT FLAGS ***
;***********************************
; NOTE: Below, I only clear the interrupt flags! This does not
; necessarily mean, that the interrupts are already re-enabled.
; Basically, interrupt re-enabling is carried out at the end of
; the corresponding service routine in normal operation mode.
; The flag responsible for the current ISR call has to be cleared
; to prevent recursive ISR calls. Other interrupt flags, activated
; during execution of this ISR, will immediately be served upon
; termination of the current ISR run.
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
KBDdecode
;**********************************************************
;*** KEYBOARD SCAN CODE PRE-DECODING, SET / CLEAR FLAGS ***
;**********************************************************
;****************************************************
;* The following table has to be located within one *
;* page to allow for correct lookup functionality. *
;* Therefore, additional ISR code has been moved *
;* further down. *
;****************************************************
;*********************************************************************
;* LOOKUP TABLE FOR KEYBOARD-SCAN-CODE TO ASCII-CHARACTER CONVERSION *
;*********************************************************************
;****************************************************
;* The following code belongs also to the interrupt *
;* service routine and has been moved down to this *
;* place to allow the main keyboard decode lookup *
;* table to be located within one page. *
;* The code below may be arranged on another page, *
;* but that doesn't matter. *
;****************************************************
;********************************
;*** SCAN CODE RANGE CHECKING ***
;********************************
_KBD_2 ;*** check if special code (0xE0) has been submitted previously ***
btfss SPEflag
goto _KBD_3
;*** decoding of scan code with preceeding special code (0xE0) ***
; (decoding currently only necessary for 'E0 4A' = '/')
movfw KBD
sublw 0x4A ; 0x4A - w
bnz _NOSUP ; branch on non-zero
movlw '/' ; store '/' in KBD
movwf KBD
goto _OUTP
_NOSUP ;*** check if scan code 0x5A or smaller has occurred ***
movfw KBD
sublw 0x5A ; 0x5A - w
bc _KBD_3 ; carry if result positive or zero, branch
;*** range exceeded (above 0x5A) ***
; it's one of the following keys: arrow button, 'Home', 'Del',
; 'PageUp', 'PageDown', 'Insert', 'End'
; these keys are currently not used, so
goto _ClrStall
_KBD_3 ;*** check if scan code 0x61 or smaller has occurred ***
movfw KBD
sublw 0x61 ; 0x61 - w
bc KBD_dec ; carry if result positive or zero, goto table
movlw d'14'
subwf KBD,F ; KBD = KBD - d'14'
;*** check if scan code 0x61 (0x6F-d'14') or smaller has occurred ***
movfw KBD
sublw 0x61 ; 0x61 - w
bnc _KBD_4 ; no carry if result negative, goto _KBD_4
movlw d'25'
addwf KBD,F ; KBD = KBD + d'25'
goto KBD_dec
_KBD_4 ;*** check if scan code 0x78 (0x86 - d'14') or higher has occurred ***
movfw KBD
sublw 0x77 ; 0x77 - w
;*******************************************************
;*** SCAN CODE DECODING & ASCII CHARACTER CONVERSION ***
;*******************************************************
;***************************************************
;*** KEYBOARD DATA OUTPUT TO RS232 & LCD DISPLAY ***
;***************************************************
;************************************************
;*** SPECIAL COMMANDS I (with special output) ***
;************************************************
;**********************************************************
;*** STALL RELEASE & CLEAR KEYBOARD DATA RECEPTION FLAG ***
;**********************************************************
_ClrStall
BANK1
bsf KBDclktris ; set clk line back to input (and goes high)
BANK0 ; (release stall)
bcf KBDflag ; clear keyboard data reception flag
bsf INTCON,INTE ; re-enable interrupt RB0/INT
RETURN
;****************************************************
;*** SPECIAL COMMANDS II (without special output) ***
;****************************************************
;***********************************************
;*** ALT-DEC & CTRL-HEX STORING & CONVERSION ***
;***********************************************
; store typed numbers in CTRLreg1 - CTRLreg3
_CTRLstr ; /not implemented, enhancement/
_ALTstr ; /not implemented, enhancement/
;*****************************************************************
;*** SCAN CODE DECODING & ASCII CONVERSION FOR 'SHIFT' ENTRIES ***
;*****************************************************************
_SHICHR ;*** special character decoding typed with shift button active ***
; check for active shift button, if not active, branch
btfss SHIflag
goto _OUTP ; branch
; check for 'backspace', 'tab', 'linefeed' and 'carriage return' :
; (here, KBD has already been converted to ASCII character values)
movfw KBD
sublw d'13' ; d'13' - w
bc _OUTP ; carry if result zero or positive, branch
;*******************************************************
;* The following table has also to be located within *
;* one page to allow for correct lookup functionality. *
;*******************************************************
;**********************************************************************
;* LOOKUP TABLE FOR SPECIAL CHARACTERS TYPED WITH SHIFT BUTTON ACTIVE *
;**********************************************************************
ORG 0x230
;******************************
_MLOOP btfsc KBDflag ; check scan pattern reception flag
call KBDdecode ; if set, call decoding routine
goto _MLOOP
;******************************
;ORG 0x310
WelcomeTable
addwf PCL,F ; add offset to table base pointer
DT "PIC 16F84 AT Keyboard Decoder connecte" ; create table
WTableEND DT "d"
END
:020000040000FA
:10000000831603138101C02A8B138B1B04289700CE
:10001000030E980083010A0899008A0183130408DB
:100020009A00931F37281B08073C031C1D281C1C23
:1000300005121C1805169C0C65281B08083C031C9F
:100040002628141C05121418051665281B08093CDF
:10005000031C302883160313051683120313652827
:100060001B080B3C031C65289B01931366289B0807
:10007000031D3D28051A622865281B08083C031C3F
:100080004928051E9C13051A9C17031965289C0C0A
:1000900065281B08093C031C4E286528051E62289C
:1000A00094185B2813178316031306108312031387
:1000B00006100B1263280F081C02031D62289410FF
:1000C0009B0166289C019B0166289B0A8B101A08DD
:1000D000840019088A00180E8300970E170E090075
:1000E0001C089D00F03C031D782813141311072AE7
:1000F000131C902913101C08123C031982281C0899
:10010000593C031993101C08583C031DA728931D44
:1001100098289311ED309C004A213121FA30572163
:100120001E111E089C004A213121FA305721072A4E
:100130009315ED309C004A213121FA3057211E15CC
:100140001E089C004A213121FA305721072A1C0839
:10015000113C031DAD281312482A1C08143C031D32
:06016000072A93127F2A1A
:100180008C00810183160313C030810508008C00A8
:10019000810183160313C03081050130810483126D
:1001A00003130B110B1DD2288C0BD12808009500CE
:1001B000051008308C00E82015180514151C0510D2
:1001C000950CE8208C0BDC280514E820E8200800BA
:1001D0001D308D00EE2808308D00EE288D0BEE28A6
:1001E0000800960166288E00E13086050E0D1E3946
:1001F000860408009415FD2894118F001621941D83
:1002000086170F080F0EF3200D210F08F3200D2184
:10021000E130860586130613080086160000861254
:10022000080018308E008E0B132908008613141551
:10023000831603131E30860483120313061700006F
:1002400086161121061E1411861211210D21141972
:100250002029061383160313E13086058312031346
:1002600008000B12831603130610051283120313E2
:100270000610051220308C008C0B3C299B01831644
:10028000031306148312031393178B100B16931B7F
:10029000472908008E0008308F0090010E18900A40
:1002A0008E0C8F0B4E291410101C141408008F0094
:1002B000941494185929080028309F00141E6B29A3
:1002C0008030FA2014122030FC209F0B63298030EC
:1002D000FA209F010800C030FA2014162030FC20BC
:0C02E0009F0B6E29C030FA209F0108001F
:10032000131DA229131AA229931AA2291C084A3CB8
:10033000031D9D292F309C00D6291C085A3C031808
:10034000A229072A1C08613C0318B8290E309C0218
:100350001C08613C031CAF2919309C07B8291C08F4
:10036000773C0318B8291C08D23C03191315072A37
:1003700003308A001C0861239C009C080319072A8B
:10038000131A2B2A931A192A1C08603C0318982A5E
:100390001C087A3C031C982A1C089319D229931C28
:1003A000D629D4299318D629E03E9C001C08D720D2
:1003B0001C08083C031DEB291F08031D9F031F0891
:1003C000141EE329403E80389100FA202030FC20A2
:1003D0001108FA20072A1C08093C031DF8291F08E8
:1003E000263C031CF6292030FC209F0A20309C006C
:1003F0001F08273C0318FD295C219F0A1C08FC20CC
:10040000072A5C210D30D7200A30D720003483160C
:10041000031306148312031313130B16080093140B
:1004200000341316142A9316A001A101A201A301FE
:1004300000341C08403C03182B2A1C08463C031CB3
:10044000232A9C16332A1C08603C03182B2A1C08FC
:10045000663C0318332A1C08293C0318072A1C0889
:10046000393C031C072AA008031D3A2AA00A1C08CD
:10047000A100072A200B402AA00A1C08A200072A74
:100480002008023C031D072AA00A1C08A300072A13
:10049000A0080319072A3030A102A202A302A00378
:1004A000031D552A21089C006F2AA003031D5F2A03
:1004B00002308A002108712222079C006F2A21083D
:1004C000023C031C072A02308A0021080A3E7122DE
:1004D000A10022087122A107230821079C00A00186
:1004E000D629820700340A3414341E3428343234B6
:1004F0003C34463450345A3400346434C834A00890
:100500000319072A3030A102A202A11E892A27302E
:10051000A102A21E8D2A2730A202A003031D932A46
:1005200021089C00962A210E22049C00A001D629B5
:10053000931CD6291C080D3C0318D6291D08613CC4
:10054000031CD6291D083C3C0318A92A3D309D02F6
:10055000B22A1D08243C0318B02A23309D02B22A77
:1005600004309D0703308A001D08DA239C00D62939
:1005800005108312031305148316031306140516AE
:100590000113831203130B16831603130130860510
:1005A00083120313861206138613E1308605043086
:1005B000C7200330F3200D210130C7200830F3207D
:1005C0000D210130C7200230F3200D210130C7205A
:1005D0002830FA200C30FA200130FA200830C720E9
:1005E00028309F00F8308B058B1702309E009B014E
:1005F000930194012730910003308A001108273CB1
:100600002F239200D7201208FC20910BFC2A0D30DA
:10061000D7200A30D7200A30D720FF309C004A214B
:100620003121FA305721ED309C004A213121FA3036
:1006300057211E089C004A213121FA305721ED3004
:100640009C004A213121FA3057211E141E089C00BB
:100650004A213121FA305721131B70202C2B82079D
:100660005034493443342034313436344634383409
:10067000343420344134543420344B3465347934A8
:1006800062346F34613472346434203444346534F9
:1006900063346F34643465347234203463346F34BB
:0E06A0006E346E3465346334743465346434FF
:0E06C200820700343934003435343334313497
:1006D000323432340034303438343634343409343B
:1006E0007E3400340034112A0F2A0034132A713466
:1006F00031340034003400347A3473346134773464
:10070000323400340034633478346434653434343F
:100710003334003400342034763466347434723424
:100720003534003400346E346234683467347934DC
:1007300036340034003400346D346A347534373460
:100740003834003400342C346B3469346F34303432
:100750003934003400342E343F346C343B3470343C
:100760002D34003400340034273400345B342B340F
:100770000034003400340F2A012A5D3400347C3404
:100780000034003400343C3430342E3432343534C8
:10079000363438340034003431342B3433342D348F
:1007A0002A343934003408340034003431343734D6
:1007B00034343734820726342A34243423343C3406
:1007C00000340034003429342834003425343E34D5
:1007D0002F3400343A3400345F3460345E340034F3
:1007E000223400347B343D3400342134003400346E
:1007F00000347D3400345C340034403400343E3402
:02400E00F13F80
:00000001FF
:020000040000FA
:10000000831603138101C02A8B138B1B04289700CE
:10001000030E980083010A0899008A0183130408DB
:100020009A00931F37281B08073C031C1D281C1C23
:1000300005121C1805169C0C65281B08083C031C9F
:100040002628141C05121418051665281B08093CDF
:10005000031C302883160313051683120313652827
:100060001B080B3C031C65289B01931366289B0807
:10007000031D3D28051A622865281B08083C031C3F
:100080004928051E9C13051A9C17031965289C0C0A
:1000900065281B08093C031C4E286528051E62289C
:1000A00094185B2813178316031306108312031387
:1000B00006100B1263280F081C02031D62289410FF
:1000C0009B0166289C019B0166289B0A8B101A08DD
:1000D000840019088A00180E8300970E170E090075
:1000E0001C089D00F03C031D782813141311072AE7
:1000F000131C902913101C08123C031982281C0899
:10010000593C031993101C08583C031DA728931D44
:1001100098289311ED309C004A213121FA30572163
:100120001E111E089C004A213121FA305721072A4E
:100130009315ED309C004A213121FA3057211E15CC
:100140001E089C004A213121FA305721072A1C0839
:10015000113C031DAD281312482A1C08143C031D32
:06016000072A93127F2A1A
:100180008C00810183160313C030810508008C00A8
:10019000810183160313C03081050130810483126D
:1001A00003130B110B1DD2288C0BD12808009500CE
:1001B000051008308C00E82015180514151C0510D2
:1001C000950CE8208C0BDC280514E820E8200800BA
:1001D0001D308D00EE2808308D00EE288D0BEE28A6
:1001E0000800960166288E00E13086050E0D1E3946
:1001F000860408009415FD2894118F001621941D83
:1002000086170F080F0EF3200D210F08F3200D2184
:10021000E130860586130613080086160000861254
:10022000080018308E008E0B132908008613141551
:10023000831603131E30860483120313061700006F
:1002400086161121061E1411861211210D21141972
:100250002029061383160313E13086058312031346
:1002600008000B12831603130610051283120313E2
:100270000610051220308C008C0B3C299B01831644
:10028000031306148312031393178B100B16931B7F
:10029000472908008E0008308F0090010E18900A40
:1002A0008E0C8F0B4E291410101C141408008F0094
:1002B000941494185929080028309F00141E6B29A3
:1002C0008030FA2014122030FC209F0B63298030EC
:1002D000FA209F010800C030FA2014162030FC20BC
:0C02E0009F0B6E29C030FA209F0108001F
:10032000131DA229131AA229931AA2291C084A3CB8
:10033000031D9D292F309C00D6291C085A3C031808
:10034000A229072A1C08613C0318B8290E309C0218
:100350001C08613C031CAF2919309C07B8291C08F4
:10036000773C0318B8291C08D23C03191315072A37
:1003700003308A001C0861239C009C080319072A8B
:10038000131A2B2A931A192A1C08603C0318982A5E
:100390001C087A3C031C982A1C089319D229931C28
:1003A000D629D4299318D629E03E9C001C08D720D2
:1003B0001C08083C031DEB291F08031D9F031F0891
:1003C000141EE329403E80389100FA202030FC20A2
:1003D0001108FA20072A1C08093C031DF8291F08E8
:1003E000263C031CF6292030FC209F0A20309C006C
:1003F0001F08273C0318FD295C219F0A1C08FC20CC
:10040000072A5C210D30D7200A30D720003483160C
:10041000031306148312031313130B16080093140B
:1004200000341316142A9316A001A101A201A301FE
:1004300000341C08403C03182B2A1C08463C031CB3
:10044000232A9C16332A1C08603C03182B2A1C08FC
:10045000663C0318332A1C08293C0318072A1C0889
:10046000393C031C072AA008031D3A2AA00A1C08CD
:10047000A100072A200B402AA00A1C08A200072A74
:100480002008023C031D072AA00A1C08A300072A13
:10049000A0080319072A3030A102A202A302A00378
:1004A000031D552A21089C006F2AA003031D5F2A03
:1004B00002308A002108712222079C006F2A21083D
:1004C000023C031C072A02308A0021080A3E7122DE
:1004D000A10022087122A107230821079C00A00186
:1004E000D629820700340A3414341E3428343234B6
:1004F0003C34463450345A3400346434C834A00890
:100500000319072A3030A102A202A11E892A27302E
:10051000A102A21E8D2A2730A202A003031D932A46
:1005200021089C00962A210E22049C00A001D629B5
:10053000931CD6291C080D3C0318D6291D08613CC4
:10054000031CD6291D083C3C0318A92A3D309D02F6
:10055000B22A1D08243C0318B02A23309D02B22A77
:1005600004309D0703308A001D08DA239C00D62939
:1005800005108312031305148316031306140516AE
:100590000113831203130B16831603130130860510
:1005A00083120313861206138613E1308605043086
:1005B000C7200330F3200D210130C7200830F3207D
:1005C0000D210130C7200230F3200D210130C7205A
:1005D0002830FA200C30FA200130FA200830C720E9
:1005E00028309F00F8308B058B1702309E009B014E
:1005F000930194012730910003308A001108273CB1
:100600002F239200D7201208FC20910BFC2A0D30DA
:10061000D7200A30D7200A30D720FF309C004A214B
:100620003121FA305721ED309C004A213121FA3036
:1006300057211E089C004A213121FA305721ED3004
:100640009C004A213121FA3057211E141E089C00BB
:100650004A213121FA305721131B70202C2B82079D
:100660005034493443342034313436344634383409
:10067000343420344134543420344B3465347934A8
:1006800062346F34613472346434203444346534F9
:1006900063346F34643465347234203463346F34BB
:0E06A0006E346E3465346334743465346434FF
:0E06C200820700343934003435343334313497
:1006D000323432340034303438343634343409343B
:1006E000A73400340034112A0F2A0034132A71343D
:1006F0003134003400340034793473346134773465
:10070000323400340034633478346434653434343F
:100710003334003400342034763466347434723424
:100720003534003400346E346234683467347A34DB
:1007300036340034003400346D346A347534373460
:100740003834003400342C346B3469346F34303432
:100750003934003400342E342D346C34F634703493
:100760002734003400340034E4340034FC345E3484
:100770000034003400340F2A012A21340034243498
:100780000034003400343C3430342E3432343534C8
:10079000363438340034003431342B3433342D348F
:1007A0002A343934003408340034003431343734D6
:1007B0003434373482072F34283423342A343B34FA
:1007C0000034003400343D342934003425343A34C4
:1007D0005F3400345C3400343F3440342634003419
:1007E0007B3400345B347E3400342B3400340034EA
:1007F00000345D3400347D340034223400343E341F
:02400E00F13F80
:00000001FF
PIC16F84 MAX232
VDD
D XT1 D
R1 VDD
VSS
10k C1 4.000 MHz C2 C4
C3
10p 10p 10u
S1 VDD 10u
VSS VSS
16
SW-PB
2
6
14
C5 U2
U1
13 12
V+
VCC
V-
16 15 R1 IN R1 OUT
VDD
VSS 4n7 OSC1/CLKIN OSC2/CLKOUT RS232 8 9 5V
4 7 D4 R2 IN R2 OUT
MCLR RB1 11 14
17 8 D5 PIC TXD T1 IN T1 OUT RS232 RXD
PIC TXD RA0 RB2 5V 10 7 RS232
18 9 D6 T2 IN T2 OUT
C RA1 RB3 1 4 C
GND
1 10 D7 C1+ C2+
RA2 RB4 3 5
2 11 E C1 - C2 -
RA3 RB5
3 12 R/W
KBD_Data RA4/T0CKI VSS RB6 C6 MAX232CPE(16) C7
6 13 RS
KBD_Clk RB0/INT RB7 10u 10u
15
PIC16F84-04/P(18)
5
VSS
VDD
VDD
VSS SUB1 VDD
C8
5
100n VSS VDD
B
VSS
LCD D4
D4 RS232 9
4 C9 B
VSS D5
LCD D5 8 100n
(Direction seen from host) VSS
D6 3
VDD LCD D6
7 VSS
D7
LCD D7 2
RS232 RXD
PS/2 Connector R2 LCD E
E 6
1
10k R/W
R3 LCD R/W
J1
10k RS DB9
LCD RS
1 KBD_Data
2
3 VSS Title
Dot Matrix LCD Display
4 VDD AT Keyboard Interface with PIC16F84
5 KBD_Clk (HD44780 compatible)
A 6 A
Written by Date
16-Aug-2003
CON6 Peter Luethi
Revision Page
Dietikon, Switzerland 2.03 1 of 1
1 2 3 4
http://www.trash.net/~luethi/microchip/projects/keyboard/v3xx/kbd_3xx.asm
;***************************************************************************
;
; AT Keyboard Interface V3.05 (with LCD Display)
; ===============================================
;
; written by Peter Luethi, 04.01.2001, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 17.04.2004
;
; V3.05: Added LCDcflag (LCD command/data flag) to comply with
; latest LCD modules. Changed controller type to flash
; device, i.e. PIC16F77.
; (17.04.2004)
;
; V3.04: Fixed issue in RS232 hardware reception service routine.
; Reads now both data bytes out of double-buffered RX FIFO.
; Tries to eliminate some sporadic reception hangs under
; heavy full-duplex traffic scenarios.
; In case of FIFO overrun errors in the USART receive logic,
; the service routine performs a partial reset of the USART
; receive logic. No specific error handling for RS232
; reception framing errors.
; (17.10.2003)
;
; V3.03: Improved AT keyboard and RS232 initialization,
; fixed RBIF/INTF interrupt initialization issue.
; Changed keyboard data pin to PORTA,4 (open-collector).
; Fixed ALT-DEC and CTRL-HEX issue on right side keys.
; Added special LCD treatment for 'tabulator' key.
; (14.08.2003)
;
; V3.02: Implemented support for ASCII conversion from direct ALT-DEC
; and CTRL-HEX entries. Accepts both keypad and keyboard
; numbers, as well as upper and lower case letters [a..f].
; (03.01.2002)
;
; V3.01: Made forward compatible (yes, this is feasible) by
; implementing/completing ALT and CTRL flags. Added
; labels to support non-implemented ALT and CTRL
; enhancements. (02.01.2002)
;
; V3.00: Initial release (04.01.2001)
;
; DESCRIPTION:
; ============
; Developed and tested on Microchip PIC 16F77, previously on PIC 16C74A.
;
; Any key stroke on the keyboard connected to the PIC will send the
; corresponding scan code from the keyboard to the microcontroller.
; Afterwards, the microcontroller converts the keyboard scan code to
; ASCII characters and transmits them to the personal computer across
; the RS232 link.
; Visualization of received data on the first line, user-entered data
; on the second line of the dot matrix LCD display. This routine is
; best used with a 2 line by 20 or 40 characters LCD display.
; This program features also the capability of bi-directional
; communication between controller and keyboard for configuration
; purposes and to control the keyboard LEDs.
;
; The keyboard scan pattern capture and decoding is done by an
; interrupt service routine. The event, which triggers the interrupt
; is a falling edge on the keyboard clock line at the KBDclkpin
; (PORTB,0). The keyboard data (scan code) will be fetched at the
; KBDdatapin (PORTA,4). The configuration of the KBDclkpin interrupt
; is done by the KEYBOARDinit macro.
;
; RS232 data exchange is carried out by using the internal USART of
; the PIC 16C74A. RS232 data reception is done on an interrupt
; based acquisition scheme, provided by the USART.
;
; For the AT keyboard layout, English and modified Swiss-German
; 'codepages' are supported:
; QWERTY and QWERTZ keyboard layout
;
;
; IMPLEMENTED FEATURES:
; =====================
; - Bi-directional communication between microcontroller application
; and remote RS232 client.
; - Bi-directional communication between microcontroller and keyboard.
; - Bi-directional communication between microcontroller and LCD
; display.
; - Visualization of received and transmitted characters on local LCD.
; - Parametrizable LCD display width: constant 'LCDwidth'
; - Support for all keyboard characters typed with shift button active
; and inactive.
; - English and modified Swiss-German 'codepages' available
PROCESSOR 16F77
#include "p16f77.inc"
;PROCESSOR 16C74A
;#include "p16c74a.inc"
ORG 0x100
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
#include "..\..\m_lcd_bf.asm"
KEYBOARDinit macro
BANK1
bsf KBDclktris ; set keyboard clock line to input explicitely
bsf KBDdatatris ; set keyboard data line to input explicitely
bcf OPTION_REG,INTEDG ; keyboard interrupt on falling edge
BANK0
bsf INTCON,INTE ; enable RB0/INT interrupts
endm
RS232init macro
BANK1 ; Asynchronous USART assignment:
bsf TXSTA,BRGH ; BRGH = 1
movlw d'25' ; baud rate assignment: 9600 baud
movwf SPBRG
BANK0
bsf RCSTA,SPEN ; enable serial port
BANK1
bsf PIE1,RCIE ; enable serial reception interrupt
bsf TXSTA,TXEN ; enable serial transmission
BANK0
bsf INTCON,PEIE ; enable peripheral interrupts
bsf RCSTA,CREN ; enable continuous reception
endm
SENDw macro
call _RSxmit
endm
KBDexp macro _KBDresp ; keyboard expect function: busy wait for kbd response
movlw _KBDresp ; load expected kbd response
call KBDexpt
endm
_RSxmit BANK1
_RSbusy btfss TXSTA,TRMT ; check, if previous transmission
goto _RSbusy ; has been terminated
BANK0
movwf TXREG ; send next char
RETURN
KBDexpt ;*** keyboard expect function: busy wait for kbd response ***
movwf KBDexpval ; load expected kbd response to KBDexpval
bsf KBDexpf ; set flag
_KBDexp btfsc KBDexpf ; wait loop: poll for completion
goto _KBDexp ; not yet completed, loop
RETURN
RSdisplay ;*** LCD display routine for received RS232 characters ***
; first byte in RXreg
movfw RXreg ; retrieve data
movwf RXtemp ; store data
call _RSdisp ; call output subroutine
btfss RX2flag ; check for second data byte received
goto RSdispEND
; second byte in RXreg2, i.e. RX2flag = 1
movfw RXreg2 ; retrieve data
movwf RXtemp ; store data
call _RSdisp ; call output subroutine
bcf RX2flag ; reset flag
btfss RCSTA,OERR ; check for RX overrun (overrun error bit)
goto RSdispEND
; buffer overrun, severe error, reset USART RX logic
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
;******************************
;*** RS232 DATA ACQUISITION ***
;******************************
_ISR_RS232
movfw RCREG ; get RS232 data (first RX FIFO entry)
movwf RXreg ; store first data byte
btfss PIR1,RCIF ; check flag for second RX FIFO entry
goto _ISR_RS232_A ; no second byte received, branch
movfw RCREG ; get RS232 data (second RX FIFO entry)
movwf RXreg2 ; store second data byte
bsf RX2flag ; set flag to indicate second byte received
_ISR_RS232_A
bsf RSflag ; enable RS232 data reception flag
BANK1 ; (for display routine)
bcf PIE1,RCIE ; disable USART reception interrupt
BANK0 ; (will be re-enabled in normal subroutine)
goto _RS232end ; exit ISR
;****************************
;*** AT KEYBOARD DECODING ***
;****************************
_ISR_KBD ;*** check origin of keyboard interrupt ***
btfss KBDtxf ; check keyboard TX flag
goto _ISR_KBDacq ; if cleared, keyboard data acquisition,
;goto _ISR_KBDxmit ; else keyboard data transmission
;******************************************
;*** HOST TO KEYBOARD DATA TRANSMISSION ***
;******************************************
_ISR_KBDxmit
;*** data transmission ***
movfw KBDcnt ; get kbd scan pattern acquisition counter
sublw d'7' ; w = d'7' - KBDcnt (*)
bnc _KBDparo ; branch if negative (carry == 0)
btfss KBD,0x00 ; serial transmission of keyboard data
bcf KBDdatapin
btfsc KBD,0x00
bsf KBDdatapin
rrf KBD,F ; rotate right keyboard TX data register
goto _INCF ; exit
;*** data and parity transmission completed, turn around cycle ***
_KBDrel movfw KBDcnt ; get kbd scan pattern acquisition counter
sublw d'9' ; w = d'9' - KBDcnt
bnc _KBDack ; branch if negative (carry == 0)
BANK1
bsf KBDdatatris ; release keyboard data line, set to input
BANK0
goto _INCF ; exit
;*****************************************
;*** KEYBOARD SCAN PATTERN ACQUISITION ***
;*****************************************
_ISR_KBDacq
;*** check start bit ***
tstf KBDcnt ; check
bnz _KBDdat ; branch on no zero
btfsc KBDdatapin ; test start bit of keyboard data input
goto _KBDabort ; no valid start bit, abort
goto _INCF ; exit
;***********************************
;*** CLEARING OF INTERRUPT FLAGS ***
;***********************************
; NOTE: Below, I only clear the interrupt flags! This does not
; necessarily mean, that the interrupts are already re-enabled.
; Basically, interrupt re-enabling is carried out at the end of
; the corresponding service routine in normal operation mode.
; The flag responsible for the current ISR call has to be cleared
; to prevent recursive ISR calls. Other interrupt flags, activated
; during execution of this ISR, will immediately be served upon
; termination of the current ISR run.
_INCF incf KBDcnt,F ; increment acquisition counter
_KBDend bcf INTCON,INTF ; clear RB0/INT interrupt flag
;goto ISRend ; terminate execution of ISR
_RS232end
;bcf PIR1,RCIF ; cleared by hardware: USART RX interrupt flag
;goto ISRend ; terminate execution of ISR
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
KBDdecode
;**********************************************************
;*** KEYBOARD SCAN CODE PRE-DECODING, SET / CLEAR FLAGS ***
;**********************************************************
;****************************************************
;* The following table has to be located within one *
;* page to allow for correct lookup functionality. *
;* Therefore, additional ISR code has been moved *
;* further down. *
;****************************************************
;*********************************************************************
;* LOOKUP TABLE FOR KEYBOARD-SCAN-CODE TO ASCII-CHARACTER CONVERSION *
;*********************************************************************
;****************************************************
;* The following code belongs also to the interrupt *
;* service routine and has been moved down to this *
;* place to allow the main keyboard decode lookup *
;* table to be located within one page. *
;* The code below may be arranged on another page, *
;* but that doesn't matter. *
;****************************************************
;********************************
;*** SCAN CODE RANGE CHECKING ***
;********************************
_KBD_2 ;*** check if special code (0xE0) has been submitted previously ***
btfss SPEflag
goto _KBD_3
;*** decoding of scan code with preceding special code (0xE0) ***
;*******************************************************
;*** SCAN CODE DECODING & ASCII CHARACTER CONVERSION ***
;*******************************************************
;***************************************************
;*** KEYBOARD DATA OUTPUT TO RS232 & LCD DISPLAY ***
;***************************************************
;************************************************
;*** SPECIAL COMMANDS I (with special output) ***
;************************************************
;**********************************************************
;*** STALL RELEASE & CLEAR KEYBOARD DATA RECEPTION FLAG ***
;**********************************************************
_ClrStall
BANK1
bsf KBDclktris ; set clk line back to input (and goes high)
BANK0 ; (release stall)
bcf KBDflag ; clear keyboard data reception flag
bsf INTCON,INTE ; re-enable interrupt RB0/INT
RETURN
;****************************************************
;*** SPECIAL COMMANDS II (without special output) ***
;****************************************************
;***********************************************
;*** ALT-DEC & CTRL-HEX STORING & CONVERSION ***
;***********************************************
; store typed numbers in CTRLreg1 - CTRLreg3
;*******************************************************
;* The following table has also to be located within *
;* one page to allow for correct lookup functionality. *
;*******************************************************
;ORG 0x??
;*****************************************************************
;*** SCAN CODE DECODING & ASCII CONVERSION FOR 'SHIFT' ENTRIES ***
;*****************************************************************
_SHICHR ;*** special character decoding typed with shift button active ***
; check for active shift button, if not active, branch
btfss SHIflag
goto _OUTP ; branch
; check for 'backspace', 'tab', 'linefeed' and 'carriage return' :
; (here, KBD has already been converted to ASCII character values)
movfw KBD
sublw d'13' ; d'13' - w
bc _OUTP ; carry if result zero or positive, branch
;*******************************************************
;* The following table has also to be located within *
;* one page to allow for correct lookup functionality. *
;*******************************************************
;**********************************************************************
;* LOOKUP TABLE FOR SPECIAL CHARACTERS TYPED WITH SHIFT BUTTON ACTIVE *
;**********************************************************************
BANK1
clrf OPTION_REG ; PORTB pull-ups enabled
goto _MAIN
ORG 0x440
movlw LCDwidth
movwf LCDpos1 ; init LCD output position counters
clrf LCDpos2
;******************************
_MLOOP btfsc KBDflag ; check scan pattern reception flag
call KBDdecode ; if set, call decoding routine
btfsc RSflag ; check RS232 data reception flag
call RSdisplay ; if set, call display routine
goto _MLOOP
;******************************
WelcomeTable
addwf PCL,F ; add offset to table base pointer
DT "PIC 16F77 AT Keyboard Decoder connecte" ; create table
WTableEND DT "d"
END
;***************************************************************************
;
; AT Keyboard Interface V3.01 (with LCD Display)
; ===============================================
;
; written by Peter Luethi, 4.1.2001, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 17.04.2004
;
; V3.01b: Added LCDcflag (LCD command/data flag) to comply with
; latest LCD modules. Changed controller type to flash
; device, i.e. PIC16F77.
; (17.04.2004)
;
; V3.01: Made forward compatible (yes, this is feasible) by
; implementing/completing ALT and CTRL flags. Added
; labels to support non-implemented ALT and CTRL
; enhancements. (2.1.2002)
;
; V3.00: Initial release (4.1.2001)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F77 (16C74A)
; Clock Frequency: 4.00 / 8.00 MHz XT
; Throughput: 1 / 2 MIPS
; RS232 Baud Rate: 9600 / 19200 baud with BRGH = 1
; Keyboard Routine Features: Capability of bi-directional
; communication between controller
; and keyboard (keys & LEDs)
; Acquisition Methodology: Preemptive, interrupt-based
; keyboard scan pattern acquisition
; routine, with decoding to ASCII
PROCESSOR 16F77
#include "p16f77.inc"
;PROCESSOR 16C74A
;#include "p16c74a.inc"
ORG 0xC0
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
#include "..\..\m_lcd_bf.asm"
KEYBOARDinit macro
BANK1
bsf KBDclktris ; set input with weak pull-up
bsf KBDdatatris ; set input with weak pull-up
bcf OPTION_REG,INTEDG ; keyboard interrupt on falling edge
BANK0
movlw b'10010000'
iorwf INTCON,F ; enable global & RB0/INT interrupts
bcf INTCON,RBIF ; clear uninitialized RBIF flag
endm
RS232init macro
BANK1 ; Asynchronous USART assignment:
bsf TXSTA,BRGH ; BRGH = 1
movlw d'25' ; baud rate assignment: 9600 baud
movwf SPBRG
BANK0
bsf RCSTA,SPEN ; enable serial port
BANK1
bsf PIE1,RCIE ; enable serial reception interrupt
bsf TXSTA,TXEN ; enable serial transmission
BANK0
movlw b'11000000' ; enable gobal and peripheral interrupts
iorwf INTCON,F
SENDw macro
call _RSxmit
endm
KBDexp macro _KBDresp ; keyboard expect function: busy wait for kbd response
movlw _KBDresp ; load expected kbd response
call KBDexpt
endm
_RSxmit BANK1
_RSbusy btfss TXSTA,TRMT ; check, if previous transmission
goto _RSbusy ; has been terminated
BANK0
movwf TXREG ; send next char
RETURN
BANK0
bcf KBDclkpin ; set keyboard clk line low
bcf KBDdatapin ; set keyboard data line low
movlw 0x20 ; load temporary counter
movwf TEMP1
_KBDtx1 decfsz TEMP1,F ; wait loop: approx. 60 us @ 4 MHz
goto _KBDtx1
clrf KBDcnt ; init kbd scan pattern acquisition counter
BANK1
bsf KBDclktris ; release keyboard clk line, set to input
BANK0
bsf KBDtxf ; set keyboard TX flag
bcf INTCON,INTF ; clear RB0/INT interrupt flag
bsf INTCON,INTE ; re-enable RB0/INT interrupt
_KBDtx2 btfsc KBDtxf ; wait loop: poll for completion
goto _KBDtx2 ; not yet completed, loop
RETURN
KBDexpt ;*** keyboard expect function: busy wait for kbd response ***
movwf KBDexpval ; load expected kbd response to KBDexpval
bsf KBDexpf ; set flag
_KBDexp btfsc KBDexpf ; wait loop: poll for completion
goto _KBDexp ; not yet completed, loop
RETURN
RSdisp ;*** LCD display routine for received RS232 characters ***
movfw LCDpos1 ; get LCD position counter
sublw LCDwidth - 1 ; w = LCDwidth - 1 - w
bc _RSdsp1 ; branch if res positive or zero
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
;******************************
;*** RS232 DATA ACQUISITION ***
;******************************
_ISR_RS232
movfw RCREG ; get RS232 data
movwf RXreg
bsf RSflag ; enable RS232 data reception flag
BANK1 ; (for display routine)
bcf PIE1,RCIE ; disable USART reception interrupt
BANK0 ; (will be re-enabled in normal subroutine)
goto _RS232end ; exit
;******************************************
;*** HOST TO KEYBOARD DATA TRANSMISSION ***
;******************************************
_ISR_KBDxmit
;*** data transmission ***
movfw KBDcnt ; get kbd scan pattern acquisition counter
sublw d'7' ; w = d'7' - KBDcnt (*)
bnc _KBDparo ; branch if negative (carry == 0)
btfss KBD,0x00 ; serial transmission of keyboard data
bcf KBDdatapin
btfsc KBD,0x00
bsf KBDdatapin
rrf KBD,F ; rotate right keyboard TX data register
goto _INCF ; exit
;*** data and parity transmission completed, turn around cycle ***
_KBDrel movfw KBDcnt ; get kbd scan pattern acquisition counter
sublw d'9' ; w = d'9' - KBDcnt
bnc _KBDack ; branch if negative (carry == 0)
BANK1
bsf KBDdatatris ; release keyboard data line, set to input
BANK0
goto _INCF ; exit
;*****************************************
;*** KEYBOARD SCAN PATTERN ACQUISITION ***
;*****************************************
_ISR_KBDacq
;*** check start bit ***
tstf KBDcnt ; check
bnz _KBDdat ; branch on no zero
btfsc KBDdatapin ; test start bit of keyboard data input
goto _KBDabort ; no valid start bit, abort
goto _INCF ; exit
;***********************************
;*** CLEARING OF INTERRUPT FLAGS ***
;***********************************
; NOTE: Below, I only clear the interrupt flags! This does not
; necessarily mean, that the interrupts are already re-enabled.
; Basically, interrupt re-enabling is carried out at the end of
; the corresponding service routine in normal operation mode.
; The flag responsible for the current ISR call has to be cleared
; to prevent recursive ISR calls. Other interrupt flags, activated
; during execution of this ISR, will immediately be served upon
; termination of the current ISR run.
_RS232end
bcf PIR1,RCIF ; clear USART RX interrupt flag
goto ISRend ; terminate execution of ISR
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
KBDdecode
;**********************************************************
;*** KEYBOARD SCAN CODE PRE-DECODING, SET / CLEAR FLAGS ***
;**********************************************************
;****************************************************
;* The following table has to be located within one *
;* page to allow for correct lookup functionality. *
;* Therefore, additional ISR code has been moved *
;* further down. *
;****************************************************
;*********************************************************************
;* LOOKUP TABLE FOR KEYBOARD-SCAN-CODE TO ASCII-CHARACTER CONVERSION *
;*********************************************************************
;****************************************************
;* The following code belongs also to the interrupt *
;* service routine and has been moved down to this *
;* place to allow the main keyboard decode lookup *
;* table to be located within one page. *
;* The code below may be arranged on another page, *
;* but that doesn't matter. *
;****************************************************
;********************************
;*** SCAN CODE RANGE CHECKING ***
;********************************
_KBD_2 ;*** check if special code (0xE0) has been submitted previously ***
btfss SPEflag
goto _KBD_3
;*** decoding of scan code with preceeding special code (0xE0) ***
; (decoding currently only necessary for 'E0 4A' = '/')
movfw KBD
sublw 0x4A ; 0x4A - w
bnz _NOSUP ; branch on non-zero
movlw '/' ; store '/' in KBD
movwf KBD
goto _OUTP
_NOSUP ;*** check if scan code 0x5A or smaller has occurred ***
movfw KBD
sublw 0x5A ; 0x5A - w
bc _KBD_3 ; carry if result positive or zero, branch
;*** range exceeded (above 0x5A) ***
; it's one of the following keys: arrow button, 'Home', 'Del',
; 'PageUp', 'PageDown', 'Insert', 'End'
; these keys are currently not used, so
goto _ClrStall
_KBD_3 ;*** check if scan code 0x61 or smaller has occurred ***
movfw KBD
sublw 0x61 ; 0x61 - w
bc KBD_dec ; carry if result positive or zero, goto table
movlw d'14'
subwf KBD,F ; KBD = KBD - d'14'
;*** check if scan code 0x61 (0x6F-d'14') or smaller has occurred ***
movfw KBD
sublw 0x61 ; 0x61 - w
bnc _KBD_4 ; no carry if result negative, goto _KBD_4
movlw d'25'
addwf KBD,F ; KBD = KBD + d'25'
goto KBD_dec
_KBD_4 ;*** check if scan code 0x78 (0x86 - d'14') or higher has occurred ***
movfw KBD
sublw 0x77 ; 0x77 - w
bc KBD_dec ; carry if result zero or positive, branch
;*** no character to display: ***
;*** check for special code (0xE0): 0xD2 = 0xE0 - d'14' ***
movfw KBD
sublw 0xD2 ; 0xD2 - w
skpnz ; skip if not zero
bsf SPEflag ; special code occurred, set flag
goto _ClrStall ; abort with nothing to display
;*******************************************************
;*** SCAN CODE DECODING & ASCII CHARACTER CONVERSION ***
;*******************************************************
;***************************************************
;*** KEYBOARD DATA OUTPUT TO RS232 & LCD DISPLAY ***
;***************************************************
;************************************************
;*** SPECIAL COMMANDS I (with special output) ***
;************************************************
;**********************************************************
;*** STALL RELEASE & CLEAR KEYBOARD DATA RECEPTION FLAG ***
;**********************************************************
_ClrStall
BANK1
bsf KBDclktris ; set clk line back to input (and goes high)
BANK0 ; (release stall)
bcf KBDflag ; clear keyboard data reception flag
bsf INTCON,INTE ; re-enable interrupt RB0/INT
RETURN
;****************************************************
;*** SPECIAL COMMANDS II (without special output) ***
;****************************************************
;***********************************************
;*** ALT-DEC & CTRL-HEX STORING & CONVERSION ***
;***********************************************
; store typed numbers in CTRLreg1 - CTRLreg3
_CTRLstr ; /not implemented, enhancement/
_ALTstr ; /not implemented, enhancement/
;*****************************************************************
;*** SCAN CODE DECODING & ASCII CONVERSION FOR 'SHIFT' ENTRIES ***
;*****************************************************************
_SHICHR ;*** special character decoding typed with shift button active ***
; check for active shift button, if not active, branch
btfss SHIflag
goto _OUTP ; branch
; check for 'backspace', 'tab', 'linefeed' and 'carriage return' :
; (here, KBD has already been converted to ASCII character values)
movfw KBD
sublw d'13' ; d'13' - w
bc _OUTP ; carry if result zero or positive, branch
;*******************************************************
;* The following table has also to be located within *
;* one page to allow for correct lookup functionality. *
;*******************************************************
;**********************************************************************
;* LOOKUP TABLE FOR SPECIAL CHARACTERS TYPED WITH SHIFT BUTTON ACTIVE *
;**********************************************************************
BANK1
clrf OPTION_REG ; INTEDG bit cleared => INTB on falling edge
goto _MAIN
ORG 0x1A0
;******************************
_MLOOP btfsc KBDflag ; check scan pattern reception flag
call KBDdecode ; if set, call decoding routine
btfsc RSflag ; check RS232 data reception flag
call RSdisp ; if set, call display routine
goto _MLOOP
;******************************
WelcomeTable
addwf PCL,F ; add offset to table base pointer
DT "PIC 16C74A AT Keyboard Decoder connecte" ; create table
WTableEND DT "d"
END
:020000040000FA
:10000000831603138101402C8B138B1B0428AD0036
:10001000030EAE0083010A08AF008A0183130408AF
:10002000B0008B1824288C1A16287A281A08AA00DF
:100030008C1E1D281A08AB002817271483160313DB
:100040008C12831203137A28281C4A283208073C92
:10005000031C3028331C051233180516B30C7828FE
:100060003208083C031C3928A81C0512A8180516DC
:1000700078283208093C031C43288316031305160D
:1000800083120313782832080B3C031C7828B20132
:1000900028107928B208031D5028051A75287828D9
:1000A0003208083C031C5C28051EB313051AB3175D
:1000B00003197828B30C78283208093C031C6128FE
:1000C0007828051E752828196E28A717831603138C
:1000D00006108312031306100B127628230833022E
:1000E000031D75282811B2017928B301B2017928BE
:1000F000B20A8B10300884002F088A002E0E83006D
:10010000AD0E2D0E09003308B400F03C031D8B2802
:10011000A714A711252BA71CA92AA7103308123C46
:10012000031995283308593C031927113308583C03
:10013000031DBA28271EAB282712ED30B300762105
:100140005D21FA30832135113508B30076215D2118
:10015000FA308321252B2716ED30B30076215D215F
:10016000FA30832135153508B30076215D21FA3048
:100170008321252B3308113C031DC028A712662BB1
:0C0180003308143C031D252B27139D2B76
:10020000A000810183160313C03081050800A000FF
:10021000810183160313C0308105013081048312EC
:1002200003130B110B1D1229A00B11290800A200AA
:10023000E1308605220D1E39860408002816212982
:100240002812A3003A21281E86172308230E1721FF
:100250003121230817213121E13086058613061349
:10026000080086160000861208001830A200A20BB3
:10027000372908008613A815831603131E30860439
:10028000831203130617000086163521061EA811D7
:10029000861235213121A819442906138316031328
:1002A000E130860583120313080083160313981C9C
:1002B000572983120313990008000B1283160313A6
:1002C0000610051283120313061005122030A00039
:1002D000A00B6829B20183160313061483120313BB
:1002E00028148B100B16281873290800A200083058
:1002F000A300A4012218A40AA20CA30B7A29A81017
:10030000241CA8140800A300281528198529080012
:100310002A08AC009C21281F96292B08AC009C21A0
:100320002813981C962918121811181683160313EF
:100330008C168312031308002C08083C031DAA29FD
:1003400036080319BF29B603360880381E2120302D
:100350002021BF293608273C0318B029A812C12143
:10036000360880381E212C080D3C031CBC29031DB7
:10037000BF29A812C121BF292C082021B60A2710A5
:1003800008002830A81ACF29B60080301E2120305E
:100390002021B60BC72980301E21B6010800B70006
:1003A000C0301E2120302021B70BD229C0301E21A1
:0403B000B701080089
:100460008207003439340034353433343134323493
:1004700032340034303438343634343409347E3451
:10048000003400342F2B2D2B0034312B71343134B8
:100490000034003400347A347334613477343234C5
:1004A00000340034633478346434653434343334A1
:1004B0000034003420347634663474347234353485
:1004C000003400346E34623468346734793436343E
:1004D0000034003400346D346A34753437343834C1
:1004E000003400342C346B3469346F343034393494
:1004F000003400342E343F346C343B3470342D34AB
:10050000003400340034273400345B342B3400349E
:10051000003400342D2B1E2B5D3400347C34003429
:10052000003400343C3430342E34323435343634F4
:1005300038340034003431342B3433342D342A34FD
:10054000393400340834003400343134373434342E
:100550003734A71DBB2AA71ABB2A271BBB2A33087F
:100560004A3C031DB62A2F30B300EF2A33085A3C09
:100570000318BB2A252B3308613C0318D12A0E30FF
:10058000B3023308613C031CC82A1930B307D12ACF
:100590003308773C0318D12A3308D23C0319A71536
:1005A000252B02308A0033083022B300B308031928
:1005B000252BA71A492B271B372B3308603C031820
:1005C000B62B33087A3C031CB62B3308271AEB2AC8
:1005D000271DEF2AED2A2719EF2AE03EB300330842
:1005E00055213308083C031D032B37080319252B1D
:1005F000B7033708403E8038A5001E212030202157
:1006000025081E21252B3308093C031D102B370814
:10061000263C031C0E2B20302021B70A2030B300CB
:100620003708273C0318162BA816C1213708403E6F
:1006300080381E2133082021B70A252BA816C12196
:100640000D3055210A30552100348316031306144A
:1006500083120313A7130B16080027150034A716DF
:10066000322B2717B801B901BA01BB010034330896
:10067000403C0318492B3308463C031C412BB3165E
:10068000512B3308603C0318492B3308663C031890
:10069000512B3308293C0318252B3308393C031C04
:1006A000252BB808031D582BB80A3308B900252B91
:1006B000380B5E2BB80A3308BA00252B3808023CE9
:1006C000031D252BB80A3308BB00252BB8080319D6
:1006D000252B3030B902BA02BB02B803031D732BBD
:1006E0003908B3008D2BB803031D7D2B03308A001E
:1006F00039088F233A07B3008D2B3908023C031CBD
:10070000252B03308A0039080A3E8F23B9003A08A6
:100710008F23B9073B083907B300B801EF2A8207D6
:1007200000340A3414341E34283432343C34463411
:1007300050345A3400346434C834B8080319252BB3
:100740003030B902BA02B91EA72B2730B902BA1E3F
:10075000AB2B2730BA02B803031DB12B3908B30005
:10076000B42B390E3A04B300B801EF2A271DEF2A43
:1007700033080D3C0318EF2A3408613C031CEF2AB0
:1007800034083C3C0318C72B3D30B402D02B34084E
:10079000243C0318CE2B2330B402D02B0430B407F2
:1007A00003308A003408D623B300EF2A82072634A8
:1007B0002A34243423343C340034003400342934C3
:1007C0002834003425343E342F3400343A34003495
:1007D0005F3460345E340034223400347B343D3482
:1007E000003421340034003400347D3400345C346F
:0807F0000034403400343E34B3
:1008800002309F00831203138316031318151930C7
:100890009900831203139817831603138C16981666
:1008A000831203130B171816831603130614051669
:1008B0000113831203130B16F8308B058C018D0185
:1008C0008B170230B500B201A701A80183160313EC
:1008D0000130860583120313861206138613E13056
:1008E000860504300721033017213121013007210B
:1008F0000830172131210130072102301721312121
:100900000130072128301E210C301E2101301E210C
:10091000083007212830B600B7012730A500043081
:100920008A002508273CC224A6005521260820213C
:10093000A50B8F2C0D3055210A3055210A30552139
:10094000FF30B30076215D21ED30B30076215D21CB
:10095000FA3083213508B30076215D21FA308321F6
:10096000ED30B30076215D21FA308321351435084E
:10097000B30076215D21FA308321A71B832027183D
:100980008821BD2C8207503449344334203431341B
:1009900036344634373437342034413454342034F8
:1009A0004B346534793462346F3461347234643476
:1009B00020344434653463346F34643465347234C1
:1009C000203463346F346E346E346534633474347D
:0409D00065346434F2
:02400E00F23F7F
:00000001FF
:020000040000FA
:10000000831603138101402C8B138B1B0428AD0036
:10001000030EAE0083010A08AF008A0183130408AF
:10002000B0008B1824288C1A16287A281A08AA00DF
:100030008C1E1D281A08AB002817271483160313DB
:100040008C12831203137A28281C4A283208073C92
:10005000031C3028331C051233180516B30C7828FE
:100060003208083C031C3928A81C0512A8180516DC
:1000700078283208093C031C43288316031305160D
:1000800083120313782832080B3C031C7828B20132
:1000900028107928B208031D5028051A75287828D9
:1000A0003208083C031C5C28051EB313051AB3175D
:1000B00003197828B30C78283208093C031C6128FE
:1000C0007828051E752828196E28A717831603138C
:1000D00006108312031306100B127628230833022E
:1000E000031D75282811B2017928B301B2017928BE
:1000F000B20A8B10300884002F088A002E0E83006D
:10010000AD0E2D0E09003308B400F03C031D8B2802
:10011000A714A711252BA71CA92AA7103308123C46
:10012000031995283308593C031927113308583C03
:10013000031DBA28271EAB282712ED30B300762105
:100140005D21FA30832135113508B30076215D2118
:10015000FA308321252B2716ED30B30076215D215F
:10016000FA30832135153508B30076215D21FA3048
:100170008321252B3308113C031DC028A712662BB1
:0C0180003308143C031D252B27139D2B76
:10020000A000810183160313C03081050800A000FF
:10021000810183160313C0308105013081048312EC
:1002200003130B110B1D1229A00B11290800A200AA
:10023000E1308605220D1E39860408002816212982
:100240002812A3003A21281E86172308230E1721FF
:100250003121230817213121E13086058613061349
:10026000080086160000861208001830A200A20BB3
:10027000372908008613A815831603131E30860439
:10028000831203130617000086163521061EA811D7
:10029000861235213121A819442906138316031328
:1002A000E130860583120313080083160313981C9C
:1002B000572983120313990008000B1283160313A6
:1002C0000610051283120313061005122030A00039
:1002D000A00B6829B20183160313061483120313BB
:1002E00028148B100B16281873290800A200083058
:1002F000A300A4012218A40AA20CA30B7A29A81017
:10030000241CA8140800A300281528198529080012
:100310002A08AC009C21281F96292B08AC009C21A0
:100320002813981C962918121811181683160313EF
:100330008C168312031308002C08083C031DAA29FD
:1003400036080319BF29B603360880381E2120302D
:100350002021BF293608273C0318B029A812C12143
:10036000360880381E212C080D3C031CBC29031DB7
:10037000BF29A812C121BF292C082021B60A2710A5
:1003800008002830A81ACF29B60080301E2120305E
:100390002021B60BC72980301E21B6010800B70006
:1003A000C0301E2120302021B70BD229C0301E21A1
:0403B000B701080089
:100460008207003439340034353433343134323493
:100470003234003430343834363434340934A73428
:10048000003400342F2B2D2B0034312B71343134B8
:1004900000340034003479347334613477343234C6
:1004A00000340034633478346434653434343334A1
:1004B0000034003420347634663474347234353485
:1004C000003400346E346234683467347A3436343D
:1004D0000034003400346D346A34753437343834C1
:1004E000003400342C346B3469346F343034393494
:1004F000003400342E342D346C34F6347034273408
:10050000003400340034E4340034FC345E3400340D
:10051000003400342D2B1E2B2134003424340034BD
:10052000003400343C3430342E34323435343634F4
:1005300038340034003431342B3433342D342A34FD
:10054000393400340834003400343134373434342E
:100550003734A71DBB2AA71ABB2A271BBB2A33087F
:100560004A3C031DB62A2F30B300EF2A33085A3C09
:100570000318BB2A252B3308613C0318D12A0E30FF
:10058000B3023308613C031CC82A1930B307D12ACF
:100590003308773C0318D12A3308D23C0319A71536
:1005A000252B02308A0033083022B300B308031928
:1005B000252BA71A492B271B372B3308603C031820
:1005C000B62B33087A3C031CB62B3308271AEB2AC8
:1005D000271DEF2AED2A2719EF2AE03EB300330842
:1005E00055213308083C031D032B37080319252B1D
:1005F000B7033708403E8038A5001E212030202157
:1006000025081E21252B3308093C031D102B370814
:10061000263C031C0E2B20302021B70A2030B300CB
:100620003708273C0318162BA816C1213708403E6F
:1006300080381E2133082021B70A252BA816C12196
:100640000D3055210A30552100348316031306144A
:1006500083120313A7130B16080027150034A716DF
:10066000322B2717B801B901BA01BB010034330896
:10067000403C0318492B3308463C031C412BB3165E
:10068000512B3308603C0318492B3308663C031890
:10069000512B3308293C0318252B3308393C031C04
:1006A000252BB808031D582BB80A3308B900252B91
:1006B000380B5E2BB80A3308BA00252B3808023CE9
:1006C000031D252BB80A3308BB00252BB8080319D6
:1006D000252B3030B902BA02BB02B803031D732BBD
:1006E0003908B3008D2BB803031D7D2B03308A001E
:1006F00039088F233A07B3008D2B3908023C031CBD
:10070000252B03308A0039080A3E8F23B9003A08A6
:100710008F23B9073B083907B300B801EF2A8207D6
:1007200000340A3414341E34283432343C34463411
:1007300050345A3400346434C834B8080319252BB3
:100740003030B902BA02B91EA72B2730B902BA1E3F
:10075000AB2B2730BA02B803031DB12B3908B30005
:10076000B42B390E3A04B300B801EF2A271DEF2A43
:1007700033080D3C0318EF2A3408613C031CEF2AB0
:1007800034083C3C0318C72B3D30B402D02B34084E
:10079000243C0318CE2B2330B402D02B0430B407F2
:1007A00003308A003408D623B300EF2A82072F349F
:1007B000283423342A343B340034003400343D34AC
:1007C0002934003425343A345F3400345C34003446
:1007D0003F344034263400347B3400345B347E3480
:1007E00000342B340034003400345D3400347D3464
:0807F0000034223400343E34D1
:1008800002309F00831203138316031318151930C7
:100890009900831203139817831603138C16981666
:1008A000831203130B171816831603130614051669
:1008B0000113831203130B16F8308B058C018D0185
:1008C0008B170230B500B201A701A80183160313EC
:1008D0000130860583120313861206138613E13056
:1008E000860504300721033017213121013007210B
:1008F0000830172131210130072102301721312121
:100900000130072128301E210C301E2101301E210C
:10091000083007212830B600B7012730A500043081
:100920008A002508273CC224A6005521260820213C
:10093000A50B8F2C0D3055210A3055210A30552139
:10094000FF30B30076215D21ED30B30076215D21CB
:10095000FA3083213508B30076215D21FA308321F6
:10096000ED30B30076215D21FA308321351435084E
:10097000B30076215D21FA308321A71B832027183D
:100980008821BD2C8207503449344334203431341B
:1009900036344634373437342034413454342034F8
:1009A0004B346534793462346F3461347234643476
:1009B00020344434653463346F34643465347234C1
:1009C000203463346F346E346E346534633474347D
:0409D00065346434F2
:02400E00F23F7F
:00000001FF
PIC16C74A MAX232
VDD
D XT1 D
R1 VDD
VSS
10k C1 4.000 MHz C2 C4
C3
10p 10p 10u
S1 VDD 10u
VSS VSS
16
SW-PB
2
6
11
32
C5 U2
U1
13 12
V+
VCC
V-
13 14 RS232 TXD R1 IN R1 OUT PIC RXD
VDD
VDD
VSS 4n7 OSC1/CLKIN OSC2/CLKOUT RS232 8 9 5V
1 15 R2 IN R2 OUT
MCLR/VPP RC0/T1OSO/T1CKI 11 14
2 16 PIC TXD T1 IN T1 OUT RS232 RXD
RA0 RC1/T1OSI/CCP2 5V 10 7 RS232
3 17 T2 IN T2 OUT
C RA1 RC2/CCP1 1 4 C
GND
4 18 C1+ C2+
RA2 RC3/SCK/SCL 3 5
5 23 C1 - C2 -
RA3 RC4/SDI/SDA
6 24
KBD_Data RA4/T0CKI RC5/SDO C6 MAX232CPE(16) C7
7 25
RA5/SS RC6/TX/CK PIC TXD 10u 10u
15
33 26
KBD_Clk RB0/INT RC7/RX/DT PIC RXD
D4 34 19
RB1 RD0/PSP0
D5 35 20
RB2 RD1/PSP1
D6 36 21 VSS
RB3 RD2/PSP2
D7 37 22 VDD
RB4 RD3/PSP3 VDD
E 38 27
RB5 RD4/PSP4
R/W 39 28
RB6 RD5/PSP5
RS 40
8
RB7 RD6/PSP6
29
30
C8
100n
PS/2 Connector R2
RE0/RD//AN5 RD7/PSP7 10k
VSS
VSS
B 9 10 R3 B
RE1/WR/AN6 RE2/CS/AN7 J1
VSS 10k
PIC16C74-04/JW(40) 1 KBD_Data
2
12
31
3 VSS
D4
LCD D4 SUB1 4 VDD
D5 5 KBD_Clk
LCD D5 VSS 5
D6
LCD D6
RS232 VSS
9
6
VDD 4 CON6
D7 (Direction seen from host)
LCD D7 8
VDD
E 3
LCD E RS232 TXD Title
C9 7
R/W
LCD R/W
VSS
100n
RS232 RXD
2 AT Keyboard Interface with PIC16C74
RS 6
A LCD RS A
VSS 1 Written by Date
20-Aug-2003
Dot Matrix LCD Display Peter Luethi
DB9 Revision Page
(HD44780 compatible) Dietikon, Switzerland 3.03 1 of 1
1 2 3 4
Conrad Electronic - Europas fhrendes Versandhandelsunternehmen fr Elektronik und Technik
Conrad Shop cXtreme.de Conrad-Security Licht-direct.de Business-Shop Tipps & Infos DVD+Games Verleih Handys Modellbauclub PDF-Kataloge Filialen Kontakt Jobs Impressum AGB ber Conrad
http://www1.conrad.de/scripts/wgate/zcop_b2c/~flN0YXRlPTEwNDM5ODYxMTA=?~...EA_S_BROWSE&glb_user_js=Y&shop=B2C&p_init_ipc=X&~cookies=1&scrwidth=102412/02/2008 20:20:21
http://www.trash.net/~luethi/microchip/projects/keyboard/kbd_box/kbd_box_205.asm
;***************************************************************************
;
; AT Keyboard Box V2.05 (with LCD Display and Keypad)
; ====================================================
;
; written by Peter Luethi, 06.08.2003, Dresden, Germany
; http://www.electronic-engineering.ch
; last update: 17.04.2004
;
; V2.05: Added LCDcflag (LCD command/data flag) to comply with
; latest LCD modules. Changed controller type to flash
; device, i.e. PIC16F77.
; (17.04.2004)
;
; V2.04: Changed RS232 transmission sub-routine: checks now
; PIR1,TXIF instead of TXSTA,TRMT
; (29.10.2003)
;
; V2.03: Implemented watchdog timer for user-customization phase.
; After 12 seconds of inactivity, the user-customization
; process is terminated. Then, the default baud rate settings
; (9600 baud) are configured, and normal full-duplex operation
; mode is established.
; (17.10.2003)
;
; V2.02: Fixed issue in RS232 hardware reception service routine.
; Reads now both data bytes out of double-buffered RX FIFO.
; Tries to eliminate some sporadic reception hangs under
; heavy full-duplex traffic scenarios.
; In case of FIFO overrun errors in the USART receive logic,
; the service routine performs a partial reset of the USART
; receive logic. No specific error handling for RS232
; reception framing errors.
; (17.10.2003)
;
; V2.01: Added dynamic RS232 baud rate configuration through
; AT keyboard (16.10.2003)
;
; V2.00: Added dynamic RS232 baud rate setup (customizable by
; user through keypad), changed clock frequency from
; 4 MHz to 14.745600 MHz in order to support 1200 baud
; up to 115200 baud (15.10.2003)
;
; IMPLEMENTED FEATURES:
; =====================
; - Dynamic configuration of RS232 baud rate setting at start-up.
; - Bi-directional communication between microcontroller application
; and remote RS232 client by hardware-based RS232 transmission.
; - Bi-directional communication between microcontroller and keyboard.
; - Bi-directional communication between microcontroller and LCD
; display.
; - Supports foil-keypad input through direct 8 bit A/D conversion
; and look-up table.
; - Piezo-beeper for acoustic feedback of keypad entries.
; - Visualization of received and transmitted characters on local LCD.
; - Parametrizable LCD display width: constant 'LCDwidth'
; - Support for all keyboard characters typed with shift button active
; and inactive.
; - English and modified Swiss-German 'codepages' available
; (QWERTY and QWERTZ)
; Include the desired keyboard lookup tables at the correct location.
; - Caps Lock implemented
; - Num Lock always active
; - Support of ASCII conversion from direct ALT-DEC entries, e.g.
; ALT + 6 + 4 = @ (ALT + [1..3] numbers)
; - Support of ASCII conversion from direct CTRL-HEX entries, e.g.
; CTRL + 3 + F = ? (CTRL + [1..2] letters/numbers)
; - ALT-DEC and CTRL-HEX features work for both, keypad and keyboard
; numbers, as well as with upper and lower case letters [a..f]
;
; - Possibility to implement short-cuts or user defined characters
; for 'Esc', 'Num Lock', 'Scroll Lock' and 'F1' - 'F12' keys
;
;
; LIMITATIONS:
; ============
; - No support for ALT-GR characters.
; - No support for arrow buttons, 'Home', 'Del', 'PageUp', 'PageDown',
; 'Insert', 'End' because there exists no character/command
; corresponding to the ASCII character map. (But it is possible to
; use them for short-cuts or user defined characters, if the special
; code routine (0xE0) is altered.)
;
;
; NOTE:
; =====
; This program needs 'ORG' directives to locate tables within entire
; memory pages. To allow for slight modifications, the code has not
; been optimized to the utmost extent regarding program memory
; placement. This can be carried out using the program memory window
; of MPLAB showing the hexadecimal representation of the code.
;
;
; CREDITS:
; ========
; - Craig Peacock, the author of the excellent page about keyboards
; "Interfacing the PC's Keyboard" available at his website:
; http://www.beyondlogic.org/keyboard/keybrd.htm
;
;***************************************************************************
PROCESSOR 16F77
#include "p16f77.inc"
;PROCESSOR 16C74A
;#include "p16c74a.inc"
; debug LEDs
;#define DEBUG0tris TRISC,0x00 ; Port C !
;#define DEBUG1tris TRISC,0x01
;#define DEBUG2tris TRISC,0x02
;#define DEBUG3tris TRISC,0x03
;#define DEBUG4tris TRISC,0x04
;#define DEBUG5tris TRISC,0x05
;#define DEBUG0 PORTC,0x00 ; Port C !
;#define DEBUG1 PORTC,0x01
;#define DEBUG2 PORTC,0x02
;#define DEBUG3 PORTC,0x03
;#define DEBUG4 PORTC,0x04
;#define DEBUG5 PORTC,0x05
ORG 0x430
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
#include "..\..\m_lcd_bf.asm"
IF BEEP_ENABLE == 1 ; conditional assembly
#include "..\..\m_beep.asm" ; Piezo beeper
ENDIF
KEYPADinit macro
BANK1
bsf PADOUTtris ; set numeric keypad to (analog) input
bsf PADIRQtris ; set numeric keypad interrupt pin to input
BANK0
;movlw b'01000001' ; select Fosc/8, CH0, A/D ON
movlw b'11000001' ; select RC Osc, CH0, A/D ON
movwf ADCON0
KEYBOARDinit macro
BANK1
bsf KBDclktris ; set keyboard clock line to input explicitely
bsf KBDdatatris ; set keyboard data line to input explicitely
bcf OPTION_REG,INTEDG ; keyboard interrupt on falling edge
BANK0
bcf INTCON,INTF ; ensure interrupt flag is cleared
bsf INTCON,INTE ; enable RB0/INT interrupt
endm
SENDw macro
call _RSxmit
endm
KBDexp macro _KBDresp ; keyboard expect function: busy wait for kbd response
movlw _KBDresp ; load expected kbd response
call KBDexpfun
endm
WDT_SETUP ;*** sub-routine for IRQ-based WDT timer using TMR1 ***
movwf WDT_CNT ; set self-defined watchdog (customization time-out)
bcf WDTflag ; clear WDT time-out flag
clrf TMR1L
clrf TMR1H
bcf PIR1,TMR1IF ; reset TMR1 interrupt flag
BANK1
bsf PIE1,TMR1IE ; enable TMR1 interrupt
BANK0
bsf INTCON,PEIE ; enable peripheral interrupts
; configure & enable TMR1:
; prescaler = b'11', OSCEN = 0, _T1SYNC = 0, TMR1CS = 0, TMR1ON = 1
movlw b'00110001'
movwf T1CON
RETURN
KBDexpfun ;*** keyboard expect function: busy wait for kbd response ***
movwf KBDexpval ; load expected kbd response to KBDexpval
bsf KBDexpf ; set flag
_KBDexp btfsc WDTflag ; check for watchdog expiration
goto _KBDexp_timeout ; abort in case of time-out
RSdisplay ;*** LCD display routine for received RS232 characters ***
; first byte in RXreg
movfw RXreg ; retrieve data
movwf RXtemp ; store data
call _RSdisp ; call output sub-routine
btfss RX2flag ; check for second data byte received
goto RSdispEND
; second byte in RXreg2, i.e. RX2flag = 1
movfw RXreg2 ; retrieve data
movwf RXtemp ; store data
call _RSdisp ; call output sub-routine
bcf RX2flag ; reset flag
btfss RCSTA,OERR ; check for RX overrun (overrun error bit)
goto RSdispEND
; buffer overrun, severe error, reset USART RX logic
bcf RCSTA,CREN ; reset USART RX logic, clear RCSTA,OERR
bcf RCSTA,FERR ; reset framing error bit
bsf RCSTA,CREN ; re-enable continuous reception
RSdispEND
BANK1
bsf PIE1,RCIE ; re-enable USART reception interrupt
BANK0 ; (interrupt flag already cleared in ISR)
RETURN
_RSclr movfw LCDpos1 ; check now for line end: get LCD position counter
BRS LCDwidth, _RSdsp1 ; if not at the line end, branch to next check
bcf LCD_ln ; line flag = 0 (LCD line 1)
call LCDclrline ; call LCD clear line sub-routine
_RSdsp1 movfw LCDpos1 ; load cursor position to w
iorlw b'10000000' ; mask
call LCDcomd ; call LCD command sub-routine to place cursor
movfw RXtemp ; check for carriage return
BRG 0x0D, _RSdsp2 ; branch on w > 0x0D
skpz ; skip on zero: it was a carriage return
goto _RSend ; else terminate
_RScr bcf LCD_ln ; line flag = 0 (LCD line 1)
call LCDclrline ; call LCD clear line sub-routine
goto _RSend ; exit
_RSdsp2 movfw RXtemp
LCDw ; display RS232 data on LCD
incf LCDpos1,F ; increment LCD position counter
_RSend bcf RSflag ; reset RS232 data reception flag
RETURN
KEYPADout ;*** numeric foil-keypad output routine (LCD display & RS232) ***
IF BEEP_ENABLE == 1 ; conditional assembly
BEEP d'240', d'4' ; acoustic feedback
ENDIF
movlw KEYPAD_SIZE-0x1 ; get amount of keypad buttons
movwf TEMP6 ; prepare loop counter
_KPlut1 ; loop through keypad look-up table 1
movlw HIGH KeypadTable1 ; get correct page for PCLATH
movwf PCLATH ; prepare right page bits for table read
movfw TEMP6 ; retrieve loop counter value
call KeypadTable1 ; call lookup table
addlw 0x0 - KEYPAD_WINDOW/2 ; w - WINDOW/2
movwf TEMP7 ; store retrieved value in temp register
subwf KPval,w ; KPval - w = w
bnc _KPreloop ; no carry if result negative, branch
movfw TEMP7
subwf KPval,w ; KPval - w = w
BRES KEYPAD_WINDOW, _KPlut2 ; A/D value in window, branch
_KPreloop decfsz TEMP6,f ; decrement loop counter, exit if zero
goto _KPlut1 ; loop again
_KPlut2 ; get now corresponding symbol from keypad look-up table 2
movlw HIGH KeypadTable2 ; get correct page for PCLATH
movwf PCLATH ; prepare right page bits for table read
movfw TEMP6 ; retrieve loop counter value
_CUST1_CHANGE
; RS232_CUST = 1 (115200), 3 (57600), 5 (38400), 11 (19200)
; CUST_CNT = 7 6 5 4
; RS232_CUST = 23 (9600), 47 (4800), 95 (2400), 191 (1200)
; CUST_CNT = 3 2 1 0
; change configuration value
clrf CUST_POS ; reset table position counter
incf CUST_CNT,F ; increment counter to change configuration
movfw CUST_CNT
BRES 0x7, _CUST1_C ; branch if still in [0..7]
clrf CUST_CNT ; it was > 7, reset to 0
_CUST1_C ;*** calculate table position of the current display output to change ***
movfw CUST_CNT
movwf TEMP7 ; get configuration counter value
bz _CUST1_D ; skip loop in case of zero (1200 baud)
_CUST1_LOOP1
movlw d'4' ; delta
LCDout_line2 ;*** shared LCD subroutine for AT keyboard and foil-keypad ***
; Pre: Character stored in register KBD
; Post: Output on LCD line 2
; check for necessary clearing of LCD line 2
movfw LCDpos2 ; get LCD position counter
sublw LCDwidth - 1 ; w = LCDwidth - 1 - w
bc _LCDout ; branch if res positive or zero
bsf LCD_ln ; line flag = 1 (LCD line 2)
call LCDclrline ; call LCD clear line subroutine
_LCDout movfw LCDpos2 ; load cursor position to w
addlw 0x40 ; add offset (LCD line 2)
iorlw b'10000000' ; mask
call LCDcomd ; call LCD command subroutine to place cursor
movfw KBD ; retrieve character
LCDw ; display keyboard character on LCD
incf LCDpos2,F ; increment LCD position counter
RETURN
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
;**************************************************************
;*** TMR1 INTERRUPT - WATCHDOG TIMER FOR USER-CUSTOMIZATION ***
;**************************************************************
_ISR_TMR1
decf WDT_CNT,F ; decrement watchdog counter
bnz _ISR_TMR1_A ; if not zero, exit
; watchdog has timed out:
bsf WDTflag ; set WDT time-out flag
bcf CUST_fl ; prepare abort of user-customization:
; clear flag to indicate setup has to finish
_ISR_TMR1_A
bcf PIR1,TMR1IF ; reset TMR1 interrupt flag
goto ISRend ; exit ISR
;******************************
;*** RS232 DATA ACQUISITION ***
;******************************
_ISR_RS232
movfw RCREG ; get RS232 data
movwf RXreg
bsf RSflag ; enable RS232 data reception flag
BANK1 ; (for display routine)
bcf PIE1,RCIE ; disable USART reception interrupt
BANK0 ; (will be re-enabled in normal subroutine)
goto _RS232end ; exit ISR
;*******************************
;*** NUMERIC KEYPAD DECODING ***
;*******************************
_ISR_KEYPAD
btfss PADIRQpin ; check if active one
goto _KEYPADend ; else, exit ISR
bcf INTCON,RBIE ; disable PORTB4:7 change interrupts
movlw KEYPAD_DELAY ; busy wait (64 us @ 4 MHz)
movwf ISR_TEMP1
_KPloop1 decfsz ISR_TEMP1,f
goto _KPloop1
; A/D input charge time completed, continue
bsf ADCON0,GO ; turn conversion ON
_KPloop2 btfsc ADCON0,GO ; check A/D status flag
goto _KPloop2 ; wait until the end of conversion
movfw ADRES ; fetch result of A/D conversion
movwf KPval ; store A/D keypad value
bsf KPflag ; set keypad reception flag
goto _KEYPADend ; exit ISR
;****************************
;*** AT KEYBOARD DECODING ***
;****************************
_ISR_KBD ;*** check origin of keyboard interrupt ***
btfss KBDtxf ; check keyboard TX flag
goto _ISR_KBDacq ; if cleared, keyboard data acquisition,
;goto _ISR_KBDxmit ; else keyboard data transmission
;******************************************
;*** HOST TO KEYBOARD DATA TRANSMISSION ***
;******************************************
_ISR_KBDxmit
;*** data transmission ***
movfw KBDcnt ; get kbd scan pattern acquisition counter
sublw d'7' ; w = d'7' - KBDcnt (*)
bnc _KBDparo ; branch if negative (carry == 0)
btfss KBD,0x00 ; serial transmission of keyboard data
bcf KBDdatapin
btfsc KBD,0x00
bsf KBDdatapin
rrf KBD,F ; rotate right keyboard TX data register
goto _INCF ; exit
;*** data and parity transmission completed, turn around cycle ***
_KBDrel movfw KBDcnt ; get kbd scan pattern acquisition counter
sublw d'9' ; w = d'9' - KBDcnt
bnc _KBDack ; branch if negative (carry == 0)
BANK1
bsf KBDdatatris ; release keyboard data line, set to input
BANK0
goto _INCF ; exit
;*****************************************
;*** KEYBOARD SCAN PATTERN ACQUISITION ***
;*****************************************
_ISR_KBDacq
;*** check start bit ***
tstf KBDcnt ; check
bnz _KBDdat ; branch on no zero
btfsc KBDdatapin ; test start bit of keyboard data input
goto _KBDabort1 ; no valid start bit, abort
goto _INCF ; exit
bsf KBD,0x07
bz _INCF ; exit on zero (zero flag still valid from (*))
rrf KBD,F ; do this only 7 times
goto _INCF ; exit
;***********************************
_KEYPADend
bcf INTCON,RBIF ; clear RB[7:4] port change interrupt flag
goto ISRend ; terminate execution of ISR
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
KBDdecode
;**********************************************************
;*** KEYBOARD SCAN CODE PRE-DECODING, SET / CLEAR FLAGS ***
;**********************************************************
;****************************************************
;* The following table has to be located within one *
;* page to allow for correct lookup functionality. *
;* Therefore, additional ISR code has been moved *
;* further down. *
;****************************************************
;*********************************************************************
;* LOOKUP TABLE FOR KEYBOARD-SCAN-CODE TO ASCII-CHARACTER CONVERSION *
;*********************************************************************
;****************************************************
;* The following code belongs also to the interrupt *
;* service routine and has been moved down to this *
;* place to allow the main keyboard decode lookup *
;* table to be located within one page. *
;* The code below may be arranged on another page, *
;* but that doesn't matter. *
;****************************************************
;********************************
;*** SCAN CODE RANGE CHECKING ***
;********************************
_KBD_2 ;*** check if special code (0xE0) has been submitted previously ***
btfss SPEflag
goto _KBD_3
;*** decoding of scan code with preceding special code (0xE0) ***
; check for ALT-DEC or CTRL-HEX activity
btfsc ALTflag
goto _KBD_3
btfsc CTRLflag
goto _KBD_3
; (decoding currently only necessary for 'E0 4A' = '/')
movfw KBD
sublw 0x4A ; 0x4A - w
bnz _NOSUP ; branch on non-zero
movlw '/' ; store '/' in KBD
movwf KBD
goto _OUTP
_NOSUP ;*** check if scan code 0x5A or smaller has occurred ***
movfw KBD
sublw 0x5A ; 0x5A - w
bc _KBD_3 ; carry if result positive or zero, branch
;*** range exceeded (above 0x5A) ***
; it's one of the following keys: arrow button, 'Home', 'Del',
; 'PageUp', 'PageDown', 'Insert', 'End'
; these keys are currently not used, so
goto _ClrStall
_KBD_3 ;*** check if scan code 0x61 or smaller has occurred ***
movfw KBD
sublw 0x61 ; 0x61 - w
bc KBD_dec ; carry if result positive or zero, goto table
movlw d'14'
subwf KBD,F ; KBD = KBD - d'14'
;*** check if scan code 0x61 (0x6F-d'14') or smaller has occurred ***
movfw KBD
sublw 0x61 ; 0x61 - w
bnc _KBD_4 ; no carry if result negative, goto _KBD_4
movlw d'25'
addwf KBD,F ; KBD = KBD + d'25'
goto KBD_dec
_KBD_4 ;*** check if scan code 0x78 (0x86 - d'14') or higher has occurred ***
movfw KBD
sublw 0x77 ; 0x77 - w
bc KBD_dec ; carry if result zero or positive, branch
;*** no character to display: ***
;*** check for special code (0xE0): 0xD2 = 0xE0 - d'14' ***
movfw KBD
sublw 0xD2 ; 0xD2 - w
skpnz ; skip if not zero
bsf SPEflag ; special code occurred, set flag
goto _ClrStall ; abort with nothing to display
;*******************************************************
;*** SCAN CODE DECODING & ASCII CHARACTER CONVERSION ***
;*******************************************************
;***************************************************
;*** KEYBOARD DATA OUTPUT TO RS232 & LCD DISPLAY ***
;***************************************************
;************************************************
;*** SPECIAL COMMANDS I (with special output) ***
;************************************************
;**********************************************************
;*** STALL RELEASE & CLEAR KEYBOARD DATA RECEPTION FLAG ***
;**********************************************************
_ClrStall
BANK1
bsf KBDclktris ; set clk line back to input (and goes high)
BANK0 ; (release stall)
bcf KBDflag ; clear keyboard data reception flag
bsf INTCON,INTE ; re-enable interrupt RB0/INT
RETURN
;****************************************************
;*** SPECIAL COMMANDS II (without special output) ***
;****************************************************
;***********************************************
;*** ALT-DEC & CTRL-HEX STORING & CONVERSION ***
;***********************************************
; store typed numbers in CTRLreg1 - CTRLreg3
_CTRLstr ; check for capital letter [A..F], i.e. KBD in [0x41..0x46]
movfw KBD
sublw 0x40 ; 0x40 - w
bc _ALTstr ; carry if result >= 0, go to number check
movfw KBD
sublw 0x46 ; 0x46 - w
bnc _CTRLstr2 ; no carry if result negative, go to next check
; valid capital letter [A..F], convert to lower case (+ 0x20)
bsf KBD,0x5 ; KBD += 0x20
goto _CTRLstr3 ; jump for storing
_CTRLstr2 ; check for lower case letter [a..f], i.e. KBD in [0x61..0x66]
movfw KBD
sublw 0x60 ; 0x60 - w
bc _ALTstr ; carry if result >= 0, go to number check
movfw KBD
sublw 0x66 ; 0x66 - w
bc _CTRLstr3 ; carry if result >= 0, valid lower case letter [a..f]
_ALTstr ;*** check for number, i.e. KBD in [0x30..0x39]: ***
movfw KBD
sublw 0x29 ; 0x29 - w
bc _ClrStall ; carry if result >= 0, no number, exit
movfw KBD
sublw 0x39 ; 0x39 - w
bnc _ClrStall ; no carry if result negative, no number, exit
_CTRLstr3 ;*** store letter/number now ***
tstf CTRLcnt
;*******************************************************
;* The following table has also to be located within *
;* one page to allow for correct lookup functionality. *
;*******************************************************
;ORG 0x??
;*****************************************************************
;*** SCAN CODE DECODING & ASCII CONVERSION FOR 'SHIFT' ENTRIES ***
;*****************************************************************
_SHICHR ;*** special character decoding typed with shift button active ***
; check for active shift button, if not active, branch
btfss SHIflag
goto _OUTP ; branch
; check for 'backspace', 'tab', 'linefeed' and 'carriage return' :
; (here, KBD has already been converted to ASCII character values)
movfw KBD
sublw d'13' ; d'13' - w
bc _OUTP ; carry if result zero or positive, branch
;*******************************************************
;* The following table has also to be located within *
;* one page to allow for correct lookup functionality. *
;*******************************************************
;**********************************************************************
;* LOOKUP TABLE FOR SPECIAL CHARACTERS TYPED WITH SHIFT BUTTON ACTIVE *
;**********************************************************************
BANK1
clrf OPTION_REG ; PORTB pull-ups enabled
goto _MAIN
ORG 0x100
; bcf DEBUG5tris
; bcf DEBUG6tris
; bcf DEBUG7tris
BANK0
; bcf DEBUG0
; bcf DEBUG1
; bcf DEBUG2
; bcf DEBUG3
; bcf DEBUG4
; bcf DEBUG5
; bcf DEBUG6
; bcf DEBUG7
;******************************
_ILOOP3 btfsc KPflag ; check foil-keypad reception flag
call KEYPADout ; if set, call output routine
btfsc KBDflag ; check scan pattern reception flag
call KBDdecode ; if set, call decoding routine
btfsc CUST_fl ; if customization flag is cleared, exit loop
goto _ILOOP3 ; loop again
;******************************
; RS232 initialization
bcf INTCON,GIE ; enable global interrupt
movfw RS232_CUST ; retrieve customized baud rate value
RS232init ; RS232 initialization
movlw b'11111000'
andwf INTCON,F ; clear all interrupt flags
clrf PIR1 ; clear all interrupt flags
clrf PIR2 ; clear all interrupt flags
bsf INTCON,GIE ; enable global interrupt
;******************************
_MLOOP btfsc KBDflag ; check scan pattern reception flag
call KBDdecode ; if set, call decoding routine
btfsc RSflag ; check RS232 data reception flag
call RSdisplay ; if set, call display routine
btfsc KPflag ; check foil-keypad reception flag
call KEYPADout ; if set, call output routine
goto _MLOOP ; loop forever
;******************************
StartupTable
addwf PCL,F ; add offset to table base pointer
DT "Customization of Serial Communication" ; create table
StartupTableEND DT ":"
IF (HIGH (StartupTable) != HIGH (StartupTableEND))
ERROR "StartupTable hits page boundary!"
ENDIF
WelcomeTable
addwf PCL,F ; add offset to table base pointer
DT "PIC16F77 AT Keyboard Box V2.05 stand-b" ; create table
WTableEND DT "y"
IF (HIGH (WelcomeTable) != HIGH (WTableEND))
ERROR "WelcomeTable hits page boundary!"
ENDIF
RS_Table1
addwf PCL,F ; add offset to table base pointer
DT "RS232 9600 baud a/* alter s/# selec" ; create table
RS_Table1END DT "t"
IF (HIGH (RS_Table1) != HIGH (RS_Table1END))
ERROR "RS_Table1 hits page boundary!"
ENDIF
CUST_Table1
addwf PCL,F ; add offset to table base pointer
DT " 12" ; create table
DT " 24"
DT " 48"
DT " 96"
DT " 192"
DT " 384"
DT " 576"
DT "115"
CUST_Table1END DT "2"
IF (HIGH (CUST_Table1) != HIGH (CUST_Table1END))
ERROR "CUST_Table1 hits page boundary!"
ENDIF
CUST_Table2
addwf PCL,F ; add offset to table base pointer
retlw d'191' ; 1200 baud
KeypadTable1
addwf PCL,F ; add offset to table base pointer
retlw d'76' ;*
retlw d'90' ;7
retlw d'105' ;4
retlw d'120' ;1
retlw d'135' ;0
retlw d'151' ;8
retlw d'167' ;5
retlw d'184' ;2
retlw d'201' ;#
retlw d'218' ;9
retlw d'236' ;6
KeypadTable1END retlw d'254' ; 3
IF (HIGH (KeypadTable1) != HIGH (KeypadTable1END))
ERROR "KeypadTable1 hits page boundary!"
ENDIF
KeypadTable2
addwf PCL,F ; add offset to table base pointer
DT "*7410852#96" ; create table
KeypadTable2END DT "3"
IF (HIGH (KeypadTable2) != HIGH (KeypadTable2END))
ERROR "KeypadTable2 hits page boundary!"
ENDIF
END
;* 76 76
;7 90 91
;4 105 106
;1 120 121
;0 135 137
;8 151 152
;5 167 168
;2 184 185
;# 201 201
;9 218 218
;6 236 236
;3 254 254
:020000040000FA
:1000000083160313810100298B138B1B0428AD0079
:10001000030EAE0083010A08AF008A0183130408AF
:10002000B0008B1838280B182A288C1A21280C1895
:100030001A289428C103031D1F28291529100C1004
:1000400094281A08AA002714831603138C1283120B
:1000500003138E28861F90288B115030B100B10BEE
:100060002F281F151F1932281E08BD00A817902819
:10007000281C5E283208073C031C4428331C051248
:1000800033180516B30C92283208083C031C4D287F
:10009000A81C0512A818051692283208093C031C52
:1000A0005728831603130516831203139228320868
:1000B0000B3C031C9228B20128109328B208031DA0
:1000C0006428051A892892283208083C031C7028E5
:1000D000051EB313051AB31703199228B30C9228FF
:1000E0003208093C031C75289228051E8A28281905
:1000F0008228A71783160313061083120313061012
:100100000B128C2836083302031D8B282811B201EC
:1001100093288B288B28B301B20193288C12942842
:100120000B109428B20A8B10300884002F088A0024
:100130002E0E8300AD0E2D0E09003308B400F03CE6
:10014000031DA528A714A711232BA71C992AA710C4
:100150003308123C0319AF283308593C03192711FF
:100160003308583C031DD428271EC5282712ED301C
:10017000B300CF24B624FA30DC2435113508B3009F
:10018000CF24B624FA30DC24232B2716ED30B3001D
:10019000CF24B624FA30DC2435153508B300CF243B
:1001A000B624FA30DC24232B3308113C031DDA2853
:1001B000A712642B3308143C031D232B27139B2BFE
:1002000002309F0083120313091083160313091091
:1002100083120313831603130614051601138312A6
:1002200003138B100B168316031305148617831202
:100230000313C1309F000B108B15F8308B058C0118
:100240008D018B170230B500B201A701A801A901E9
:1002500083160313013088058312031388120813D1
:100260008813E130880504303724033047246124A3
:10027000013037240830472461240130372402300C
:10028000472461240130372428304E240C304E247A
:1002900001304E24083037242830B700B80126300A
:1002A000A50006308A002508263C00265024A50B10
:1002B0005129FF30B300CF24B624ED30B300CF2452
:1002C000B624FA30DC243508B300CF24B624FA3043
:1002D000DC24ED30B300CF24B624FA30DC2435140E
:1002E0003508B300CF24B624FA30DC24FF30A00058
:1002F0000430852480303724F030A0000430852479
:10030000C0304E242830A50006308A002508283C3D
:100310004F265024A50B842929141730BE00033022
:10032000BF0055309C24A81B1F25A71B9D20291802
:100330009329AA2480303724F030A000043085248B
:1003400080303724F030A000043085248B133E0821
:100350008316031399001811831203139817831639
:1003600003138C169816831203130B171816F83004
:100370008B058C018D018B1701304E242730A50091
:1003800006308A002508273C2726A600B224260826
:100390005024A50BC0290D30B2240A30B2240A30F3
:1003A000B224A71B9D202718E624A81B1F25D129AE
:1004400082070034393400343534333431343234B3
:1004500032340034303438343634343409347E3471
:10046000003400342D2B2B2B00342F2B71343134DE
:100470000034003400347A347334613477343234E5
:1004800000340034633478346434653434343334C1
:1004900000340034203476346634743472343534A5
:1004A000003400346E34623468346734793436345E
:1004B0000034003400346D346A34753437343834E1
:1004C000003400342C346B3469346F3430343934B4
:1004D000003400342E343F346C343B3470342D34CB
:1004E000003400340034273400345B342B340034BF
:1004F000003400342B2B1A2B5D3400347C34003450
:10050000003400343C3430342E3432343534363414
:1005100038340034003431342B3433342D342A341D
:10052000393400340834003400343134373434344E
:100530003734A71DAB2AA71AAB2A271BAB2A3308CF
:100540004A3C031DA62A2F30B300DF2A33085A3C49
:100550000318AB2A232B3308613C0318C12A0E3041
:10056000B3023308613C031CB82A1930B307C12A0F
:100570003308773C0318C12A3308D23C0319A71566
:10058000232B02308A0033082022B300B30803195A
:10059000232BA71A472B271B352B3308603C031846
:1005A000B42B33087A3C031CB42B3308271ADB2AFC
:1005B000271DDF2ADD2A2719DF2AE03EB30029188C
:1005C000042B3308B2243308083C031DF52A3808ED
:1005D0000319232BB8033808403E8038A5004E2469
:1005E0002030502425084E24232B3308093C031DBA
:1005F000022B3808263C031C002B20305024B80A5C
:100600002030B3007225232B3308613C031D0E2BD1
:100610005125F030A00004308524172B3308733C9B
:10062000031D172B2910F030A0000430852455300D
:10063000C100232B29180034A81680250D30B224C0
:100640000A30B224003483160313061483120313F2
:10065000A7130B16080027150034A716302B2717F1
:10066000B901BA01BB01BC0100343308403C031896
:10067000472B3308463C031C3F2BB3164F2B330844
:10068000603C0318472B3308663C03184F2B330894
:10069000293C0318232B3308393C031C232BB908AE
:1006A000031D562BB90A3308BA00232B390B5C2BD8
:1006B000B90A3308BB00232B3908023C031D232B46
:1006C000B90A3308BC00232BB9080319232B303097
:1006D000BA02BB02BC02B903031D712B3A08B30076
:1006E0008B2BB903031D7B2B03308A003A088D2323
:1006F0003B07B3008B2B3A08023C031C232B03302F
:100700008A003A080A3E8D23BA003B088D23BA07B7
:100710003C083A07B300B901DF2A820700340A34E3
:1007200014341E34283432343C34463450345A3471
:1007300000346434C834B9080319232B3030BA02AA
:10074000BB02BA1EA52B2730BA02BB1EA92B27302D
:10075000BB02B903031DAF2B3A08B300B22B3A0E0C
:100760003B04B300B901DF2A271DDF2A33080D3C03
:100770000318DF2A3408613C031CDF2A34083C3CA0
:100780000318C52B3D30B402CE2B3408243C03188B
:10079000CC2B2330B402CE2B0430B40703308A00B4
:1007A0003408D423B300DF2A820726342A342434C1
:1007B00023343C34003400340034293428340034E9
:1007C00025343E342F3400343A3400345F346034FE
:1007D0005E340034223400347B343D340034213420
:1007E0000034003400347D3400345C340034403450
:0407F00000343E345F
:10086000A000810183160313C03081050800A00099
:10087000810183160313C030810501308104831286
:1008800003130B110B1D422CA00B412C0800A200DE
:10089000E1308805220D1E39880408002816512CE5
:1008A0002812A3006A24281E88172308230E472431
:1008B0006124230847246124E13088058813081344
:1008C000080088160000881208001830A200A20B49
:1008D000672C08008813A815831603131E3088049C
:1008E000831203130817000088166524081EA81138
:1008F000881265246124A819742C08138316031325
:10090000E1308805831203130800A10081018316DA
:10091000031307308100831203130B11091497246A
:10092000091097240B1D8E2CA10B8D2C080020087C
:10093000A200A20B992C0800C10029118E018F0181
:100940000C10831603130C14831203130B1731308E
:1009500090000800831603130C1083120313101069
:10096000291108000C1EB22C990008000B128316E6
:10097000031306100512831203130610051220300C
:10098000A000A00BC12CB20183160313061483121E
:10099000031328148B100B162818CC2C0800A20067
:1009A0000830A300A4012218A40AA20CA30BD32C84
:1009B000A810241CA8140800B60028152919E32C37
:1009C0002819DE2C08002811B20108002A08AC0002
:1009D000FA24A91CF42C2B08AC00FA24A910981CAA
:1009E000F42C181218111816831603138C16831280
:1009F000031308002C08083C031D082D37080319B1
:100A00001D2DB703370880384E24203050241D2D6B
:100A10003708273C03180E2DA81280253708803888
:100A20004E242C080D3C031C1A2D031D1D2DA8124D
:100A300080251D2D2C085024B70A27100800F030FF
:100A4000A000043085240B30A50006308A0025085C
:100A5000A226FD3EA6003D02031C332D26083D02C2
:100A6000063C0318352DA50B252D06308A002508D8
:100A7000AF262918412DB224B3007225A8138B1577
:100A80000800A5002A3C031D472D51254C2D2508A3
:100A9000233C031D4C2D2910A8135530C1008B1584
:100AA0000800C001BF0A3F08073C0318582DBF01CA
:100AB0003F08A6000319602D0430C007A60B5C2D6B
:100AC000C6304E240430A60006308A00400878263E
:100AD0005024C00AA60B642D06308A003F089926D0
:100AE000BE0008003808273C0318782DA81680257A
:100AF0003808403E80384E2433085024B80A080095
:100B00002830A81A8E2DB70080304E242030502473
:100B1000B70B862D80304E24B7010800B800C030D6
:100B20004E2420305024B80B912DC0304E24B801F3
:020B30000800BB
:100C0000820743347534733474346F346D3469340B
:100C10007A346134743469346F346E3420346F3410
:100C200066342034533465347234693461346C343E
:100C3000203443346F346D346D3475346E3469341C
:100C400063346134743469346F346E343A348207F7
:100C500050344934433431343634463437343734FD
:100C600020344134543420344B3465347934623484
:100C70006F34613472346434203442346F347834E5
:100C80002034563432342E343034353420347334F6
:100C9000743461346E3464342D34623479348207B0
:100CA0005234533432343334323420342034203408
:100CB000393436343034303420346234613475346D
:100CC00064342034203461342F342A3420346134A5
:100CD0006C347434653472342034203473342F34DB
:100CE00023342034733465346C34653463347434A1
:100CF00082072034203431343234203420343234EA
:100D000034342034203434343834203420343934EA
:100D100036342034313439343234203433343834B6
:100D20003434203435343734363431343134353496
:100D300032348207BF345F342F3417340B34053418
:100D40000334013482074E345E346C347C348B348B
:100D50009B34AC34BE34CF34E134F334FF348207F7
:100D60002A3437343434313430343834353432344E
:080D70002334393436343334E6
:02400E00F23F7F
:00000001FF
:020000040000FA
:1000000083160313810100298B138B1B0428AD0079
:10001000030EAE0083010A08AF008A0183130408AF
:10002000B0008B1838280B182A288C1A21280C1895
:100030001A289428C103031D1F28291529100C1004
:1000400094281A08AA002714831603138C1283120B
:1000500003138E28861F90288B115030B100B10BEE
:100060002F281F151F1932281E08BD00A817902819
:10007000281C5E283208073C031C4428331C051248
:1000800033180516B30C92283208083C031C4D287F
:10009000A81C0512A818051692283208093C031C52
:1000A0005728831603130516831203139228320868
:1000B0000B3C031C9228B20128109328B208031DA0
:1000C0006428051A892892283208083C031C7028E5
:1000D000051EB313051AB31703199228B30C9228FF
:1000E0003208093C031C75289228051E8A28281905
:1000F0008228A71783160313061083120313061012
:100100000B128C2836083302031D8B282811B201EC
:1001100093288B288B28B301B20193288C12942842
:100120000B109428B20A8B10300884002F088A0024
:100130002E0E8300AD0E2D0E09003308B400F03CE6
:10014000031DA528A714A711232BA71C992AA710C4
:100150003308123C0319AF283308593C03192711FF
:100160003308583C031DD428271EC5282712ED301C
:10017000B300CF24B624FA30DC2435113508B3009F
:10018000CF24B624FA30DC24232B2716ED30B3001D
:10019000CF24B624FA30DC2435153508B300CF243B
:1001A000B624FA30DC24232B3308113C031DDA2853
:1001B000A712642B3308143C031D232B27139B2BFE
:1002000002309F0083120313091083160313091091
:1002100083120313831603130614051601138312A6
:1002200003138B100B168316031305148617831202
:100230000313C1309F000B108B15F8308B058C0118
:100240008D018B170230B500B201A701A801A901E9
:1002500083160313013088058312031388120813D1
:100260008813E130880504303724033047246124A3
:10027000013037240830472461240130372402300C
:10028000472461240130372428304E240C304E247A
:1002900001304E24083037242830B700B80126300A
:1002A000A50006308A002508263C00265024A50B10
:1002B0005129FF30B300CF24B624ED30B300CF2452
:1002C000B624FA30DC243508B300CF24B624FA3043
:1002D000DC24ED30B300CF24B624FA30DC2435140E
:1002E0003508B300CF24B624FA30DC24FF30A00058
:1002F0000430852480303724F030A0000430852479
:10030000C0304E242830A50006308A002508283C3D
:100310004F265024A50B842929141730BE00033022
:10032000BF0055309C24A81B1F25A71B9D20291802
:100330009329AA2480303724F030A000043085248B
:1003400080303724F030A000043085248B133E0821
:100350008316031399001811831203139817831639
:1003600003138C169816831203130B171816F83004
:100370008B058C018D018B1701304E242730A50091
:1003800006308A002508273C2726A600B224260826
:100390005024A50BC0290D30B2240A30B2240A30F3
:1003A000B224A71B9D202718E624A81B1F25D129AE
:1004400082070034393400343534333431343234B3
:100450003234003430343834363434340934A73448
:10046000003400342D2B2B2B00342F2B71343134DE
:1004700000340034003479347334613477343234E6
:1004800000340034633478346434653434343334C1
:1004900000340034203476346634743472343534A5
:1004A000003400346E346234683467347A3436345D
:1004B0000034003400346D346A34753437343834E1
:1004C000003400342C346B3469346F3430343934B4
:1004D000003400342E342D346C34F6347034273428
:1004E000003400340034E4340034FC345E3400342E
:1004F000003400342B2B1A2B2134003424340034E4
:10050000003400343C3430342E3432343534363414
:1005100038340034003431342B3433342D342A341D
:10052000393400340834003400343134373434344E
:100530003734A71DAB2AA71AAB2A271BAB2A3308CF
:100540004A3C031DA62A2F30B300DF2A33085A3C49
:100550000318AB2A232B3308613C0318C12A0E3041
:10056000B3023308613C031CB82A1930B307C12A0F
:100570003308773C0318C12A3308D23C0319A71566
:10058000232B02308A0033082022B300B30803195A
:10059000232BA71A472B271B352B3308603C031846
:1005A000B42B33087A3C031CB42B3308271ADB2AFC
:1005B000271DDF2ADD2A2719DF2AE03EB30029188C
:1005C000042B3308B2243308083C031DF52A3808ED
:1005D0000319232BB8033808403E8038A5004E2469
:1005E0002030502425084E24232B3308093C031DBA
:1005F000022B3808263C031C002B20305024B80A5C
:100600002030B3007225232B3308613C031D0E2BD1
:100610005125F030A00004308524172B3308733C9B
:10062000031D172B2910F030A0000430852455300D
:10063000C100232B29180034A81680250D30B224C0
:100640000A30B224003483160313061483120313F2
:10065000A7130B16080027150034A716302B2717F1
:10066000B901BA01BB01BC0100343308403C031896
:10067000472B3308463C031C3F2BB3164F2B330844
:10068000603C0318472B3308663C03184F2B330894
:10069000293C0318232B3308393C031C232BB908AE
:1006A000031D562BB90A3308BA00232B390B5C2BD8
:1006B000B90A3308BB00232B3908023C031D232B46
:1006C000B90A3308BC00232BB9080319232B303097
:1006D000BA02BB02BC02B903031D712B3A08B30076
:1006E0008B2BB903031D7B2B03308A003A088D2323
:1006F0003B07B3008B2B3A08023C031C232B03302F
:100700008A003A080A3E8D23BA003B088D23BA07B7
:100710003C083A07B300B901DF2A820700340A34E3
:1007200014341E34283432343C34463450345A3471
:1007300000346434C834B9080319232B3030BA02AA
:10074000BB02BA1EA52B2730BA02BB1EA92B27302D
:10075000BB02B903031DAF2B3A08B300B22B3A0E0C
:100760003B04B300B901DF2A271DDF2A33080D3C03
:100770000318DF2A3408613C031CDF2A34083C3CA0
:100780000318C52B3D30B402CE2B3408243C03188B
:10079000CC2B2330B402CE2B0430B40703308A00B4
:1007A0003408D423B300DF2A82072F3428342334BB
:1007B0002A343B340034003400343D3429340034CE
:1007C00025343A345F3400345C3400343F344034F0
:1007D000263400347B3400345B347E3400342B34D4
:1007E0000034003400345D3400347D34003422346D
:0407F00000343E345F
:10086000A000810183160313C03081050800A00099
:10087000810183160313C030810501308104831286
:1008800003130B110B1D422CA00B412C0800A200DE
:10089000E1308805220D1E39880408002816512CE5
:1008A0002812A3006A24281E88172308230E472431
:1008B0006124230847246124E13088058813081344
:1008C000080088160000881208001830A200A20B49
:1008D000672C08008813A815831603131E3088049C
:1008E000831203130817000088166524081EA81138
:1008F000881265246124A819742C08138316031325
:10090000E1308805831203130800A10081018316DA
:10091000031307308100831203130B11091497246A
:10092000091097240B1D8E2CA10B8D2C080020087C
:10093000A200A20B992C0800C10029118E018F0181
:100940000C10831603130C14831203130B1731308E
:1009500090000800831603130C1083120313101069
:10096000291108000C1EB22C990008000B128316E6
:10097000031306100512831203130610051220300C
:10098000A000A00BC12CB20183160313061483121E
:10099000031328148B100B162818CC2C0800A20067
:1009A0000830A300A4012218A40AA20CA30BD32C84
:1009B000A810241CA8140800B60028152919E32C37
:1009C0002819DE2C08002811B20108002A08AC0002
:1009D000FA24A91CF42C2B08AC00FA24A910981CAA
:1009E000F42C181218111816831603138C16831280
:1009F000031308002C08083C031D082D37080319B1
:100A00001D2DB703370880384E24203050241D2D6B
:100A10003708273C03180E2DA81280253708803888
:100A20004E242C080D3C031C1A2D031D1D2DA8124D
:100A300080251D2D2C085024B70A27100800F030FF
:100A4000A000043085240B30A50006308A0025085C
:100A5000A226FD3EA6003D02031C332D26083D02C2
:100A6000063C0318352DA50B252D06308A002508D8
:100A7000AF262918412DB224B3007225A8138B1577
:100A80000800A5002A3C031D472D51254C2D2508A3
:100A9000233C031D4C2D2910A8135530C1008B1584
:100AA0000800C001BF0A3F08073C0318582DBF01CA
:100AB0003F08A6000319602D0430C007A60B5C2D6B
:100AC000C6304E240430A60006308A00400878263E
:100AD0005024C00AA60B642D06308A003F089926D0
:100AE000BE0008003808273C0318782DA81680257A
:100AF0003808403E80384E2433085024B80A080095
:100B00002830A81A8E2DB70080304E242030502473
:100B1000B70B862D80304E24B7010800B800C030D6
:100B20004E2420305024B80B912DC0304E24B801F3
:020B30000800BB
:100C0000820743347534733474346F346D3469340B
:100C10007A346134743469346F346E3420346F3410
:100C200066342034533465347234693461346C343E
:100C3000203443346F346D346D3475346E3469341C
:100C400063346134743469346F346E343A348207F7
:100C500050344934433431343634463437343734FD
:100C600020344134543420344B3465347934623484
:100C70006F34613472346434203442346F347834E5
:100C80002034563432342E343034353420347334F6
:100C9000743461346E3464342D34623479348207B0
:100CA0005234533432343334323420342034203408
:100CB000393436343034303420346234613475346D
:100CC00064342034203461342F342A3420346134A5
:100CD0006C347434653472342034203473342F34DB
:100CE00023342034733465346C34653463347434A1
:100CF00082072034203431343234203420343234EA
:100D000034342034203434343834203420343934EA
:100D100036342034313439343234203433343834B6
:100D20003434203435343734363431343134353496
:100D300032348207BF345F342F3417340B34053418
:100D40000334013482074E345E346C347C348B348B
:100D50009B34AC34BE34CF34E134F334FF348207F7
:100D60002A3437343434313430343834353432344E
:080D70002334393436343334E6
:02400E00F23F7F
:00000001FF
;***************************************************************************
;
; AT Keyboard Interface with Morse Code V1.02
; ===========================================
;
; written by Peter Luethi, 02.02.2003, Dresden, Germany
; http://www.electronic-engineering.ch
; last update: 11.04.2004
;
; V1.02: Re-structured ISR and RS232 echo sub-routines
; (11.04.2004)
;
; V1.01: Improved AT keyboard and RS232 initialization,
; fixed RBIF/INTF interrupt initialization issue.
; Changed keyboard data pin to PORTA,4 (open-collector).
; (16.08.2003)
;
; V1.00: Initial release (23.03.2003)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock Frequency: 4.00 MHz XT
; Throughput: 1 MIPS
; RS232 Baud Rate: 9600 baud (depends on the module included)
; Serial Output: 9600 baud, 8 bit, no parity, 1 stopbit
; Acquisition Methodology: Preemptive, interrupt-based
; keyboard scan pattern acquisition
; routine, with decoding to ASCII
; characters during normal operation
; Code Size of entire Program: 782 instruction words
; Required Hardware: AT Keyboard, MAX 232
; Optional Hardware: Piezo beeper with decoupling capacitor
; by a zero.
; The Morse code has different lengths for encoding, e.g.
; e=. b = -... 1 = .---- ? = ..--..
; therefore 16 bits are necessary to support all of them.
; For instance, 'b' is encoded in 16 bits as b'1101_0101_0000_0000'
; Subsequent zeros at the end within a pattern are considered as
; termination and are ignored. The Morse pattern is signaled as
; pulse-width modulated stream at the Morse port, active high.
;
; Acoustic feedback of Morse code output through additional
; Piezo beeper possible.
;
;
; IMPLEMENTED FEATURES:
; =====================
; - Uni-directional communication between microcontroller application
; and remote RS232 client.
; - Uni-directional communication between microcontroller and keyboard.
; - Support for all keyboard characters typed with shift button active
; and inactive.
; - English and modified Swiss-German 'codepages' available
; (QWERTY and QWERTZ)
; Include the desired keyboard lookup tables at the correct location.
; - Caps Lock implemented
; - Num Lock always active
; - Possibility to implement short-cuts or user defined characters
; for 'Esc', 'Num Lock', 'Scroll Lock' and 'F1' - 'F12' keys
;
; - Further enhancement, not implemented: Support of ASCII conversion
; from direct ALT-DEC and CTRL-HEX entries, e.g. ALT + 6 + 4 = @
; or CTRL + 3 + F = ?
;
; - Morse code translation and PWM output at Morse port, active high
; - Acoustic feedback through Piezo beeper, default enabled
;
;
; LIMITATIONS:
; ============
; - No support for ALT-GR characters.
; - Minimized keyboard routine with support for only uni-directional
; communication from keyboard to controller, therefore no control
; over keyboard status LEDs.
; - No support for arrow buttons, 'Home', 'Del', 'PageUp', 'PageDown',
; 'Insert', 'End' because there exists no character/command
PROCESSOR 16F84
#include "p16f84.inc"
TEMP1 set
BASE+d'0' ; Universal temporary register
TEMP2 set
BASE+d'1' ; ATTENTION !!!
TEMP3 set
BASE+d'2' ; They are used by various modules.
TEMP4 set
BASE+d'3' ; If you use them, make sure not to use
; them concurrently !
FLAGreg equ BASE+d'4' ; register containing keyboard and other flags
;FLAGreg2 equ BASE+d'5'
; RS232 registers
TXD equ
BASE+d'6' ; RS232 TX-Data register
RXD equ
BASE+d'7' ; RS232 RX-Data register (not used here,
; but m_rs232 requires its declaration)
; AT keyboard registers and flags
#define RELflag FLAGreg,0x00 ; release flag (0xF0)
#define SHIflag FLAGreg,0x01 ; shift flag (0x12 / 0x59)
#define SPEflag FLAGreg,0x02 ; special code flag (0xE0)
#define CAPflag FLAGreg,0x03 ; caps lock flag (0x0D)
#define ALTflag FLAGreg,0x04 ; ALT flag (0x11)
#define CTRLflag FLAGreg,0x05 ; CTRL flag (0x14)
#define KBDflag FLAGreg,0x06 ; keyboard data reception flag
KBDcnt equ BASE+d'8' ; IRQ based keyboard scan pattern counter
KBD equ BASE+d'9' ; keyboard scan code & ascii data register
KBDcopy equ BASE+d'10' ; keyboard scan code register
ORG 0x240
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
#include "..\..\m_rs096.asm" ; 9600 baud @ 4 MHz
IF BEEP_ENABLE == 1 ; conditional assembly
#include "..\..\m_beep.asm" ; Piezo beeper
ENDIF
KEYBOARDinit macro
BANK1
bsf KBDclktris ; set keyboard clock line to input explicitely
bsf KBDdatatris ; set keyboard data line to input explicitely
bcf OPTION_REG,INTEDG ; keyboard interrupt on falling edge
BANK0
bsf INTCON,INTE ; enable RB0/INT interrupts
endm
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
;*****************************************
;*** KEYBOARD SCAN PATTERN ACQUISITION ***
;*****************************************
;***********************************
;*** CLEARING OF INTERRUPT FLAGS ***
;***********************************
; NOTE: Below, I only clear the interrupt flags! This does not
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
KBDdecode
;**********************************************************
;*** KEYBOARD SCAN CODE PRE-DECODING, SET / CLEAR FLAGS ***
;**********************************************************
;****************************************************
;* The following table has to be located within one *
;* page to allow for correct lookup functionality. *
;* Therefore, additional ISR code has been moved *
;* further down. *
;****************************************************
;*********************************************************************
;* LOOKUP TABLE FOR KEYBOARD-SCAN-CODE TO ASCII-CHARACTER CONVERSION *
;*********************************************************************
;****************************************************
;* The following code belongs also to the interrupt *
;* service routine and has been moved down to this *
;* place to allow the main keyboard decode lookup *
;* table to be located within one page. *
;* The code below may be arranged on another page, *
;* but that doesn't matter. *
;****************************************************
;********************************
;*** SCAN CODE RANGE CHECKING ***
;********************************
_KBD_2 ;*** check if special code (0xE0) has been submitted previously ***
btfss SPEflag
goto _KBD_3
;*** decoding of scan code with preceeding special code (0xE0) ***
; (decoding currently only necessary for 'E0 4A' = '/')
movfw KBD
sublw 0x4A ; 0x4A - w
bnz _NOSUP ; branch on non-zero
movlw '/' ; store '/' in KBD
movwf KBD
goto _OUTP
_NOSUP ;*** check if scan code 0x5A or smaller has occurred ***
movfw KBD
sublw 0x5A ; 0x5A - w
bc _KBD_3 ; carry if result positive or zero, branch
;*** range exceeded (above 0x5A) ***
; it's one of the following keys: arrow button, 'Home', 'Del',
; 'PageUp', 'PageDown', 'Insert', 'End'
;*******************************************************
;*** SCAN CODE DECODING & ASCII CHARACTER CONVERSION ***
;*******************************************************
;**********************************************************
;*** KEYBOARD DATA OUTPUT TO RS232 & MORSE CODE BUFFERS ***
;**********************************************************
movfw MRStmp0
BRS 0x41, _ClrStall ; branch on w < 0x41
;now in 0x41 - 0x5A, calculate table pointer
rlf MRStmp0,W ; get ASCII character value, multiply 2
addlw d'146' ; subtract (wrap-around addition)
movwf MRS_pnt ; store calculated pointer
goto _MRS_dec ; goto decoding
goto _MRSspc3
_MRSspc1f movfw MRStmp0
BNEQ 0x2E, _ClrStall ; wasn't '.' - exit
movlw d'82' ; load discrete pointer
goto _MRSspc3
;prepare decoding
_MRS_dec bsf MRSflag ; if valid, set flag
movwf MRS_pnt ; store value in pointer
;get corresponding Morse code lookup-table entry
;and store entries in morse buffer (high & low)
movlw HIGH MORSEtable ; get correct page for PCLATH
movwf PCLATH ; prepare right page bits for table read
movfw MRS_pnt ; get pointer for high value
call MORSEtable ; call lookup-table
movwf MRS_hbuf ; store in high buffer
incf MRS_pnt,f ; increment pointer for low value
movfw MRS_pnt ; get pointer
call MORSEtable ; call lookup-table
movwf MRS_lbuf ; store in low buffer
;************************************************
;*** SPECIAL COMMANDS I (with special output) ***
;************************************************
;**********************************************************
;*** STALL RELEASE & CLEAR KEYBOARD DATA RECEPTION FLAG ***
;**********************************************************
_ClrStall
BANK1
bsf KBDclktris ; set clk line back to input (and goes high)
BANK0 ; (release stall)
bcf KBDflag ; clear keyboard data reception flag
bsf INTCON,INTE ; re-enable interrupt RB0/INT
RETURN
;****************************************************
;*** SPECIAL COMMANDS II (without special output) ***
;****************************************************
;***********************************************
;*** ALT-DEC & CTRL-HEX STORING & CONVERSION ***
;***********************************************
; store typed numbers in CTRLreg1 - CTRLreg3
_CTRLstr ; /not implemented, enhancement/
_ALTstr ; /not implemented, enhancement/
;*****************************************************************
;*** SCAN CODE DECODING & ASCII CONVERSION FOR 'SHIFT' ENTRIES ***
;*****************************************************************
_SHICHR ;*** special character decoding typed with shift button active ***
; check for active shift button, if not active, branch
btfss SHIflag
goto _OUTP ; branch
; check for 'backspace', 'tab', 'linefeed' and 'carriage return' :
; (here, KBD has already been converted to ASCII character values)
movfw KBD
sublw d'13' ; d'13' - w
bc _OUTP ; carry if result zero or positive, branch
;*******************************************************
;* The following table has also to be located within *
;* one page to allow for correct lookup functionality. *
;*******************************************************
;**********************************************************************
;* LOOKUP TABLE FOR SPECIAL CHARACTERS TYPED WITH SHIFT BUTTON ACTIVE *
;**********************************************************************
ORG 0x1B0
MORSEout
movfw MRS_lbuf ; copy buffers to output registers
movwf MRS_lo
movfw MRS_hbuf
movwf MRS_hi
bcf MRSflag ; reset Morse flag
clrf MRS_cnt ; clear one's counter
movlw 0x2
movwf MRStmp0 ; set up outer loop counter
_MRSloop1
movlw 0x8
movwf MRStmp1 ; set up inner loop counter
; in first pass, take high value, in second pass, take low value
btfsc MRStmp0,1 ; check for first outer loop pass
movfw MRS_hi ; get high value
btfss MRStmp0,1 ; check for second outer loop pass
movfw MRS_lo ; get low value
movwf MRStmp2 ; store in temp register
_MRSloop2
btfss MRStmp2,0x7 ; check for 1
goto _MRSout ; it has been a zero, signal now
incf MRS_cnt,F ; increment one's counter
goto _MRSnext ; continue loop
_MRSout ;*** check for next dash/dot to signal ***
BANK1
clrf OPTION_REG ; PORTB pull-ups enabled
goto _MAIN
ORG 0x180
;******************************
_MLOOP btfsc KBDflag ; check scan pattern reception flag
call KBDdecode ; if set, call decoding routine
btfsc MRSflag ; check for new Morse buffer content
call MORSEout ; if set, call Morse output subroutine
goto _MLOOP ; endless loop
;******************************
WelcomeTable
addwf PCL,F ; add offset to table base pointer
DT "PIC 16F84 AT Keyboard Decoder connected" ; create table
retlw CR ; Carriage Return
retlw LF ; Line Feed
WelcomeTableEND retlw LF ; Line Feed
MORSEtable
addwf PCL,1
retlw 0xDB ; 0, Hi-Byte
retlw 0x6C ; Lo-Byte
retlw 0xB6 ;1
retlw 0xD8
retlw 0xAD ;2
retlw 0xB0
retlw 0xAB ;3
retlw 0x60
retlw 0xAA ;4
retlw 0xC0
retlw 0xAA ;5
retlw 0x80
retlw 0xD5 ;6
retlw 0x40
retlw 0xDA ;7
retlw 0xA0
retlw 0xDB ;8
retlw 0x50
retlw 0xDB ;9
retlw 0x68
retlw 0xB0 ;A
retlw 0x0
retlw 0xD5 ;B
retlw 0x0
retlw 0xD6 ;C
retlw 0x80
retlw 0xD4 ;D
retlw 0x0
retlw 0x80 ;E
retlw 0x0
retlw 0xAD ;F
retlw 0x0
retlw 0xDA ;G
retlw 0x0
retlw 0xAA ;H
retlw 0x0
retlw 0xA0 ;I
retlw 0x0
retlw 0xB6 ;J
retlw 0xC0
retlw 0xD6 ;K
retlw 0x0
retlw 0xB5 ;L
retlw 0x0
retlw 0xD8 ;M
retlw 0x0
retlw 0xD0 ;N
retlw 0x0
retlw 0xDB ;O
retlw 0x0
retlw 0xB6 ;P
retlw 0x80
retlw 0xDA ;Q
retlw 0xC0
retlw 0xB4 ;R
retlw 0x0
retlw 0xA8 ;S
retlw 0x0
retlw 0xC0 ;T
retlw 0x0
retlw 0xAC ;U
retlw 0x0
retlw 0xAB ;V
retlw 0x0
retlw 0xB6 ;W
retlw 0x0
retlw 0xD5 ;X
retlw 0x80
retlw 0xD6 ;Y
retlw 0xC0
retlw 0xDA ;Z
retlw 0x80
retlw 0xB5 ;"
retlw 0x68
retlw 0xB6 ;'
retlw 0xDA
retlw 0xD6 ; ()
retlw 0xD6
retlw 0xDA ;,
retlw 0xB6
retlw 0xD5 ;-
retlw 0x58
retlw 0xB5 ;.
retlw 0xAC
retlw 0xDB ;:
retlw 0x54
retlw 0xAD ;?
MORSEtableEND retlw 0xA8
END
:020000040000FA
:1000000083160313810180298B138B1B042897000F
:10001000030E980083010A0899008A0183130408DB
:100020009A009408031D1728051A33283628140847
:10003000083C031C2328051E9513051A9517031960
:100040003628950C36281408093C031C2828362825
:10005000051E33281017831603130610831203138B
:1000600006100B123428950194013728940A8B103E
:100070001A08840019088A00180E8300970E170EBC
:10008000090015089600F03C031D492810141011B2
:100090003529101C902810101508123C03195328FC
:1000A0001508593C031990101508583C031D5E288B
:1000B000901D5C2890113529901535291508113CA3
:1000C000031D6428101243291508143C031D35290B
:0400D000901243291E
:10012000101D9E2815084A3C031D99282F30950064
:10013000CE2815085A3C03189E2835291508613C1D
:100140000318B4280E3095021508613C031CAB2837
:1001500019309507B4281508773C0318B4281508FA
:10016000D23C03191015352903308A001508612384
:1001700095009508031935291508603C0318442992
:1001800015087A3C031C442915089019CA28901CAC
:10019000CE28CC289018CE28E03E950015089B006C
:1001A00057221B087A3C031C35291B08403C0318C6
:1001B000E2289B121B08403C031835291B0D923E78
:1001C0009E0025291B082F3C0318EE281B08393CEC
:1001D000031C18291B0D9F3E9E0025291B08223C4D
:1001E000031DF428483023291B08273C031DFA2847
:1001F0004A3023291B08283C031D00294C302329A1
:100200001B08293C031D06294C3023291B082C3CC4
:10021000031D0C294E3023291B082D3C031D1229D8
:10022000503023291B082E3C031D35295230232929
:100230001B083A3C031D1E29543023291B083F3C50
:10024000031D352956309E00252990179E00033046
:100250008A001E080723A1009E0A1E080723A0008B
:1002600035290D3057220A3008008316031306146F
:100270008312031310130B16080090140034101689
:100280000034901600343529901CCE2815080D3CFA
:100290000318CE281608613C031CCE2816083C3CE7
:1002A000031855293D3096025E291608243C031890
:1002B0005C29233096025E290430960703308A00B9
:0802C0001608DA239500CE2890
:1003000005100511851183120313051405118316B9
:100310000313061405160113831203130B1694011D
:100320009001F8308B058B172A308E0002308A003E
:100330000E082A3CD02257228E0B9629FF308C00C3
:100340000230852290308C0003308522C0308C0032
:0E03500003308522101B4120901BB021AA29EA
:100360002008A2002108A30090139F0102309B00E7
:1003700008309C009B1823089B1C22089D009D1F91
:10038000C3299F0ADA299F080319DA2905151F08CE
:10039000013C031CD02991308C0001308522D429E6
:1003A000FA308C00053085220511063040220630D7
:1003B0004E229F019D0D9C0BBF299B0BB829083035
:0803C000402206304E22080025
:100480008C00810183160313C030810508008C00A5
:10049000810183160313C03081050130810483126A
:1004A00003130B110B1D522A8C0B512A08009200CA
:1004B000051008308C00682212180514121C051053
:1004C000920C68228C0B5C2A0514682268220800B2
:1004D0001D308D006E2A0B308D006E2A8D0B6E2A1A
:1004E00008006B220618832A08308C006822061840
:1004F0009317061C93130C0B930C8C0B762A682213
:10050000061C93010800930138288D008101831691
:10051000031307308100831203130B1185159722F3
:10052000851197220B1D8E2A8D0B8D2A08000C0831
:080530008E008E0B992A0800D1
:1005A00082075034493443342034313436344634AD
:1005B0003834343420344134543420344B346534AA
:1005C000793462346F3461347234643420344434A6
:1005D000653463346F346434653472342034633486
:1005E0006F346E346E34653463347434653464341B
:0605F0000D340A340A3448
:02060E00820761
:10061000DB346C34B634D834AD34B034AB346034FD
:10062000AA34C034AA348034D5344034DA34A03407
:10063000DB345034DB346834B0340034D534003427
:10064000D6348034D434003480340034AD340034B3
:10065000DA340034AA340034A0340034B634C03460
:10066000D6340034B5340034D8340034D0340034B7
:10067000DB340034B6348034DA34C034B43400347B
:10068000A8340034C0340034AC340034AB3400340B
:10069000B6340034D5348034D634C034DA348034BF
:1006A000B5346834B634DA34D634D634DA34B634C1
:1006B000D5345834B534AC34DB345434AD34A83488
:0E06C200820700343934003435343334313497
:1006D000323432340034303438343634343409343B
:1006E0007E34003400343F293D29003441297134DF
:1006F00031340034003400347A3473346134773464
:10070000323400340034633478346434653434343F
:100710003334003400342034763466347434723424
:100720003534003400346E346234683467347934DC
:1007300036340034003400346D346A347534373460
:100740003834003400342C346B3469346F34303432
:100750003934003400342E343F346C343B3470343C
:100760002D34003400340034273400345B342B340F
:100770000034003400343D2931295D3400347C34A8
:100780000034003400343C3430342E3432343534C8
:10079000363438340034003431342B3433342D348F
:1007A0002A343934003408340034003431343734D6
:1007B00034343734820726342A34243423343C3406
:1007C00000340034003429342834003425343E34D5
:1007D0002F3400343A3400345F3460345E340034F3
:1007E000223400347B343D3400342134003400346E
:1007F00000347D3400345C340034403400343E3402
:02400E00F13F80
:00000001FF
:020000040000FA
:1000000083160313810180298B138B1B042897000F
:10001000030E980083010A0899008A0183130408DB
:100020009A009408031D1728051A33283628140847
:10003000083C031C2328051E9513051A9517031960
:100040003628950C36281408093C031C2828362825
:10005000051E33281017831603130610831203138B
:1000600006100B123428950194013728940A8B103E
:100070001A08840019088A00180E8300970E170EBC
:10008000090015089600F03C031D492810141011B2
:100090003529101C902810101508123C03195328FC
:1000A0001508593C031990101508583C031D5E288B
:1000B000901D5C2890113529901535291508113CA3
:1000C000031D6428101243291508143C031D35290B
:0400D000901243291E
:10012000101D9E2815084A3C031D99282F30950064
:10013000CE2815085A3C03189E2835291508613C1D
:100140000318B4280E3095021508613C031CAB2837
:1001500019309507B4281508773C0318B4281508FA
:10016000D23C03191015352903308A001508612384
:1001700095009508031935291508603C0318442992
:1001800015087A3C031C442915089019CA28901CAC
:10019000CE28CC289018CE28E03E950015089B006C
:1001A00057221B087A3C031C35291B08403C0318C6
:1001B000E2289B121B08403C031835291B0D923E78
:1001C0009E0025291B082F3C0318EE281B08393CEC
:1001D000031C18291B0D9F3E9E0025291B08223C4D
:1001E000031DF428483023291B08273C031DFA2847
:1001F0004A3023291B08283C031D00294C302329A1
:100200001B08293C031D06294C3023291B082C3CC4
:10021000031D0C294E3023291B082D3C031D1229D8
:10022000503023291B082E3C031D35295230232929
:100230001B083A3C031D1E29543023291B083F3C50
:10024000031D352956309E00252990179E00033046
:100250008A001E080723A1009E0A1E080723A0008B
:1002600035290D3057220A3008008316031306146F
:100270008312031310130B16080090140034101689
:100280000034901600343529901CCE2815080D3CFA
:100290000318CE281608613C031CCE2816083C3CE7
:1002A000031855293D3096025E291608243C031890
:1002B0005C29233096025E290430960703308A00B9
:0802C0001608DA239500CE2890
:1003000005100511851183120313051405118316B9
:100310000313061405160113831203130B1694011D
:100320009001F8308B058B172A308E0002308A003E
:100330000E082A3CD02257228E0B9629FF308C00C3
:100340000230852290308C0003308522C0308C0032
:0E03500003308522101B4120901BB021AA29EA
:100360002008A2002108A30090139F0102309B00E7
:1003700008309C009B1823089B1C22089D009D1F91
:10038000C3299F0ADA299F080319DA2905151F08CE
:10039000013C031CD02991308C0001308522D429E6
:1003A000FA308C00053085220511063040220630D7
:1003B0004E229F019D0D9C0BBF299B0BB829083035
:0803C000402206304E22080025
:100480008C00810183160313C030810508008C00A5
:10049000810183160313C03081050130810483126A
:1004A00003130B110B1D522A8C0B512A08009200CA
:1004B000051008308C00682212180514121C051053
:1004C000920C68228C0B5C2A0514682268220800B2
:1004D0001D308D006E2A0B308D006E2A8D0B6E2A1A
:1004E00008006B220618832A08308C006822061840
:1004F0009317061C93130C0B930C8C0B762A682213
:10050000061C93010800930138288D008101831691
:10051000031307308100831203130B1185159722F3
:10052000851197220B1D8E2A8D0B8D2A08000C0831
:080530008E008E0B992A0800D1
:1005A00082075034493443342034313436344634AD
:1005B0003834343420344134543420344B346534AA
:1005C000793462346F3461347234643420344434A6
:1005D000653463346F346434653472342034633486
:1005E0006F346E346E34653463347434653464341B
:0605F0000D340A340A3448
:02060E00820761
:10061000DB346C34B634D834AD34B034AB346034FD
:10062000AA34C034AA348034D5344034DA34A03407
:10063000DB345034DB346834B0340034D534003427
:10064000D6348034D434003480340034AD340034B3
:10065000DA340034AA340034A0340034B634C03460
:10066000D6340034B5340034D8340034D0340034B7
:10067000DB340034B6348034DA34C034B43400347B
:10068000A8340034C0340034AC340034AB3400340B
:10069000B6340034D5348034D634C034DA348034BF
:1006A000B5346834B634DA34D634D634DA34B634C1
:1006B000D5345834B534AC34DB345434AD34A83488
:0E06C200820700343934003435343334313497
:1006D000323432340034303438343634343409343B
:1006E000A734003400343F293D29003441297134B6
:1006F0003134003400340034793473346134773465
:10070000323400340034633478346434653434343F
:100710003334003400342034763466347434723424
:100720003534003400346E346234683467347A34DB
:1007300036340034003400346D346A347534373460
:100740003834003400342C346B3469346F34303432
:100750003934003400342E342D346C34F634703493
:100760002734003400340034E4340034FC345E3484
:100770000034003400343D2931292134003424343C
:100780000034003400343C3430342E3432343534C8
:10079000363438340034003431342B3433342D348F
:1007A0002A343934003408340034003431343734D6
:1007B0003434373482072F34283423342A343B34FA
:1007C0000034003400343D342934003425343A34C4
:1007D0005F3400345C3400343F3440342634003419
:1007E0007B3400345B347E3400342B3400340034EA
:1007F00000345D3400347D340034223400343E341F
:02400E00F13F80
:00000001FF
;***************************************************************************
;
; AT Keyboard Interface with Morse Code V2.02
; ===========================================
;
; written by Peter Luethi, 23.03.2003, Dresden, Germany
; http://www.electronic-engineering.ch
; last update: 11.04.2004
;
; V2.02: Added LCDcflag (LCD command/data flag) to comply with
; latest LCD modules.
; (11.04.2004)
;
; V2.01: Improved AT keyboard and RS232 initialization,
; fixed RBIF/INTF interrupt initialization issue.
; Changed keyboard data pin to PORTA,4 (open-collector).
; Added special LCD treatment for 'tabulator' key.
; (16.08.2003)
;
; V2.00: Initial release (23.03.2003)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock Frequency: 4.00 MHz XT
; Throughput: 1 MIPS
; RS232 Baud Rate: 9600 baud (depends on the module included)
; Serial Output: 9600 baud, 8 bit, no parity, 1 stopbit
; Acquisition Methodology: Preemptive, interrupt-based
; keyboard scan pattern acquisition
; routine, with decoding to ASCII
; characters during normal operation
; (incl. LCD display and RS232 activities)
PROCESSOR 16F84
#include "p16f84.inc"
; RS232 registers
TXD equ BASE+d'9' ; RS232 TX-Data register
RXD equ BASE+d'10' ; RS232 RX-Data register (not used here,
; but m_rs232 requires its declaration)
; AT keyboard registers and flags
#define RELflag FLAGreg,0x00 ; release flag (0xF0)
#define SHIflag FLAGreg,0x01 ; shift flag (0x12 / 0x59)
#define SPEflag FLAGreg,0x02 ; special code flag (0xE0)
#define CAPflag FLAGreg,0x03 ; caps lock flag (0x0D)
#define ALTflag FLAGreg,0x04 ; ALT flag (0x11)
#define CTRLflag FLAGreg,0x05 ; CTRL flag (0x14)
#define KBDflag FLAGreg,0x06 ; keyboard data reception flag
KBDcnt equ BASE+d'11' ; IRQ based keyboard scan pattern counter
KBD equ BASE+d'12' ; keyboard scan code & ascii data register
KBDcopy equ BASE+d'13' ; keyboard scan code register
ORG 0x220
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
#include "..\..\m_rs096.asm" ; 9600 baud @ 4 MHz
#include "..\..\m_lcd_bf.asm"
IF BEEP_ENABLE == 1 ; conditional assembly
#include "..\..\m_beep.asm" ; Piezo beeper
ENDIF
KEYBOARDinit macro
BANK1
bsf KBDclktris ; set keyboard clock line to input explicitely
bsf KBDdatatris ; set keyboard data line to input explicitely
bcf OPTION_REG,INTEDG ; keyboard interrupt on falling edge
BANK0
bsf INTCON,INTE ; enable RB0/INT interrupts
endm
goto _cl_1
LCD_DDAdr 0x00 ; reset cursor to beginning of line
clrf LCDpos ; reset LCD position counter
RETURN
_line2 LCD_DDAdr 0x40 ; move cursor to beginning of second line
bsf LCD_ln ; set flag
_cl_2 LCDchar ' ' ; put subsequent blanks on LCD to clear line
decfsz LCDpos,F ; decrement counter
goto _cl_2
LCD_DDAdr 0x40 ; reset cursor to beginning of line
clrf LCDpos ; reset LCD position counter
RETURN
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
;*****************************************
;*** KEYBOARD SCAN PATTERN ACQUISITION ***
;*****************************************
;***********************************
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
KBDdecode
;**********************************************************
;*** KEYBOARD SCAN CODE PRE-DECODING, SET / CLEAR FLAGS ***
;**********************************************************
;****************************************************
;* The following table has to be located within one *
;*********************************************************************
;* LOOKUP TABLE FOR KEYBOARD-SCAN-CODE TO ASCII-CHARACTER CONVERSION *
;*********************************************************************
;****************************************************
;* The following code belongs also to the interrupt *
;* service routine and has been moved down to this *
;* place to allow the main keyboard decode lookup *
;* table to be located within one page. *
;* The code below may be arranged on another page, *
;* but that doesn't matter. *
;****************************************************
;********************************
;*** SCAN CODE RANGE CHECKING ***
;********************************
_KBD_2 ;*** check if special code (0xE0) has been submitted previously ***
btfss SPEflag
goto _KBD_3
;*** decoding of scan code with preceeding special code (0xE0) ***
; (decoding currently only necessary for 'E0 4A' = '/')
movfw KBD
sublw 0x4A ; 0x4A - w
bnz _NOSUP ; branch on non-zero
movlw '/' ; store '/' in KBD
movwf KBD
goto _OUTP
_NOSUP ;*** check if scan code 0x5A or smaller has occurred ***
movfw KBD
sublw 0x5A ; 0x5A - w
bc _KBD_3 ; carry if result positive or zero, branch
;*******************************************************
;*** SCAN CODE DECODING & ASCII CHARACTER CONVERSION ***
;*******************************************************
;***********************************************************************
;*** KEYBOARD DATA OUTPUT TO RS232, LCD DISPLAY & MORSE CODE BUFFERS ***
;***********************************************************************
;prepare decoding
_MRS_dec bsf MRSflag ; if valid, set flag
movwf MRS_pnt ; store value in pointer
;get corresponding Morse code lookup-table entry
;and store entries in morse buffer (high & low)
movlw HIGH MORSEtable ; get correct page for PCLATH
movwf PCLATH ; prepare right page bits for table read
movfw MRS_pnt ; get pointer for high value
call MORSEtable ; call lookup-table
movwf MRS_hbuf ; store in high buffer
incf MRS_pnt,f ; increment pointer for low value
movfw MRS_pnt ; get pointer
call MORSEtable ; call lookup-table
movwf MRS_lbuf ; store in low buffer
;************************************************
;*** SPECIAL COMMANDS I (with special output) ***
;************************************************
;**********************************************************
;*** STALL RELEASE & CLEAR KEYBOARD DATA RECEPTION FLAG ***
;**********************************************************
_ClrStall
BANK1
bsf KBDclktris ; set clk line back to input (and goes high)
BANK0 ; (release stall)
bcf KBDflag ; clear keyboard data reception flag
bsf INTCON,INTE ; re-enable interrupt RB0/INT
RETURN
;****************************************************
;*** SPECIAL COMMANDS II (without special output) ***
;****************************************************
;***********************************************
;*** ALT-DEC & CTRL-HEX STORING & CONVERSION ***
;***********************************************
; store typed numbers in CTRLreg1 - CTRLreg3
_CTRLstr ; /not implemented, enhancement/
_ALTstr ; /not implemented, enhancement/
;*****************************************************************
;*** SCAN CODE DECODING & ASCII CONVERSION FOR 'SHIFT' ENTRIES ***
;*****************************************************************
_SHICHR ;*** special character decoding typed with shift button active ***
; check for active shift button, if not active, branch
btfss SHIflag
goto _OUTP ; branch
; check for 'backspace', 'tab', 'linefeed' and 'carriage return' :
; (here, KBD has already been converted to ASCII character values)
movfw KBD
sublw d'13' ; d'13' - w
bc _OUTP ; carry if result zero or positive, branch
;*******************************************************
;* The following table has also to be located within *
;* one page to allow for correct lookup functionality. *
;*******************************************************
;**********************************************************************
;* LOOKUP TABLE FOR SPECIAL CHARACTERS TYPED WITH SHIFT BUTTON ACTIVE *
;**********************************************************************
ORG 0x1E0
MORSEout
movfw MRS_lbuf ; copy buffers to output registers
movwf MRS_lo
movfw MRS_hbuf
movwf MRS_hi
bcf MRSflag ; reset Morse flag
clrf MRS_cnt ; clear one's counter
movlw 0x2
movwf MRStmp0 ; set up outer loop counter
_MRSloop1
movlw 0x8
movwf MRStmp1 ; set up inner loop counter
; in first pass, take high value, in second pass, take low value
btfsc MRStmp0,1 ; check for first outer loop pass
movfw MRS_hi ; get high value
btfss MRStmp0,1 ; check for second outer loop pass
movfw MRS_lo ; get low value
movwf MRStmp2 ; store in temp register
_MRSloop2
btfss MRStmp2,0x7 ; check for 1
goto _MRSout ; it has been a zero, signal now
incf MRS_cnt,F ; increment one's counter
goto _MRSnext ; continue loop
_MRSout ;*** check for next dash/dot to signal ***
tstf MRS_cnt ; test register
skpnz ; skip on not zero
goto _MRSnext ; if zero, goto next loop
;*** put now dash/dot to Morse output port ***
BANK1
clrf OPTION_REG ; PORTB pull-ups enabled
goto _MAIN
ORG 0x180
;******************************
_MLOOP btfsc KBDflag ; check scan pattern reception flag
call KBDdecode ; if set, call decoding routine
btfsc MRSflag ; check for new Morse buffer content
call MORSEout ; if set, call Morse output subroutine
goto _MLOOP ; endless loop
;******************************
WelcomeTable
addwf PCL,F ; add offset to table base pointer
DT "PIC 16F84 AT Keyboard Decoder connecte" ; create table
WTableEND DT "d"
MORSEtable
addwf PCL,1
retlw 0xDB ; 0, Hi-Byte
retlw 0x6C ; Lo-Byte
retlw 0xB6 ;1
retlw 0xD8
retlw 0xAD ;2
retlw 0xB0
retlw 0xAB ;3
retlw 0x60
retlw 0xAA ;4
retlw 0xC0
retlw 0xAA ;5
retlw 0x80
retlw 0xD5 ;6
retlw 0x40
retlw 0xDA ;7
retlw 0xA0
retlw 0xDB ;8
retlw 0x50
retlw 0xDB ;9
retlw 0x68
retlw 0xB0 ;A
retlw 0x0
retlw 0xD5 ;B
retlw 0x0
retlw 0xD6 ;C
retlw 0x80
retlw 0xD4 ;D
retlw 0x0
retlw 0x80 ;E
retlw 0x0
retlw 0xAD ;F
retlw 0x0
retlw 0xDA ;G
retlw 0x0
retlw 0xAA ;H
retlw 0x0
retlw 0xA0 ;I
retlw 0x0
retlw 0xB6 ;J
retlw 0xC0
retlw 0xD6 ;K
retlw 0x0
retlw 0xB5 ;L
retlw 0x0
retlw 0xD8 ;M
retlw 0x0
retlw 0xD0 ;N
retlw 0x0
retlw 0xDB ;O
retlw 0x0
retlw 0xB6 ;P
retlw 0x80
retlw 0xDA ;Q
retlw 0xC0
retlw 0xB4 ;R
retlw 0x0
retlw 0xA8 ;S
retlw 0x0
retlw 0xC0 ;T
retlw 0x0
retlw 0xAC ;U
retlw 0x0
retlw 0xAB ;V
retlw 0x0
retlw 0xB6 ;W
retlw 0x0
retlw 0xD5 ;X
retlw 0x80
retlw 0xD6 ;Y
retlw 0xC0
retlw 0xDA ;Z
retlw 0x80
retlw 0xB5 ;"
retlw 0x68
retlw 0xB6 ;'
retlw 0xDA
retlw 0xD6 ; ()
retlw 0xD6
retlw 0xDA ;,
retlw 0xB6
retlw 0xD5 ;-
retlw 0x58
retlw 0xB5 ;.
retlw 0xAC
retlw 0xDB ;:
retlw 0x54
retlw 0xAD ;?
MORSEtableEND retlw 0xA8
END
:020000040000FA
:1000000083160313810180298B138B1B04289A000C
:10001000030E9B0083010A089C008A0183130408D5
:100020009D009708031D1728051A3328362817083E
:10003000083C031C2328051E9813051A981703195A
:100040003628980C36281708093C031C282836281F
:10005000051E332813178316031306108312031388
:1000600006100B123428980197013728970A8B1035
:100070001D0884001C088A001B0E83009A0E1A0EAD
:10008000090018089900F03C031D492813141311A6
:100090004729131C782813101808123C03195328F9
:1000A0001808593C031993101808583C031D5E2882
:1000B000931D5C2893114729931547291808113C73
:1000C000031D6428131255291808143C031D4729E1
:0400D0009312552909
:1000F000131D862818084A3C031D81282F309800BC
:10010000B62818085A3C0318862847291808613C65
:1001100003189C280E3098021808613C031C932891
:10012000193098079C281808773C03189C28180851
:10013000D23C03191315472903308A00180861239C
:1001400098009808031947291808603C0318562995
:1001500018087A3C031C562918089319B228931CD6
:10016000B628B4289318B628E03E980018089E00D8
:1001700037221808083C031DCC282708031DA703B5
:100180002708141DC428403E803891005A22203090
:100190005C2211085A2247291808093C031DD92856
:1001A0002708263C031CD72820305C22A70A2030D1
:1001B00098002708273C0318DE28A822A70A180859
:1001C0005C221E087A3C031C47291E08403C031889
:1001D000F2289E121E08403C031847291E0D923E2D
:1001E000A10035291E082F3C0318FE281E08393CA3
:1001F000031C28291E0D9F3EA10035291E08223C04
:10020000031D0429483033291E08273C031D0A29F1
:100210004A3033291E08283C031D10294C3033294D
:100220001E08293C031D16294C3033291E082C3C7E
:10023000031D1C294E3033291E082D3C031D222985
:10024000503033291E082E3C031D472952303329D4
:100250001E083A3C031D2E29543033291E083F3C0A
:10026000031D47295630A10035299317A1000330FB
:100270008A0021080723A400A10A21080723A3005C
:100280004729A8220D3037220A303722003483163E
:10029000031306148312031313130B16080093148D
:1002A000003413160034931600344729931CB628E3
:1002B00018080D3C0318B6281908613C031CB62821
:1002C00019083C3C031867293D3099027029190828
:1002D000243C03186E2923309902702904309907B1
:0C02E00003308A001908DA239800B628C1
:1003000005108510851183120313051485108316BB
:100310000313061405160113831203130B1697011A
:10032000930183160313013086058312031386128B
:1003300006138613E130860504302722033053224A
:100340006D2201302722083053226D2201302722EE
:10035000023053226D220130272228305A220C30DD
:100360005A2201305A22083027222830A700F830BC
:100370008B058B172730910002308A001108273C2B
:10038000D8229200372212085C22910BBC290D3032
:1003900037220A3037220A303722FF308C000230F1
:1003A000912290308C0003309122C0308C000330B9
:0C03B0009122131B4120931BE021D9294E
:1003C0002308A5002408A6009313A20102309E0072
:1003D00008309F009E1826089E1C2508A000A01F1C
:1003E000F329A20A0A2AA20803190A2A8514220854
:1003F000013C031C002A91308C0001309122042A18
:10040000FA308C000530912285100630202206300B
:100410002E22A201A00D9F0BEF299E0BE829083088
:08042000202206302E22080004
:100440008C00810183160313C030810508008C00E5
:10045000810183160313C0308105013081048312AA
:1004600003130B110B1D322A8C0B312A0800950047
:10047000051008308C00482215180514151C0510AD
:10048000950C48228C0B3C2A05144822482208006F
:100490001D308D004E2A08308D004E2A8D0B4E2ABD
:1004A0000800960137288E00E13086050E0D1E39B2
:1004B0008604080094145D2A94108F007622941C00
:1004C00086170F080F0E53226D220F0853226D223C
:1004D000E130860586130613080086160000861292
:1004E000080018308E008E0B732A0800861314142F
:1004F000831603131E3086048312031306170000AD
:1005000086167122061E1410861271226D2214188E
:10051000802A061383160313E13086058312031322
:1005200008008D00810183160313073081008312B8
:1005300003130B118515A3228511A3220B1D9A2AE3
:100540008D0B992A08000C088E008E0BA52A080036
:100550002830A700141DB72A80305A2214112030E9
:100560005C22A70BAF2A80305A22A7010800C030B6
:100570005A22141520305C22A70BBA2AC0305A2206
:04058000A7010800C7
:1005B000820750344934433420343134363446349D
:1005C0003834343420344134543420344B3465349A
:1005D000793462346F346134723464342034443496
:1005E000653463346F346434653472342034633476
:1005F0006F346E346E34653463347434653464340B
:02060E00820761
:10061000DB346C34B634D834AD34B034AB346034FD
:10062000AA34C034AA348034D5344034DA34A03407
:10063000DB345034DB346834B0340034D534003427
:10064000D6348034D434003480340034AD340034B3
:10065000DA340034AA340034A0340034B634C03460
:10066000D6340034B5340034D8340034D0340034B7
:10067000DB340034B6348034DA34C034B43400347B
:10068000A8340034C0340034AC340034AB3400340B
:10069000B6340034D5348034D634C034DA348034BF
:1006A000B5346834B634DA34D634D634DA34B634C1
:1006B000D5345834B534AC34DB345434AD34A83488
:0E06C200820700343934003435343334313497
:1006D000323432340034303438343634343409343B
:1006E0007E340034003451294F29003453297134A9
:1006F00031340034003400347A3473346134773464
:10070000323400340034633478346434653434343F
:100710003334003400342034763466347434723424
:100720003534003400346E346234683467347934DC
:1007300036340034003400346D346A347534373460
:100740003834003400342C346B3469346F34303432
:100750003934003400342E343F346C343B3470343C
:100760002D34003400340034273400345B342B340F
:100770000034003400344F2941295D3400347C3486
:100780000034003400343C3430342E3432343534C8
:10079000363438340034003431342B3433342D348F
:1007A0002A343934003408340034003431343734D6
:1007B00034343734820726342A34243423343C3406
:1007C00000340034003429342834003425343E34D5
:1007D0002F3400343A3400345F3460345E340034F3
:1007E000223400347B343D3400342134003400346E
:1007F00000347D3400345C340034403400343E3402
:02400E00F13F80
:00000001FF
:020000040000FA
:1000000083160313810180298B138B1B04289A000C
:10001000030E9B0083010A089C008A0183130408D5
:100020009D009708031D1728051A3328362817083E
:10003000083C031C2328051E9813051A981703195A
:100040003628980C36281708093C031C282836281F
:10005000051E332813178316031306108312031388
:1000600006100B123428980197013728970A8B1035
:100070001D0884001C088A001B0E83009A0E1A0EAD
:10008000090018089900F03C031D492813141311A6
:100090004729131C782813101808123C03195328F9
:1000A0001808593C031993101808583C031D5E2882
:1000B000931D5C2893114729931547291808113C73
:1000C000031D6428131255291808143C031D4729E1
:0400D0009312552909
:1000F000131D862818084A3C031D81282F309800BC
:10010000B62818085A3C0318862847291808613C65
:1001100003189C280E3098021808613C031C932891
:10012000193098079C281808773C03189C28180851
:10013000D23C03191315472903308A00180861239C
:1001400098009808031947291808603C0318562995
:1001500018087A3C031C562918089319B228931CD6
:10016000B628B4289318B628E03E980018089E00D8
:1001700037221808083C031DCC282708031DA703B5
:100180002708141DC428403E803891005A22203090
:100190005C2211085A2247291808093C031DD92856
:1001A0002708263C031CD72820305C22A70A2030D1
:1001B00098002708273C0318DE28A822A70A180859
:1001C0005C221E087A3C031C47291E08403C031889
:1001D000F2289E121E08403C031847291E0D923E2D
:1001E000A10035291E082F3C0318FE281E08393CA3
:1001F000031C28291E0D9F3EA10035291E08223C04
:10020000031D0429483033291E08273C031D0A29F1
:100210004A3033291E08283C031D10294C3033294D
:100220001E08293C031D16294C3033291E082C3C7E
:10023000031D1C294E3033291E082D3C031D222985
:10024000503033291E082E3C031D472952303329D4
:100250001E083A3C031D2E29543033291E083F3C0A
:10026000031D47295630A10035299317A1000330FB
:100270008A0021080723A400A10A21080723A3005C
:100280004729A8220D3037220A303722003483163E
:10029000031306148312031313130B16080093148D
:1002A000003413160034931600344729931CB628E3
:1002B00018080D3C0318B6281908613C031CB62821
:1002C00019083C3C031867293D3099027029190828
:1002D000243C03186E2923309902702904309907B1
:0C02E00003308A001908DA239800B628C1
:1003000005108510851183120313051485108316BB
:100310000313061405160113831203130B1697011A
:10032000930183160313013086058312031386128B
:1003300006138613E130860504302722033053224A
:100340006D2201302722083053226D2201302722EE
:10035000023053226D220130272228305A220C30DD
:100360005A2201305A22083027222830A700F830BC
:100370008B058B172730910002308A001108273C2B
:10038000D8229200372212085C22910BBC290D3032
:1003900037220A3037220A303722FF308C000230F1
:1003A000912290308C0003309122C0308C000330B9
:0C03B0009122131B4120931BE021D9294E
:1003C0002308A5002408A6009313A20102309E0072
:1003D00008309F009E1826089E1C2508A000A01F1C
:1003E000F329A20A0A2AA20803190A2A8514220854
:1003F000013C031C002A91308C0001309122042A18
:10040000FA308C000530912285100630202206300B
:100410002E22A201A00D9F0BEF299E0BE829083088
:08042000202206302E22080004
:100440008C00810183160313C030810508008C00E5
:10045000810183160313C0308105013081048312AA
:1004600003130B110B1D322A8C0B312A0800950047
:10047000051008308C00482215180514151C0510AD
:10048000950C48228C0B3C2A05144822482208006F
:100490001D308D004E2A08308D004E2A8D0B4E2ABD
:1004A0000800960137288E00E13086050E0D1E39B2
:1004B0008604080094145D2A94108F007622941C00
:1004C00086170F080F0E53226D220F0853226D223C
:1004D000E130860586130613080086160000861292
:1004E000080018308E008E0B732A0800861314142F
:1004F000831603131E3086048312031306170000AD
:1005000086167122061E1410861271226D2214188E
:10051000802A061383160313E13086058312031322
:1005200008008D00810183160313073081008312B8
:1005300003130B118515A3228511A3220B1D9A2AE3
:100540008D0B992A08000C088E008E0BA52A080036
:100550002830A700141DB72A80305A2214112030E9
:100560005C22A70BAF2A80305A22A7010800C030B6
:100570005A22141520305C22A70BBA2AC0305A2206
:04058000A7010800C7
:1005B000820750344934433420343134363446349D
:1005C0003834343420344134543420344B3465349A
:1005D000793462346F346134723464342034443496
:1005E000653463346F346434653472342034633476
:1005F0006F346E346E34653463347434653464340B
:02060E00820761
:10061000DB346C34B634D834AD34B034AB346034FD
:10062000AA34C034AA348034D5344034DA34A03407
:10063000DB345034DB346834B0340034D534003427
:10064000D6348034D434003480340034AD340034B3
:10065000DA340034AA340034A0340034B634C03460
:10066000D6340034B5340034D8340034D0340034B7
:10067000DB340034B6348034DA34C034B43400347B
:10068000A8340034C0340034AC340034AB3400340B
:10069000B6340034D5348034D634C034DA348034BF
:1006A000B5346834B634DA34D634D634DA34B634C1
:1006B000D5345834B534AC34DB345434AD34A83488
:0E06C200820700343934003435343334313497
:1006D000323432340034303438343634343409343B
:1006E000A7340034003451294F2900345329713480
:1006F0003134003400340034793473346134773465
:10070000323400340034633478346434653434343F
:100710003334003400342034763466347434723424
:100720003534003400346E346234683467347A34DB
:1007300036340034003400346D346A347534373460
:100740003834003400342C346B3469346F34303432
:100750003934003400342E342D346C34F634703493
:100760002734003400340034E4340034FC345E3484
:100770000034003400344F2941292134003424341A
:100780000034003400343C3430342E3432343534C8
:10079000363438340034003431342B3433342D348F
:1007A0002A343934003408340034003431343734D6
:1007B0003434373482072F34283423342A343B34FA
:1007C0000034003400343D342934003425343A34C4
:1007D0005F3400345C3400343F3440342634003419
:1007E0007B3400345B347E3400342B3400340034EA
:1007F00000345D3400347D340034223400343E341F
:02400E00F13F80
:00000001FF
;***************************************************************************
;
; RS232 Communication Test for PIC 16XXX V1.03
; ============================================
;
; written by Peter Luethi, 26.03.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 31.12.2004
;
; V1.03: Added transmission of status message ('@') every 2.75 s
; when PIC terminal is idle. Used therefore 24 bit counter.
; (31.12.2004)
;
; V1.02: Fixed copy/paste issue of ISR context store/restore
; (nobody is perfect): Erroneously erased INTCON,INTF
; clearing, resulting in endless ISR calling...
; Re-structured entire ISR and RS232 echo sub-routines
; (11.04.2004)
;
; V1.01: ISR context restore improvements
; (30.12.2000)
;
; V1.00: Initial release (26.03.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock Frequency: 4.00 MHz XT
; Throughput: 1 MIPS
; RS232 Baud Rate: 9600 baud, 8 bit, no parity, 1 stopbit
; Required Hardware: MAX 232, dot matrix LCD display
; Code Size of entire Program: approx. 566 instruction words
PROCESSOR 16F84
#include "p16f84.inc"
LO equ BASE+d'5'
LO_TEMP equ BASE+d'6'
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
#include "..\..\m_lcd.asm" ; standard version (fixed delay)
;#include "..\..\m_lcd_bf.asm" ; fast, bi-directional version
#include "..\..\m_lcdv08.asm"
#include "..\..\m_rs096.asm" ; standard RS232 baud rate
COUNTERinit ; *** Initialize 24 bit counter for status message wait interval ***
clrf LOcnt ; init counter
clrf MEDcnt ; init counter
movlw d'6'
movwf HIcnt ; init counter
RETURN
RSservice ; *** RS232 echo & LCD display routine for received RS232 characters ***
LCD_DDAdr 0x45
movfw RXD ; get received RS232 data
LCDw ; send to LCD display
LCD_DDAdr 0x4D
movfw RXD
movwf LO
LCDval_08 ; display decimal value
SEND TAB
SEND 'r'
SEND 'e'
SEND 'c'
SEND 'e'
SEND 'i'
SEND 'v'
SEND 'e'
SEND 'd'
SEND ''
SEND ''
SEND 'o'
SEND 'n'
SEND ''
SEND 'M'
SEND 'i'
SEND 'c'
SEND 'r'
SEND 'o'
SEND 'c'
SEND 'h'
SEND 'i'
SEND 'p'
SEND ''
SEND 'P'
SEND 'I'
SEND 'C'
SEND '1'
SEND '6'
SEND 'F'
SEND '8'
SEND '4'
SEND CR ; Carriage Return
SEND LF ; Line Feed
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
; catch-all
goto ISRend ; unexpected IRQ, terminate execution of ISR
;******************************
;*** RS232 DATA ACQUISITION ***
;******************************
_ISR_RS232
; first, disable interrupt source
bcf INTCON,INTE ; disable RB0/INT interrupt
; second, acquire RS232 data
RECEIVE ; macro of RS232 software reception
bsf RSflag ; enable RS232 data reception flag
goto _ISR_RS232end ; terminate RS232 ISR properly
;***********************************
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
LCDchar '3'
LCDchar '2'
LCDchar ' '
LCDchar 'C'
LCDchar 'o'
LCDchar 'm'
LCDchar 'm'
LCDchar 'u'
LCDchar 'n'
LCDchar 'i'
LCDchar 'c'
LCDchar 'a'
LCDchar '-'
LCDline 2
LCDchar 't'
LCDchar 'i'
LCDchar 'o'
LCDchar 'n'
LCDchar ' '
LCDchar 'o'
LCDchar 'n'
LCDchar ' '
LCDchar 'P'
LCDchar 'I'
LCDchar 'C'
LCDchar '1'
LCDchar '6'
LCDchar 'F'
LCDchar '8'
LCDchar '4'
movlw d'16'
movwf TEMP5
_SHL1 LCDcmd LCDSL ; shift left LCD display content
WAIT 0xC0
decfsz TEMP5,f
goto _SHL1
LCDchar 'R'
LCDchar 'S'
LCDchar '2'
LCDchar '3'
LCDchar '2'
LCDline 2
LCDchar 'C'
LCDchar 'h'
LCDchar 'a'
LCDchar 'r'
LCD_DDAdr 0x47
LCDchar 'V'
LCDchar 'a'
LCDchar 'l'
LCDchar 'u'
LCDchar 'e'
SEND 'r'
SEND 'e'
SEND 'a'
SEND 'd'
SEND 'y'
SEND '.'
SEND '.'
SEND '.'
SEND CR ; Carriage Return
SEND LF ; Line Feed
;******************************
_MLOOP btfsc RSflag ; check RS232 data reception flag
call COUNTERinit ; reset 24 bit counter
btfsc RSflag ; check RS232 data reception flag
call RSservice ; if set, call RS232 echo & LCD display routine
; now, all bytes of 24 bit counter are zero, transmit status message...
WelcomeTable
addwf PCL,F ; add offset to table base pointer
retlw CR
retlw LF
DT "Microchip PIC16F84 connected and stand-by..." ; create table
retlw CR
WTableEND retlw LF
IF (HIGH (WelcomeTable) != HIGH (WTableEND))
ERROR "WelcomeTable hits page boundary!"
ENDIF
END
:020000040000FA
:02000000FD28D9
:08000800CE288C008101831653
:100010000313C030810508008C008101831603138F
:10002000C030810501308104831203130B110B1DB5
:1000300017288C0B162808008E00E13086050E0D5F
:100040001E398604080086132628861706138F009B
:100050000F080F0E1C2033200F081C203320E13026
:1000600086058613080002300C20861600008612D2
:1000700002300C20080011089200931164308D00AA
:100080004C2025200A308D004C20252001308D0089
:1000900093154C20252008008C010D081202031C2A
:1000A00056288C0A0D08920293154E2830300C0702
:1000B000931D203008009400051008308C006C203F
:1000C00014180514141C0510940C6C208C0B60285B
:1000D00005146C206C2008001D308D00722808303B
:1000E0008D0072288D0B722808009501F2289A0164
:1000F0009B0106309C000800C530232015082520F0
:10010000CD302320150891003B2009305B20723050
:100110005B2065305B2063305B2065305B2069309D
:100120005B2076305B2065305B2064305B202030C4
:100130005B2015085B2020305B206F305B206E3029
:100140005B2020305B204D305B2069305B206330CA
:100150005B2072305B206F305B2063305B20683047
:100160005B2069305B2070305B2020305B2050309A
:100170005B2049305B2043305B2031305B203630E0
:100180005B2046305B2038305B2034305B200D3004
:100190005B200A305B2013100B1608008B138B1B9F
:1001A000CE289600030E970083010A0898008A0162
:1001B0008313040899008B18DE28F4280B126F2093
:1001C0000618752808308C006C2006189517061C38
:1001D00095130C0B950C8C0BE4286C20061C7528D1
:1001E0001314F3280B168B101908840018088A00C2
:1001F000170E8300960E160E0900831603130130A6
:10020000860583120313861206138613E1308605D2
:1002100008300C2003301C20332002300C20083022
:100220001C20332002300C2002301C2033200230EE
:100230000C20283023200C302320013023200830CC
:100240000C208316031305100614011383120313E5
:1002500005148B100B168B17930152302520533049
:100260002520323025203330252032302520203003
:100270002520433025206F3025206D3025206D301E
:100280002520753025206E302520693025206330EB
:100290002520613025202D302520C03023207430CA
:1002A0002520693025206F3025206E302520203014
:1002B00025206F3025206E3025202030252050301D
:1002C0002520493025204330252031302520363067
:1002D0002520463025203830252034302520303068
:1002E000900002308A001008303C08225B20900BFE
:1002F00071291A3005200730132061305B206E30E1
:100300005B2069305B206D305B2061305B20743096
:100310005B2069305B206E305B2067305B202030D3
:100320005B204C305B2043305B2044305B202E3020
:100330005B202E305B202E305B200D305B200A309E
:100340005B201030900018302320C0300C20900B20
:10035000A32901302320523025205330252032306C
:1003600025203330252032302520203025205230E2
:10037000252065302520633025206530252070300C
:10038000252074302520693025206F3025206E30DF
:1003900025203A302520C0302320433025206830E6
:1003A00025206130252072302520C730232056308B
:1003B0002520613025206C302520753025206530C2
:1003C000252072305B2065305B2061305B2064301B
:1003D0005B2079305B202E305B202E305B202E306E
:1003E0005B200D305B200A305B20772013187720CC
:1003F00013187C209A0BF6299B0BF6299C0BF629E7
:1004000040305B200D305B200A305B207720F629DE
:1004100082070D340A344D346934633472346F34D6
:10042000633468346934703420345034493443348C
:1004300031343634463438343434203463346F3411
:100440006E346E346534633474346534643420340B
:1004500061346E34643420347334743461346E34F3
:1004600064342D34623479342E342E342E340D34E9
:020470000A344C
:02400E00F13F80
:00000001FF
;***************************************************************************
;
; Hardware RS232 Test Routine for PIC 16F77 V1.05
; ===============================================
;
; written by Peter Luethi, 21.03.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 16.01.2005
;
; V1.05: Added transmission of status message ('@') every 2.75 s
; when PIC terminal is idle. Used therefore 24 bit counter.
; (31.12.2004)
;
; V1.04: Added LCDcflag (LCD command/data flag) to comply with
; latest LCD modules. Changed controller type from PIC16C74A
; to flash device, i.e. PIC16F77.
; (18.04.2004)
;
; V1.03: Moved LCD and RS232 output from interrupt service routine
; to normal operation sub-routine, activated through flag.
; (28.10.2003)
;
; V1.02: Fixed issue in RS232 hardware reception service routine.
; Reads now both data bytes out of double-buffered RX FIFO.
; Tries to eliminate some sporadic reception hangs under
; heavy full-duplex traffic scenarios.
; In case of FIFO overrun errors in the USART receive logic,
; the service routine performs a partial reset of the USART
; receive logic. No specific error handling for RS232
; reception framing errors.
; (28.10.2003)
;
; V1.01: Updated to latest revision of m_lcdv08.asm
; (28.12.2000)
;
; V1.00: Initial release (24.04.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
PROCESSOR 16F77
#include "p16f77.inc"
;PROCESSOR 16C74A
;#include "p16c74a.inc"
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
RS232init macro
BANK1 ; Asynchronous USART assignment:
bsf TXSTA,BRGH ; BRGH = 1
movlw d'25' ; 9600 baud @ 4.00 MHz, BRGH = 1
movwf SPBRG
BANK0
bsf RCSTA,SPEN ; enable serial port
BANK1
bsf PIE1,RCIE ; enable serial reception interrupt
bsf TXSTA,TXEN ; enable serial transmission
BANK0
bsf INTCON,PEIE ; enable peripheral interrupts
bsf RCSTA,CREN ; enable continuous reception
endm
SENDw macro
call _RSxmit
endm
COUNTERinit ; *** Initialize 24 bit counter for status message wait interval ***
clrf LOcnt ; init counter
clrf MEDcnt ; init counter
movlw d'6'
movwf HIcnt ; init counter
RETURN
_RSxmit BANK1
_RSbusy btfss TXSTA,TRMT ; check, if previous transmission
goto _RSbusy ; has been terminated
BANK0
RSservice ; *** RS232 echo & LCD display routine for received RS232 characters ***
; first byte in RXreg
movfw RXreg ; retrieve data
movwf RXtemp ; store data
call _RSdisp ; call output subroutine
btfss RX2flag ; check for second data byte received
goto RSdispEND
; second byte in RXreg2, i.e. RX2flag = 1
movfw RXreg2 ; retrieve data
movwf RXtemp ; store data
call _RSdisp ; call output subroutine
bcf RX2flag ; reset flag
btfss RCSTA,OERR ; check for RX overrun (overrun error bit)
goto RSdispEND
; buffer overrun, severe error, reset USART RX logic
bcf RCSTA,CREN ; reset USART RX logic, clear RCSTA,OERR
bcf RCSTA,FERR ; reset framing error bit
bsf RCSTA,CREN ; re-enable continuous reception
RSdispEND
bcf RSflag ; reset RS232 data reception flag
BANK1
bsf PIE1,RCIE ; re-enable USART reception interrupt
BANK0 ; (interrupt flag already cleared in ISR)
RETURN
SEND 'v'
SEND 'e'
SEND 'd'
SEND ' '
movfw RXtemp ; retrieve value
SENDw ; send across RS232 line
SEND ' '
SEND 'o'
SEND 'n'
SEND ' '
SEND 'M'
SEND 'i'
SEND 'c'
SEND 'r'
SEND 'o'
SEND 'c'
SEND 'h'
SEND 'i'
SEND 'p'
SEND ' '
SEND 'P'
SEND 'I'
SEND 'C'
SEND '1'
SEND '6'
SEND 'F'
SEND '7'
SEND '7'
SEND CR ; Carriage Return
SEND LF ; Line Feed
RETURN
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
;******************************
;*** RS232 DATA ACQUISITION ***
;******************************
_ISR_RS232
movfw RCREG ; get RS232 data (first RX FIFO entry)
movwf RXreg ; store first data byte
btfss PIR1,RCIF ; check flag for second RX FIFO entry
goto _ISR_RS232_A ; no second byte received, branch
movfw RCREG ; get RS232 data (second RX FIFO entry)
movwf RXreg2 ; store second data byte
bsf RX2flag ; set flag to indicate second byte received
_ISR_RS232_A
bsf RSflag ; enable RS232 data reception flag
BANK1 ; (for display routine)
bcf PIE1,RCIE ; disable USART reception interrupt
BANK0 ; (will be re-enabled in normal subroutine)
;goto _ISR_RS232end ; exit ISR
_ISR_RS232end
;bcf PIR1,RCIF ; cleared by hardware: USART RX interrupt flag
;goto ISRend ; terminate execution of ISR
;*****************************************
MAIN
clrf INTCON ; reset interrupts (disable all)
LCDinit ; LCD initialization
RS232init ; RS232 initialization
LCDchar 'R'
LCDchar 'S'
LCDchar '2'
LCDchar '3'
LCDchar '2'
LCDchar ' '
LCDchar 'C'
LCDchar 'o'
LCDchar 'm'
LCDchar 'm'
LCDchar 'u'
LCDchar 'n'
LCDchar 'i'
LCDchar 'c'
LCDchar 'a'
LCDchar '-'
LCDline 2
LCDchar 't'
LCDchar 'i'
LCDchar 'o'
LCDchar 'n'
LCDchar ' '
LCDchar 'o'
LCDchar 'n'
LCDchar ' '
LCDchar 'P'
LCDchar 'I'
LCDchar 'C'
LCDchar '1'
LCDchar '6'
LCDchar 'F'
LCDchar '7'
LCDchar '7'
movlw d'16'
movwf TEMP5
_SHL1 LCDcmd LCDSL ; shift left LCD display content
WAIT 0xC0
decfsz TEMP5,f
goto _SHL1
LCDchar 'R'
LCDchar 'S'
LCDchar '2'
LCDchar '3'
LCDchar '2'
LCDchar ' '
LCDchar 'R'
LCDchar 'e'
LCDchar 'c'
LCDchar 'e'
LCDchar 'p'
LCDchar 't'
LCDchar 'i'
LCDchar 'o'
LCDchar 'n'
LCDchar ':'
LCDline 2
LCDchar 'C'
LCDchar 'h'
LCDchar 'a'
LCDchar 'r'
LCD_DDAdr 0x47
LCDchar 'V'
LCDchar 'a'
LCDchar 'l'
LCDchar 'u'
LCDchar 'e'
SEND 'r'
SEND 'e'
SEND 'a'
SEND 'd'
SEND 'y'
SEND '.'
SEND '.'
SEND '.'
SEND CR ; Carriage Return
SEND LF ; Line Feed
;******************************
_MLOOP btfsc RSflag ; check RS232 data reception flag
call COUNTERinit ; reset 24 bit counter
btfsc RSflag ; check RS232 data reception flag
call RSservice ; if set, call RS232 echo & LCD display routine
WelcomeTable
addwf PCL,F ; add offset to table base pointer
retlw CR
retlw LF
DT "Microchip PIC16F77 connected and stand-by..." ; create table
retlw CR
WTableEND retlw LF
IF (HIGH (WelcomeTable) != HIGH (WTableEND))
ERROR "WelcomeTable hits page boundary!"
ENDIF
END
:020000040000FA
:02000000F228E4
:08000800CC28A0008101831641
:100010000313C03081050800A0008101831603137B
:10002000C030810501308104831203130B110B1DB5
:100030001728A00B16280800A200E1308605220D23
:100040001E39860408008613262886170613A30087
:100050002308230E1C20332023081C203320E130EA
:1000600086058613080001300C20861686120130A2
:100070000C2008002808A900A7106430A1004B201C
:1000800025200A30A1004B2025200130A100A71413
:100090004B2025200800A00121082902031C552817
:1000A000A00A2108A902A7144D2830302007A71C58
:1000B00020300800B101B2010630B30008008316F9
:1000C0000313981C612883120313990008002A085F
:1000D000AC007C20A71D75282B08AC007C20A71144
:1000E000981C752818121811181627118316031357
:1000F0008C16831203130800C53023202C082520FA
:10010000CD3023202C08A8003A2009305F2072301F
:100110005F2065305F2063305F2065305F2069308D
:100120005F2076305F2065305F2064305F202030B4
:100130005F202C085F2020305F206F305F206E3002
:100140005F2020305F204D305F2069305F206330BA
:100150005F2072305F206F305F2063305F20683037
:100160005F2069305F2070305F2020305F2050308A
:100170005F2049305F2043305F2031305F203630D0
:100180005F2046305F2037305F2037305F200D30F2
:100190005F200A305F2008008B138B1BCC28AD003A
:1001A000030EAE0083010A08AF008A01831304081E
:1001B000B0008C1ADC28E9281A08AA008C1EE32853
:1001C0001A08AB00A7152715831603138C12831288
:1001D0000313300884002F088A002E0E8300AD0E12
:1001E0002D0E09008B01831603130130860583123F
:1001F0000313861206138613E130860504300C20A3
:1002000003301C20332001300C2008301C20332008
:1002100001300C2002301C20332001300C2028300B
:1002200023200C3023200130232008300C2083169B
:1002300003131815193099008312031398178316A6
:1002400003138C169816831203130B171816F83025
:100250008B058C018D018B17A7015230252053305F
:100260002520323025203330252032302520203003
:100270002520433025206F3025206D3025206D301E
:100280002520753025206E302520693025206330EB
:100290002520613025202D302520C03023207430CA
:1002A0002520693025206F3025206E302520203014
:1002B00025206F3025206E3025202030252050301D
:1002C0002520493025204330252031302520363067
:1002D0002520463025203730252037302520303066
:1002E000A40002308A002408303C08225F20A40BBE
:1002F00071291A3005200730132061305F206E30DD
:100300005F2069305F206D305F2061305F20743086
:100310005F2069305F206E305F2067305F202030C3
:100320005F204C305F2043305F2044305F202E3010
:100330005F202E305F202E305F200D305F200A308E
:100340005F201030A40018302320C0300C20A40BF4
:10035000A32901302320523025205330252032306C
:1003600025203330252032302520203025205230E2
:10037000252065302520633025206530252070300C
:10038000252074302520693025206F3025206E30DF
:1003900025203A302520C0302320433025206830E6
:1003A00025206130252072302520C730232056308B
:1003B0002520613025206C302520753025206530C2
:1003C000252072305F2065305F2061305F2064300F
:1003D0005F2079305F202E305F202E305F202E305E
:1003E0005F200D305F200A305F205A2027195A20E5
:1003F00027196720B10BF629B20BF629B30BF629A2
:1004000040305F200D305F200A305F205A20F629EF
:1004100082070D340A344D346934633472346F34D6
:10042000633468346934703420345034493443348C
:1004300031343634463437343734203463346F340F
:100440006E346E346534633474346534643420340B
:1004500061346E34643420347334743461346E34F3
:1004600064342D34623479342E342E342E340D34E9
:020470000A344C
:02400E00F23F7F
:00000001FF
;***************************************************************************
;
; Dual RS232 Software Interface for PIC 16F77 V1.00
; =================================================
;
; written by Peter Luethi, 15.01.2005, Urdorf, Switzerland
; http://www.electronic-engineering.ch
; last update: 16.01.2005
;
; V1.00: Initial release (16.01.2005)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F77 (16C74A)
; Clock Frequency: 4.00 MHz (HS mode)
; Throughput: 1 MIPS
; RS232 Configuration: 9600 with BRGH = 1
; RS232 Baud Rate: 9600 baud, 8 bit, no parity, 1 stopbit
; Required Hardware: two MAX 232 for two RS232 interfaces,
; dot matrix LCD display
; Code Size of entire Program: approx. 733 instruction words
; Acquisition Methodology: SW-based RS232: Interrupt-based RS232
; data acquisition
; HW-based RS232: Preemptive,
; interrupt-based RS232 data acquisition
; with LCD display output and RS232 echo
; during normal operation
;
;
; ABSTRACT:
; =========
; Dual RS232 terminal: Two independent RS232 interfaces, with
;
;***************************************************************************
PROCESSOR 16F77
#include "p16f77.inc"
;PROCESSOR 16C74A
;#include "p16c74a.inc"
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
#include "..\..\m_rs096.asm" ; standard SW-based RS232
#include "..\..\m_lcd.asm" ; standard version (fixed delay)
;#include "..\..\m_lcd_bf.asm" ; fast, bi-directional version (busy flag)
#include "..\..\m_lcdv08.asm" ; 8 bit to decimal conversion for LCD
SEND2w macro
call _RSxmit
endm
COUNTERinit ; *** Initialize 24 bit counter for status message wait interval ***
clrf LOcnt ; init counter
clrf MEDcnt ; init counter
movlw d'6'
movwf HIcnt ; init counter
RETURN
RSservice ; *** RS232 echo & LCD display routine for received RS232 characters ***
; display on LCD
LCD_DDAdr 0x07
movfw RXD
LCDw ; ascii character output on LCD
LCD_DDAdr 0x0D
movfw RXD
movwf LO
LCDval_08 ; numeric ascii value output
; send echo back to PC
SEND TAB
SEND 't'
SEND 'r'
SEND 'a'
SEND 'n'
SEND 's'
SEND 'm'
SEND 'i'
SEND 't'
SEND 't'
SEND 'e'
SEND 'd'
SEND ' '
movfw RXD ; get received RS232 data
SENDw ; transmit across RS232 line
movfw RXD ; get received RS232 data
SEND2w ; transmit across other RS232 line
SEND ' '
SEND 't'
SEND 'o'
SEND ' '
SEND 'l'
SEND 'i'
SEND 'n'
SEND 'k'
SEND ' '
SEND '2'
SEND CR ; Carriage Return
SEND LF ; Line Feed
; end of RS232 service (echo & display)
bcf RSflagSW ; reset RS232 data reception flag
bsf INTCON,INTE ; re-enable RB0/INT interrupt
RETURN
RSservice2 ; *** RS232 echo & LCD display routine for received RS232 characters ***
SEND2 't'
SEND2 'e'
SEND2 'd'
SEND2 ' '
movfw RXtemp ; retrieve value
SEND2w ; transmit across RS232 line
movfw RXtemp ; retrieve value
SENDw ; transmit across other RS232 line
SEND2 ' '
SEND2 't'
SEND2 'o'
SEND2 ' '
SEND2 'l'
SEND2 'i'
SEND2 'n'
SEND2 'k'
SEND2 ' '
SEND2 '1'
SEND2 CR ; Carriage Return
SEND2 LF ; Line Feed
RETURN
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
; catch-all
goto ISRend ; unexpected IRQ, terminate execution of ISR
;***************************************
;*** SW-BASED RS232 DATA ACQUISITION ***
;***************************************
_ISR_RS232_SW
; first, disable interrupt source
bcf INTCON,INTE ; disable RB0/INT interrupt
; second, acquire RS232 data
RECEIVE ; macro of RS232 software reception
bsf RSflagSW ; enable RS232 data reception flag
goto _ISR_RS232end ; terminate RS232 ISR properly
;***********************************
;*** CLEARING OF INTERRUPT FLAGS ***
;***********************************
; NOTE: Below, I only clear the interrupt flags! This does not
; necessarily mean, that the interrupts are already re-enabled.
; Basically, interrupt re-enabling is carried out at the end of
; the corresponding service routine in normal operation mode.
; The flag responsible for the current ISR call has to be cleared
; to prevent recursive ISR calls. Other interrupt flags, activated
; during execution of this ISR, will immediately be served upon
; termination of the current ISR run.
_ISR_RS232error
bsf INTCON,INTE ; after error, re-enable IRQ already here
_ISR_RS232end
bcf INTCON,INTF ; clear RB0/INT interrupt flag
goto ISRend ; terminate execution of ISR
;***************************************
;*** HW-BASED RS232 DATA ACQUISITION ***
;***************************************
_ISR_RS232_HW
movfw RCREG ; get RS232 data (first RX FIFO entry)
movwf RXreg ; store first data byte
btfss PIR1,RCIF ; check flag for second RX FIFO entry
goto _ISR_RS232_HW_A ; no second byte received, branch
movfw RCREG ; get RS232 data (second RX FIFO entry)
movwf RXreg2 ; store second data byte
bsf RX2flag ; set flag to indicate second byte received
_ISR_RS232_HW_A
bsf RSflagHW ; enable RS232 data reception flag
BANK1 ; (for display routine)
bcf PIE1,RCIE ; disable USART reception interrupt
BANK0 ; (will be re-enabled in normal subroutine)
;goto _ISR_RS232end_HW ; exit ISR
_ISR_RS232end_HW
;bcf PIR1,RCIF ; cleared by hardware: USART RX interrupt flag
;goto ISRend ; terminate execution of ISR
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
MAIN
clrf INTCON ; reset interrupts (disable all)
LCDchar 'D'
LCDchar 'u'
LCDchar 'a'
LCDchar 'l'
LCDchar ' '
LCDchar 'R'
LCDchar 'S'
LCDchar '2'
LCDchar '3'
LCDchar '2'
LCDchar ' '
LCDchar 'R'
LCDchar 'e'
LCDchar 'c'
LCDchar 'e'
LCDchar 'p'
LCDline 0x2
LCDchar 't'
LCDchar 'i'
LCDchar 'o'
LCDchar 'n'
LCDchar ' '
LCDchar 'o'
LCDchar 'n'
LCDchar ' '
LCDchar 'P'
LCDchar 'I'
LCDchar 'C'
LCDchar '1'
LCDchar '6'
LCDchar 'F'
LCDchar '7'
LCDchar '7'
WAITX 0x1A, b'00000111' ; wait some time
LCDchar 'h'
LCD_DDAdr 0x49 ; goto specific LCD position
LCDchar 'V'
LCDchar 'a'
LCDchar 'l'
;******************************
_MLOOP ; first software-based RS232 link (no USART, just IRQs)
btfsc RSflagSW ; check RS232 data reception flag
call COUNTERinit ; reset 24 bit counter
btfsc RSflagSW ; check RS232 data reception flag
call RSservice ; if set, call RS232 echo & LCD display routine
WelcomeTable
addwf PCL,F ; add offset to table base pointer
retlw CR
retlw LF
DT "Dual RS232 Reception"
retlw CR
retlw LF
DT "===================="
retlw CR
retlw LF
DT "Microchip PIC16F77 connected and stand-by..." ; create table
retlw CR
WTableEND retlw LF
IF (HIGH (WelcomeTable) != HIGH (WTableEND))
ERROR "WelcomeTable hits page boundary!"
ENDIF
ReadyTable
addwf PCL,F ; add offset to table base pointer
DT "ready for transmission..." ; create table
retlw CR
RTableEND retlw LF
IF (HIGH (ReadyTable) != HIGH (RTableEND))
ERROR "ReadyTable hits page boundary!"
ENDIF
END
:020000040000FA
:0200000059297C
:080008001A29A00081018316F2
:100010000313C03081050800A0008101831603137B
:10002000C030810501308104831203130B110B1DB5
:100030001728A00B16280800A80005100830A000FB
:100040002D2028180514281C0510A80C2D20A00B05
:10005000212805142D202D2008001D30A100332853
:100060000830A1003328A10B33280800A90140293A
:10007000A200E1308605220D1E3986040800861391
:10008000422886170613A3002308230E38204F208A
:10009000230838204F20E130860586130800013000
:1000A0000C208616861201300C2008002608A700B6
:1000B00025126430A100672041200A30A10067208A
:1000C00041200130A1002516672041200800A00131
:1000D00021082702031C7128A00A2108A70225165F
:1000E000692830302007251E20300800B101B201F8
:1000F0000630B300080083160313981C7D28831272
:1001000003139900080087303F20290841208D30D3
:100110003F202908A600562009301C2074301C20DE
:1001200072301C2061301C206E301C2073301C206B
:100130006D301C2069301C2074301C2074301C2051
:1001400065301C2064301C2020301C2029081C2015
:1001500029087B2020301C2074301C206F301C208C
:1001600020301C206C301C2069301C206E301C207C
:100170006B301C2020301C2032301C200D301C2005
:100180000A301C2025100B1608002A08AC00DA20C3
:10019000251DD3282B08AC00DA202511981CD32864
:1001A000181218111816A510831603138C16831233
:1001B00003130800C7303F202C084120CD303F20DA
:1001C0002C08A600562009307B2074307B2072302A
:1001D0007B2061307B206E307B2073307B206D3044
:1001E0007B2069307B2074307B2074307B2065302D
:1001F0007B2064307B2020307B202C087B202C0847
:100200001C2020307B2074307B206F307B202030FE
:100210007B206C307B2069307B206E307B206B3004
:100220007B2020307B2031307B200D307B200A303A
:100230007B2008008B138B1B1A29AD00030EAE0028
:1002400083010A08AF008A0183130408B0008B18E9
:100250002C298C1A432950290B12302006183628D5
:100260000830A0002D200618A917061CA913200B82
:10027000A90CA00B32292D20061C36282514412953
:100280000B168B1050291A08AA008C1E4A291A082E
:10029000AB002515A514831603138C1283120313C8
:1002A000300884002F088A002E0E8300AD0E2D0E1C
:1002B00009008B0183160313013086058312031393
:1002C000861206138613E130860504300C200330B5
:1002D00038204F2001300C20083038204F200130CA
:1002E0000C20023038204F2001300C2028303F20D5
:1002F0000C303F2001303F2008300C2083160313C0
:100300000510061401138312031305148B100B162A
:100310008B178316031318151930990083120313D2
:100320009817831603138C169816831203130B1752
:100330001816F8308B058C018D018B17A5015C30E8
:10034000A40002308A0024085C3C4822A3001C2040
:1003500023087B20A40BA129443041207530412083
:10036000613041206C30412020304120523041200A
:10037000533041203230412033304120323041204F
:1003800020304120523041206530412063304120EF
:100390006530412070304120C0303F207430412012
:1003A000693041206F3041206E30412020304120A3
:1003B0006F3041206E3041202030412050304120AC
:1003C00049304120433041203130412036304120F6
:1003D0004630412037304120373041201A30052047
:1003E0000730132001303F20523041205830412047
:1003F00031304120203041204330412068304120BD
:1004000089303F2056304120613041206C304120FE
:10041000C0303F20523041205830412032304120FE
:10042000203041204330412068304120C9303F20F6
:1004300056304120613041206C3041201B30A400F7
:1004400002308A0024081B3CA522A3001C2023089C
:100450007B20A40B202A76202518762025188320BF
:10046000A5187620A518C520B10B2C2AB20B2C2A72
:10047000B30B2C2A40301C200D301C200A301C20CD
:1004800040307B200D307B200A307B2076202C2AC8
:1004900082070D340A344434753461346C342034AA
:1004A0005234533432343334323420345234653499
:1004B000633465347034743469346F346E340D349D
:1004C0000A343D343D343D343D343D343D343D34D7
:1004D0003D343D343D343D343D343D343D343D3494
:1004E0003D343D343D343D343D340D340A344D34D7
:1004F0006934633472346F3463346834693470340B
:10050000203450344934433431343634463437346B
:100510003734203463346F346E346E34653463346E
:10052000743465346434203461346E34643420347B
:100530007334743461346E3464342D3462347934F9
:100540002E342E342E340D340A348207723465343E
:10055000613464347934203466346F347234203436
:100560007434723461346E3473346D34693473347A
:10057000733469346F346E342E342E342E340D348B
:020580000A343B
:02400E00F23F7F
:00000001FF
;***************************************************************************
;
; RS232 Scope V1.02 Test Routine for PIC 16XXX
; ============================================
;
; written by Peter Luethi, 12.08.1999, Dietikon, Switzerland
; http://www.electronic-engineering.ch
; last update: 23.01.2005
;
; V1.02: Re-structured ISR to comply with latest modules,
; added label _ISR_RS232error
; (19.04.2004)
;
; V1.01: Minor refinements (20.08.1999)
;
; V1.00: Initial release (12.08.1999)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F84
; Clock Frequency: 4.00 MHz XT
; Throughput: 1 MIPS
; RS232 Baud Rate: 19200 baud (depends on the module included)
; Serial Output: 19200 baud, 8 bit, no parity, 1 stopbit
; Code Size of entire Program: approx. 204 instruction words
; Required Hardware: MAX232
; Required Software: MS Excel 97
;
;
; DESCRIPTION:
; ============
; Developed and tested on PIC16F84.
;PROCESSOR 16F84A
;#include "p16f84a.inc"
PROCESSOR 16F84
#include "p16f84.inc"
_ISR_RS232error
ISRend bcf INTCON,INTF ; clear interrupt flag RB0/INT
RETFIE ; enable INTCON,GIE
MAIN RS232init
clrf TblPtr
bcf TblUpDn
bottom_up
;*** Table Read : bottom up ***
movlw d'3'
subwf TblPtr,1
xmit
;*** FRAMING: start sequence ***
SEND 'T'
SEND 'X'
WAITX d'7',d'7'
goto loop
Table
addwf PCL,1
retlw 0x38 ; Hi-Byte
retlw 0x4B ; Lo-Byte
retlw 0x36
retlw 0x78
retlw 0x32
retlw 0xE1
retlw 0x2E
retlw 0x29
retlw 0x29
retlw 0x37
retlw 0x25
retlw 0x06
retlw 0x22
retlw 0x79
retlw 0x22
retlw 0x2B
retlw 0x24
retlw 0x48
retlw 0x28
retlw 0x87
retlw 0x2E
retlw 0x29
retlw 0x34
retlw 0x21
retlw 0x39
retlw 0x3D
retlw 0x3C
retlw 0x68
retlw 0x3C
retlw 0xDE
retlw 0x3A
retlw 0x59
retlw 0x35
retlw 0x28
retlw 0x2E
retlw 0x29
retlw 0x26
retlw 0xA6
retlw 0x20
retlw 0x1A
retlw 0x1B
retlw 0xEE
retlw 0x1B
retlw 0x2B
retlw 0x1E
retlw 0x45
retlw 0x24
retlw 0xF1
retlw 0x2E
retlw 0x29
retlw 0x38
retlw 0x4E
retlw 0x41
retlw 0x67
retlw 0x47
retlw 0x7C
retlw 0x48
retlw 0xFA
retlw 0x45
retlw 0x02
retlw 0x3B
retlw 0xB0
retlw 0x2E
retlw 0x29
retlw 0x1E
retlw 0x8F
retlw 0x0F
retlw 0xB3
retlw 0x04
retlw 0xB9
retlw 0x00
retlw 0x94
retlw 0x05
retlw 0x8C
retlw 0x14
retlw 0xCE
retlw 0x2E
retlw 0x29
retlw 0x4F
retlw 0xF9
retlw 0x77
retlw 0x45
retlw 0xA0
retlw 0x1E
retlw 0xC6
retlw 0x1B
retlw 0xE4
retlw 0xEF
retlw 0xF9
retlw 0x06
retlw 0xFF
retlw 0xFF
END
:020000040000FA
:020000003A289C
:080008003A288C0081018316E7
:100010000313C030810508008C008101831603138F
:10002000C030810501308104831203130B110B1DB5
:1000300017288C0B162808009600051008308C0035
:100040002D2016180514161C0510960C2D208C0B4F
:10005000212805142D202D2008000C308D00332878
:1000600001308D0033288D0B332808009701382884
:100070008B10090083160313051006140113831255
:10008000031305148B100B168B1798011310180807
:1000900072209500980A18087220940013185728A7
:1000A000980A5C301802031D61281314980303306A
:1000B0009802FE301802031D612813109801980A57
:1000C000980A54301C2058301C2015081C20140895
:1000D0001C202F301C2054301C20073005200730F6
:1000E00013204728820738344B343634783432347E
:1000F000E1342E342934293437342534063422347B
:10010000793422342B3424344834283487342E3440
:1001100029343434213439343D343C3468343C346B
:10012000DE343A345934353428342E3429342634E4
:10013000A63420341A341B34EE341B342B341E34D2
:1001400045342434F1342E34293438344E34413497
:10015000673447347C344834FA34453402343B3411
:10016000B0342E3429341E348F340F34B334043475
:10017000B9340034943405348C341434CE342E34F1
:1001800029344F34F93477344534A0341E34C6341E
:0E0190001B34E434EF34F9340634FF34FF340A
:02400E00F13F80
:00000001FF
http://www.trash.net/~luethi/microchip/projects/rs232/scope/scope.hex12/02/2008 20:31:05
http://www.trash.net/~luethi/microchip/projects/keyboard/box_dbg/box_dbg.asm
;***************************************************************************
;
; AT Keyboard Box V0.04 - Debug and Calibration version
; =====================================================
; (calibration program for numeric foil keypad, with LCD display)
;
; written by Peter Luethi, 06.08.2003, Dresden, Germany
; http://www.electronic-engineering.ch
; last update: 17.04.2004
;
; V0.04: Added LCDcflag (LCD command/data flag) to comply with
; latest LCD modules. Changed controller type from PIC16C74A
; to flash device, i.e. PIC16F77.
; (17.04.2004)
;
; V0.03: Fixed issue in RS232 hardware reception service routine.
; Reads now both data bytes out of double-buffered RX FIFO.
; Tries to eliminate some sporadic reception hangs under
; heavy full-duplex traffic scenarios.
; In case of FIFO overrun errors in the USART receive logic,
; the service routine performs a partial reset of the USART
; receive logic. No specific error handling for RS232
; reception framing errors.
; (17.10.2003)
;
; V0.02: Changed clock frequency from 4 MHz to 14.745600 MHz.
; (15.10.2003)
;
; V0.01: Initial release (06.10.2003)
;
; This code and accompanying files may be distributed freely and
; modified, provided this header with my name and this notice remain
; intact. Ownership rights remain with me.
; You may not sell this software without my approval.
;
; This software comes with no guarantee or warranty except for my
; good intentions. By using this code you agree to indemnify me from
; any liability that might arise from its use.
;
;
; SPECIFICATIONS:
; ===============
; Processor: Microchip PIC 16F77 (16C74A)
; until the received keypad A/D result matches a LUT1 entry. The amount
; of loops carried out in LUT1 determines the position of the
; corresponding symbol/character in LUT2. At the end, RS232 transmission
; and LCD display update are carried out.
;
; RS232 data exchange is carried out by using the internal USART of
; the PIC 16C74A. RS232 data reception is done on an interrupt
; based acquisition scheme, provided by the USART.
;
; For the AT keyboard layout, English and modified Swiss-German
; 'codepages' are supported:
; QWERTY and QWERTZ keyboard layout
;
;
; IMPLEMENTED FEATURES:
; =====================
; - Bi-directional communication between microcontroller application
; and remote RS232 client by hardware-based RS232 transmission.
; - Bi-directional communication between microcontroller and keyboard.
; - Bi-directional communication between microcontroller and LCD
; display.
; - Supports foil-keypad input through direct 8 bit A/D conversion
; and look-up table.
; - Piezo-beeper for acoustic feedback of keypad entries.
; - Visualization of received and transmitted characters on local LCD.
; - Parametrizable LCD display width: constant 'LCDwidth'
; - Support for all keyboard characters typed with shift button active
; and inactive.
; - English and modified Swiss-German 'codepages' available
; (QWERTY and QWERTZ)
; Include the desired keyboard lookup tables at the correct location.
; - Caps Lock implemented
; - Num Lock always active
; - Support of ASCII conversion from direct ALT-DEC entries, e.g.
; ALT + 6 + 4 = @ (ALT + [1..3] numbers)
; - Support of ASCII conversion from direct CTRL-HEX entries, e.g.
; CTRL + 3 + F = ? (CTRL + [1..2] letters/numbers)
; - ALT-DEC and CTRL-HEX features work for both, keypad and keyboard
; numbers, as well as with upper and lower case letters [a..f]
;
; - Possibility to implement short-cuts or user defined characters
; for 'Esc', 'Num Lock', 'Scroll Lock' and 'F1' - 'F12' keys
;
;
; LIMITATIONS:
; ============
; - No support for ALT-GR characters.
; - No support for arrow buttons, 'Home', 'Del', 'PageUp', 'PageDown',
; 'Insert', 'End' because there exists no character/command
; corresponding to the ASCII character map. (But it is possible to
; use them for short-cuts or user defined characters, if the special
; code routine (0xE0) is altered.)
;
;
; NOTE:
; =====
; This program needs 'ORG' directives to locate tables within entire
; memory pages. To allow for slight modifications, the code has not
; been optimized to the utmost extent regarding program memory
; placement. This can be carried out using the program memory window
; of MPLAB showing the hexadecimal representation of the code.
;
;
; CREDITS:
; ========
; - Craig Peacock, the author of the excellent page about keyboards
; "Interfacing the PC's Keyboard" available at his website:
; http://www.beyondlogic.org/keyboard/keybrd.htm
;
;***************************************************************************
PROCESSOR 16F77
#include "p16f77.inc"
;PROCESSOR 16C74A
;#include "p16c74a.inc"
; debug LEDs
;#define DEBUG0tris TRISC,0x00 ; Port C !
;#define DEBUG1tris TRISC,0x01
;#define DEBUG2tris TRISC,0x02
;#define DEBUG3tris TRISC,0x03
;#define DEBUG4tris TRISC,0x04
;#define DEBUG5tris TRISC,0x05
;#define DEBUG0 PORTC,0x00 ; Port C !
;#define DEBUG1 PORTC,0x01
;#define DEBUG2 PORTC,0x02
;#define DEBUG3 PORTC,0x03
;#define DEBUG4 PORTC,0x04
;#define DEBUG5 PORTC,0x05
ORG 0x490
#include "..\..\m_bank.asm"
#include "..\..\m_wait.asm"
#include "..\..\m_lcd_bf.asm"
#include "..\..\m_lcdv08.asm"
IF BEEP_ENABLE == 1 ; conditional assembly
#include "..\..\m_beep.asm" ; Piezo beeper
ENDIF
KEYPADinit macro
BANK1
KEYBOARDinit macro
BANK1
bsf KBDclktris ; set keyboard clock line to input explicitely
bsf KBDdatatris ; set keyboard data line to input explicitely
bcf OPTION_REG,INTEDG ; keyboard interrupt on falling edge
BANK0
bsf INTCON,INTE ; enable RB0/INT interrupts
endm
RS232init macro
BANK1 ; Asynchronous USART assignment:
bcf TXSTA,BRGH ; BRGH = 0
movlw d'23' ; 9600 baud @ 14.7456 MHz, BRGH = 0
;movlw d'25' ; 9600 baud @ 16.00 MHz, BRGH = 0
;movlw d'25' ; 9600 baud @ 4.00 MHz, BRGH = 1
movwf SPBRG
BANK0
bsf RCSTA,SPEN ; enable serial port
BANK1
bsf PIE1,RCIE ; enable serial reception interrupt
bsf TXSTA,TXEN ; enable serial transmission
BANK0
bsf INTCON,PEIE ; enable peripheral interrupts
bsf RCSTA,CREN ; enable continuous reception
endm
SENDw macro
call _RSxmit
endm
KBDexp macro _KBDresp ; keyboard expect function: busy wait for kbd response
movlw _KBDresp ; load expected kbd response
call KBDexpt
endm
_RSxmit BANK1
_RSbusy btfss TXSTA,TRMT ; check, if previous transmission
goto _RSbusy ; has been terminated
BANK0
movwf TXREG ; send next char
RETURN
KBDexpt ;*** keyboard expect function: busy wait for kbd response ***
movwf KBDexpval ; load expected kbd response to KBDexpval
bsf KBDexpf ; set flag
_KBDexp btfsc KBDexpf ; wait loop: poll for completion
goto _KBDexp ; not yet completed, loop
RETURN
RSdisplay ;*** LCD display routine for received RS232 characters ***
; first byte in RXreg
movfw RXreg ; retrieve data
movwf RXtemp ; store data
call _RSdisp ; call output subroutine
btfss RX2flag ; check for second data byte received
goto RSdispEND
; second byte in RXreg2, i.e. RX2flag = 1
movfw RXreg2 ; retrieve data
movwf RXtemp ; store data
call _RSdisp ; call output subroutine
bcf RX2flag ; reset flag
btfss RCSTA,OERR ; check for RX overrun (overrun error bit)
goto RSdispEND
; buffer overrun, severe error, reset USART RX logic
bcf RCSTA,CREN ; reset USART RX logic, clear RCSTA,OERR
KEYPADout ;*** numeric foil-keypad output routine (LCD display & RS232) ***
movfw KPval ; retrieve A/D keypad value
movwf LO
BEEP d'240', d'4'
LCD_DDAdr 0x40 ; set display cursor at second line
LCDchar 'V'
LCDchar 'a'
LCDchar 'l'
LCDchar ' '
LCDchar '='
LCDchar ' '
LCDval_08 ; display value in LO
LCDchar ' '
LCDchar ' '
movlw KEYPAD_SIZE-0x1 ; get amount of keypad buttons
movwf TEMP6 ; prepare loop counter
_KPlut1 ; loop through keypad look-up table 1
movlw HIGH KeypadTable1 ; get correct page for PCLATH
movwf PCLATH ; prepare right page bits for table read
movfw TEMP6 ; retrieve loop counter value
call KeypadTable1 ; call lookup table
addlw 0x0 - KEYPAD_WINDOW/2 ; w - WINDOW/2
movwf TEMP7 ; store retrieved value in temp register
subwf KPval,w ; KPval - w = w
bnc _KPreloop ; no carry if result negative, branch
movfw TEMP7
subwf KPval,w ; KPval - w = w
BRES KEYPAD_WINDOW, _KPlut2 ; A/D value in window, branch
_KPreloop decfsz TEMP6,f ; decrement loop counter, exit if zero
goto _KPlut1 ; loop again
_KPlut2 ; get now corresponding symbol from keypad look-up table 2
movlw HIGH KeypadTable2 ; get correct page for PCLATH
movwf PCLATH ; prepare right page bits for table read
movfw TEMP6 ; retrieve loop counter value
call KeypadTable2 ; call lookup table
SENDw ; RS232 transmission of char in w
LCDw ; display char in working register
LCDchar ' ' ; erase with blank character
bcf KPflag ; reset keypad reception flag
bsf INTCON,RBIE ; re-enable PORTB4:7 change interrupts
RETURN
ISR ;************************
;*** ISR CONTEXT SAVE ***
;************************
;**************************
;*** ISR MAIN EXECUTION ***
;**************************
;******************************
;*** RS232 DATA ACQUISITION ***
;******************************
_ISR_RS232
movfw RCREG ; get RS232 data (first RX FIFO entry)
movwf RXreg ; store first data byte
btfss PIR1,RCIF ; check flag for second RX FIFO entry
goto _ISR_RS232_A ; no second byte received, branch
movfw RCREG ; get RS232 data (second RX FIFO entry)
movwf RXreg2 ; store second data byte
bsf RX2flag ; set flag to indicate second byte received
_ISR_RS232_A
bsf RSflag ; enable RS232 data reception flag
BANK1 ; (for display routine)
bcf PIE1,RCIE ; disable USART reception interrupt
BANK0 ; (will be re-enabled in normal subroutine)
goto _RS232end ; exit ISR
;*******************************
;*** NUMERIC KEYPAD DECODING ***
;*******************************
_ISR_KEYPAD
btfss PADIRQpin ; check if active one
goto _KEYPADend ; else, exit ISR
bcf INTCON,RBIE ; disable PORTB4:7 change interrupts
movlw KEYPAD_DELAY ; busy wait (64 us @ 4 MHz)
movwf ISR_TEMP1
_KPloop1 decfsz ISR_TEMP1,f
goto _KPloop1
; A/D input charge time completed, continue
bsf ADCON0,GO ; turn conversion ON
_KPloop2 btfsc ADCON0,GO ; check A/D status flag
goto _KPloop2 ; wait until the end of conversion
movfw ADRES ; fetch result of A/D conversion
movwf KPval ; store A/D keypad value
;****************************
;*** AT KEYBOARD DECODING ***
;****************************
_ISR_KBD ;*** check origin of keyboard interrupt ***
btfss KBDtxf ; check keyboard TX flag
goto _ISR_KBDacq ; if cleared, keyboard data acquisition,
;goto _ISR_KBDxmit ; else keyboard data transmission
;******************************************
;*** HOST TO KEYBOARD DATA TRANSMISSION ***
;******************************************
_ISR_KBDxmit
;*** data transmission ***
movfw KBDcnt ; get kbd scan pattern acquisition counter
sublw d'7' ; w = d'7' - KBDcnt (*)
bnc _KBDparo ; branch if negative (carry == 0)
btfss KBD,0x00 ; serial transmission of keyboard data
bcf KBDdatapin
btfsc KBD,0x00
bsf KBDdatapin
rrf KBD,F ; rotate right keyboard TX data register
goto _INCF ; exit
;*** data and parity transmission completed, turn around cycle ***
_KBDrel movfw KBDcnt ; get kbd scan pattern acquisition counter
sublw d'9' ; w = d'9' - KBDcnt
bnc _KBDack ; branch if negative (carry == 0)
BANK1
bsf KBDdatatris ; release keyboard data line, set to input
BANK0
goto _INCF ; exit
;*****************************************
;*** KEYBOARD SCAN PATTERN ACQUISITION ***
;*****************************************
_ISR_KBDacq
;*** check start bit ***
tstf KBDcnt ; check
bnz _KBDdat ; branch on no zero
btfsc KBDdatapin ; test start bit of keyboard data input
goto _KBDabort ; no valid start bit, abort
goto _INCF ; exit
;***********************************
;*** CLEARING OF INTERRUPT FLAGS ***
;***********************************
; NOTE: Below, I only clear the interrupt flags! This does not
; necessarily mean, that the interrupts are already re-enabled.
; Basically, interrupt re-enabling is carried out at the end of
; the corresponding service routine in normal operation mode.
; The flag responsible for the current ISR call has to be cleared
; to prevent recursive ISR calls. Other interrupt flags, activated
; during execution of this ISR, will immediately be served upon
; termination of the current ISR run.
_KEYPADend
bcf INTCON,RBIF ; clear RB[7:4] port change interrupt flag
goto ISRend ; terminate execution of ISR
_RS232end
;bcf PIR1,RCIF ; cleared by hardware: USART RX interrupt flag
;goto ISRend ; terminate execution of ISR
;*****************************************
;*** ISR TERMINATION (CONTEXT RESTORE) ***
;*****************************************
KBDdecode
;**********************************************************
;*** KEYBOARD SCAN CODE PRE-DECODING, SET / CLEAR FLAGS ***
;**********************************************************
;****************************************************
;* The following table has to be located within one *
;* page to allow for correct lookup functionality. *
;* Therefore, additional ISR code has been moved *
;* further down. *
;****************************************************
;*********************************************************************
;****************************************************
;* The following code belongs also to the interrupt *
;* service routine and has been moved down to this *
;* place to allow the main keyboard decode lookup *
;* table to be located within one page. *
;* The code below may be arranged on another page, *
;* but that doesn't matter. *
;****************************************************
;********************************
;*** SCAN CODE RANGE CHECKING ***
;********************************
_KBD_2 ;*** check if special code (0xE0) has been submitted previously ***
btfss SPEflag
goto _KBD_3
;*** decoding of scan code with preceding special code (0xE0) ***
; check for ALT-DEC or CTRL-HEX activity
btfsc ALTflag
goto _KBD_3
btfsc CTRLflag
goto _KBD_3
; (decoding currently only necessary for 'E0 4A' = '/')
movfw KBD
sublw 0x4A ; 0x4A - w
bnz _NOSUP ; branch on non-zero
movlw '/' ; store '/' in KBD
movwf KBD
goto _OUTP
_NOSUP ;*** check if scan code 0x5A or smaller has occurred ***
movfw KBD
sublw 0x5A ; 0x5A - w
bc _KBD_3 ; carry if result positive or zero, branch
;*** range exceeded (above 0x5A) ***
; it's one of the following keys: arrow button, 'Home', 'Del',
; 'PageUp', 'PageDown', 'Insert', 'End'
;*******************************************************
;*** SCAN CODE DECODING & ASCII CHARACTER CONVERSION ***
;*******************************************************
;***************************************************
;*** KEYBOARD DATA OUTPUT TO RS232 & LCD DISPLAY ***
;***************************************************
;************************************************
;*** SPECIAL COMMANDS I (with special output) ***
;************************************************
;**********************************************************
;*** STALL RELEASE & CLEAR KEYBOARD DATA RECEPTION FLAG ***
;**********************************************************
_ClrStall
BANK1
bsf KBDclktris ; set clk line back to input (and goes high)
BANK0 ; (release stall)
bcf KBDflag ; clear keyboard data reception flag
bsf INTCON,INTE ; re-enable interrupt RB0/INT
RETURN
;****************************************************
;*** SPECIAL COMMANDS II (without special output) ***
;****************************************************
;***********************************************
;*** ALT-DEC & CTRL-HEX STORING & CONVERSION ***
;***********************************************
; store typed numbers in CTRLreg1 - CTRLreg3
_CTRLstr ; check for capital letter [A..F], i.e. KBD in [0x41..0x46]
movfw KBD
sublw 0x40 ; 0x40 - w
bc _ALTstr ; carry if result >= 0, go to number check
movfw KBD
sublw 0x46 ; 0x46 - w
bnc _CTRLstr2 ; no carry if result negative, go to next check
; valid capital letter [A..F], convert to lower case (+ 0x20)
bsf KBD,0x5 ; KBD += 0x20
goto _CTRLstr3 ; jump for storing
_CTRLstr2 ; check for lower case letter [a..f], i.e. KBD in [0x61..0x66]
movfw KBD
sublw 0x60 ; 0x60 - w
bc _ALTstr ; carry if result >= 0, go to number check
movfw KBD
sublw 0x66 ; 0x66 - w
bc _CTRLstr3 ; carry if result >= 0, valid lower case letter [a..f]
_ALTstr ;*** check for number, i.e. KBD in [0x30..0x39]: ***
movfw KBD
sublw 0x29 ; 0x29 - w
bc _ClrStall ; carry if result >= 0, no number, exit
movfw KBD
sublw 0x39 ; 0x39 - w
bnc _ClrStall ; no carry if result negative, no number, exit
_CTRLstr3 ;*** store letter/number now ***
tstf CTRLcnt
bnz _cnt_1 ; branch if not zero
incf CTRLcnt,F ; increment counter (0->1)
movfw KBD
movwf CTRLreg1 ; store first number
goto _ClrStall ; abort & exit
_cnt_1 decfsz CTRLcnt,W ; decrement counter, don't store
goto _cnt_2 ; counter > 1
incf CTRLcnt,F ; increment counter (1->2)
movfw KBD
movwf CTRLreg2 ; store second number
goto _ClrStall ; abort & exit
_cnt_2 movfw CTRLcnt
sublw 0x02 ; 0x02 - w
bnz _ClrStall ; if result not zero: overflow, abort & exit
incf CTRLcnt,F ; increment counter (2->3)
movfw KBD
movwf CTRLreg3 ; store third number
goto _ClrStall ; abort & exit
;*******************************************************
;* The following table has also to be located within *
;* one page to allow for correct lookup functionality. *
;*******************************************************
;ORG 0x??
retlw d'30' ; 30
retlw d'40' ; 40
retlw d'50' ; 50
retlw d'60' ; 60
retlw d'70' ; 70
retlw d'80' ; 80
retlw d'90' ; 90
retlw d'0' ; 0 BCD for 100's
retlw d'100' ; 100
BCDtableEND retlw d'200' ; 200
;*****************************************************************
;*** SCAN CODE DECODING & ASCII CONVERSION FOR 'SHIFT' ENTRIES ***
;*****************************************************************
_SHICHR ;*** special character decoding typed with shift button active ***
; check for active shift button, if not active, branch
btfss SHIflag
goto _OUTP ; branch
; check for 'backspace', 'tab', 'linefeed' and 'carriage return' :
; (here, KBD has already been converted to ASCII character values)
movfw KBD
sublw d'13' ; d'13' - w
bc _OUTP ; carry if result zero or positive, branch
;*******************************************************
;* The following table has also to be located within *
;* one page to allow for correct lookup functionality. *
;*******************************************************
;**********************************************************************
;* LOOKUP TABLE FOR SPECIAL CHARACTERS TYPED WITH SHIFT BUTTON ACTIVE *
;**********************************************************************
BANK1
clrf OPTION_REG ; PORTB pull-ups enabled
goto _MAIN
ORG 0x170
movlw b'00000010'
movwf ADCON1
BANK0
; bcf DEBUG0
; bcf DEBUG1
; bcf DEBUG2
; bcf DEBUG3
; bcf DEBUG4
; bcf DEBUG5
; bcf DEBUG6
; bcf DEBUG7
;******************************
_MLOOP btfsc KBDflag ; check scan pattern reception flag
call KBDdecode ; if set, call decoding routine
btfsc RSflag ; check RS232 data reception flag
call RSdisplay ; if set, call display routine
btfsc KPflag ; check foil-keypad reception flag
call KEYPADout ; if set, call output routine
goto _MLOOP ; loop forever
;******************************
WelcomeTable
addwf PCL,F ; add offset to table base pointer
DT "PIC16F77 AT Keyboard Box V0.04 stand-b" ; create table
WTableEND DT "y"
IF (HIGH (WelcomeTable) != HIGH (WTableEND))
ERROR "WelcomeTable hits page boundary!"
ENDIF
KeypadTable1
addwf PCL,F ; add offset to table base pointer
retlw d'76' ;*
retlw d'90' ;7
retlw d'105' ;4
retlw d'120' ;1
retlw d'135' ;0
retlw d'151' ;8
retlw d'167' ;5
retlw d'184' ;2
retlw d'201' ;#
retlw d'218' ;9
retlw d'236' ;6
KeypadTable1END retlw d'254' ; 3
IF (HIGH (KeypadTable1) != HIGH (KeypadTable1END))
ERROR "KeypadTable1 hits page boundary!"
ENDIF
KeypadTable2
addwf PCL,F ; add offset to table base pointer
DT "*7410852#96" ; create table
KeypadTable2END DT "3"
IF (HIGH (KeypadTable2) != HIGH (KeypadTable2END))
ERROR "KeypadTable2 hits page boundary!"
ENDIF
END
:020000040000FA
:1000000083160313810170298B138B1B0428AD0009
:10001000030EAE0083010A08AF008A0183130408AF
:10002000B0008B1834280B1826288C1A18288C2816
:100030001A08AA008C1E1F281A08AB0029142714BE
:10004000831603138C12831203138C28861F8828AF
:100050008B115030B100B10B2B281F151F192E2802
:100060001E08BE00A8178828281C5A283208073CFA
:10007000031C4028331C051233180516B30C8A28BC
:100080003208083C031C4928A81C0512A8180516AC
:100090008A283208093C031C5328831603130516CB
:1000A000831203138A2832080B3C031C8A28B201EE
:1000B00028108B28B208031D6028051A85288A2875
:1000C0003208083C031C6C28051EB313051AB3172D
:1000D00003198A28B30C8A283208093C031C7128AA
:1000E0008A28051E852828197E28A717831603133A
:1000F00006108312031306100B12862823083302FE
:10010000031D85282811B2018B28B301B2018B2869
:100110000B108C28B20A8B10300884002F088A003C
:100120002E0E8300AD0E2D0E09003308B400F03CF6
:10013000031D9D28A714A711752BA71CF92AA7102A
:100140003308123C0319A7283308593C0319271117
:100150003308583C031DCC28271EBD282712ED303C
:10016000B30034251B25FA30412535113508B3007D
:1001700034251B25FA304125752B2716ED30B300A9
:1001800034251B25FA30412535153508B3003425B3
:100190001B25FA304125752B3308113C031DD2284D
:1001A000A712B62B3308143C031D752B2713ED2B18
:1002E00002309F00831203130910831603130910B1
:1002F0008312031383160313181117309900831206
:1003000003139817831603138C169816831203137E
:100310000B17181683160313061405160113831200
:1003200003130B1683160313051486178312031386
:10033000C1309F008B15F8308B058C018D018B1718
:100340000230B500B201A701A801831603130130E2
:10035000880583120313881208138813E130880577
:10036000043097240330A724C12401309724083097
:10037000A724C124013097240230A724C1240130CE
:1003800097242830AE240C30AE242830AE2401301F
:10039000AE242830B600B7012730A50002308A000D
:1003A0002508273C1B22A60013252608B024A50BF0
:1003B000CE290D3013250A3013250A301325FF30BE
:1003C000B30034251B25ED30B30034251B25FA304E
:1003D00041253508B30034251B25FA304125ED3081
:1003E000B30034251B25FA30412535143508B300F8
:1003F00034251B25FA304125FF30A0000430FC24B1
:1004000080309724FF30A0000430FC24103090246A
:1004100007309E24C830A0000430FC24803097248C
:10042000B430A0000330FC24A71B952027184625D4
:10043000A81B7F25142A82075034493443343134B1
:10044000363446343734373420344134543420344D
:100450004B346534793462346F34613472346434CB
:10046000203442346F3478342034563430342E34CF
:100470003034343420347334743461346E3464343E
:100480002D346234793482074C345A3469347834E8
:1004900087349734A734B834C934DA34EC34FE34B2
:1004A00082072A34373434343134303438343534F4
:0A04B0003234233439343634333447
:1005000082070034393400343534333431343234F2
:1005100032340034303438343634343409347E34B0
:10052000003400347F2B7D2B0034812B7134313427
:100530000034003400347A34733461347734323424
:100540000034003463347834643465343434333400
:1005500000340034203476346634743472343534E4
:10056000003400346E34623468346734793436349D
:100570000034003400346D346A3475343734383420
:10058000003400342C346B3469346F3430343934F3
:10059000003400342E343F346C343B3470342D340A
:1005A000003400340034273400345B342B340034FE
:1005B000003400347D2B6E2B5D3400347C340034E9
:1005C000003400343C3430342E3432343534363454
:1005D00038340034003431342B3433342D342A345D
:1005E000393400340834003400343134373434348E
:1005F0003734A71D0B2BA71A0B2B271B0B2B3308EC
:100600004A3C031D062B2F30B3003F2B33085A3CC6
:1006100003180B2B752B3308613C0318212B0E306C
:10062000B3023308613C031C182B1930B307212B8C
:100630003308773C0318212B3308D23C0319A71544
:10064000752B02308A0033088022B300B3080319E7
:10065000752BA71A992B271B872B3308603C03188F
:10066000062C33087A3C031C062C3308271A3B2B34
:10067000271D3F2B3D2B27193F2BE03EB3003308AE
:1006800013253308083C031D532B37080319752B1A
:10069000B7033708403E8038A500AE242030B02490
:1006A0002508AE24752B3308093C031D602B370841
:1006B000263C031C5E2B2030B024B70A2030B30048
:1006C0003708273C0318662BA816B5253708403E87
:1006D0008038AE243308B024B70A752BA816B52588
:1006E0000D3013250A301325003483160313061426
:1006F00083120313A7130B16080027150034A7163F
:10070000822B2717B801B901BA01BB0100343308A5
:10071000403C0318992B3308463C031C912BB3161D
:10072000A12B3308603C0318992B3308663C03184F
:10073000A12B3308293C0318752B3308393C031CC3
:10074000752BB808031DA82BB80A3308B900752B00
:10075000380BAE2BB80A3308BA00752B3808023CA8
:10076000031D752BB80A3308BB00752BB808031995
:10077000752B3030B902BA02BB02B803031DC32B7C
:100780003908B300DD2BB803031DCD2B03308A00DD
:100790003908DF233A07B300DD2B3908023C031C7C
:1007A000752B03308A0039080A3EDF23B9003A0866
:1007B000DF23B9073B083907B300B8013F2B820795
:1007C00000340A3414341E34283432343C34463471
:1007D00050345A3400346434C834B8080319752BC3
:1007E0003030B902BA02B91EF72B2730B902BA1E4F
:1007F000FB2B2730BA02B803031D012C3908B300C4
:10080000042C390E3A04B300B8013F2B271D3F2BAF
:1008100033080D3C03183F2B3408613C031C3F2B6D
:1008200034083C3C0318172C3D30B402202C34080B
:10083000243C03181E2C2330B402202C0430B407AF
:1008400004308A0034082624B3003F2B8207263464
:100850002A34243423343C34003400340034293422
:100860002834003425343E342F3400343A340034F4
:100870005F3460345E340034223400347B343D34E1
:10088000003421340034003400347D3400345C34CE
:080890000034403400343E3412
:10092000A000810183160313C03081050800A000D8
:10093000810183160313C0308105013081048312C5
:1009400003130B110B1DA22CA00BA12C0800A2005D
:10095000E1308805220D1E39880408002816B12CC4
:100960002812A300C524281E88172308230EA724B5
:10097000C1242308A724C124E13088058813081363
:10098000080088160000881208008813A81583162E
:1009900003131E3088048312031308178816081ED9
:1009A000A81188120000C124A819CE2C08138316A0
:1009B0000313E13088058312031308003C08BD00CF
:1009C00028136430A100EC240A30A100EC2401308B
:1009D000A1002817EC240800A00121083D02031CF7
:1009E000F62CA00A2108BD022817EE2C3030200773
:1009F000281F2030B0240800A100810183160313B2
:100A000007308100831203130B1109140E250910FE
:100A10000E250B1D052DA10B042D08002008A2009A
:100A2000A20B102D080083160313981C152D83129A
:100A30000313990008000B12831603130610051206
:100A400083120313061005122030A000A00B262DE0
:100A5000B2018316031306148312031328148B1098
:100A60000B162818312D0800A2000830A300A4019D
:100A70002218A40AA20CA30B382DA810241CA81419
:100A80000800A30028152819432D08002A08AC00E7
:100A90005A25291C542D2B08AC005A252910981CC6
:100AA000542D181218111816831603138C1683125E
:100AB000031308002C08083C031D682D3608031991
:100AC0007D2DB60336088038AE242030B0247D2D2D
:100AD0003608273C03186E2DA812B5253608803835
:100AE000AE242C080D3C031C7A2D031D7D2DA8126D
:100AF000B5257D2D2C08B024B60A271008003E0825
:100B0000BC00F030A0000430FC24C030AE245630CD
:100B1000B0246130B0246C30B0242030B0243D309B
:100B2000B0242030B024DE242030B0242030B02483
:100B30000B30A50002308A0025084322FD3EA600A6
:100B40003E02031CA82D26083E02063C0318AA2DCF
:100B5000A50B9A2D02308A00250850221325B024B7
:100B60002030B024A8138B1508002830A81AC32DF4
:100B7000B6008030AE242030B024B60BBB2D8030C0
:100B8000AE24B6010800B700C030AE242030B02437
:0C0B9000B70BC62DC030AE24B701080022
:02400E00F23F7F
:00000001FF
:020000040000FA
:1000000083160313810170298B138B1B0428AD0009
:10001000030EAE0083010A08AF008A0183130408AF
:10002000B0008B1834280B1826288C1A18288C2816
:100030001A08AA008C1E1F281A08AB0029142714BE
:10004000831603138C12831203138C28861F8828AF
:100050008B115030B100B10B2B281F151F192E2802
:100060001E08BE00A8178828281C5A283208073CFA
:10007000031C4028331C051233180516B30C8A28BC
:100080003208083C031C4928A81C0512A8180516AC
:100090008A283208093C031C5328831603130516CB
:1000A000831203138A2832080B3C031C8A28B201EE
:1000B00028108B28B208031D6028051A85288A2875
:1000C0003208083C031C6C28051EB313051AB3172D
:1000D00003198A28B30C8A283208093C031C7128AA
:1000E0008A28051E852828197E28A717831603133A
:1000F00006108312031306100B12862823083302FE
:10010000031D85282811B2018B28B301B2018B2869
:100110000B108C28B20A8B10300884002F088A003C
:100120002E0E8300AD0E2D0E09003308B400F03CF6
:10013000031D9D28A714A711752BA71CF92AA7102A
:100140003308123C0319A7283308593C0319271117
:100150003308583C031DCC28271EBD282712ED303C
:10016000B30034251B25FA30412535113508B3007D
:1001700034251B25FA304125752B2716ED30B300A9
:1001800034251B25FA30412535153508B3003425B3
:100190001B25FA304125752B3308113C031DD2284D
:1001A000A712B62B3308143C031D752B2713ED2B18
:1002E00002309F00831203130910831603130910B1
:1002F0008312031383160313181117309900831206
:1003000003139817831603138C169816831203137E
:100310000B17181683160313061405160113831200
:1003200003130B1683160313051486178312031386
:10033000C1309F008B15F8308B058C018D018B1718
:100340000230B500B201A701A801831603130130E2
:10035000880583120313881208138813E130880577
:10036000043097240330A724C12401309724083097
:10037000A724C124013097240230A724C1240130CE
:1003800097242830AE240C30AE242830AE2401301F
:10039000AE242830B600B7012730A50002308A000D
:1003A0002508273C1B22A60013252608B024A50BF0
:1003B000CE290D3013250A3013250A301325FF30BE
:1003C000B30034251B25ED30B30034251B25FA304E
:1003D00041253508B30034251B25FA304125ED3081
:1003E000B30034251B25FA30412535143508B300F8
:1003F00034251B25FA304125FF30A0000430FC24B1
:1004000080309724FF30A0000430FC24103090246A
:1004100007309E24C830A0000430FC24803097248C
:10042000B430A0000330FC24A71B952027184625D4
:10043000A81B7F25142A82075034493443343134B1
:10044000363446343734373420344134543420344D
:100450004B346534793462346F34613472346434CB
:10046000203442346F3478342034563430342E34CF
:100470003034343420347334743461346E3464343E
:100480002D346234793482074C345A3469347834E8
:1004900087349734A734B834C934DA34EC34FE34B2
:1004A00082072A34373434343134303438343534F4
:0A04B0003234233439343634333447
:1005000082070034393400343534333431343234F2
:100510003234003430343834363434340934A73487
:10052000003400347F2B7D2B0034812B7134313427
:100530000034003400347934733461347734323425
:100540000034003463347834643465343434333400
:1005500000340034203476346634743472343534E4
:10056000003400346E346234683467347A3436349C
:100570000034003400346D346A3475343734383420
:10058000003400342C346B3469346F3430343934F3
:10059000003400342E342D346C34F6347034273467
:1005A000003400340034E4340034FC345E3400346D
:1005B000003400347D2B6E2B21340034243400347D
:1005C000003400343C3430342E3432343534363454
:1005D00038340034003431342B3433342D342A345D
:1005E000393400340834003400343134373434348E
:1005F0003734A71D0B2BA71A0B2B271B0B2B3308EC
:100600004A3C031D062B2F30B3003F2B33085A3CC6
:1006100003180B2B752B3308613C0318212B0E306C
:10062000B3023308613C031C182B1930B307212B8C
:100630003308773C0318212B3308D23C0319A71544
:10064000752B02308A0033088022B300B3080319E7
:10065000752BA71A992B271B872B3308603C03188F
:10066000062C33087A3C031C062C3308271A3B2B34
:10067000271D3F2B3D2B27193F2BE03EB3003308AE
:1006800013253308083C031D532B37080319752B1A
:10069000B7033708403E8038A500AE242030B02490
:1006A0002508AE24752B3308093C031D602B370841
:1006B000263C031C5E2B2030B024B70A2030B30048
:1006C0003708273C0318662BA816B5253708403E87
:1006D0008038AE243308B024B70A752BA816B52588
:1006E0000D3013250A301325003483160313061426
:1006F00083120313A7130B16080027150034A7163F
:10070000822B2717B801B901BA01BB0100343308A5
:10071000403C0318992B3308463C031C912BB3161D
:10072000A12B3308603C0318992B3308663C03184F
:10073000A12B3308293C0318752B3308393C031CC3
:10074000752BB808031DA82BB80A3308B900752B00
:10075000380BAE2BB80A3308BA00752B3808023CA8
:10076000031D752BB80A3308BB00752BB808031995
:10077000752B3030B902BA02BB02B803031DC32B7C
:100780003908B300DD2BB803031DCD2B03308A00DD
:100790003908DF233A07B300DD2B3908023C031C7C
:1007A000752B03308A0039080A3EDF23B9003A0866
:1007B000DF23B9073B083907B300B8013F2B820795
:1007C00000340A3414341E34283432343C34463471
:1007D00050345A3400346434C834B8080319752BC3
:1007E0003030B902BA02B91EF72B2730B902BA1E4F
:1007F000FB2B2730BA02B803031D012C3908B300C4
:10080000042C390E3A04B300B8013F2B271D3F2BAF
:1008100033080D3C03183F2B3408613C031C3F2B6D
:1008200034083C3C0318172C3D30B402202C34080B
:10083000243C03181E2C2330B402202C0430B407AF
:1008400004308A0034082624B3003F2B82072F345B
:10085000283423342A343B340034003400343D340B
:100860002934003425343A345F3400345C340034A5
:100870003F344034263400347B3400345B347E34DF
:1008800000342B340034003400345D3400347D34C3
:080890000034223400343E3430
:10092000A000810183160313C03081050800A000D8
:10093000810183160313C0308105013081048312C5
:1009400003130B110B1DA22CA00BA12C0800A2005D
:10095000E1308805220D1E39880408002816B12CC4
:100960002812A300C524281E88172308230EA724B5
:10097000C1242308A724C124E13088058813081363
:10098000080088160000881208008813A81583162E
:1009900003131E3088048312031308178816081ED9
:1009A000A81188120000C124A819CE2C08138316A0
:1009B0000313E13088058312031308003C08BD00CF
:1009C00028136430A100EC240A30A100EC2401308B
:1009D000A1002817EC240800A00121083D02031CF7
:1009E000F62CA00A2108BD022817EE2C3030200773
:1009F000281F2030B0240800A100810183160313B2
:100A000007308100831203130B1109140E250910FE
:100A10000E250B1D052DA10B042D08002008A2009A
:100A2000A20B102D080083160313981C152D83129A
:100A30000313990008000B12831603130610051206
:100A400083120313061005122030A000A00B262DE0
:100A5000B2018316031306148312031328148B1098
:100A60000B162818312D0800A2000830A300A4019D
:100A70002218A40AA20CA30B382DA810241CA81419
:100A80000800A30028152819432D08002A08AC00E7
:100A90005A25291C542D2B08AC005A252910981CC6
:100AA000542D181218111816831603138C1683125E
:100AB000031308002C08083C031D682D3608031991
:100AC0007D2DB60336088038AE242030B0247D2D2D
:100AD0003608273C03186E2DA812B5253608803835
:100AE000AE242C080D3C031C7A2D031D7D2DA8126D
:100AF000B5257D2D2C08B024B60A271008003E0825
:100B0000BC00F030A0000430FC24C030AE245630CD
:100B1000B0246130B0246C30B0242030B0243D309B
:100B2000B0242030B024DE242030B0242030B02483
:100B30000B30A50002308A0025084322FD3EA600A6
:100B40003E02031CA82D26083E02063C0318AA2DCF
:100B5000A50B9A2D02308A00250850221325B024B7
:100B60002030B024A8138B1508002830A81AC32DF4
:100B7000B6008030AE242030B024B60BBB2D8030C0
:100B8000AE24B6010800B700C030AE242030B02437
:0C0B9000B70BC62DC030AE24B701080022
:02400E00F23F7F
:00000001FF
(Original in German available from the address below. Translation errors courtesy of
Peter Lamb, Swiss Fed. Inst. of Technology)
The 1978 law on time standards defines legal time in Germany on the
basis of Coordinated World Time (UTC) and gives the PTB responsibility
for the keeping and broadcasting of legal time. As well as this, the
time standards law empowers the Federal government to issue regulations
for the introduction of Summer Time.
Legal time in the FRG is either Middle European Time (MEZ - German
abbreviation) or, in case of its introduction Middle European Summer
Time (MESZ). The following relationships hold between UTC and MEZ and
MESZ.
MEZ(D) = UTC(PTB) + 1h
MESZ(D) = UTC(PTB) + 2h
DCF77 Specifications
specifications:
minutes, 6 bits for the hour and 22 bits for the date,
including the week day number) to maintain an even count
of 1's.
1-14 Reserved
Literature
Since July 1983, the DCF77 carrier has been phase modulated in a test
configuration. The phase modulation is a pseudorandom binary sequence
sent twice each second. The clock frequency of the binary sequence is
645.833...Hz and the phase shift \Delta\tau about 3% of the period
(\^{=} 10\deg). Equal numbers of shifts of +\Delta\tau and -\Delta\tau
are always sent, so that the mean frequency remains unchanged, and the
use of DCF77 as a frequency standard is unaffected. The timecode is
encoded in the sequence by inverting the sequence or not. Not inverted
sequence corresponds to a 0 bit. The sequence is alleged to be generated
by a 9 bit shift register which is coupled back on positions 5 and 9.
The polynomial might be: x^9 + x^4 + 1.
Availability
Walter Schmidt
Eichwisrain 14
8634 Hombrechtikon
Switzerland
LF reciever and decoder for the German time standard DCF77. As yet
untested. Has a 1s impulse output driven direct from the reciever, which
could be used in a similar manner to the pulse output on the Spectracom.
Internal crystal-controlled clock reset each minute by the DCF77 minute
mark. Indication available to program of whether currently synchronised,
and a count of how long since the last synchronisation is available if
running unsynchronised. Returns time with resolution 0.1s, but probably
synchronised to the time of command reception, and not to the 0.1s
counter. I will try to get the firmware changed if this is the case.
Other sources
Die folgende Liste ist einer Information der PTB entnommen. Fuer evtl.
Tippfehler wird nicht gehaftet (;-) (Umlaute sind in ASCII Umschrift
(ae,oe,ue,ss) dargestellt.)
Note: This document was corrected for the new zip codes on July 1st
1993. The old zip codes are in parenthesis. Some zip codes could not be
converted.
Schwille-Elektronik Benzstrasse 1
Tel.: 089/9031041 85551 (8011) Kirchheim
Siemens AG Postfach 53 29
Tel.: 0511/1290 30053 (3000) Hannover (1)
Die mit `*' gekennzeichneten Firmen unter 1. haben neben Funkuhren auch
DCF77-Normalfrequenzempfaenger in ihrem Vertriebsprogramm.
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Using only a speaker and decoupling capacitor, it is possible to generate tunes or melodies from your Microchip PIC16F87x processor. A timer can be used
to generate each of the eleven musical notes and another timer can be used to time the note duration. You can even choose to support several octaves if
you want a challenge.
The code can form the foundation for a range of applications such as christmas toys to customised doorbells or chimes. Add a DIP switch to support
multiple melodies.
However the hard parts comes from making and coding your own melodies to play. Wouldnt it make sense to use some of the tens of thousands of Mobile
Phone Ring Tones floating around the place. This is what we have done here.
One of the more popular standards is the RTTTL (Ringing Tones Text Transfer Language) specification which is used by Nokia mobile phones. These
tunes can be save and transported using the .RTX ringtone specification. This specification is no more than a ASCII text file which includes the ringtone
name, a control section specifying default attributes and a comma delimited string of notes that can be optionally encoded with the octave and duration.
A simple RTTTL ring tone is the itchy and scratchy theme song which is displayed below :
itchy:d=8,o=6,b=160:c,a5,4p,c,a,4p,c,a5,c,a5,c,a,4p,p,c,d,e,p,e,f,g,4p,d,c,4d,f,4a#,4a,2c7
Title : The title of the ring tone starts the string followed by a semicolon. There are varying specifications on its maximum length but it is suggested it
shouldnt be any more than 10 characters long.
Control : The control section sets up default parameters which are carried throughout the melody. The idea is to reduce the size of the string, by
omitting common parameters. Instead of each comma delimited note containing the note, octave and duration information, the octave and duration
can be omitted if it is the same than the specified default.
Note Commands :The body of the ring tone is made up of comma delimited notes prefixed by the optional duration and postfixed by the octave. A
dotted note (.) can be specified after the octave which indicates the duration of the note is extended by 50%, making it 1.5x the original note duration.
http://www.beyondlogic.org/pic/ringtones.htm (1 of 12)13/02/2008 16:34:11
Generate Ring Tones on your PIC16F87x.
d (default duration). The default duration can be one of 1, 2, 4, 8, 16, 32 or 64. The default duration can be one of 1, 2, 4, 8, 16, 32 or 64. 1 specifies
a Semibreve (Whole Note), 2 indicates it a Minim (Half Note), 4 is a Crotchet (Quarter Note) etc up to 64 which is a Hemidemisemiquaver (64th
note). .
b (beats per minute). The BPM or tempo can be any one of the following values 25, 28, 31, 35, 40, 45, 50, 56, 63, 70, 80, 90, 100, 112, 125, 140,
160, 180, 200, 225, 250, 285, 320, 355, 400, 450, 500, 565, 635, 715, 800, 900.
l (looping). The loop value can be 0 to 15. 0 disables looping. 15 enables infinite looping. Values between 1 and 14 specify how many loops to make
before stopping.
If any of the parameters is missing from the control section, the following defaults are assumed : 4=duration, 6=scale, 63=beats-per-minute.
The circuit
As you can see the circuit required to generate tones is very simple. The 20MHz crystal controls the timing and can not be substituted with another value
without recalculating the divisors for each tone.
The following spreedsheet shows the desired and actual frequencies for each note @ 20MHz. The code supports 4 octaves.
The code has been written in C and compiled with the Hi-Tech PICC Compiler. HiTech Software have a demo version of the PICC for download which
works for 30 days. A pre-compiled .HEX file has be included in the archive which has been compiled for use with (or without) the ICD.
To add new tones is simply a matter of cut and paste. You may choose to search Overtonez.co.uk or any number of internet sites for new ring tones. Once
you have one, simply cut the note commands into the Melody[ ] array and adjust the defaultduration, defaultoctave and beat_speed to suit.
If you have a Nokia F-Bus cable, you can download your favourite tunes from your phone using software such as Logomanager or the Oxygen Phone
Manager. You can then save them as .rtl files and paste it into your source code.
/*****************************************************************************/
/* */
/* RTTTL Ring Tone Player for Microchip PIC16F87x Microcontrollers */
/* Copyright Craig.Peacock@beyondlogic.org */
/* Version 1.0 17th August 2003 */
/* */
/*****************************************************************************/
#include <pic.h>
void InitTimer(void);
http://www.beyondlogic.org/pic/ringtones.htm (4 of 12)13/02/2008 16:34:11
Generate Ring Tones on your PIC16F87x.
#define MissionImpossible
void main(void)
{
unsigned int pointer = 0;
unsigned int octave = 0;
unsigned int duration = 0;
unsigned short note = 0;
unsigned int defaultoctave = 0;
unsigned int defaultduration = 0;
#ifdef AxelF
/* AxelF */
const unsigned char static Melody[] = {"32p,8g,8p,16a#.,8p,16g,16p,16g,8c6,8g,8f,8g,8p,16d.6,8p,16g,16p,
16g,8d#6,8d6,8a#,8g,8d6,8g6,16g,16f,16p,16f,8d,8a#,2g,4p,16f6,8d6,
8c6,8a#,4g,8a#.,16g,16p,16g,8c6,8g,8f,4g,8d.6,16g,16p,16g,8d#6,86,
8a#,8g,8d6,8g6,16g,16f,16p,16f,8d,8a#,2g"};
defaultoctave = 5;
defaultduration = 4;
beat_speed = 125;
#endif
#ifdef HappyBirthday
/* HappyBirthday */
const unsigned char static Melody[] = {"8g.,16g,a,g,c6,2b,8g.,16g,a,g,d6,2c6,8g.,16g,g6,e6,c6,b,a,8f6.,16f6,
e6,c6,d6,2c6,8g.,16g,a,g,c6,2b,8g.,16g,a,g,d6,2c6,8g.,16g,g6,e6,c6,b,
a,8f6.,16f6,e6,c6,d6,2c6"};
defaultoctave = 5;
defaultduration = 4;
beat_speed = 125;
#endif
#ifdef Itchy
/* Itchy & Scratcy */
const unsigned char static Melody[] = {"8c,8a5,4p,8c,8a,4p,8c,a5,8c,a5,8c,8a,4p,8p,8c,8d,8e,8p,8e,8f,8g,4p,8d,
http://www.beyondlogic.org/pic/ringtones.htm (5 of 12)13/02/2008 16:34:11
Generate Ring Tones on your PIC16F87x.
8c,4d,8f,4a#,4a,2c7"};
defaultoctave = 6;
defaultduration = 8;
beat_speed = 198;
#endif
#ifdef MissionImpossible
/* Mission Impossible */
const unsigned char static Melody[] = {"16d5,16d#5,16d5,16d#5,16d5,16d#5,16d5,16d5,16d#5,16e5,16f5,16f#5,16g5,
8g5,4p,8g5,4p,8a#5,8p,8c6,8p,8g5,4p,8g5,4p,8f5,8p,8p,8g5,4p,4p,8a#5,8p,
8c6,8p,8g5,4p,4p,8f5,8p,8f#5,8p,8a#5,8g5,1d5"};
defaultoctave = 6;
defaultduration = 4;
beat_speed = 150;
#endif
beep = 0;
InitTimer();
PEIE = 1;
GIE = 1; /* Enable General Purpose Interrupts */
do {
if (Melody[pointer + 1] == '#') {
/* Process Sharps */
switch (Melody[pointer]) {
case 'a' : note = 10726;
break;
case 'c' : note = 9019;
break;
case 'd' : note = 8035;
break;
case 'f' : note = 6757;
break;
case 'g' : note = 6024;
break;
}
pointer +=2;
} else {
switch (Melody[pointer]) {
case 'a' : note = 11364;
break;
case 'b' : note = 10123;
break;
case 'c' : note = 9555;
break;
case 'd' : note = 8513;
break;
case 'e' : note = 7584;
break;
case 'f' : note = 7158;
break;
case 'g' : note = 6378;
break;
if (Melody[pointer] == '.') {
/* Duration 1.5x */
duration = duration + 128;
pointer++;
}
if (Melody[pointer] == '4') {
octave = 4;
pointer++;
} else if (Melody[pointer] == '5') {
octave = 5;
pointer++;
} else if (Melody[pointer] == '6') {
octave = 6;
pointer++;
} else if (Melody[pointer] == '7') {
octave = 7;
pointer++;
}
if (Melody[pointer] == '.') {
/* Duration 1.5x */
duration = duration + 128;
pointer++;
}
/* Loop */
while(1) {};
void PlayNote(unsigned short note, unsigned char octave, unsigned int duration)
{
/* Process octave */
switch (octave) {
case 4 : /* Do noting */
break;
case 5 : /* %2 */
note = note >> 1;
break;
case 6 : /* %4 */
note = note >> 2;
break;
case 7 : /* %8 */
note = note >> 4;
break;
}
if (note) beep = 1;
}
void InitTimer(void)
{
/* Initialise Timer 0 */
OPTION = 0b11010111; /* Set TMR0 to Internal CLk, 1:256 */
/* Initialise Timer 1 */
T1CON = 0b00000001; /* Counter Enabled, Using Ext Pin 1:1 Prescaler */
TMR1IF = 0; /* Clear Flag */
TMR1IE = 1; /* Enable Interrupt */
}
The above example compiled with the Mission Impossible theme takes a modest 1K of memory. .
Program statistics:
Revision History
Glossary
Semibreve - Semibreve is the British term for Whole Note. A semibreve is worth 4 beats.
Minim - Minim is the British term for Half Note. A minim is worth 2 beats.
Crotchet - Crotchet is the British term for Quarter Note. A crotchet is worth 1 beat.
Quaver - Quaver is the British term for 8th Note. A quaver is worth 1/2 a beat.
Semiquaver - Semiquaver is the British term for 16th Note. A semiquaver is worth 1/4 of a beat.
Demisemiquaver - Demisemiquaver is the British term for 32nd Note. A demisemiquaver is worth 1/8 of a beat.
Hemidemisemiquaver - Hemidemisemiquaver is the British term for 64th Note. A hemidemisemiquaver is worth 1/16 of a beat.
Octave - With the 12 musical notes, let's call note number one C. If we start on C and work our way up the 12 notes in pitch, we will eventually hit C
again but of a higher pitch (exactly one octave higher). At this point the C we are playing is in the next Octave on from the C we started on. For
example if we started on C4 (4th Octave) we would end up on C5 (5th Octave) and this can keep going endlessly until the frequency of the pitch
reaches beyond our aural hearing frequency range. The same can apply going down in pitch / octaves. So Octave is specifiying what Octave or Pitch/
Frequency Range to play your specified note from.
Staccato - Staccato is a direction to perform a note quickly, lightly, and seperated from the notes before and after it. Staccato performance in
practice reduces the time value of a note by 50%, thus a staccato'd crotchet (quarter note) lasts only as long as a quaver (8th note).
Links
http://overtonez.co.uk/frame_me/index.pl - OvertoneZ - Search and download ASCII RTTTL Ring Tones to import into your source code.
http://www.htsoft.com/ HiTech Software - Make the PICC C Cross Compiler for Microchip PIC16x Family of Microcontrollers.
Copyright 2003-2007 Craig Peacock & Andrew Toner 6th April 2007.
http://www.beyondlogic.org/pic/ringtones.htm (11 of 12)13/02/2008 16:34:11
Generate Ring Tones on your PIC16F87x.
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Adding vision to your projects needs not be a difficult task. Whether its machine vision for robot
control or the sampling and storage of images for security, CMOS images sensors can offer many
advantages over traditional CCD sensors. Just some of the technical advantages of CMOS
sensors are,
No Blooming
Low power consumption. Ideal for battery operated
devices
Direct digital output (Incorporates ADC and associated
circuitry)
Small size and little support circuitry. Often just a
crystal and some decoupling is all that is needed.
Simple to design with.
There are many manufacturers making CMOS Image Sensors. Just some of the more notable
ones are Micron who acquired Photobit, OmniVision, ST who acquired VLSI Vision, Mitsubishi and
Kodak.
There are two different categories of CMOS Sensors based on their output. One type will have a
analog signal out encoded in a video format such as PAL, NTSC, S-Video etc which are designed
for camera on a chip applications. With these devices you simply supply power and feed the output
straight into you AV Equipment. Others will have a digital out, typically a 4/8 or 16 bit data bus.
These 'digital' sensors simplify designs, where once a traditional 'analog' camera was feed into a
video capture card for conversion to digital. Today, digital data can be pulled straight from the
sensor.
Once you have completed the above, you have yourself a imaging system which constantly spits
out a pixel data stream synchronised to a pixel, frame and/or line clocks. Connecting this directly to
a microcontroller/processor system will cause headaches. Trying to clock this raw data in will use
up great amounts of CPU time, if your uC could do it in the first place. If you drop a pixel because
an ISR is doing some thing more privileged, then you have no ability to sample that location again,
and thus no method of error correction.
While the frame rate on many devices can be slowed down by using internal divisors, it still doesn't
reach an acceptable speed nor allow random access to pixels. Reducing the master clock rate of
the device will effect exposure times and other time dependent settings, thus is not an option.
Clearly some additional circuitry will need to be designed.
By using a CPLD/FPGA and RAM, you can program the CPLD to dump the data straight into RAM.
Your micro could then read this RAM through the PLD which could be memory mapped. If you
really want performance (And budget is not a problem), you could use Dual Port RAM. If however
you only want to capture one frame, then the PLD could copy one frame into memory and ignore
subsequent pixel data until an event such as when your device has read all the data out of RAM.
Other options are to use a LVDS (Low Voltage Differential Signalling) serial bus, to relay your data
over a few metres or more. At a high enough clock rate, you won't wait all day for a frame.
The other thing you must not forget is how to control the sensor. Most of it's internal parameters are
controlled by a serial bus, typically I2C for the majority of sensors. This can either be controlled
through a memory mapped Register programmed into your PLD or via an I2C port straight from
your uC. All up this makes quite a cheap way to capture video. Ideal for your Embedded Linux
Systems.
OmniVision Technologies
OmniVision not only develops CMOS Image Sensors, but also support device ICs such as
the OV-511 & OV-518 Advanced Camera to USB Bridge. OmniVision is one of the more
popular manufacturers with devices such as the OV7910 NTSC/PAL Camera on a Chip
being used in many small analog camera modules around the world. This would be the
recommended starting point if you are starting out designing with CMOS Image Sensors.
OV9620
OV8610
OV7640
OV7620
OV6630
up to 60 fps
LCC-48 Package
DIY Electronics (http://www.kitsrus.com) are just one outlet which sells the third party
evaluation boards.
1/3" B/W Camera VGA Module M3188 with Digital Output (OV7110 Sensor)
1/3" Colour Camera VGA Module C3188 with Digital Output (OV7610 Sensor)
Kodak
In August 2001 Kodak launched it's first two CMOS Images to its Kodak Digital Science
range of image sensors. Kodak has been in the game of CCD Sensors for twenty plus years
with a wealth of imaging expertise and research.
KAC-0311
KAC-1310
Mitsubishi Chips
Mitsubishi have broken the pack, to produce smaller resolution sensors. These sensors can
typically be used for a range of applications such as finger print sensing, motor detection,
gaming, tracing of moving parts etc. Just one application is the new optical mice flooding the
market place. They use a low resolution Image Sensor to track movement on a wide variety
of surfaces.
Also unique to these sensors is in-built image processing. Both sensors can output edge
enhanced or extracted data, making them ideal for tracking on small robots, industrial control
etc. The sensors can also process 2D images into 1D. The output of each pixel is by the
means of a analog potential, thus this must be fed into an ADC to return digital image data.
Micron
Micron Imaging has aquired Photobit Corporation and inherited its IP and Image Sensors.
CMOS APS (CMOS active pixel sensor) was first created by a team of JPL engineers lead
by Dr Eric Fossum. Dr Fossum is now Fellow at Micron Tecnology Inc. Micron's Product
range can be sought from Micron's Product Matrix
MI-0111
MI-0330
Spectronix have used the ST Sensors in their RoboCam Series. ST also offer a couple of
CoProcessors, a STV0657 Digital CoProcessor, a STV0672 USB CoProcessor and a
STV0680 DSC (Digital Still Camera) CoProcessor. The DSC CoProcessor offers an RS-
232 / USB Interface and on board SDRAM Storage.
VV5301/VV6301
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
USB in a NutShell
Making sense of the USB standard
Starting out new with USB can be quite daunting. With the USB 2.0 specification at
650 pages one could easily be put off just by the sheer size of the standard. This is
only the beginning of a long list of associated standards for USB. There are USB
Class Standards such as the HID Class Specification which details the common
operation of devices (keyboards, mice etc) falling under the HID (Human Interface
Devices) Class - only another 97 pages. If you are designing a USB Host, then you
have three Host Controller Interface Standards to choose from. None of these are
detailed in the USB 2.0 Spec.
The good news is you dont even need to bother reading the entire USB standard.
Some chapters were churned out by marketing, others aimed at the lower link layer
normally taken care off by your USB controller IC and a couple aimed at host and hub
developers. Lets take a little journey through the various chapters of the USB 2.0
specification and briefly introduce the key points.
So now we can begin to read the parts of the standard relevant to our needs. If you
develop drivers (Software) for USB peripherals then you may only need to read
chapters,
4 - Architectural Overview
5 - USB Data Flow Model
9 - USB Device Frame Work, and
10 - USB Host Hardware and Software.
Peripheral hardware (Electronics) designers on the other hand may only need to read
chapters,
4 - Architectural Overview
5 - USB Data Flow Model
6 - Mechanical, and
7 - Electrical.
Now lets face it, (1) most of us are here to develop USB peripherals and (2) it's
common to read a standard and still have no idea how to implement a device. So in
the next 7 chapters we focus on the relevant parts needed to develop a USB device.
This allows you to grab a grasp of USB and its issues allowing you to further research
the issues specific to your application.
The USB 1.1 standard was complex enough before High Speed was thrown into USB
2.0. In order to help understand the fundamental principals behind USB, we omit many
areas specific to High Speed devices.
USB version 1.1 supported two speeds, a full speed mode of 12Mbits/s and a low
speed mode of 1.5Mbits/s. The 1.5Mbits/s mode is slower and less susceptible to EMI,
thus reducing the cost of ferrite beads and quality components. For example, crystals
can be replaced by cheaper resonators. USB 2.0 which is still yet to see day light on
mainstream desktop computers has upped the stakes to 480Mbits/s. The 480Mbits/s
is known as High Speed mode and was a tack on to compete with the Firewire Serial
Bus.
USB Speeds
High Speed - 480Mbits/s
The Universal Serial Bus is host controlled. There can only be one host per bus. The
specification in itself, does not support any form of multimaster arrangement. However
the On-The-Go specification which is a tack on standard to USB 2.0 has introduced a
Host Negotiation Protocol which allows two devices negotiate for the role of host. This
is aimed at and limited to single point to point connections such as a mobile phone
and personal organiser and not multiple hub, multiple device desktop configurations.
The USB host is responsible for undertaking all transactions and scheduling
bandwidth. Data can be sent by various transaction methods using a token-based
protocol.
In my view the bus topology of USB is somewhat limiting. One of the original intentions
of USB was to reduce the amount of cabling at the back of your PC. Apple people will
say the idea came from the Apple Desktop Bus, where both the keyboard, mouse and
some other peripherals could be connected together (daisy chained) using the one
cable.
However USB uses a tiered star topology, simular to that of 10BaseT Ethernet. This
imposes the use of a hub somewhere, which adds to greater expense, more boxes on
your desktop and more cables. However it is not as bad as it may seem. Many devices
have USB hubs integrated into them. For example, your keyboard may contain a hub
which is connected to your computer. Your mouse and other devices such as your
digital camera can be plugged easily into the back of your keyboard. Monitors are just
another peripheral on a long list which commonly have in-built hubs.
This tiered star topology, rather than simply daisy chaining devices together has some
benefits. Firstly power to each device can be monitored and even switched off if an
overcurrent condition occurs without disrupting other USB devices. Both high, full and
low speed devices can be supported, with the hub filtering out high speed and full
speed transactions so lower speed devices do not receive them.
Up to 127 devices can be connected to any one USB bus at any one given time. Need
more devices? - simply add another port/host. While most earlier USB hosts had two
ports, most manufacturers have seen this as limiting and are starting to introduce 4
and 5 port host cards with an internal port for hard disks etc. The early hosts had one
USB controller and thus both ports shared the same available USB bandwidth. As
bandwidth requirements grew, we are starting to see multi-port cards with two or more
controllers allowing individual channels.
The USB host controllers have their own specifications. With USB 1.1, there were two
Host Controller Interface Specifications, UHCI (Universal Host Controller Interface)
developed by Intel which puts more of the burden on software (Microsoft) and allowing
for cheaper hardware and the OHCI (Open Host Controller Interface) developed by
Compaq, Microsoft and National Semiconductor which places more of the burden on
hardware(Intel) and makes for simpler software. Typical hardware / software engineer
relationship. . .
With the introduction of USB 2.0 a new Host Controller Interface Specification was
needed to describe the register level details specific to USB 2.0. The EHCI (Enhanced
Host Controller Interface) was born. Significant Contributors include Intel, Compaq,
NEC, Lucent and Microsoft so it would hopefully seem they have pooled together to
provide us one interface standard and thus only one new driver to implement in our
operating systems. Its about time.
USB as its name would suggest is a serial bus. It uses 4 shielded wires of which two
are power (+5v & GND). The remaining two are twisted pair differential data signals. It
uses a NRZI (Non Return to Zero Invert) encoding scheme to send data with a sync
field to synchronise the host and receiver clocks.
USB supports plugnplug with dynamically loadable and unloadable drivers. The user
simply plugs the device into the bus. The host will detect this addition, interrogate the
newly inserted device and load the appropriate driver all in the time it takes the
hourglass to blink on your screen provided a driver is installed for your device. The
end user needs not worry about terminations, terms such as IRQs and port addresses,
or rebooting the computer. Once the user is finished, they can simply lug the cable
out, the host will detect its absence and automatically unload the driver.
The loading of the appropriate driver is done using a PID/VID (Product ID/Vendor ID)
combination. The VID is supplied by the USB Implementor's forum at a cost and this is
seen as another sticking point for USB. The latest info on fees can be found on the
USB Implementors Website
Other standards organisations provide a extra VID for non-commercial activities such
as teaching, research or fiddling (The Hobbyist). The USB Implementors forum has yet
to provide this service. In these cases you may wish to use one assigned to your
development system's manufacturer. For example most chip manufacturers will have a
VID/PID combination you can use for your chips which is known not to exist as a
commercial device. Other chip manufacturers can even sell you a PID to use with their
VID for your commercial device.
Another more notable feature of USB, is its transfer modes. USB supports Control,
Interrupt, Bulk and Isochronous transfers. While we will look at the other transfer
modes later, Isochronous allows a device to reserve a defined about of bandwidth with
guaranteed latency. This is ideal in Audio or Video applications where congestion may
cause loss of data or frames to drop. Each transfer mode provides the designer trade-
offs in areas such as error detection and recovery, guaranteed latency and bandwidth.
Connectors
Electrical
Speed Identification
Power (Vbus)
Suspend Current
Data Signalling Rate
Comments and Feedback?
Comments :
Email
Address : (Optional) Send
Copyright 2001-2007 Craig Peacock, 6th April 2007.
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
USB in a NutShell
Making Sense of the USB Standard
Enumeration
Enumeration is the process of determining what device has just been connected to the bus and what parameters it
requires such as power consumption, number and type of endpoint(s), class of product etc. The host will then
assign the device an address and enable a configuration allowing the device to transfer data on the bus. A fairly
generic enumeration process is detailed in section 9.1.2 of the USB specification. However when writing USB
firmware for the first time, it is handy to know exactly how the host responds during enumeration, rather than the
general enumeration process detailed in the specification.
1. The host or hub detects the connection of a new device via the device's pull up resistors on the data pair.
The host waits for at least 100ms allowing for the plug to be inserted fully and for power to stabilise on the
device.
2. Host issues a reset placing the device is the default state. The device may now respond to the default
address zero.
3. The MS Windows host asks for the first 64 bytes of the Device Descriptor.
4. After receiving the first 8 bytes of the Device Descriptor, it immediately issues another bus reset.
5. The host now issues a Set Address command, placing the device in the addressed state.
6. The host asks for the entire 18 bytes of the Device Descriptor.
7. It then asks for 9 bytes of the Configuration Descriptor to determine the overall size.
At the end of Step 9, Windows will ask for a driver for your device. It is then common to see it request all the
descriptors again before it issues a Set Configuration request.
The above enumeration process is common to Windows 2000, Windows XP and Windows 98 SE.
Step 4 often confuses people writing firmware for the first time. The Host asks for the first 64 bytes of the device
descriptor, so when the host resets your device after it receives the first 8 bytes, it is only natural to think there is
something wrong with your device descriptor or how your firmware handles the request. However as many will tell
you, if you keep persisting by implementing the Set Address Command it will pay off by asking for a full 18 bytes of
device descriptor next.
Normally when something is wrong with a descriptor or how it is being sent, the host will attempt to read it three
times with long pauses in between requests. After the third attempt, the host gives up reporting an error with your
device.
We start our examples with a Philip's PDIUSBD11 I2C Serial USB Device connected to a MicroChip PIC16F876
(shown) or a Microchip PIC16F877 (Larger 40 Pin Device). While Microchip has got two low speed USB
PIC16C745 and PIC16C765 devices out now, they are only OTP without In-Circuit Debugging (ICD) support which
doesn't help with the development flow too well. They do have four new full speed flash devices with (ICD) support
coming. In the mean time the Philips PDIUSBD11 connected to the PIC16F876 which gives the advantage of
Flash and In-Circuit Debugging.
A schematic of the required hardware is shown above. The example enumerates and allows analog voltages to be
read from the five multiplexed ADC inputs on the PIC16F876 MCU. The code is compatible with the PIC16F877
allowing a maximum of 8 Analog Channels. A LED connected on port pin RB3 lights when the device is
configured. A 3.3V regulator is not pictured, but is required for the PDIUSBD11. If you are running the example
circuit from an external power supply, then you can use a garden variety 78L033 3.3V voltage regulator, however if
you wish to run the device as a Bus Powered USB device then a low dropout regulator needs to be sought.
Debugging can be done by connecting TXD (Pin 17) to a RS-232 Line Driver and fed into a PC at 115,200bps.
Printf statements have been included which display the progress of enumeration.
The code has been written in C and compiled with the Hi-Tech PICC Compiler. They have a demo version (7.86
PL4) of the PICC for download which works for 30 days. A pre-compiled .HEX file has be included in the archive
which has been compiled for use with (or without) the ICD.
#include <pic.h>
#include <stdio.h>
#include <string.h>
#include "usbfull.h"
0, /* bDeviceClass */
0, /* bDeviceSubclass */
0, /* bDeviceProtocol */
8, /* bMaxPacketSize 8 Bytes */
0x04B4, /* idVendor (Cypress Semi) */
0x0002, /* idProduct (USB Thermometer Example) */
0x0000, /* bcdDevice */
1, /* iManufacturer String Index */
0, /* iProduct String Index */
0, /* iSerialNumber String Index */
1 /* bNumberConfigurations */
};
The structures are all defined in the header file. We have based this example on the Cypress USB Thermometer
example so you can use our USB Driver for the Cypress USB Starter Kit. A new generic driver is being written to
support this and other examples which will be available soon. Only one string is provided to display the
manufacturer. This gives enough information about how to implement string descriptors without filling up the entire
device with code. A description of the Device Descriptor and its fields can be found here.
A description of the Configuration Descriptor and its fields can be found here. We provide two endpoint descriptors
on top of the default pipe. EP1 OUT is an 8 byte maximum Bulk OUT Endpoint and EP1 IN is an 8 byte max Bulk
IN Endpoint. Our example reads data from the Bulk OUT endpoint and places it in an 80 byte circular buffer.
Sending an IN packet to EP1 reads 8 byte chunks from this circular buffer.
A Zero Index String Descriptor is provided to support the LANGID requirements of USB String Descriptors. This
indicates all descriptors are in US English. The Manufacturer Descriptor can be a little deceiving as the size of the
char array is fixed in the header and is not dynamic.
#define MAX_BUFFER_SIZE 80
#define PROGRESS_IDLE 0
#define PROGRESS_ADDRESS 3
InitUART();
printf("Initialising\n\r");
I2C_Init();
USB_Init();
printf("PDIUSBD11 Ready for connection\n\r");
while(1)
if (!RB0) D11GetIRQ(); /* If IRQ is Low, PDIUSBD11 has an Interrupt
Condition */
The main function is example dependent. It's responsible for initialising the direction of the I/O Ports, initialising the
I2C interface, Analog to Digital Converters and PDIUSBD11. Once everything is configured it keeps calling
D11GetIRQ which processes PDIUSBD11 Interrupt Requests.
void USB_Init(void)
{
unsigned char Buffer[2];
The USB Init function initialises the PDIUSBD11. This initialisation procedure has been omitted from the Philips
PDIUSBD11 datasheet but is available from their FAQ. The last command enables the soft-connect pull up resistor
on D+ indicating it is a full speed device but also advertises its presence on the universal serial bus.
void D11GetIRQ(void)
{
unsigned short Irq;
unsigned char Buffer[1];
Main() keeps calling the D11GetIRQ in a loop. This function reads the PDIUSBD11's Interrupt Register to establish
if any interrupts are pending. If this is the case it will act upon them, otherwise it will continue to loop. Other USB
devices may have a series of interrupt vectors assigned to each endpoint. In this case each ISR will service the
appropriate interrupt removing the if statements.
The If statements work down in order of priority. The highest priority interrupt is the bus reset. This simply calls
USB_Init which re-initialises the USB function. The next highest priority is the default pipe consisting of EP0 OUT
and EP1 IN. This is where all the enumeration and control requests are sent. We branch to another function to
handle the EP0_OUT requests.
When a request is made by the host and it wants to receive data, the PIC16F876 will send the PDIUSBD11 a 8
byte packet. As the USbus is host controlled it cannot write the data when ever it desires, so the PDIUSBD11
buffers the data and waits for an IN Token to be sent from the host. When the PDIUSBD11 receives the IN Token
it generates an interrupt. This makes a good time to reload the next packet of data to send. This is done by an
additional function WriteBufferToEndpoint();
The section under CtlTransferInProgress == PROGRESS_ADDRESS handles the setting of the device's address.
We detail this later.
EP1 OUT and EP1 IN are implemented to read and write bulk data to or from a circular buffer. This setup allows
the code to be used in conjunction with the BulkUSB example in the Windows DDK's. The circular buffer is defined
earlier in the code as being 80 bytes long taking up all of bank1 of the PIC16F876's RAM.
Endpoints two and three are not used at the moment, so we stall them if any data is received. The PDIUSBD11
has a Set Endpoint Enable Command which can be used to enable or disable function generic endpoints (any
endpoints other than the default control pipe). We could use this command to diable the generic endpoints, if we
were planning on not using these later. However at the moment this code provides a foundation to build upon.
void Process_EP0_OUT_Interrupt(void)
{
unsigned long a;
unsigned char Buffer[2];
USB_SETUP_REQUEST SetupPacket;
The first thing we must do is determine is the packet we have received on EP0 Out is a data packet or a Setup
Packet. A Setup Packet contains a request such as Get Descriptor where as a data packet contains data for a
previous request. We are lucky that most requests do not send data packets from the host to the device. A request
that does is SET_DESCRIPTOR but is rarely implemented.
/* Parse bmRequestType */
switch (SetupPacket.bmRequestType & 0x7F) {
As we have seen in our description of Control Transfers, a setup packet cannot be NAKed or STALLed. When the
PDIUSBD11 receives a Setup Packet it flushes the EP0 IN buffer and disables the Validate Buffer and Clear
Buffer commands. This ensures the setup packet is acknowledged by the microcontroller by sending an
Acknowledge Setup command to both EP0 IN and EP0 OUT before a Validate or Clear Buffer command is
effective. The recept of a setup packet will also un-stall a STALLed control endpoint.
Once the packet has been read into memory and the setup packet acknowledged, we being the parse the request
starting with the request type. At the moment we are not interesting in the direction, so we AND off this bit. The
three requests all devices must process is the Standard Device Request, Standard Interface Request and
Standard Endpoint Requests. We provide our functionality (Read Analog Inputs) by the Vendor Request, so we
add a case statement for Standard Vendor Requests. If your device supports a USB Class Specification, then you
may also need to add cases for Class Device Request, Class Interface Request and/or Class Endpoint Request.
case STANDARD_DEVICE_REQUEST:
printf("Standard Device Request ");
switch (SetupPacket.bRequest) {
case GET_STATUS:
/* Get Status Request to Device should return */
/* Remote Wakeup and Self Powered Status */
Buffer[0] = 0x01;
Buffer[1] = 0x00;
D11WriteEndpoint(D11_ENDPOINT_EP0_IN, Buffer, 2);
break;
case CLEAR_FEATURE:
case SET_FEATURE:
/* We don't support DEVICE_REMOTE_WAKEUP or TEST_MODE */
ErrorStallControlEndPoint();
break;
The Get Status request is used to report the status of the device in terms of if the device is bus or self powered
and if it supports remote wakeup. In our device we report it as self powered and as not supporting remote wakeup.
Of the Device Feature requests, this device doesn't support DEVICE_REMOTE_WAKEUP nor TEST_MODE and
return a USB Request Error as a result.
case SET_ADDRESS:
printf("Set Address\n\r");
DeviceAddress = SetupPacket.wValue | 0x80;
D11WriteEndpoint(D11_ENDPOINT_EP0_IN, NULL, 0);
CtlTransferInProgress = PROGRESS_ADDRESS;
break;
The Set Address command is the only command that continues to be processed after the status stage. All other
commands must finish processing before the status stage. The device address is read and OR'ed with 0x80 and
stored in a variable DeviceAddress. The OR'ing with 0x80 is specific to the PDIUSBD11 with the most significant
bit indicating if the device is enabled or not. A zero length packet is returned as status to the host indicating the
command is complete. However the host must send an IN Token, retrieve the zero length packet and issue an
ACK before we can change the address. Otherwise the device may never see the IN token being sent on the
default address.
The completion of the status stage is signalled by an interrupt on EP0 IN. In order to differentiate between a set
address response and a normal EP0_IN interrupt we set a variable, CtlTransferInProgress to
PROGRESS_ADDRESS. In the EP0 IN handler a check is made of CtlTransferInProgress. If it equals
PROGRESS_ADDRESS then the Set Address Enable command is issued to the PDIUSBD11 and
CtlTransferInProgress is set to PROGRESS_IDLE. The host gives 2ms for the device to change its address before
the next command is sent.
case GET_DESCRIPTOR:
GetDescriptor(&SetupPacket);
break;
case GET_CONFIGURATION:
D11WriteEndpoint(D11_ENDPOINT_EP0_IN, &DeviceConfigured, 1);
break;
case SET_CONFIGURATION:
printf("Set Configuration\n\r");
DeviceConfigured = SetupPacket.wValue & 0xFF;
D11WriteEndpoint(D11_ENDPOINT_EP0_IN, NULL, 0);
if (DeviceConfigured) {
RB3 = 0;
printf("\n\r *** Device Configured *** \n\r");
}
else {
RB3 = 1; /* Device Not Configured */
printf("\n\r ** Device Not Configured *** \n\r");
}
break;
//case SET_DESCRIPTOR:
default:
/* Unsupported - Request Error - Stall */
ErrorStallControlEndPoint();
break;
}
break;
The Get Configuration and Set Configuration is used to "enable" the USB device allowing data to be transferred on
endpoints other than endpoint zero. Set Configuration should be issued with wValue equal to that of a
bConfigurationValue of the configuration you want to enable. In our case we only have one configuration,
configuration 1. A zero configuration value means the device is not configured while a non-zero configuration value
indicates the device is configured. The code does not fully type check the configuration value, it only copies it into
a local storage variable, DeviceConfigured. If the value in wValue does not match the bConfigurationValue of a
Configuration, it should return with a USB Request Error.
case STANDARD_INTERFACE_REQUEST:
printf("Standard Interface Request\n\r");
switch (SetupPacket.bRequest) {
case GET_STATUS:
/* Get Status Request to Interface should return */
case SET_INTERFACE:
/* Device Only supports default setting, Stall may be */
/* returned in the status stage of the request */
if (SetupPacket.wIndex == 0 && SetupPacket.wValue == 0)
/* Interface Zero, Alternative Setting = 0 */
D11WriteEndpoint(D11_ENDPOINT_EP0_IN, NULL, 0);
else ErrorStallControlEndPoint();
break;
case GET_INTERFACE:
if (SetupPacket.wIndex == 0) { /* Interface Zero */
Buffer[0] = 0; /* Alternative Setting */
D11WriteEndpoint(D11_ENDPOINT_EP0_IN, Buffer, 1);
break;
} /* else fall through as RequestError */
//case CLEAR_FEATURE:
//case SET_FEATURE:
/* Interface has no defined features. Return RequestError */
default:
ErrorStallControlEndPoint();
break;
}
break;
Of the Standard Interface Requests, none perform any real function. The Get Status request must return a word of
zero and is reserved for future use. The Set Interface and Get Interface requests are used with alternative
Interface Descriptors. We have not defined any alternative Interface Descriptors so Get Interface returns zero and
any request to Set an interface other than to set interface zero with an alternative setting of zero is processed with
a Request Error.
case STANDARD_ENDPOINT_REQUEST:
printf("Standard Endpoint Request\n\r");
switch (SetupPacket.bRequest) {
case CLEAR_FEATURE:
case SET_FEATURE:
/* Halt(Stall) feature required to be implemented on all
Interrupt and */
/* Bulk Endpoints. It is not required nor recommended on the
Default Pipe */
if (SetupPacket.wValue == ENDPOINT_HALT)
{
if (SetupPacket.bRequest == CLEAR_FEATURE) Buffer[0] =
0x00;
else Buffer[0] =
0x01;
switch (SetupPacket.wIndex & 0xFF) {
case 0x01 : D11CmdDataWrite(D11_SET_ENDPOINT_STATUS
+ \
The Set Feature and Clear Feature requests are used to set endpoint specific features. The standard defines one
endpoint feature selector, ENDPOINT_HALT. We check what endpoint the request is directed to and set/clear the
STALL bit accordingly. This HALT feature is not required on the default endpoints.
case GET_STATUS:
/* Get Status Request to Endpoint should return */
/* Halt Status in D0 for Interrupt and Bulk */
switch (SetupPacket.wIndex & 0xFF) {
case 0x01 : D11CmdDataRead(D11_READ_ENDPOINT_STATUS + \
D11_ENDPOINT_EP1_OUT, Buffer, 1);
break;
case 0x81 : D11CmdDataRead(D11_READ_ENDPOINT_STATUS + \
D11_ENDPOINT_EP1_IN, Buffer, 1);
break;
case 0x02 : D11CmdDataRead(D11_READ_ENDPOINT_STATUS + \
D11_ENDPOINT_EP2_OUT, Buffer, 1);
break;
case 0x82 : D11CmdDataRead(D11_READ_ENDPOINT_STATUS + \
D11_ENDPOINT_EP2_IN, Buffer, 1);
break;
case 0x03 : D11CmdDataRead(D11_READ_ENDPOINT_STATUS + \
D11_ENDPOINT_EP3_OUT, Buffer, 1);
break;
case 0x83 : D11CmdDataRead(D11_READ_ENDPOINT_STATUS + \
D11_ENDPOINT_EP3_IN, Buffer, 1);
break;
default : /* Invalid Endpoint - RequestError */
ErrorStallControlEndPoint();
break;
}
if (Buffer[0] & 0x08) Buffer[0] = 0x01;
else Buffer[0] = 0x00;
Buffer[1] = 0x00;
D11WriteEndpoint(D11_ENDPOINT_EP0_IN, Buffer, 2);
break;
default:
/* Unsupported - Request Error - Stall */
ErrorStallControlEndPoint();
break;
}
break;
The Get Status request when directed to the endpoint returns the status of the endpoint, ie. if it is halted or not.
Like the Set/Clear feature request ENDPOINT_HALT, we only need to report the status of the generic endpoints.
Any undefined Standard Endpoint Requests are handled by USB Request Error.
case VENDOR_DEVICE_REQUEST:
case VENDOR_ENDPOINT_REQUEST:
printf("Vendor Device bRequest = 0x%X, wValue = 0x%X, wIndex = 0x%X\n
\r", \
SetupPacket.bRequest, SetupPacket.wValue, SetupPacket.wIndex);
switch (SetupPacket.bRequest) {
case VENDOR_GET_ANALOG_VALUE:
printf("Get Analog Value, Channel %x :",SetupPacket.wIndex &
0x07);
ADCON0 = 0xC1 | (SetupPacket.wIndex & 0x07) << 3;
/* Wait Acquistion time of Sample and Hold */
for (a = 0; a <= 255; a++);
ADGO = 1;
while(ADGO);
Buffer[0] = ADRESL;
Buffer[1] = ADRESH;
a = (Buffer[1] << 8) + Buffer[0];
a = (a * 500) / 1024;
printf(" Value = %d.%02d\n\r",(unsigned int)a/100,(unsigned
int)a%100);
D11WriteEndpoint(D11_ENDPOINT_EP0_IN, Buffer, 2);
break;
Now comes the functional parts of the USB device. The Vendor Requests can be dreamed up by the designer. We
have dreamed up two requests, VENDOR_GET_ANALOG_VALUE and VENDOR_SET_RB_HIGH_NIBBLE.
VENDOR_GET_ANALOG_VALUE reads the 10-bit Analog Value on Channel x dictated by wIndex. This is ANDed
with 0x07 to allow 8 possible channels, supporting the larger PIC16F877 if required. The analog value is returned
in a two byte data packet.
case VENDOR_SET_RB_HIGH_NIBBLE:
printf("Write High Nibble of PORTB\n\r");
PORTB = (PORTB & 0x0F) | (SetupPacket.wIndex & 0xF0);
D11WriteEndpoint(D11_ENDPOINT_EP0_IN, NULL, 0);
break;
default:
ErrorStallControlEndPoint();
break;
}
break;
The VENDOR_SET_RB_HIGH_NIBBLE can be used to set the high nibble bits of PORTB[3:7].
default:
printf("UnSupported Request Type 0x%X\n\r",SetupPacket.
bmRequestType);
ErrorStallControlEndPoint();
break;
}
} else {
printf("Data Packet?\n\r");
/* This is a Data Packet */
}
}
Any unsupported request types such as class device request, class interface request etc is dealt with by a USB
Request Error.
case TYPE_DEVICE_DESCRIPTOR:
printf("\n\rDevice Descriptor: Bytes Asked For %d, Size of Descriptor %d
\n\r", \
SetupPacket->wLength,DeviceDescriptor.bLength);
pSendBuffer = (const unsigned char *)&DeviceDescriptor;
BytesToSend = DeviceDescriptor.bLength;
if (BytesToSend > SetupPacket->wLength)
BytesToSend = SetupPacket->wLength;
WriteBufferToEndPoint();
break;
case TYPE_CONFIGURATION_DESCRIPTOR:
printf("\n\rConfiguration Descriptor: Bytes Asked For %d, Size of
Descriptor %d\n\r", \
SetupPacket->wLength, sizeof(ConfigurationDescriptor));
pSendBuffer = (const unsigned char *)&ConfigurationDescriptor;
BytesToSend = sizeof(ConfigurationDescriptor);
if (BytesToSend > SetupPacket->wLength)
BytesToSend = SetupPacket->wLength;
WriteBufferToEndPoint();
break;
The Get Descriptor requests involve responses greater than the 8 byte maximum packet size limit of the endpoint.
Therefore they must be broken up into 8 byte chunks. Both the Device and Configuration requests load the
address of the relevant descriptors into pSendBuffer and sets the BytesToSend to the length of the descriptor. The
request will also specify a descriptor length in wLength specifying the maximum data to send. In each case we
check the actual length against that of what the host has asked for and trim the size if required. Then we call
WriteBuffertoEndpoint which loads the first 8 bytes into the endpoint buffer and increment the pointer ready for the
next 8 byte packet.
case TYPE_STRING_DESCRIPTOR:
printf("\n\rString Descriptor: LANGID = 0x%04x, Index %d\n\r", \
SetupPacket->wIndex, SetupPacket->wValue & 0xFF);
switch (SetupPacket->wValue & 0xFF){
If any string descriptors are included, there must be a string descriptor zero present which details what languages
are supported by the device. Any non zero string requests have a LanguageID specified in wIndex telling what
language to support. In our case we cheat somewhat and ignore the value of wIndex (LANGID) returning the
string, no matter what language is asked for.
default:
ErrorStallControlEndPoint();
break;
}
}
void ErrorStallControlEndPoint(void)
{
unsigned char Buffer[] = { 0x01 };
/* 9.2.7 RequestError - return STALL PID in response to next DATA Stage
Transaction */
D11CmdDataWrite(D11_SET_ENDPOINT_STATUS + D11_ENDPOINT_EP0_IN, Buffer, 1);
/* or in the status stage of the message. */
D11CmdDataWrite(D11_SET_ENDPOINT_STATUS + D11_ENDPOINT_EP0_OUT, Buffer, 1);
}
When we are faced with an invalid request, invalid parameter or a request the device doesn't support, we must
report a request error. This is defined in 9.2.7 of the specification. A request error will return a STALL PID in
response to the next data stage transaction or in the status stage of the message. However it notes that to prevent
unnecessary bus traffic the error should be reported at the next data stage rather than waiting until the status
stage.
/* Select Endpoint */
D11CmdDataRead(Endpoint, &BufferStatus, 1);
/* Select Endpoint */
D11CmdDataRead(Endpoint, &BufferStatus, 1);
/* Write Header */
D11CmdDataWrite(D11_WRITE_BUFFER, D11Header, 2);
/* Write Packet */
if (Bytes) D11CmdDataWrite(D11_WRITE_BUFFER, Buffer, Bytes);
/* Validate Buffer */
D11CmdDataWrite(D11_VALIDATE_BUFFER, NULL, 0);
}
D11ReadEndpoint and D11WriteEndpoint are PDIUSBD11 specific functions. The PDIUSBD11 has two dummy
bytes prefixing any data read or write operation. The first byte is reserved, while the second byte indicates the
number of bytes received or to be transmitted. These two functions take care of this header.
void WriteBufferToEndPoint(void)
{
if (BytesToSend == 0) {
/* If BytesToSend is Zero and we get called again, assume buffer is smaller
*/
/* than Setup Request Size and indicate end by sending Zero Lenght packet */
D11WriteEndpoint(D11_ENDPOINT_EP0_IN, NULL, 0);
} else if (BytesToSend >= 8) {
/* Write another 8 Bytes to buffer and send */
D11WriteEndpoint(D11_ENDPOINT_EP0_IN, pSendBuffer, 8);
pSendBuffer += 8;
BytesToSend -= 8;
} else {
/* Buffer must have less than 8 bytes left */
D11WriteEndpoint(D11_ENDPOINT_EP0_IN, pSendBuffer, BytesToSend);
BytesToSend = 0;
}
}
As we have mentioned previously, WriteBufferToEndPoint is responsible for loading data into the PDIUSBD11 in 8
byte chunks and adjusting the pointers ready for the next packet. It is called once by the handler of a request to
load the first 8 bytes into the endpoint buffer. The host will then send an IN token, read this data and the
PDIUSBD11 will generate an interrupt. The EP0 IN handler will then call WriteBufferToEndpoint to load in the next
A transfer is considered complete if all requested bytes have been read, if a packet is received with a payload less
than bMaxPacketSize or if a zero length packet is returned. Therefore if the BytesToSend counter hits zero, we
assume the data to be sent was a multiple of 8 bytes and we send a zero length packet to indicate this is the last
of the data. However if we have less than 8 bytes left to send, we send only the remaining bytes. There is no need
to pad the data with zeros.
void loadfromcircularbuffer(void)
{
unsigned char Buffer[10];
unsigned char count;
if (Buffer[0] == 0){
// Buffer Empty
if (inpointer != outpointer){
// We have bytes to send
count = 0;
do {
Buffer[count++] = circularbuffer[outpointer++];
if (outpointer >= MAX_BUFFER_SIZE) outpointer = 0;
if (outpointer == inpointer) break; // No more data
} while (count < 8); // Maximum Buffer Size
// Now load it into EP1_In
D11WriteEndpoint(D11_ENDPOINT_EP1_IN, Buffer, count);
}
}
}
The loadfromcircularbuffer() routine handles the loading of data into the EP1 IN endpoint buffer. It is normally
called after an EP1 IN interrupt to reload the buffer ready for the next IN token on EP1. However in order to send
out first packet, we need to load the data prior to receiving the EP1 IN interrupt. Therefore the routine is also called
after data is received on EP1 OUT.
By also calling the routine from the handler for EP1 OUT, we are likely to overwrite data in the IN Buffer regardless
of whether it has been sent or not. To prevent this, we determine if the EP1 IN buffer is empty, before we attempt
to reload it with new data.
D11CmdDataWrite and D11CmdDataRead are two PDIUSBD11 specific functions which are responsible for
sending the I2C Address/Command first and then send or received data on the I2C Bus. Additional lower level
functions are included in the source code but have not been reproduced here as it is the intend to focus on the
This example can be used with the bulkUSB.sys example as part of the Windows DDK's. To load the bulkUSB.sys
driver either change the code to identify itself with a VID of 0x045E and a PID of 0x930A or change the bulkUSB.
inf file accompanying bulkUSB.sys to match the VID/PID combination you use in this example.
It is then possible to use the user mode console program, rwbulk.exe to send and receive packets from the circular
buffer. Use
rwbulk -r 80 -w 80 -c 1 -i 1 -o 0
to send 80 byte chunks of data to the PIC16F876. Using payloads greater than 80 bytes is going to overflow the
PIC's circular buffer in BANK1.
This example has been coded for readability at the expense of code size. It compiles in 3250 words of FLASH
(39% capacity of the PIC16F876).
Acknowledgments
A special acknowledgment must go to Michael DeVault of DeVaSys Embedded Systems. This example has been based
upon code written by Michael and been effortlessly developed on the USBLPT-PD11 DeVaSys USB development board
before being ported to the PIC.
Revision History
6th April 2002 - Version 1.2 - Increased I2C speed to match that of comment. Improved PDIUSBD11
IRQ Handling
7th January 2002 - Version 1.1 - Added EP1 IN and EP1 OUT Bulk handler routines and made
descriptors load from FLASH
31st December 2001 - Version 1.0.
Comments :
Email Address : Send
(Optional)
Copyright 2001-2007 Craig Peacock, 6th April 2007.
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Cypress Semiconductor
This range starts with the Cypress M8 Series which is predominantly low speed
1.5Mbps controllers for low speed devices such as mice and keyboards. They
have added two full speed devices to the M8 range, the CY7C64013 and the
CY7C64113. More recently they have added a enCoRe range to their books.
CY7C63001
Should you wish to extend to higher speed devices, Cypresss High Speed USB
MCUs requires specialised programmers and development tools that come at
great cost. Cypress is a good start, should your company desire to sink a bit of
money for some nice toys.
Cypress Semiconductor brought out Anchor Chip's EzUSB Series. Anchor had
taken initiative in the USB market with some smart features. One of these was
it's Re-numeration(TM) which allows it's processor to operate without ROM,
EPROM or FLASH. It does this by automatically enumerating without firmware
as a "Default Anchor Device". This then allows you to download 8051 code to
the processor, then renumerate with your newly downloaded code. This is not
only a sought after feature during development, but can also be used in the field
as a means of a re-configurable device or having the ability to download the
code each time the device is used to ensure the firmware is up to date.
Extending on this, EzUSB also has the ability to do enumeration in silicon, thus
making your coding of the enumeration process a breeze.
Cypress has enhanced the EzUSB series, bringing out the EZ-USB FX Series.
(They have re-introduced the CY7C64xxx part number of course).
Microchip
Microchip has been late to enter the market with their USB Microcontrollers.
Based on their popular PIC16x series devices, these USB controllers use
traditional windowed devices for development rather than Flash which is
common among the newer PIC Micro's. Being a low speed device, you would
have to look closely at their feasibility as they don't support Bulk nor
PIC16C745
8k Program Memory
Low Speed 1Mbps USB Device with 6 Endpoints
Five 8 Bit ADC Channels
Universal Synchronous Asynchronous Receiver Transmitter
(USART/SCI)
28 Pin UV erasable CERDIP / One Time Programmable Plastic
PIC16C765
8k Program Memory
Low Speed 1Mbps USB Device with 6 Endpoints
Eight 8 Bit ADC Channels
Universal Synchronous Asynchronous Receiver Transmitter
(USART/SCI)
40 Pin UV erasable CERDIP / One Time Programmable Plastic
Microchip have released details of their future products which is sure to keep
any Microchip follower happy. They are full speed flash devices with support for
the In-Circuit Debugger. While that may be enough to win the hearts of some, I
like the 18Fxxx architecture which means linear program and data memory.
Yes, no more paging!.
PIC18F2X50
Full Speed USB1.1 Device with 16 endpoints and a 512 byte dual
port buffer
Up to 12 MIPs operation. PLL Generates clock from 12MHz Crystal.
5 Channel 10-bit Analog-to-Digital Converter
PIC18F2450 16Kbyte Program Memory, 1kbyte Data Memory
PIC18F2550 32Kbyte Program Memory, 1kbyte Data Memory
Linear program memory addressing and Linear data memory
addressing
Pinout compatible with PIC16C745 (USB)
Synchronous Serial Port with SPI Master mode and I2C
Master/Slave mode
PIC18F4X50
Full Speed USB1.1 Device with 16 endpoints and a 512 byte dual
port buffer
Up to 12 MIPs operation. PLL Generates clock from 12MHz
Crystal.
8 Channel 10-bit Analog-to-Digital Converter
PIC18F4450 16Kbyte Program Memory, 1kbyte Data Memory
PIC18F4550 32Kbyte Program Memory, 1kbyte Data Memory
Linear program memory addressing and Linear data memory
addressing
Pinout compatible with PIC16C765 (USB)
Synchronous Serial Port with SPI Master mode and I2C
Master/Slave mode
In-Circuit Debug (ICD) via two pins
40 pin PDIP, SOIC, SSOP
Motorola
Motorola has had since 1997, the 68HC705JB2, a 20 pin Low Speed USB MCU
based on their popular HC05 Core. However since late 1997, Ive been trying to
source them. . . . Some distributors have a small quantity (5-10) of the OTP
parts, but this is not much good if you cant source a windowed device for
development. Too bad they are Obsolete now. I may try for some
68HC705JB3 / JB4's now . . .
Motorola have just recently extended their MCU range to include a JB3 & JB4.
These are again low speed devices coming in a 20 or 28 pin package. These
are prequalified parts and Motorola should start production of these ICs any
day now. (April/May 1999).
68HC705JB3
68HC705JB4
Philips Semiconductor
Philips has a nice alternative - A add on full speed USB Device. The problem
with low speed USB Devices, is the restriction of transfer modes. A full speed
device can use Isochronous, Control, Interrupt or Bulk transfer modes. A low
speed device is restricted to Control & Interrupt Modes. Therefore by Philip's
making their Serial USB Device Full Speed, even though the I2C interface is
limited to 1Mbps, the designer has the added flexibility of most transfer modes
(except Isochronous on the PDIUSBD11).
Other added advantages are - why waste time learning a new architecture?
With the USB Interface I.C.s you can use your existing designs, existing code
and existing development tools. All you need to do is modify the design to hang
the USB Device of the bus. What could be cheaper?
There are disadvantages to these devices, namely board real estate. You
wouldnt make a USB Mouse with these chips. However both come in surface
mount devices giving a very small footprint. They are also not intended for self
powered devices.
Philips also has a USB Transceiver Chip, the PDIUSBP11. This I.C. will convert
USB into a Digital CMOS Serial stream. Couple this with a FPGA or CPLD and
write your own Serial Interface Engine.
firmware.
Philips have released the ISP1161 - the world's first single-chip, integrated host
and device controller conforming to the USB Revision 1.1. It has been used by
Philips to demonstrate USB OTG functionallity, but also makes an excellent
host controller for embedded systems such as Linux. See our write-up of the On-
The-Go Supplement - Point-to-Point Connectivity for USB and further details of
this device.
single chip.
Can function as a USB Host only, USB Device Only or both
simultaneously.
Selectable one or two downstream ports for HC and one upstream
port for DC.
Supports single-cycle burst mode and multiple-cycle burst mode
DMA operations.
Built in separate FIFO buffer RAM for HC (4 kbytes) and DC (2462
bytes).
6 MHz crystal oscillator with integrated PLL for low EMI.
USB device functionally simular to the ISP1181.
USB Host Controller registers compatible to OpenHCI although
accessed though two memory map locations.
Available in a LQFP64 package.
If you wish to try these FTDI devices out before committing them to your design,
then you can get prebuilt prototyping modules from Elexol. These modules are
available in both serial and parallel interface versions. This makes them an ideal
USB add on solution for Microchip, AVR and other microprocessors. The serial
version gives you the flexibility of adding it to your existing asynchronous
comms port leaving the parallel I/O ports free or if you need speed, you can use
the USBMOD2 with a parallel interface capable of 1Mbyte/sec. The 32-pin
600mil IC socket profile allows them to be plugged into phototyping boards with
ease.
components required
Module powered from
DataSheet
Components
Provision for external
EEPROM for custom
USB enumeration data
Module powered from
USB bus with up to
50mA from USB for
user hardware
Click here for PDF
DataSheet
The I/O Warrior from Code Mercenaries is a quick and easy way to add USB to
your products without having to understand the USB specification or write
custom firmware and device drivers. Two programmed devices are available, a
24 pin version and a larger 40 pin version, both enumerating as a common HID
device. The unique feature of these devices is the built in support for various
industry standard protocols such as I2C, SPI, HD44780 Alphanumeric LCDs,
RC5 code IR remote controls, matrix scanning of keypads and driving of LEDs.
The manual also comes with details on how to drive relays, LEDs and opto-
isolating inputs and outputs.
IOWarrior 24
USB 1.1/2.0 Low Speed Compatible Device. Full USB HID 1.1
compliance.
16 general purpose I/O pins
IOWarrior 40
USB 1.1/2.0 Low Speed Compatible Device. Full USB HID 1.1
compliance.
32 general purpose I/O pins
Supports HD44780 compatible LCD modules.
Can read a key or switch matrix of 8x8 size.
Can drive LED matrix of 8x32 LEDs.
Software support for Mac, Linux, and Windows.
DIP40 or SSOP48 Package
I/O Warriors can be purchased in I.C. form for quick integration into your
designs. Code Mercenaries also has two development boards for quick
evaluation and phototyping.
National Semiconductor
National Semiconductor has the USBN960x series of USB devices which can
be connected up to your micro, just like the Philip's devices could. This gives
you the ability to make your existing microcontrollers talk USB without the need
for a new set of development tools or training in a new architecture. NatSemi
has combined both a serial and parallel interface version into the one I.C., which
makes sense when it comes to needing to stock only the one I.C. for all your
USB projects.
They also have an older USBN9602. The biggest problem with this part was its
48MHz Oscillator. The Philip's devices at the time used a PLL to generate the
48MHz internal Clock. The result, a cheap 6 or 12Mhz Crystal could be used
helping with the EMC compliance. This part is no longer recommended for new
designs.
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Under Windows NT, there are only two I/O privilege levels used, level 0 & level 3. Usermode programs will run in
privilege level 3, while device drivers and the kernel will run in privilege level 0, commonly referred to as ring 0. This
allows the trusted operating system and drivers running in kernel mode to access the ports, while preventing less
trusted usermode processes from touching the I/O ports and causing conflicts. All usermode programs should talk to
a device driver which arbitrates access.
The I/O permission bitmap can be used to allow programs not privileged enough (I.e. usermode programs) the ability
to access the I/O ports. When an I/O instruction is executed, the processor will first check if the task is privileged
enough to access the ports. Should this be the case, the I/O instruction will be executed. However if the task is not
allowed to do I/O, the processor will then check the I/O permission bitmap.
The I/O permission bitmap, as the name suggests uses a single bit to represent each I/O address. If the bit
corresponding to a port is set, then the instruction will generate an exception however if the bit is clear then the I/O
operation will proceed. This gives a means to allow certain processes to access certain ports. There is one I/O
permission bitmap per task.
There are two solutions to solving the problem of I/O access under Windows NT. The first solution is to write a device
driver which runs in ring 0 (I/O privilege level 0) to access your I/O ports on your behalf. Data can be passed to and
from your usermode program to the device driver via IOCTL calls. The driver can then execute your I/O instructions.
The problem with this, is that it assumes you have the source code to make such a change.
Another possible alternative is to modify the I/O permission bitmap to allow a particular task, access to certain I/O
ports. This grants your usermode program running in ring 3 to do unrestricted I/O operations on selected ports, per
the I/O permission bitmap. This method is not really recommended, but provides a means of allowing existing
applications to run under windows NT/2000. Writing a device driver to support your hardware is the preferred
method. The device driver should check for any contentions before accessing the port.
However, using a driver such as PortTalk can become quite inefficient. Each time an IOCTL call is made to read or
write a byte or word to a port, the processor must switch from ring 3 to ring 0 perform the operation, then switch
back. If your intentions were to write, for example a microcontroller programmer which is programmed serially using
a parallel port pin, it would make better sense to send a pointer to a buffer of x many bytes. The device driver would
then serialise the data and generate the handshake necessary in the programming of a PIC device.
The porttalk device driver comes complete with source code. It provides the facility to modify the IO permission
bitmap and/or write and read to I/O ports via IOCTL calls.
PortTalk can be used in conjunction with allowio to make existing programs that access the I/O ports work under
Windows NT/2000/XP. As you already know, any 32bit program will cause a Privileged Instruction Exception. Many
hacks have been produced for I/O port access under Windows 95 and 98 such as .DLL libraries. Should you need to
run such a program under Windows NT, an exception will occur. Try PortTalk.
16 Bit Windows and DOS programs will run on virtual machines. In many cases existing applications should be
transparent on Windows NT/2000/XP. However others just refuse to run. The virtual machines has support for
communication ports, video, mouse, and keyboard. Therefore any program using these common I/O ports should
run, however there is often a problem with timing. Other MS-DOS programs accessing specific hardware requires
VDDs (Virtual Device Drivers) written to enable them to be used with Windows NT.
The Virtual Machine will intercept I/O operations and send them to a I/O handler for processing. The way the Virtual
Machine does this, is by giving insufficient rights to I/O operations and creating an exception handler to dig back into
the stack, find the last instruction and decode it. By giving the VDM full rights to I/O ports, it has no means of
intercepting I/O operations, thus creating less problems with timing or the need to provide VDDs for obscurer
hardware.
In order to change a processes IOPM, we must first have the process ID for the process we want to grant access
too. This is accomplished by creating the process ourselves, so we can pass the ProcessID to our device driver. An
small application is used which accepts the program name as an argument. This application then creates the
process (i.e. executes the program) which starts and continues as another process in the system.
Note : We can also register a callback with the operating system which notifies our driver of any processes started
and what their ID is. We can then keep a directory of processes that we want to have access to certain ports. When
this process is executed, the callback informs the driver it has started and what it's process ID is. We could then
automatically change the IOPM of this process. See the Process Monitor driver at Process.zip
When a Windows 32 bit program is started using CreateProcess(), it will return the ProcessID for the 32 Bit Program.
This is passed to the Device Driver using an IOCTL Call.
DOS programs do not have their own ProcessID's. They run under the Windows NT Virtual DOS Machine (NTVDM.
EXE) which is a protected environment subsystem that emulates MS-DOS. When a DOS program is called using this
program, it will get the ProcessID for NTVDM.EXE and as a result changes NTVDM's IOPM.
However if NTVDM is already resident (if another DOS Program is running) it will return a process ID of zero. This
doesn't cause a problem if the NT Virtual DOS Machine's IOPM is already set to allow any IO operation, however if
the first DOS program was called from the command line without using "AllowIo", the NTVDM will not have the
modified IOPM.
Windows 3.1 programs will run using WOW (Windows on Win32). This is another protected subsystem that runs
within the NTVDM process. Running a Win3.1 program will return the ProcessID of NTVDM in accordance with the
problem set out above.
When the device driver has the ProcessID, it finds the pointer to process for our newly created program and sets the
IOPM to allow all I/O instructions. Once the ProcessID has been given to our PortTalk device driver, the allowio
programs finishes.
Running a DOS/Win 3.1 program normally under NTVDM.EXE should not create any major problems. NTVDM will
normally intercept most IO calls and check these resources against the registry to make sure they are not in use.
Should they be in use, a message box will pop as simular to the one shown here, giving the user the option to
terminate the program or ignore the error. If the user chooses to ignore the error, access will NOT be granted to the
offending I/O Port.
However using PortTalk to remove all I/O Protection will grant the application full rights to any port. As a result if it
wants to talk to your mouse on COM1, it will. Result - Your mouse freezes. Using this program should be done at the
discretion of the informed and educated user. If not, system instability will result. One solution to this problem is to be
C:\>allowio Test.exe /a
will grant test.exe exclusive access to all ports. However if you use,
this will grant test.exe access only to 0x378 to 0x37F. As one byte represents 8 port addresses and that most
devices will use a bank of 8 or 16 addresses, you need not specify every port address, only one port in the 8 byte
boundary. Thus 0x378 will grant test.exe access to LPT1, including the data, status and control registers.
In most cases, the PORTTALK.SYS driver isn't required to be explicitly installed. When running the usermode
executable such as allowio.exe, it will check for the device driver and if it cannot be opened, it will install and start the
driver for you. However for this to happen correctly, the PORTTALK.SYS driver must be in the same directory than
the usermode executable ran and the user must have administrator privileges. Once the driver has been installed for
the first time, any user with normal user privileges can access the device driver normally. This is ideal in classroom/
corporate environments where security is paramount.
The driver can also be installed manually using the registry file included. Copy the PORTTALK.SYS to your /
system32/drivers directory and click on the PORTTALK.REG file to load the required registry keys. Then reboot the
computer and on boot-up the PORTTALK.SYS driver will load and start automatically. This is recommended for
classroom/corporate use where the driver can be stored away securely in the system directory.
Two versions of the driver exist. The standard distribution is a free compiled version which has debugging
statements removed and thus execute faster. However when writing your own code, or debugging problems such as
buffer overuns, a checked version of the driver is provided which displays debugging. These debug messages can
be read with any good debug viewer. One such recommended viewer is the System Internals DebugView which can
be downloaded from their website (http://www.sysinternals.com) for free.
The checked build of the driver is provided in the checked folder of the distribution. Simply replace the PORTTALK.
SYS with this driver and reload to display debug information.
The code for the device driver has been compiled using Microsoft Visual C and the Windows 2000 DDK. The source
code is provided, but during the normal development cycle it is not required to be recompiled. It has also been built
for testing purposes on the Windows XP DDK which includes build tools and is no longer dependent on Microsoft
Visual C being installed. (Excellent for Borland Folks)
Changing the IOPM within your Kernel Mode Drivers requires the knowledge of a couple of undocumented calls.
These are Ke386IoSetAccessProcess, Ke386SetIoAccessMap and PsLookupProcessByProcessId.
The IOPM routines use a Pointer to Process and not the ProcessID. Therefore our first task is to convert the
ProcessID to a Pointer to Process. There are documented calls such as PsGetCurrentProcess(), however we don't
want the current process but rather the pointer to process of the process we wish to grant access to. This information
is passed to the driver in the form of a processID. We must then use the undocumented call
PsLookupProcessByProcessId to convert our ProcessID to a Pointer to Process.
Once we have a Pointer to Process we can start manipulating the I/O permission bitmap using the following
undocumented calls
Ke386SetIoAccessMap will copy the IOPM specified to the TSS. Ke386QueryIoAccessMap will read it from the TSS.
The IOPM is a 8192 byte array specifying which ports are allowed access and which ones aren't. Each address is
represented by one bit, thus the 8192 bytes will specify access up to 64K. Any zero bit will allow access, while a one
will deny access.
After the IOPM has been copied to the TSS, the IOPM offset pointer must be adjusted to point to our IOPM. This is
done using the Ke386IoSetAccessProcess. The int parameter must be set to 1 to enable it to be set. Calling the
function with zero will remove the pointer.
PortTalk also has IOCTLs to allow reading and writing to I/O Ports. In this case, your usermode program would open
the PortTalk device driver and pass data to the driver through IOCTL calls. The driver then talks to the I/O port(s) in
ring 0.
The Porttalk driver contains two IOCTL calls to read from and write to I/O Ports. A c source file, pt_iotcl.c can be
used to provide easy support based on the popular inportb/outportb and inp/outp calls supported in earlier
programming environments. By simply including pt_ioctl.c and calling OpenPortTalk when you program starts and
ClosePortTalk when your program finishes you can have the functionality of the inportb/outportb and inp/outp calls.
#include
#include
#include
ClosePortTalk();
}
The sample program above is included in the IoExample directory along with the pt_ioctl.c. The pt_ioctl can be used
as an example of how to load and open the driver and then make IOCTL_WRITE_PORT_UCHAR and
IOCTL_READ_PORT_UCHAR calls.
Revision History
6th April 2002 - Version 2.2.
13th January 2002 - Version 2.1, tested on Windows 2000 SP2 and Windows XP RTM.
Added uninstall.exe to deal with older V1.x versions of PortTalk.
12th January 2002 Version 2.0, tested on Windows 2000 SP2 and Windows XP RTM.
Self installs driver for ease of use.
Distributed with IoExample code showing use of inportb/outportb() inp/outp() macros and IOCTL
calls.
XP.
13th March 1999 Version 1.0 first public release for Windows NT4.
When installing PortTalk V2.x on machines with an older version of V1.x, the existing driver must be un-installed.
Simply run the uninstall.exe contained within the PortTalk package with administrator privileges. After the old driver
has been removed, running allowio.exe or IoExample.exe will detect the absence of PortTalk and re-install the new
driver.
Additionally, the driver can be removed manually. This is only recommended for advanced users. Either
Replace your old porttalk.sys with the new version and reboot.
Delete the HKEY_LOCAL_MACHINE\system\currentcontrolset\services\porttalk key and reboot.
Use the Windows NT Device Driver Installer to stop and remove the PortTalk Driver.
References
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
With the introduction of USB 2.0 a new Host Controller Interface Specification was
needed to describe the register level details specific to USB 2.0. The EHCI (Enhanced
Host Controller Interface) was born which at the time of writing is at revision 1.0.
Significant contributors include Intel, Compaq, NEC, Lucent and Microsoft so it would
hopefully seem they have pooled together to provide us one interface standard and
thus only one driver to implement in our operating systems.
Both XP and Windows 2000 USB 2.0 drivers should be available from the Windows
Update site. However if you don't have a USB 2.0 card installed, it will not appear on
the site (Windows Update searches your PCI bus for the VID/PIDs). Corporate IT Staff
or developers who wish to copy it to multiple computers may download the driver from
Corporate Windows Update site.
In the Linux camp, David Brownell and crew have been busy implementing EHCI.
Monday the 14th of January 2002 saw the release of the 2.5.2 linux kernel which has
USB 2.0 support built in. Once again Linux has support before Windows.
Philips Semiconductor
Philips semiconductor has two USB 2.0 compliant devices in development at the
present moment. One is a USB transceiver, while the other is a USB function device.
Philips have scared many off with their ISP1581. At one stage their
website indicated this was a discontinued product, however Wei Leong
Chui (Marketing Manager) from Philips Semiconductor advises us that this
isn't the case. In fact this part is all well and is now in production. Samples
are available from your local Philips distributor.
What makes this product neat over its competitors is the easy bus
interfacing and separate DMA / control buses. The ISP1581 has two
modes of operation, Generic Processor mode and Split Bus Mode. In
Generic Processor Mode it uses AD[7:0] as an address bus and DATA
[15:0] as a 16 bit data bus shared by both the processor and DMA. The
device has all the standard CS, ALE, R/W, RD, DS, WR pins so it can be
mapped into memory on both Intel and Motorola style buses. In Split bus
mode, the processor can control the device using AD[7..0] as a
multiplexed data/address bus and use the DMA bus as a totally separate
and independent bus to transfer data to and from the FIFOs.
Fully compliant with the USB Specification Rev. 2.0, with fall-back to
USB 1.1
High Speed DMA Interface block
14 programmable USB endpoints with 2 fixed control IN/OUT
endpoints
Integrated 8KB FIFO memory
Software controlled connection to the USB bus (SoftConnect)
Low Speed 12MHz External Crystal
3.3V device with 5 V tolerant I/O pads.
Suitable for a Bus Powered Designs with on board 3.3V Regulator.
Memory like interface for control - AD[0..7], CS, ALE, R/W, RD, DS,
WR.
Separate 16 Bit Data Bus and associated DMA Signalling.
Two types of Generic DMA transfer and three types of IDE-specified
transfer - Generic DMA Slave mode; Generic DMA Master mode;
PIO mode for IDE transfers; Multiword DMA mode for IDE transfers
and Ultra DMA mode for IDE transfers
Available in LQFP64 package.
Cypress Semiconductor
Cypress Semiconductor currently has two USB 2.0 offerings, the FX-2 and SX-2. One
includes a 8051 Microcontroller while the other is a DMA slave device designed to
connect to a microprocessor or DSP. Cypress is well known for its re-numeration
feature allowing USB devices with no firmware to enumerate as a default device, have
code downloaded to it from the host and then re-enumerate as a different device
executing the code freshly downloaded to it. It also provides enumeration in silicon,
allowing the developer to code the interesting bits. . .
The SX2 loses the 8051 in favour for becoming a slave device controlled
by your DSP or microcontroller in a language and design environment that
you are familiar with. It continues the EZ-USB tradition of silicon
enumeration allowing the SX2 to read its Product and Vendor IDs plus its
descriptors from serial EEPROM (up to 1KB) on power up. This allows the
device to enumerate all chapter 9 descriptors without need of interrupting
the master processor. It has a on-board I2C master device which is used
to connect to the serial EEPROM on boot-up and can be used under
control of your host after bootup and initialisation making it ideal for digital
image sensors and other devices running on a I2C bus.
Unlike the Philips ISP1581, the SX2 has three address pins to select
FIFO2/4/6/8 or command operation and a 8/16-bit data bus shared for
command and FIFO Data. Advanced information would also suggest it is
missing an on board 3.3V regulator thus requiring external circuitry if used
as a bus powered device. Never the less, the silicon numeration continues
to put this device on the favourite list for many.
56 SSOP Package
Advanced Information 497kb
Opal Kelly's XEM3001 FPGA experimentation with High Speed USB 2.0
Interface
Xilinx Spartan 3
FPGA
(XC3S400)
High Speed
USB 2.0 Port
using Cypress
CY68013 FX2
USB
microcontroller
Bus-powered
(self-powered
capable).
On Board Clock
Generator (1
MHz to 150
MHz)
Three 0.1"
headers giving
access to 90
FPGA I/O lines
including 4 clock
inputs
Includes 8 SMD
LEDs and 4
Tactile switches.
JTAG header
included.
Complete with
driver, powerful
C++ class
library (and
Python wrapper)
and FrontPanel
programmers
interface (API)
Business-card
sized 3.5 x
2.0 (88.9mm x
50.8mm).
Cypress CY7C68013-128AC
EZ-USB FX2 Controller
FPGA configuration
port
Complete with driver, DLL
and C library
Small 2" x 1.5" Circuit Board.
Cesys Spartan-II FPGA board with Cypress FX-2 USB 2.0 High Speed
Interface
Xilinx XC2S200-
5PQ208C Spartan II
FPGA.
1 Mbyte 15nS SRAM
accessible from the
FPGA.
Cypress EZ-USB FX2
2.0 Full Speed USB
Controller with GPIF
connection to FPGA.
128 kBytes RAM
connected to USB FX-2
Controller.
User programmable
clock from 1MHz to 250
MHz.
Generous 96 pin I/O.
Cypress EZ-USB
FX2 2.0 Full Speed
USB Controller.
11 Pin Data
Connector (8 Data
Bits, R/W, Clk and
GND).
3 Pin Power
Connector (+5V,
+3.3V and GND).
1.25" x 2.0" Size with
Mini USB Connector.
Netchip Technology has two USB 2.0 peripheral controllers which can connect to many
microcontroller, microprocessor or DSP systems without any additional glue logic. The
NET 2280 is a USB 2.0 peripheral device with a PCI 2.2 compliant bus. The NET 2270
on the other hand is a smaller 16 bit peripheral housed in a 64 pin TQFP and has a
simpler core without Auto-Enumerate.
slave modes
4 Kbyte double-buffered, selectable FIFO IN/OUT Memory
Built in high performance 8051 CPU and 8kB program memory
Four channel DMA controller
120-pin TQFP package
Another increasingly popular solution is to integrate the USB 2.0 SIE (Serial Interface
Engine) into a FPGA. However with USB's High Speed signalling running at a
differential 480Mbps, a transceiver is required to convert this signal into a TTL/CMOS
signal your FPGA can handle. To standardise high speed transceivers and allow
portability between transceiver vendors and IP Core vendors, a USB Transceiver
Macrocell Interface (UTMI) Specification was produced.
UTMI Specification
USB 2.0 Transceiver Macrocell Interface, version 1.05(UTMI) specification
With USB's high speed differential bus and highly complex protocol, what do you do
when you want to monitor what is going on between your device and the host? Have
you spent days on end hitting your head against the wall? What you need is a USB
Protocol Analyser.
Most developers are now thinking this must be expensive. But at what cost do you
value a days trial and error when you can't see exactly what is going on. Perhaps the
tension is building between the software engineer and the firmware engineer, neither
will admit the problem lies with their end.
Ellisys with their hugely popular USB Tracker has come to the rescue of USB 2.0 High
Speed developers with the USB Explorer 200.
protocols
Device Bus Powered. No need for external
adaptor.
Speedy USB2.0 Uplink with Internal 32MB FIFO
Memory.
Intutive, Easy to use Interface.
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
The HIDMaker from Trace System's Inc helps to quickly create in seconds both the
firmware for your HID device and a GUI application program for your Host.
Supporting a varity of development environments on the PC including Visual Basic,
Delphi, and C++ Builder, the HID Builder can be used in conjunction with your
Microchip PIC16C745/765, NatSemi USBN9603/4 connected to a PIC16F877 or
PIC18F452 and the new 18F2550 as soon as Microchip releases these parts to the
market. Firmware can be produced in a range of enviroments including PicBasic
Pro, MPASM, Hi-Tech C, and CCS C.
Retailing at $149 USD, the HID Maker Test Suite comes with USBWatch and
AnyHID. USB Watch is a software based product which allows the developer to see
what is being sent or received from your USB device even during enumeration.
AnyHID on the other hand can interrogate any HID device regardless of if you wrote
it or not. It can display information about the devices and allows you to effortlessly
get and send reports to test the device. AnyHID comes with full source code in VB,
Delphi, and C++ Builder.
Microsoft provides Device Driver Kits for all of it's operating systems which includes
example USB device drivers. The Windows 98 and Windows 2000 DDK's is
available for download from www.microsoft.com/ddk. The Windows XP DDK is only
available through MSDN registration or by ordering a copy on CDROM. All the
DDKs except XP requires Visual C to be installed. The windows XP DDK includes
build tools alleviating the need to have a compiler installed.
The DDK's include two USB driver examples, the BulkUSB and IsoUSB plus a USB
filter driver and a USBView utility. Early Win98/ME and Win2K examples are
plagued by bugs, thus it is recommended you use the WinXP DDK as a foundation
for your new drivers.
Jungo Ltd
Have you taken one look at the Microsoft DDK and said this is not for me, let your
boss is still waiting for your driver? Don't give up, Jungo has two products to help
you. WinDriver allows you to develop USB drivers in user mode with no knowledge
of DDKs or kernel mode architecture. If on the other hand you have a little kernel
mode experience, but find it takes weeks if not months to write your driver then the
Jungo KernelDriver may be for you. It produces driver templates which can be
modified and compiled with Visual C and the Microsoft DDKs.
Jungo WinDriver
Jungo KernelDriver
When it comes to debugging your USB device drivers or monitoring what other USB
device drivers are doing, USB Snoopy Pro is a free utility certainly worth
downloading. USB Snoopy Pro consists of a user mode program and filter driver
which can be attached to various USB drivers displaying the IRPs passing down to
the lower drivers.
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
With USB's differential bus and highly complex protocol, what do you do when you want to monitor what is
going on between your device and the host? You can't just grab the digital storage oscilloscope and probe
around like you could with less complex traditional serial buses. What you need is a USB Protocol Analyser.
Most developers are now thinking this must be expensive. Yes, many are. But at what cost do you value a
days trial and error when you can't see exactly what is going on. Perhaps the tension is building between the
software engineer and the firmware engineer, neither will admit the problem lies with their code.
While there are the more known players such as CATCs or Catalyst Enterprises, Ellisys had captured the
market with the very functional and easy to use, "USB Tracker" supporting the analysis of low and full speeds.
Just recently, they have built on the great success of the tracker with the Ellisys USB Explorer 200 which now
supports high speed 480Mbps, yet still at an very affordable price.
limited warranty.
The 1.2MB accompanying software installs like a treat and is quite intuitive to use. The events are stored in
an expandable table which makes it easy to navigate hundreds and thousands of events, something that
some competitors more graphical software solutions lacks. The details tab on the right by default only shows
the more important and frequently used fields, helping cut down on cutler and information overload.
The software provides the normal filtering one would expect plus the option of "colouring" (in pascal colours
off course) transactions via endpoints numbers. Any possible breaches of the specification comes up with a
little yellow exclamation mark and the field in red. This quickly helps weed out possible problems with
descriptors etc.
The Software is free which allows others in your organisation to display captured results. It comes with a
couple of demonstration logs including a camera, memorystick and mouse captures. If you are in the market
for an Analyser we recommend you take a minute to download the Ellisys USB show software and see just
what it offers you. I don't believe you will be disappointed.
The USB tracker from Ellisys opens up these powerful tools to the smaller developers who were previously
priced out of the market. While it doesn't do Inrush Current, or Signal Integrity, Skew, Jitters Measurements
etc like the more pricey units it does provide a range of functionality which should help get your next project
out to market quicker.
Another low cost USB Protocol Analyzer is the USB Viewer from USB Developer.com.
Speed (12Mbits/s)
USB2.0 Uplink (Backwards compatible
with 1.1).
Device Bus Powered. No need for
external adaptor.
Power and Activity LEDs.
Once again the software is available for download so you can try it out before you buy. The shrink view allows
the user to quickly determine the position of data in amongst SOF etc.
Other Standalone USB Protocol Analysers (Don't require connection to logic Analyser etc)
The following USB Protocol Analysers/probes connect to existing Logic Analyser systems.
FuturePlus Systems FS4100 Universal Serial Bus (USB) Analysis Probe (Connects to Agilent
logic Analyzer for display)
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Its now a common daily occurrence to receive PE viruses such as the recent MyDoom via e-mail. On Windows platforms,
nine out of ten of last year's top viruses were spread via e-mail. While staff training is the best deterrent, wouldnt it be
helpful to prevent users opening un-trusted executables yet being non-restrictive on the opening documents and other less
harmful files?
With typical figures saying 70% of network related attacks come from within your organisation doesn't it make sense to
prevent users running port scanners or other executable tools from floppy disk or CDROM drives yet still allowing the use of
these drives to transfer files and maintain office efficiency.
Or perhaps you have caught users trying to install software on machines. While operating systems are becoming more
secure, it is still possible to install programs as a user or run programs directly from the CDROM drive. Other users may
choose to play games from CDROM drives?
The speed at which viruses can propagate must be a concern for all Administrators. Most sites now have automatic updates
running which frequently update their scanners, sometimes as frequently as twice daily. However it takes time after a virus
is released, to first be detected and identified and then to be added to the virus definitions of all the major virus scanners
before the site administrator even gets their hand on it. Many people will remember the SQL Slammer Worm. Its peak
occurred only three minutes after it was released to the wild. At its peak it was scanning 55 million Internet hosts per second
and had infected at least 75,000 victims.
However the biggest disadvantage to this scheme is the administrator has no control over drives which do not have a NTFS
file system or compatible network file system. Drives such as a 1.44MB 3.5" Floppy, CDROM, DVD, Zip Drive or even some
network drives do not have adequate security descriptors and thus cannot be secured. Removing or disabling these drives
is one option but doing so greatly effects the productivity that should be gained from a PC Workstation.
What is trust-no-exe?
Trust-no-exe is a executable file filter. It attaches to the operating system and filters all executable files, be it .exe .com .dll .
drv .sys .dpl etc from all drives and all network shares against a list of files or paths, you, the administrator provide as
trusted applications. If a prohibited executable (one not in the allow list or one explicitly defined in the deny list) is loaded, a
popup box informs the user with an intelligent message that can be customised to your site.
On the other hand perhaps you are worried about all these PE viruses, executable Christmas/birthday cards, screen savers
etc that are coming in via email. While most of your users do not click on these programs you are worried about security
holes in your email client, either hiding extensions or embedding files into html messages, or if the virus is so new your virus
scanner has not yet got a signature for it. By using Trust-no-exe, you can prevent users from opening executable email
attachments. The popup message box can be customised to remind users that it is company policy not to open executable
files. But what happens if the executables dont have .exe or hidden extensions? How will trust-no-exe know if they are
executable or data files?
Trust-no-exe hooks into the operating systems routines for creating a process and loading it into memory. If the operating
system attempts to load any compiled code into memory ready to give it execution as a process or thread, trust-no-exe will
jump on it and prevent the code from being loaded into memory. Therefore trust-no-one doesnt rely on the file extension
and can not be easily fooled.
Trust-no-exe has been designed for ease of use. Out of the box, a control panel applet is installed which allows for the
configuration to be quickly modified. By default the program files and winnt/windows directories are added which in many
cases is all that is required to make a secured, yet functional system.
New in version 3 is the ability to add a custom message. This allows you to put in a contact name and number should your
users require special access to certain files. The other unique feature of Trust-no-exe is the file denied dialog is a single
executable that is called by the trust-no-exe driver. Therefore you can create your own dialog with company logo should the
need arise. Please contact us if you would like to explore this option. We can assist my providing a Visual C++.net or
Borland C++ Builder Template.
It is just as important, if not more, to have trust-no-exe protection when logged in as an Administrator. Trust-No-Exe protects
your PC all the time regardless of what user is logged in. To install software, or run executables from un-trusted locations,
the administrator can utilise the control panel to stop the driver and briefly interrupt filtering while the software is installed.
Trust-No-Exe also protects tasks running in the SYSTEM account.
Trust-No-Exe Version 3 now has support for installing and cloning settings to groups of computers.
Installing software and modify settings on multiple computers is never fun, yet alone efficient. With Trust-no-exe you need
only install the package on a single workstation. Once installed and appropriately configured, you may utilise the Multiple
Workstation functionality to remotely install it with your configuration on other selected computers. All that is needed is a
single click. Likewise changes to the access list can be distributed almost instantly and with minimal fuss. Computer groups
compatible with beyondexec can be quickly loaded, or you can effortlessly create your own using the built in computer
picker and save it for later use.
Download
Revision History
Added DenyExe\Refresh registry key to allow for the periodic refreshing of the access lists. This allows third party
Fixed buffer overrun bug in driver affecting sites with many entries in the allow/deny lists.
Tweaked denyexe.exe to fix problem found on some copies of Windows XP SP1 where denyexe would not unload
Workstation Support. Control Panel Applet now unloads and un-installs properly
Rewritten denyexe.exe to accept custom messages. Reduced code size.
Rewritten GetDriveDeviceObject routine. No longer seeks the A: drive and improved the speed and reliability of the
routine.
Modified HookZwCreateSection routines to improve reliability across WinNT/2000 and XP.
Fixed problem with running programs on network shares mounted on Windows XP.
Modified installer so driver is automatically loaded by the service control manager and not by the system loader.
Modified driver so if registry keys are missing, driver is inactive. This prevents the computer from failing to boot in rare
instances.
Tested on Windows 2000 SP3 & SP4, Windows NT4 SP5 & SP6(a), and Windows XP & SP2.
Bmail is a free but lean command line SMTP mail sender. Bmail allows the user to automate the sending of email messages
containing log files, data downloads or error messages on Win32 based computers.
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
As the USBLPTPD11 driver communicates with parport.sys, there is no need to pass the driver a Port Address or
Interrupt number. The driver will obtain these details from parport.sys on loading. Simply, if your existing LPT1 port
works, simply connect the DeVaSys USBLPTPD11(D) board to your system and open the handle for LPT1. If you
change Parallel Port details after the driver has been loaded, these changes will not be reflected by the USBLPTPD11
driver until the driver is reloaded.
In most cases, the USBLPTPD11.SYS driver isn't required to be explicitly installed. When running the usermode
executable such as hidmouse.exe, it will check for the device driver and if it cannot be opened, it will install and start the
driver for you. However for this to happen correctly, the USBLPTPD11.SYS driver must be in the same directory than
the usermode executable and the user must have administrator privileges. It is also wise to run it from a fixed disk,
preferably your main system volume. While this will not effect operation for the first time, when Windows next loads it
will try to load the driver at bootup and report a failure in your event viewer. It will not cause damage to your system,
only an annoying message each time you boot.
Once the driver has been installed for the first time, any user with normal user privileges can access the device driver
normally. This is ideal in classroom and corporate environments where security is paramount. The driver can also be
installed manually using the registry file included. Copy the USBLPTPD11.SYS to your /system32/drivers directory and
click on the USBLPT.REG file to load the required registry keys. Then reboot the computer and on boot-up the
USBLPTPD11.SYS driver will load and start automatically. This is recommended for classroom/corporate use where the
driver can be stored away securely in the system directory.
Two versions of the driver exists. The standard distribution is a free compiled version which has debugging statements
removed and thus executes faster. However when writing your own code, or debugging problems, a checked version of
the driver is provided which displays debugging messages such as which call is being made, if the interrupt service
routine was called or the I2C_Read and I2C_Write functions including the number of bytes to send/receive and the
byDevID. These debug messages can be read with any good debug viewer. One such recommended viewer is the
System Internals DebugView which can be downloaded from their website - www.sysinternals.com for free.
The checked build of the driver is provided in the checked folder of the distribution. Simply replace the USBLPTPD11.
SYS with this driver and reload to display debug information.
The code for the device driver has been compiled using Microsoft Visual C and the Windows 2000 DDK. The source
code is provided, but during the normal development cycle it is not required to be recompiled. The usermode program,
hidmouse.exe in which all the development work is done will need to be recompiled in order to make changes. The code
was originally compiled in Borland C 5.02. Borland offers their Borland C++ 5.5 command line compiler tools for
download from their web site free of charge. A make file has been included for the command line compiler. To rebuild
the code using the free Borland C 5.5 compiler use
MAKE -f hidmouse.mak
Testing it out
The distribution comes with two files, hidmouselpt1.exe and hidmouselpt2.exe based on DeVaSys's HIDMouse source.
Permission has been sought to redistribute these files with the driver. However please note that the source code
remains Copyright of DeVaSys. Please see the header files for more information.
To test out the driver and your board, simply run hidmouselpt1.exe for a DeVaSys board connected to LPT1. You
should see a dump of the enumeration as shown below, then your device enumerates as a mouse, and you pointer
starts moving in a small square pattern.
(configuration) 9
USB_CtlTx Loading first 8 bytes
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) Sending last 1 bytes at p=0x40c6ca
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) End of Transmission, Getting Status Byte 1
wIrq = 0x0004 Irq - Ep0_Out (EpIdx2) RdEpIdx02 Null { 0x00, 0x00 }
wIrq = 0x0004 Irq - Ep0_Out (EpIdx2) Standard Device request - Get Descriptor
(configuration) 34
USB_CtlTx Loading first 8 bytes
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) 26 Sending packet of 8 bytes p=0x40C6CA
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) 18 Sending packet of 8 bytes p=0x40C6D2
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) 10 Sending packet of 8 bytes p=0x40C6DA
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) Sending last 2 bytes at p=0x40c6e2
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) End of Transmission, Getting Status Byte 41
wIrq = 0x0004 Irq - Ep0_Out (EpIdx2) RdEpIdx02 Null { 0x00, 0x00 }
wIrq = 0x0004 Irq - Ep0_Out (EpIdx2) Standard Device request - Set Configuration
Setup - Set
Standard Device Configuration 1
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) End of Transmission, Getting Status Byte 41
wIrq = 0x0004 Irq - Ep0_Out (EpIdx2) Class Interface request - Idle
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) End of Transmission, Getting Status Byte 41
wIrq = 0x0004 Irq - Ep0_Out (EpIdx2) Standard Interface request - Get Descriptor
(report)
USB_CtlTx Loading first 8 bytes
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) 42 Sending packet of 8 bytes p=0x40C6EC
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) 34 Sending packet of 8 bytes p=0x40C6F4
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) 26 Sending packet of 8 bytes p=0x40C6FC
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) 18 Sending packet of 8 bytes p=0x40C704
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) 10 Sending packet of 8 bytes p=0x40C70C
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) Sending last 2 bytes at p=0x40c714
wIrq = 0x0008 Irq - Ep0_In (EpIdx3) End of Transmission, Getting Status Byte 41
wIrq = 0x0004 Irq - Ep0_Out (EpIdx2) RdEpIdx02 Null { 0x00, 0x00 }
wIrq = 0x0010 Irq - Ep1_In (EpIdx4) Sending Mouse Report of size 3 bytes
wIrq = 0x0010 Irq - Ep1_In (EpIdx4) Sending Mouse Report of size 3 bytes
wIrq = 0x0010 Irq - Ep1_In (EpIdx4) Sending Mouse Report of size 3 bytes
wIrq = 0x0010 Irq - Ep1_In (EpIdx4) Sending Mouse Report of size 3 bytes
wIrq = 0x0010 Irq - Ep1_In (EpIdx4) Sending Mouse Report of size 3 bytes
wIrq = 0x0010 Irq - Ep1_In (EpIdx4) Sending Mouse Report of size 3 bytes
wIrq = 0x0010 Irq - Ep1_In (EpIdx4) Sending Mouse Report of size 3 bytes
wIrq = 0x0010 Irq - Ep1_In (EpIdx4) Sending Mouse Report of size 3 bytes
wIrq = 0x0010 Irq - Ep1_In (EpIdx4) Sending Mouse Report of size 3 bytes
Revision History
10th November 2001 - Version 1.2.
Modified usermode source code to compile with Visual C, Borland C 5.01 and the free Borland C 5.5
on first install.
Added usblpt.reg which was omitted from version 1.0
time.
Added interrupt support.
The USBLPT-PD11 USB development board is avaliable from DeVaSys Embedded Systems in two versions, a desktop
and a dongle version. The dongle version starts at $59US.
A special thanks to Michael DeVault from DeVaSys Embedded Systems for sending out a USB I2C/IO Interface Board,
USBLPT-PD11 USB development board (desktop version) and a USBLPT-PD11D, USB development board (dongle
version) for evaluation.
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Want a small command line utility to view, kill, suspend or set the priority and affinity of processes, perhaps
from a batch file? . . Has a virus disabled your Task Manager? . . or perhaps your Administrator has?
The Command Line Process Utility will function even when the task manager is disabled and/or the
dreaded "Task Manager has been disabled by your Administrator" dialog box appears.
Works on remote machines with the Microsoft Telnet Server (tlntsvr) found on Windows 2000 and XP or
with BeyondExec for Windows NT4/2000/XP.
Additional switches can be used to display User and Kernel Times (-t) or the Creation Time of processes (-
c).
Kill Processes . . .
Processes can be killed immediately (terminated without saving files or cleaning up) by specifying either the
name or the PID (Process IDentifier). In cases where there are multiple processes running with the same
name and your desire is to kill a specific process you will need to use the PID.
C:\>process -k 748
If an image name such as iexplore.exe is specified, the utility will kill all processes by that name.
C:\>process -k iexplore.exe
Close Processes . . .
On the other hand if you want to gracefully close programs by sending them a WM_CLOSE message first,
you can used the -q option. This allows processes to clean up, save files, flush buffers etc. However it can
cause deadlocks. e.g trying to close Microsoft Word when a unsaved, but edited document is open will
generate a dialog box "Do you want to save changes to document 1?". This will prevent winword.exe from
exiting until a user responds to the prompt.
C:\>process -q wordpad.exe
When this option is used a WM_CLOSE message is immediately sent to the process. It then waits up to a
default of 60 seconds for the program to clean up and gracefully close before it is killed. The different
timeout can be specified as an option after the PID/Image Name.
Processes can be suspended if you need some extra CPU cycles without having to kill the process outright.
Once the requirement for the extra CPU cycles has passed you may resume the process and carry on from
where you left off. The process is suspended by sleeping all the processes' active threads.
C:\>process -s winword.exe
Suspending a process causes the threads to stop executing user-mode (application) code. It also
increments a suspend count for each thread. Therefore if a process is suspended twice, two resume
operations will be required to resume the process (Decrement the suspend count to zero).
When viewing the list of processes, the 4th column shows the base priority of a process. This is a numeric
value from zero (lowest priority) to 31 (highest priority). You may set the base priority of a process by
specifying one of the priority classes below.
Low 4
BelowNormal 6
Normal 8
AboveNormal 10
High 13
Realtime 24
Please note Windows NT4 does not support the Above Normal and Below Normal priority classes.
Specifying these two parameters on a Windows NT4 machine will result in a " The Parameter is incorrect "
error.
The affinity is a mask which indicates on which processors (CPUs) a process can run. This is only useful on
multiprocessor systems. When the -a option is used in conjunction with a process name or PID, the utility
will show the System Affinity Mask and the Process Affinity Mask. The System Affinity Mask shows how
many configured processors are currently available in a system. The Process Affinity Mask indicates on
what processor(s) the specified process can run on.
C:\>process -a wordpad.exe
To set the affinity mask, simply append the binary mask after the PID/Image Name. Any leading zeros are
ignored, so there is no requirement to enter the full 32 bit mask.
C:\>process -a wordpad.exe 01
Download
Revision History
Added -t switch which displays both User Mode and Kernel Mode CPU times.
detect operating system and use appropriate API calls plus a couple of undocumented
calls to provide all the functionality of previous versions yet across all three NT
platforms.
Added preliminary support for the setting and display of Affinity Masks for multi
processor systems.
Added support for killing multiple processes by name. e.g using -k iexplorer.exe will kill
Improved OpenProcess access so CPU time can now be sought from processes we
numbers. eg process -s 3dsmax.exe would try to suspend the process with PID 3 and
not 3dsmax.exe.
Added -q Send WM_CLOSE message option. This will gracefully issue a WM_CLOSE
1 = Miscellaneous Error.
etc or shutdown a single or group of remote computers without having the burden of installing any remote
client on your target computers?
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Options to shutdown, power-off, reboot, suspend, hibernate, log-off or lock the workstation.
Actually shutdowns ACPI Compliant computers including WinNT4 with the hal.dll.softex Hardware
Abstraction Layer.
Ability to display optional message of a maximum 300 characters.
The shutdown dialog will appear on the active window, should it be the login window, login screen saver,
logged in user's desktop, or on a locked workstation.
Option to allow the user to cancel the operation. (This can be greyed out)
Option to prevent shutdown action occurring on logged-on computers giving your users the flexibly to run
lengthy processes overnight without being disturbed.
The beyondlogic shutdown dialog, giving your users the option to cancel your action
This utility is based on the shutdown module of the popular beyondexec. If you need to shutdown multiple
computers it is recommended to use beyondexec
Usage
Using the industry standard /? switch will
show the utilities parameters. A summary is
shown on the right.
Windows 2000 and XP contains a GUI task scheduler. However this scheduler doesnt provide the option to
allow processes the right to interact with the desktop. Therefore you need to use the AT service bundled with
NT4/2000 and XP instead.
The above example shows how you can schedule a shutdown to occur at 6:00pm each night. In this example
shutdown.exe has been copied to c:\windows (Windows XP).
In medium workgroups and larger organisations, the above solution requires shutdown.exe to be copied to all
your computers and the scheduler set up on each computer. Each computer will then shutdown based on it's
own system clock. While many sites sync the workstation clock at log-in, flat CMOS batteries can be a problem
for those sites who don't. It can also be a large task to change the configuration should you need to reschedule
around an event.
Another solution is the popular beyondexec which can be used to run processes or shutdown multiple
workstations on a single or group of remote workstations. In this case you could run a single scheduled task on
a NTP sync'd server to shutdown your group of computers. If you need to change the scheduled time there is
only one setting to change, and it gives you the flexibility to shutdown the workstations on demand such as
moments before a scheduled power outage. The other advantage is there is absolutely nothing you have to
install on your remote computers.
Trouble Shooting
Windows NT 4 can be made to switch itself off after shutdown should your computer supports power
management. When Service Pack 6/6a is extracted you will find a hal.dll.softex file. If you replace \winnt
\system32\hal.dll with a copy of this file, using -d poweroff with beyondexec will shutdown and poweroff
your ACPI Windows NT 4 Workstation. Failure to replace the hal.dll will result in the poweroff action
rebooting your Windows NT computer.
Locked Workstations
When a workstation is locked, the shutdown, reboot and logout actions will not function correctly unless
the -f (force applications to terminate) switch is specified. The suspend and hibernate actions will function
correctly on a locked workstation. This is a problem associated with the ExitWindowsEx() API provided in
Windows.
Download
Revision History
16th November 2003 - Version 1.01
First release to public. Extracted the shutdown module from BeyondExec for standalone use.
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
RS-232 was quite simplistic. While the specs defined the electrical characteristics, little
was said about the protocol. RS-232 was a simple communications channel. Send a
binary or ASCII byte down the wire and it gets received by the other end. This allowed
RS-232 to be used effortlessly for just about anything. Most designers would develop
their own protocols which sat on top of RS-232.
Then comes along USB with all its complexities. Enumeration, device descriptors,
endpoints, tokens, message pipes, control/bulk/interrupt/isochronous transfers, WDM
device drivers - enough! No longer is it something you can wack on your
microcontroller in 30 minutes.
However if you are just starting out in USB and want to get something happening
quickly without any hassles of enumeration, device descriptors and the works then
FTDI may have two ICs which interest you. One provides a simple asynchronous
channel, the other a byte wide FIFO interface with little need to even glance at the
USB Spec.
FTDI brought out the FT8U232AM as a legacy USB to RS-232 Converter. It doesnt
require any programming, simply solder the device down and switch it on. While they
can be used for USB to RS-232 adaptors they are also a quick way to make an
existing product USB compliant.
But won't this device enumerate as a FTDI USB <-> RS-232 making my product look
sub-standard? Yes, you are quite right - if you dont include a serial EEPROM. But for
a extra $1 you can surface mount down a SO8 serial EEPROM and program it with
your PID/VID, manufacturer string, product string and serial number string. Now when
your customers plug in your device they see the "Bells and Whistles USB Data
Logger" made by "my company XYZ."
While the external 93C46 can dictate a new set of VID/PID and strings, it can also set
up the maximum power in the USB Configuration Descriptor. This is handy when you
plan to use the FT8U232AM in a bus powered design. The '232AM has a PWRCTL
pin which is tied low for bus powered designs and tied high for self powered designs.
The status of this pin is reflected in the configuration descriptors bmAttributes field,
allowing the '232AM to be used in devices that are bus or self powered without the
need of reprogramming the EEPROM each time or on loss of self power.
In a bus powered design under suspend conditions the entire device can only drain
500uA from Vbus, a limitation imposed by the USB Standard. The '232AM provides a
sleep pin which can be connected to the RS-232 line drivers (in the case of a USB to
RS-232 dongle) or other circuitry to place the devices in sleep modes and hopefully
meeting the low power suspend requirements of the spec.
The '232AM also provides a USBEN output which goes high once the device has been
configured by the host. The FTDI documentation suggests it could be used in devices
with both USB and RS-232 ports to control a multiplexer to switch control between
ports. Another use could be in high powered bus functions which can drain up to
500mA (5 load units) but is not permitted to drain any more than 100mA (1 load unit)
until they are configured. This pin could enable the extra load once the device is
configured, such as charge pumps or LCD/user interfaces etc.
But while this device has many advantages for legacy devices, it shouldnt be
dismissed for new designs either. While the legacy VCOM drivers may put some off on
the PC side, the good news is VCOM isnt the only way to talk to your new
FT8U2XXAM device. You can also use FTDIs direct driver FTD2XX. This does away
with the hassles of legacy com port interfaces and worries of device drivers by
providing a series of .DLL calls your user mode program can call to interrogate your
device.
But designing a new device around the FT8U232AM could lead to performance
problems. While USB has a data rate of 12Mbits per second ignoring protocol
overheads, the FT8U232AM can only handle 2Mbits per second and worse still, many
microcontrollers can only handle a couple hundred bits per second on their
asynchronous interfaces.
Therefore FTDI has an 8 byte parallel FIFO version. It shares the same USB
descriptors, same PID/VID, but removes the asynchronous serial interface in
preference for a bi-directional 8 bit FIFO interface capable of 1Mbytes per second or
8Mbits per second. This device provides RD/WR control lines enabling it to be
memory mapped on a microcontrollers bus, but omits a chip select thus you need
additional glue logic for address decoding.
While it doesnt provide a DMA interface as such, it does provide RXF and TXE pins
indicating the FIFOs status. These could be used to control DMA or interrupts with a
little glue logic, or a more popular choice at present is to map these pins into a status
register, so you can read and write data to the device on one port and check the
FIFO's status on another.
The FT8U245AM lacks the PWRCTL (Bus Powered/Self Powered Input), USBEN
(USB Enabled) and sleep pins that it's '232AM counterpart has. As Fred Dart from
FTDI points out, the '245AM enumerates as a bus powered device. This allows the
device to be used "in practice" as a bus powered device or a self powered device.
When used in a self powered device, the FT8U245AM draws little or no current from
Vbus and thus is well within the power requirements of self powered devices.
It's also possible to detect a sleep condition on the '245AM as the RCCLK input goes
low during suspend. Adding a high impedance CMOS buffer allows the ability to detect
this condition, while not loading or effecting the RC time constant required to maintain
oscillator stability when the device comes out of suspend. In many cases the omission
of these pins isn't a significant limitation, as this device is normally tacked on to a
larger embedded system with it's own power supply. One such example is Jeff
Pollard's PC 104 adaptor published in Circuit Cellar, Issue 132, July 2001.
The serial EEPROM on both devices can be programmed effortlessly over USB with a
application (FTD2XXST EEPROM serialiser and tester utility) from FTDI. There is no
need to program the EEPROM before soldering to your board.
Summary
Only slightly larger than a SO8 package 32 pin QFTP 7mm x 7mm.
Royalty free Virtual COM Port Drivers Win98/ME Win2K/XP and linux.
Direct driver FTD2XX with .DLL usermode interface
No need to worry about the underlying USB protocols.
No wasting time debugging device drivers and firmware.
Comes in both serial and 8 bit FIFO wide versions.
Ability to customise USB descriptor and strings.
For those of us who can't wait long enough to build a board can find prebuild modules
from Ravar.net. These modules are available in both serial and parallel interface
versions and are priced at US$27ea ($50 AUS). This makes them an ideal USB add
on solution for Microchip, AVR and other microprocessors. The serial version gives
you the flexibility of adding it to your existing asynchronous comms port leaving the
parallel I/O ports free or if you need speed, you can use the USBMOD2 with a parallel
interface capable of 1Mbyte/sec.
UART solution
Based on FTDI FT8U232 High-
600mil IC Socket
Provision for external EEPROM
components required
Module powered from USB bus
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
While USB has many advantages in the plugnplay and ease of use arena, it could
never be a direct replacement for many RS-232 systems until now. One of the biggest
problems with USB is that its host controlled. Unlike its firewire equivalent, if you
switch off a USB host, nothing else works. USB does not support peer to peer
comunication. One device on the bus must be a host.
This is fine in the general computing environment, but will cause problems in industrial
applications and mobile computing enviroments. For example, a RS-232 modem was
a DCE device. Simply inserting a null modem would allow it to talk to other DCE
devices, so you could connect a modem up to your datalogger, PLC, printer or other
RS-232 device. These devices could either talk together or to a computer. However
with todays USB modems you can connect it up to your computer(host) and well,
thats about it.
Many USB digital cameras can download data to a PC, but you are unable to connect
them directly to your USB printer to print the pictures out or to a CD Burner to
permamently store your holiday snaps, something which is possible with other
communication mediums. PDAs can download and upload data from the PC over it's
USB link, but the user cant connect a printer, mobile phone (modem) or camera to it.
This turns out to be quite a restriction to USBs so called ease of use and simplicity . . .
So to combat these problems, a tack on standard was created to USB 2.0. This is
called the On-The-Go Supplement or OTG for short. The OTG specification details the
"dual role device". This is a device which can function as both a device controller (DC)
and/or a host controller (HC). Aimed at embedded applications the specification
doesnt require a fully blown, resource hungry host capability.
The OTG host can have a targeted peripheral list. This means the embedded device
does not need to have a list of every product and vendor ID or class driver. It can
target only one type of periheral if needed. This could for example be a modem
complying to the Communication Device Class Specification.
The spec also details a Session Request Protocol (SRP) which allows a B-device
As a device can be either a host (A-device) or peripheral (B-device) and that the USB
specification calls for different types of connectors for upstream and downstream
ports, the OTG spec introduced two additional connectors. One such connector is a
mini A/B connector allowing a mini A or mini B connector to plug into the one
recepticle. A dual-role device is required to be able to detect whether a Mini-A or Mini-
B plug is inserted by determining if the ID pin (an extra pin introduced by OTG) is
connected to ground.
And where would OTG be without its own descriptor? Any dual role host can request
an OTG descriptor from a B-device describing wheather or not it can handle SRP and/
or HNP. Any B-device that supports either HNP or SRP must respond to this request.
The On-The-Go specification is in its last stages of revision. Revision 0.9 released on
September the 5th, 2001 is currently avalible at http://www.usb.org/developers/
onthego/
ISP1161 Full-speed Universal Serial Bus single-chip host and device controller.
Philips have released the ISP1161 - the world's first single-chip, integrated host and
device controller conforming to the USB Revision 1.1. It has been used by Philips to
demonstrate USB OTG functionallity, but also makes an excellent host controller for
embedded systems such as Linux.
Combines a USB Host Controller and USB Device Controller in a single chip.
Can function as a USB Host only, USB Device Only or both simultaneously.
Selectable one or two downstream ports for HC and one upstream port for DC.
Supports single-cycle burst mode and multiple-cycle burst mode DMA
operations.
Built in separate FIFO buffer RAM for HC (4 kbytes) and DC (2462 bytes).
6 MHz crystal oscillator with integrated PLL for low EMI.
USB device functionally simular to the ISP1181.
USB Host Controller registers compatible to OpenHCI although accessed
though two memory map locations.
Available in a LQFP64 package.
The ISP1161 has a standard CS, RD, WR, and D[15..0] bus making interfacing to
most microcontrollers a piece of cake. This particular device only has two address
lines hogging up a minimal 4 locations/ports in memory. The 4 addresses are the HC
data port, HC command port, DC data port and DC command port making it one of
these devices where you send a command first, then data to a different port. However
to speed things along shared DMA functionality is added.
While the Host device is controlled using two memory locations, the register set is
made compatible to the OpenHCI register set further aiding portability. This allowed
the linux OHCI drivers to be ported reasonably easily.
While Philips introduced this device with their OTG promotional release, this device is
not 100% OTG complaint. You have to remember that Philips first released this device
in July 2001, the OTG specification revision 0.9 was released in early September 2001
and is still not fully qualified at time of writing.
As introduced earlier, the OTG Session Request Protocol (SRP) allows devices to turn
on Vbus enabling USB connectivity. This must be done by the B-device using both the
"data-line pulsing" and "VBUS pulsing" methods. The OTG host needs only support
one of these. In data-line pulsing the B-device can turn on its D+ pull up resistor for a
period of 5 to 10mS.
The OTG states that a dual role device should have between 1.0 F and 6.5 F.
Therefore the B device can send a pulse of duration long enough that a 6.5uF
capacitor on the dual role device will charge up beyond 2.1V, yet if connected to a
normal host with a capacitance on Vbus of 120uF or more it will not be charged over
2.0V preventing possible damage to the host. Its own capacitance on Vbus needs to
be facted into this calulation and stricter limits are imposed by the OTG standard.
The ISP1161 does not have hardware functionailty to support SRP or HNP. Philips
however informs us that they will soon offer an OTG host/device controller based on
their proven ISP1161 and an OTG version of their transceiver with OTG SRP & HNP
support. This will probaby come about once the OTG standard is finalised.
But while this device may not be 100% USB OTG complant it does make for a ideal
Host controller for embedded systems. In the linux World Roman Weissgaerber has
released an experimental version of a host controller driver for the Philips ISP1161
HC. His current patch is against Linux-2.4.8 and can be found in the linux-usb-devel
development group.
While Roman has been using the ISA card for his development, others in the
embedded linux community shouldnt find it to hard to port across to uClinux or other
embedded distributions. Philips have been busy writing application notes detailing how
to connect the ISP1161 to varous RISC processors such as the Hitachi SH7709, Intel
StrongARM SA1110, Motorola DragonBall EZ, Fujitsu SPARClite and NEC V832
RISC processors.
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Have you ever wanted to run a process such as an application installer/setup, service pack, virus definition update etc
on a group of target computers without having the burden of installing any remote client on your target computers?
Perhaps you have needed to Shutdown, Powerdown, Reboot, Suspend, Hibernate, LogOff or Lock a large number of
workstations at the one time or at certain times from a scheduler and give the user notice and the ability to cancel the
operation beforehand?
General
Zero set-up time. Simply run the single 110kb utility from the command line.
Secure. No open TCP/IP ports - utilises already existing SMB named pipes to minimise security risks.
Multiple computer support is handled by multi-threaded routines speeding up the issuing of jobs.
Command line utility allowing scripting and automation of tasks from batch files or schedulers.
Supports renamed Administrator accounts & renamed Administrators groups for added security.
Can allow or deny processes the right to interact with the logged on user (Desktop).
Ability to run processes with Above Normal, Below Normal, High Priority, Idle, Normal priorities.
Push Windows Hot Fixes/Service Packs/Virus Definition updates out to remote computers etc.
Use with the Command Line Process Viewer to View, Kill, Suspend or adjust the priorities of processes
on remote computers.
or Use with the Console Computer Information Utility for 2000/XP to view/log Specifications of Remote
Computers.
Option to terminate rogue processes after a specified number of seconds.
Remote Shutdown
Ability to shutdown groups of computers (for example at close of business to save on power.)
User can be given notification of shutdown and the option of cancelling (if permitted - Default).
Shutdown dialog will appear on active window, should it be the login window, login screen saver, logged
A process can be executed prior to shutdown. E.g. you could gracefully shutdown important programs
(open databases) using the Command Line Process Viewer before forcing a shutdown on less important
applications.
Usage
To execute a process on a remote machine the command line parameters takes on the following format
where \\computer is the name of the target computer followed by any switches and the program to be executed. Any
switches or command line parameters after the specified program is assumed to belong to the remote process and will
not effect the functioning of Beyondexec.
Alternatively you may have a requirement to run the same task on multiple computers. A group file can be specified
containing the names of the computers you wish to target. In this case the command line takes on the following
format,
where computers.grp is a plain text file containing the name of each computer listed on a new line.
If a program or remote process is not specified, the command line interpreter (cmd.exe) is spawned allowing the user
to access the remote computer simular to that of a telnet session. e.g.
C:\>beyondexec \\neptune
C:\Winnt\System32>vol
C:\Winnt\System32>exit
[neptune] Process terminated with exit code 0 after 00:00:23.922s
If beyondexec is not executed with in an account that has the same administrative username and password than on
the remote computer, a standard windows networking dialog box will appear asking for a username and password for
an account that has administrator rights on the remote computer. As this action will halt beyondexec until a password
is entered, it is not suitable for batch jobs. For batch jobs a user account and password can be specified in clear text
using the -u and -p switches.
Beyondexec defaults to running the process in the account it uses to connect. e.g. if you connect to the remote
computer using the administrator account, the process will run in the administrator account on the remote machine. If
there is a need to run the process in the context of the system account (NT AUTHORITY\SYSTEM) you can specify
the -s switch. By default the process cannot interact with the desktop or user. Specifying -i allows the process to be
interactive permitting the display of windows and dialogs. Care should be taken using this option as the currently
logged in user can take control of the process which can be running at elevated system or administrative rights.
To prevent rouge processes from sitting zombie on remote machines, a timeout can be specified. If the process is still
executing (perhaps waiting for user input etc) after this period it will be terminated. This option is specified using the -t
switch followed by the number of seconds (Max Value 4,294,967,296 seconds ~136 years.) By default, Beyondexec
will wait for a process to finish before returning control on the initiating computer. To prevent beyondexec from waiting
for the process to finish, the -w switch can be used.
Quite often you may want to run a process which isn't installed or on the filesystem of the remote machine. One option
is to use net use \\computer drive: to map a drive to an external location. Another option is to get beyondexec to copy
the file to the remote computer for you. Specifying the -c switch will do just this, copying the file to \\[Computer]\ADMIN
$\temp\ on the remote computer and executing it from this location. ADMIN$ is \winnt or \windows depending if you
have Windows 2000 or Windows XP respectively.
Shutdown Options
The shutdown options can be used in conjunction with executing a remote process, or it can be specified as a
standalone event. When specified with a process, the remote computer will attempt to shutdown/reboot/log off etc
once the specified process terminates, or if the process exceeds the time period granted (-t). If a shutdown option is
specified without a remote process, the shutdown event will occur immediately. This is useful for shutting down groups
of computers.
The shutdown method is specified by the -d [action] switch. Valid options are shutdown, reboot, suspend, hibernate,
logout and lockworkstation all case insensitive. The shutdown option will attempt to powerdown your computer should
it support power management. The suspend and hibernate options only function as desired if your hardware and OS is
set up to support it. The lock workstation option is included as some organisations have policies to lock workstations in
the event of the fire alarm etc preventing the thief of sensitive data. LockWorkstation, Suspend & Hibernate functions
are not supported on Windows NT 4.
The shutdown option will issue quit messages to applications causing them to ask to save files etc. Quite often some
machines can be consumed with zombie processes which need a little more of a kick to kill them. If this is the case the
-f switch can be used in conjunction with -d to force applications to cancel. This option should be used with caution to
prevent losing un-saved work, but can guarantee the computer will successfully terminate any non responsive
applications.
Beyondexec has a option to inform the user about the shutdown action in progress using the -m switch. This could
include messages such as "A new virus definition file has been installed on your workstation. Please reboot your
computer as soon as possible so these new signatures can take effect" or you could use a scheduler to send the "Due
to large increases in electricity prices, staff are reminded to switch their computers of at night" message at 6pm each
night. If the user has already gone home, but left their workstation on it would be shutdown to conserve power. Should
a user be working back late, they can click the cancel button and continue working. Alternatively you may choose to
add the -n switch which ignores computers which have logged on users. With this switch you can shutdown all your
idle computers without annoying other users who are logged in.
The shutdown message is displayed to logged on users for a default of 60 seconds. This gives the user the option to
cancel the shutdown and continue working. If no user is currently logged into the workstation, the dialog box will
appear in front of the login screen so confusion doesn't occur if a user logs in and finds the workstation reboots during
the log in process. The length of time the dialog is displayed for can be specified in seconds after the -l switch. If a
zero is specified, the dialog box is inhibited and the shutdown action occurs immediately without the user granted the
option of cancelling the action.
Are you looking for a simular shutdown utility for use with a scheduler on the local computer? If so, look no further than
the Beyond Logic Shutdown Utility for NT/2000/XP. By popular demand, we have extracted the shutdown module of
BeyondExec and placed it in it's own 45kb executable for standalone use. Just the thing to replace the shutdown.exe
utility found in the Windows 2000 Professional Resource Kit or in Windows XP.
With the introduction of BeyondExec version 2 comes support for multiple computers. Prior multi-computer support
was limited to batch files which didn't multithread and consequently took long periods of time as each target machine
was sequentially interrogated. Long delays were especially evident when interrogating machines that were switched
off. The multithreading support in version 2 will talk to up to 10 computers simultaneously significantly speeding up
group batch jobs.
Multiple computer support comes in the form of a group file. This is nothing more than a text file which includes the
name of each computer on a new line. This gives the flexibility to have multiple group files such as accounts.grp,
dispatch.grp or lab88.grp etc. Text files can also be stored with the Beyondexec executable on network drives which
can be accessed at multiple workstations. Competing software often requires the use of a network browser to select
each computer and saves it in the registry decreasing flexibility and portability between machines.
Uninstalling
When BeyondExec is used with a remote computer for the first time, it copies and installs a service on this computer.
This service is rexesvr.exe which can be found in /system32/. Should for any reason you want to remove this service
from the remote computer you can use the -r option.
It can also be specified on the command line along with a process to execute. In this case, the service is installed, the
desired application executed and the driver removed without a trace. Note however if you specify this option in
conjunction with a shutdown action, then the driver will be stopped before the shutdown action can complete.
Permanent Installations
By default this service is not automatically started upon each boot. However in situations where it is frequently used, it
may be permanently installed on the remote computer and scheduled to start on each boot. The -b switch can then be
used to bypass the checking and installation of the driver saving time.
Trouble Shooting
The InoculateIT virus scanner (versions 4.0, 4.5, 6.0 on WinNT, Win2000, WinXP) will effect the correct
operation of outgoing named pipes on the host (initiating PC) causing a message simular to
or
The scanner doesn't effect the operation of the beyondexec service on the remote computers, thus the
scanning of outgoing files can be suspended on the workstation/server you intend to initiate jobs from.
This is a bug with InoculateIT. Computer Associates has released a driver patch for InoculateIT which fixes this
named pipe handling bug. (You can use beyondexec to patch all your systems.)
When running BeyondExec for the first time on a specific computer I get the following message -
or
BeyondExec uses the hidden ADMIN$ share to copy the rexesvr service to the remote machine. Some sites
choose to remove this share for security purposes. Check that the hidden share ADMIN$ is present on the
target computer.
314984 HOW TO: Create and Delete Hidden or Administrative Shares on Client Computers
Locked Workstations
When a workstation is locked, the shutdown, reboot and logout actions will not function correctly unless the -f
(force applications to terminate) switch is specified. The suspend and hibernate actions will function correctly on
a locked workstation. This is a problem associated with the ExitWindowsEx() API provided in Windows.
When using net use h: \\neptune\data /USER:Administrator Password to map a shared drive
with beyondexec, the following error may result
A specified logon session does not exist. It may already have been terminated.
BeyondExec impersonates the administrator who connected to the service. As a result BeyondExec can
impersonate the client's security context on the local system, however it cannot impersonate the client on
remote systems. A solution around this to use the full domain\username. e.g.
Beyondexec runs in its own session, thus any network drives mapped by other users or in other sessions are
not available. This is also true when the administrator is logged in and you are running with the same
credentials.
Windows NT 4 can be made to switch itself off after shutdown should your computer supports power
management. When Service Pack 6/6a is extracted you will find a hal.dll.softex file. If you replace \winnt
\system32\hal.dll with a copy of this file, using -d poweroff with beyondexec will shutdown and poweroff your
ACPI Windows NT 4 Workstation. Failure to replace the hal.dll will result in the poweroff action rebooting your
Windows NT computer.
If you try to add a registry file to the remote computer's registry using <regfile>.reg on the command line,
registry editor is spawned an is waiting for the user to answer Yes or No to "Are you sure you want to add the
information in <regfile>.reg to the registry?". To prevent this occurring you need to use the /S switch (Silent)
with regedit. e.g. regedit /S <regfile>.reg
When communicating with Remote Windows XP machines, BeyondExec will not accept the
Administrator Password
Please ensure the Network access : Sharing and security model for local accounts is set to Classic local
user authenticates as themselves This can be found in the Local Security Settings, Local Policies. Note that
this policy is enabled to Guest only local users authenticate as guest by default for a computer running
Windows XP Professional that is joined to a workgroup.
This is normal operation on Windows Workstations with a blank Administrator Password. Windows will not allow
a network connection if the password is blank. Please set your password to something more secure in order to
use Windows Networking and hence BeyondExec.
Running w2ksp4.exe /? brings up the following switches which can be used to help distribute the service pack.
-u Unattended mode.
-f Force other programs to close when the computer shuts down.
-n Do not back up files for uninstallation.
-o Overwrite OEM files without prompting.
-z Do not restart when installation is complete.
-q Quite mode (no user interaction).
-l List installed hotfixes.
-s:<dir> Intergrate Service Pack files into <dir>.
-d:<dir> Back up files onto <dir>.
The following command installs the Windows 2000 SP4 on the remote computers in quite mode. While we do
not use beyondexec's -i switch to interactivity display the process on the users desktop, we ask the service pack
to run in quite mode so it doesnt prompting for input, effectively halting the process. We choose not to back up
the files for un-installation and do not allow the service pack to reboot the computer. When the service pack
reboots the computer the user gets no warning. Instead we get beyondexec to tell the user that the service pack
has been installed on the computer and that it requires rebooting. This will initiate a count down giving the user
60 seconds to cancel the shutdown before the computer reboots. However if no user is present, e.g. after hours
the computer will reboot to complete the service pack.
This command line copies the 132MB service pack to the remote computer before it is executed. After the
service pack has been installed, beyondexec deletes the file from %system%\temp to free up this room.
Depending upon your network, you may choose to install the service pack from a network drive.
The first set to installing Internet Explorer 6 SP1 is to customise the install to your site. This is done by
downloading the Microsoft IEAK (Internet Explorer Administration Kit) 6. This allows the Administrator to set up
policies, restrictions, proxy settings etc which will be installed for ALL users.
As Internet Explorer doesn't come in a single file, you may choose to install it from a network drive. In this case
create a batch file named ie6sp1.bat or simular and add the following lines :
If you run ie6setup /? it will display a number of switches you can use. /q is to install Internet Explorer in quite
mode.
Then you can use beyondexec to copy this batch file to the remote computer and start it running
where office.grp contain the names of the computers you wish to distribute ie6 onto. The -cs sets the security of
the ie6sp1.bat file so only the Administrator has rights to read and access the file.
Beyondexec can only copy the one file to the remote workstations. How can I copy more?
If you need to copy addition files to your remote computers you may consider using a batch file such as
distribute.bat. Distribute.bat contains the following :
@echo off
For /F %%i IN (%1) DO xcopy /o %2 \\%%i\c$\%3
and will read .grp files used with BeyondExec. To copy the folder c:\winnt\temp\setup to the same place on the
multiple computers use :
The batch file uses the C$ hidden share and assumes you have the same passwords across all workstations.
Download
Revision History
20th September 2003 - Version 2.05
Removed problem preventing UNC paths being used to execute programs.
Added support to remove file from remote machine after it has been copied using the -c switch.
Added extra switch -cs which copies the file to remote computer with sole Administrator or System rights.
This is good for batch files which contain confidential information, preventing users from viewing the
contents.
Added -q switch to set process priority. Acceptable values are AboveNormal, BelowNormal, HighPriority,
example versions prior to 2.04 failed on German Windows as the Administrators Group is called
Administratoren.
Improved support for computers not switched on or present. BeyondExec will no longer block as long
waiting for a response from a non-existent computer. Any blocking present now is a feature of Windows
and not BeyondExec.
18th March 2003 - Version 2.03
Checks file version of service installed on remote computer and updates it accordingly. This omits the need
to use the -r switch prior to updating to a new version and alleviates problems when some clients are
updated and others are forgotten.
Processes running with an Interactive Desktop are now given the correct security privileges to the
WindowStation and Desktop. This caused interactive processes spawned on Windows XP to show only an
ghostly outline on the desktop.
Precopy file (-c) now replaces files if they already exist in the temp directory of the target machine.
Versions prior reported an error requiring the user to manually delete the file in order to update it.
Fixed parsing of precopy file parameters so files can now be copied to the remote machine and executed
Rewritten functions so as to re-instate support for Windows NT4 due to popular demand. Tested on
WinNT4 SP6a.
Added poweroff shutdown action for support with Windows NT 4's hal.dll.sofex hardware abstraction layer.
Ensures cancel notification dialog box appears on active desktop. When workstation was locked, dialog
Included a work around for Windows ExitWindowsEx bug where a call to logoff an user on a workstation
Added shutdown options allowing the Shutdown (Powerdown), Rebooting, Suspending, Hibernating,
Logging Off and Locking of Workstations with the ability to display a message to the user for a specified
number of seconds.
Multithreaded both server and client applications.
Added group option allowing the one action to be sent to all computers listed in the specified group file.
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Bmail is a free but lean command line SMTP mail sender. Don't get fooled into playing $$$ for huge executables.
Bmail allows the user to automate the sending of email messages containing log files, data downloads or error
messages on Win32 based computers. Together with the freeware utility mpack, you can also send MIME
encoded attachments.
C:\>bmail /?
The mail server name, To: Address and From: Address fields are mandatory. Multiple recipients can be specified
after the -t by separating them by a comma. The SMTP port number is seldomly used, but can be used to force
mail to be sent to a non standard port. The user has two choices for specifying the body of the message. If a single
line body is all that is required, it can be specified on the command line using the -b option. In this case you may
want to also use -a to specify a subject and -h to add TO: and FROM: headers to the body of your message.
However if a larger message body is required, such as a pre-formatted text email, log file, data file or a mime
encoded attachment etc then the body of the message can be read from a file. The file can be specified by the -m
switch. In this case the user can choose to use the -h, -a and -b switches in conjunction with the file, or manually
Usage Examples
If you simply need to send a quick one line email you can use the following example,
Pipes can be utilised to redirect stdout from a process(s) to a log file, then send this file as the body of the
message should an error result.
Note should be taken of the -c switch which separates the body from header with a CR/LF combination. While with
most mail clients it doesn't make any difference, some versions of Outlook will display an empty body, treating
your stdout.txt body as part of the header.
Download
Revision History
3rd May 2004 - Version 1.07
Fixed problem where bmail would not exit on all errors such as 552: Mail Box Exceeds Limit etc.
Added the current time and date to the headers (-h switch).
Modified the parsing of the to: and from: email addresses to improve compatibility.
Feedback from Outlook/Exchange users V1.04 confirmed fixes non display of body. Yay, but. .
Prefixed body with extra CRLF to assist MS Outlook in displaying correct body of message.
Prefixed body with extra CRLF to assist MS Outlook in displaying correct body of message.
transactions with the mail server to the screen or you can pipe it to a file.
19th December 2002 - Version 1.01
Increase buffer size to allow compatibility with a wide range of mail servers.
System and Service Pack, Physical and Virtual Memory, Network Addresses, Logical Drive information, Video Card
Type, Hard Disk, CDROM and Printer Information.
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Have you ever had the need to copy or delete files which were owned by a certain
user?
The Delete-by-Owner (delbyown.exe) Command Line Utility will scan a NTFS or secure
Windows Network file system for files which has an owner matching the one specified.
Matched files may be copied to a designated location or deleted.
For example, you have just had a staff member leave your organisation. You would like
to back up all their files, however many of them are scattered between project folders
and programs across the file system. You have no idea which files were created by this
user. However as this staff member has their own login, and any files created would be
also be owned by them, you can search the file system for files belonging to the staff
member and have them copied to a folder for safe keeping.
On the other hand you have a public access machine and it's common for users to store
files or create folders just about anywhere on the machine. You can restrict the ability to
do so with normal security permissions, but you don't want to go overboard and
decrease productivity. As the machine was prepared as an Administrator and all the
software has been installed as Administrator you can delete all files not owned by the
Administrators group. You could choose to schedule this action on a regular basis.
Usage
The -c copy, -d delete and -t test switches control what operation will be performed. The
test switch simply displays the files that match the owner and is a good way of viewing
what files will be targeted or simply as to find which files are owned by a certain user.
Quite often you may wish to exclude a directory. e.g if you are deleting stray files which
public users have created, you may wish to skip the users' profile. For example c:\winnt
\profiles may be excluded on Windows NT machines, and c:\Document and Settings
from Windows 2000 and Windows XP Workstations.
The -o switch specifies the owner of the file to match against. All operating system files
are normally owned by the Administrators group. As the utility accepts the not operator,
you may choose to use -o !Administrators to delete all files not owned (i.e not installed)
by the Administrator. This should be a good start to tiding up the machine up.
If no -o switch is specified, the utility will retrieve the security descriptor for all the files,
but will not match it with an owner and subsequently perform any operations. This is a
good way to test for any corrupt security descriptors. They should be reported with a
message such as
The utility accepts all the normal wildcards. You may choose to only delete *.doc files
owned by cpeacock e.g.
The -r recursive switch should be self explanatory. It allows the utility to search in any
subdirectories it finds.
Download
Revision History
5th June 2003 - Version 1.02
accounts/groups etc
22nd April 2002 - Version 1.00
A problem that plagues Windows NT/2000/XP, is it's strict control over I/O ports. Unlike
Windows 95, 98 or ME, Windows NT/2000/XP will cause an exception (Privileged
Instruction) if an attempt is made to access an I/O port that your program is not
privileged to access. The PortTalk driver allows existing programs to access selected I/
O ports.
Features
The PDIUSBD11 USB Device with Serial Interface from Philips Semiconductor allows almost any
microcontroller the option of having a USB Interface. Being a full speed device, it allows USB transfer
2
modes including Control, Bulk and Interrupt. It doe not support Isochronous. Its I C Interface can be
1
clocked at a maximum of 1Mbit/s with a theoretical maximum transfer of 568KB/s , thus makes
communication between the microcontroller and PDIUSBD11 quite a bit slower than the 12Mbits/s
achievable with a full speed USB device.
The PDIUSBD11 is a 3.3v device with 5V tolerant I/O. Dont let this put you off when considering your
design. A small low powered 3.3Volt regulator is all that is needed to interface to your 5V logic. The I/O
pins are open drain, thus using pull up resistors to 5V, a 0 to 5v logic output is obtainable. Unlike other
USB peripheral ICs such as Nationals USBN9602 which require a 48Mhz crystal, the PDIUSBD11 uses a
in-built PLL to derive its internal 48MHz from a 12MHz Crystal. Not only does this make it cheaper as
48MHz crystals are hard to obtain, but it also helps reduce EMI.
But with all these positives, there must be some negatives. Lack of documentation is one. Philips gives no
sample circuits in their data sheet, makes little effort to describe any supporting passive components
around it and assumes you will consult the USB Specification for most data. After numerous contacts, and
reading between the lines a basic circuit can be sought. What is more worrying is the software. Philips has
left out critical initialisation information regarding the disabling of the HUB, and has repeatedly specified
wrong commands for the clearing of interrupts. It would be almost impossible to get the PDIUSBD11 going
from just the data sheet alone.
Oscillator
As discussed, the clock is generated by a 12MHz Crystal. The data sheet suggests that no external
components other than the crystal are needed. This is true in many cases, however Guy Jaumotte from
Philip Semiconductor states they are not needed, but are used to guarantee start-up. Its definitely much
easier to add them rather than argue and have oscillator problems later down the track. When designing a
board, its wise to place pads for the capacitors even if you do not add them during manufacture.
The data sheet would suggest some series termination resistors are required to connect the transceiver to
the USB Cable. This is the classic case where Philips expects you to look up the USB Spec, with little
knowledge of whats actually in the PDIUSBD11. 22ohm 1% resistors have been used in this example,
but its suggested that anything from 22ohms to 44ohms can be used. Their purpose is impedance
matching of the bus. The analog input pins, have an internal pull down resistor of approximately 15K and a
TM
software selectable pull up resistor to D+, known as SoftConnect .
VBUS
VBUS is used to detect a connection to the USB Bus. Without a presence, the PDIUSBD11 doesnt generate
any interrupts or returns a status. VBUS is also used to enable SoftConnect should SoftConnect be enabled
using the Set Mode command. The PDIUSBD11, being 5V tolerant will allow the VBUS pin to be connected
directly to the 5V Bus power supply. However being a 3.3V device, its wise to use a voltage divider
network to obtain 3.3v for the VBUS Pin. However as we will discover complications will result in suspend.
The PDIUSBD11 is 5.5 Volt tolerant (see Data sheet) so you can connect directly the Bus power supply line to the
VBUS pin. However the device Vcc is 3.3 Volt so it make sense to connect the Bus power line via a divider network.
Any combination of resistor will do providing that take into account the maximum voltage drop allowed on Vbus(See
USB specs), the minimum voltage that is recognised as a HIGH in 3.3Volt technology (approx 2Volt) and the maximum
consumption allowed in suspend mode (500microAmp). In a Self power mode, the pin consumes 1 microAmp and you
have to take into account the bus divider network consumption [Vbus - 1.5KOhm - D+ - 15KOhm - GND]
Guy.Jaumotte@Philips.com
3.3V
Ferrite Bead
C5
R6 0.1uF
320K
VCC VCC VCC VCC
U1
R11 10K
R10 4K7
R7 C3 C6
R8 4K7
R9 4K7
PDIUSBD11 +3.3V
680K
0.1uF 1uF 6 2
VCC RESET
15 5
AVCC CLKOUT
USB1
VCC 16 7 O.D.
1 VBUS SUSPEND Suspend
D- R4 22 13 8 O.D.
2 D- INT INT
D+ R5 22 12 9 O.D.
3 D+ SDA Data
GND 14 10 O.D.
4 AGND SCL Clock
Type B 3 1
OSC1 TEST
4 11
OSC2 GND
Contact No. Signal Name
1 VCC
2 - Data X1 12Mhz
3 + Data C1 C2 VCC U2 78L033 3.3V
4 GND 22pf 22pf 1 3
Vin Vout
USB Contact Numbers per USB1.1 Spec
G
+ C8 + C7 C4
Receptacle Series A Receptical Series B
10uF 10uF 0.1uF
2
2 1
1 2 3 4 3 4
TM
SoftConnect
Note that the USB specification calls for a 1.5k 5% (1425 to 1575) pull up resistor on D+. Philips
specifies a SoftConnect pull up resistor with a range of 1.1k minimum and a maximum of 1.9k which
has a tolerance closer to 30%, than the USB Specs 5%. Philips specifies this in their data sheet ensuring
the design engineer that VSE voltage specification can still be meet and the end designer lies with the
option of using it or not.
Essentially if you use SoftConnect, it is out of spec and not USB compliant. You could use you own
termination resistor, but you have to find a 3.3V source to connect it too, bearing in mind that the VBUS is 5
volts. However as you will need a 3.3 Volt 0.3V supply for the PDIUSBD11 in bus powered designs this
should not be a problem. The other consequence of using an external pull up resistor is that it can only be
connected when VBUS is present. The USB specification states that no power can be applied to the data
lines in the absence of VBUS.This is once again not a problem for bus powered designs as you can still
connect it to your regulated 3.3V supply which is derived from VBUS
The PDIUSBD11 doesnt mention much about power consumption. Power consumption is big business
with USB, if you draw too much current, you violate the USB Spec. The PDIUSBD11 draws around 25mA
during normal operation. The data sheet specifies no minimum, maximum or typical values for power
consumption in fully operational nor suspends states!
A USB device specifies its power consumption expressed in 2mA units in the configuration descriptor. A
device cannot increase its power consumption, greater than what it specifies during enumeration, even if it
loses external power. There are three classes of USB functions, low power bus powered functions, high
power bus powered functions, and self powered functions.
Self power functions may draw up to 1 unit load from the bus and derive the rest of its power from an
external source. Should this external source fail, it must have provisions in place to draw no more than 1
unit load from the bus. Self powered functions are easier to design to spec as there is not so much of an
issue with power consumption.
Bus Powered
During initialisation and enumeration the maximum power drain that USB 1.1 permits is 100mA. As the
PDIUSBD11 consumes approximately 25mA, there is a 75mA excess for the microcontroller and support
circuitry. A low powered device must be capable of operating on a minimum 4.40V to maximum 5.25v at
the plug of the USB device.
However during suspend, additional constrains come into force. The maximum suspend current is
proportional to the unit load. For a 1 unit load devices (default) the maximum suspend current is 500uA.
This includes current from the pull up and pull down resistors on the bus. The PDIUSBD11 drains
approximately 210uA during suspend. Of this approximately 200uA is due to the internal pull up resistor on
D+. This leaves approximately 290uA to play with.
However this is dependent on what we have done with VBUS. If you have used the 680K/320K voltage
divider then you are sinking 5A into the divider network. The input leakage current of VBUS being a digital
I/O pin is 5A max. Guy Jaumotte suggests this figure is closer to 1A typical. Another consideration is the
required 3.3V regulator for bus powered designs.
Suspend Mode
Every USB device must support suspend. However this is another area the data sheet avoids.
The PDIUSBD11 can enter suspend mode in various ways such as,
Selective Suspend Host sends a suspend command to the attached port.
Global Suspend The host suspends its self.
No activity on bus for more than 3 SOF ~ 3mS.
Each 1mS a SOF (Start of Frame) packet should be sent on the USB. This is the responsibility of the host.
When the bus goes into suspend, the SOF every 1mS will seize to exist. The PDIUSBD11 will wait for 3mS
without the presence of a SOF. It will then allow its Suspend pin to go high, signalling to the microcontroller
that it is about to enter the suspend state and to stop finishing any processing and go to sleep. The entire
USB device (PDIUSBD11, MicroController and Support Circuitry) must not drain anymore than 500uA from
VBUS when in suspend. This of course is not so much of an issue for Self Powered devices. 1mS after the
suspend pin goes low, the ClockOut will go into Lazy Clock Output if this feature is selected. These
features are selected by the Configuration Byte as detailed below.
Configuration Byte
No Lazy Clock
Clock Running
Selected Configuration Current Consumed
(Bit 1) (Bit 2)
ClockOut will switch to Lazy Clock Mode (Frequency ~2.5mA
30KHz 40%) 1mS after suspend pin goes high. Internal (External C will run at
0 0 slower speed, reducing
Clock, Crystal Oscillator and PLL will stop during suspend,
current if connected)
consuming less power.
ClockOut will switch to Lazy Clock Mode (Frequency ~25mA
30KHz 40%) 1mS after suspend pin goes high. Internal External C will run at
0 1 slower speed, reducing
Clock. Crystal Oscillator and PLL are always running
current if connected)
regardless of suspend mode.
Internal Clock, Crystal Oscillator and PLL is stopped ~210A
1 0 (Assuming SoftConnectTM
during suspend as a result, ClockOut seizes to run.
Active)
ClockOut stays at its original speed. The Internal Clock,
~25mA
1 1 Crystal Oscillator and PLL are always running regardless
(+ Full load of attached C)
of suspend mode.
The data sheet is rather misleading in this area. With the suspend pin specified as an output only and the
resume command saying This command is normally issued when the device is in suspend, one would
assume you would simply send the Resume Command. This is not the case.
If the microcontroller wishes to wake up the PDIUSBD11, it pulls the suspend pin low. The PDIUSBD11 will
come out of suspend, but cant talk on the Bus as there are no SOF Packets every 1mS. To wake up the
Host, the Send Resume command is then sent to the PDIUSBD11.
2
I C Protocol Interface
2
The PDIUSBD11 uses the Philips I C protocol which can be a little daunting if you have never used it
2
before. Unlike other serial buses such as SPI and Microwire which have individual chip selects, I C sends
an address down the bus after a start condition. Only the device which has the matching address will
respond to the following commands until either a restart condition or a stop/start condition is generated
2
again. As I C is multi-master, a restart condition will allow the host to re-issue an address without giving up
its control of the bus. Sending a stop condition means the device no longer requires the bus and should
another device want to talk on the bus, it can generate a start condition and take over as master.
Instead of the PDIUSBD11 having only one address as you would expect, the PDIUSBD11 has three
addresses for simplicity. This allows information about the data to follow e.g. is it command/data or
2
read/write to be efficiently encoded into the address. This is not entirely correct in the context of the I C
specification, as it has two addresses (Command/Data) and a direction bit (LSBit) which specifies
read/write operations as shown below.
2 Combined
Function I Caddress D
Address
Command Write 0011 011 0 0x36
Data Write 0011 010 0 0x34
Data Read 0011 010 1 0x35
The wafer of the PDIUSBD11 is the same in both the HUB (PDIUSBH11A) and Device/Function chips
(PDIUSBD11). What Philips Semiconductor omits from the data sheet is that you need to disable the hub
before you can use the embedded function. Failure to do so, will result in setup packets being received on
the HUBs default port and not the embedded functions. They do however mention the initialisation in their
FAQ but have once again missed it in their latest revision of the data sheet, dated 22 July 1999. (Before
that, one could off assumed they lost the original/editable data sheet!)
The PDIUSBD11 is effectively the embedded function 1 of a PDIUSBH11A(HuB). We have taken the silicon of the
PDIUSBH11A and bounded the embedded function 1. This has for consequence that the HUB is still present and
active inside the PDIUSBD11. The Hub part MUST be disabled at power-on and AFTER Bus reset by sending the
command 0xD0(Set Address(Hub)) and writing the data 0x00(Address 0 disabled). The same can be done for the
hub endpoints. Guy.Jaumotte@Philips.com
Another thing you must note, is that the HUB is re-enabled on a Bus Reset. It is therefore, necessary to
disable the hub and enable the Embedded Function every time a Bus Reset Interrupt occurs.
Notes :
(1) http://www-eu3.semiconductors.com/usb/products/interface/pdiusbd11/faq/#2.1 PDIUSBD11 FAQ
TM
(2) SoftConnect is a patent pending technology from Philips Semiconductors
Command 0xD0 Set Hub Address Data Command followed by a Write of One Data Byte
0xD1 Set Embedded Function 1s Address with the format below.
0xD2 Embedded Function Two (PDIUSBH11)
0xD3 Embedded Function Three (PDIUSBH11)
7 6 5 4 3 2 1 0
Enable Address
This command will enable the desired function (bit 7) and set its address. A 1 in bit 7 enables the function. The
low seven bits are used to set the functions address. When first powered up, an address of zero is used, until the
Host issues the Set Address Device Request (Chapter 9 USB Spec) during enumeration.
The PDIUSBD11 contains the same silicon than the Philips PDIUSBH11A HUB. As a result, the HUB powers up
enabled and thus needs to be turned off at initialisation and after a Bus Reset.
Command 0xD8 Set Endpoint Enable Data Command followed by a Write of One Data Byte
with the format below
7 6 5 4 3 2 1 0
X X X X 0 0 0 0 Power on Reset
Generic
Reserved Reserved Reserved Reserved Reserved Reserved Endpoint Reserved
Enable
When the function is enabled, only its Default Control Pipe (Endpoint 2 & 3) are enabled. During enumeration, your
device will describe to the host the type of Generic Endpoints it wishes to use in the form of an Endpoint Descriptor.
Later during enumeration the host will send the Set Configuration Device Request (Chapter 9 USB Spec). At this
point you can enable your Generic Endpoints. Note that many devices will enable the Generic Endpoints at Power
Up and this does not effect the functionality of the device.
Set Mode
Command 0xF3 Set Mode Data Command followed by writing two data bytes
with format below,
Byte 1 - Configuration
7 6 5 4 3 2 1 0
1 0 0 0 1 1 0 1 Power on Reset
Embedded
Soft Debug Clock No Lazy Remote
Function X X
Mode Connect Mode Running Clock Wakeup
Remote Wakeup Setting this bit enables the Remote Wakeup Feature. A bus reset will enable this function.
No Lazy Clock Clearing this bit, ensures the clock will not switch to lazy clock mode (~30kHz) 1ms after
Suspend. This value does not change on a Bus Reset.
Byte 2 sets the frequency of the clock output. Should you desire either a default 4MHz clock or do not wish to use
the clock then this byte can be ignored. The power on value is 3 giving a default clock out of 4MHz which is quite
common for many microcontrollers. Of course faster microcontrollers can power up on 4Mhz and then set the Mode
to run at their full speed. The expected clock frequency is 48MHz/(N+1) where N is the clock divisor.
The PDIUSBD11 data sheet shows only the low nibble being used. However after accidental playing, it was found
to be the same than the PDIUSBH11A, using the lowest 6 bits for the divisor. Thus care must be taken with the
extra two bits. They are NOT dont cares as the data sheet would suggest.
Command 0xF4 Read Interrupt Register Data Read Two Data Bytes
After an interrupt has occurred a read of this command will show what event caused the interrupt. Each bit is
3
cleared by reading the Read Last Transaction Status . However should a Bus Reset Interrupt occur, reading the
Interrupt Register (0xF4) will clear this flag.
The Interrupt pin on the PDIUSBD11 is an active low signal which gets pulled low after an interrupt has occurred
and remains their until all interrupts are cleared. Most microcontrollers will accept an Edge Sensitive Interrupt,
however few will accept a Level Sensitive Interrupt. There are two ways of approaching this problem. What Philips
does in many of their examples is simply poll the interrupt register continuously and branch to a handler should an
interrupt be pending. This opens up the use of the INT pin on the microcontroller to other possibilities.
The other option is to generate an interrupt on the falling edge and when the first handler has finished, before
returning from the interrupt, check if any other interrupts are still pending and if so handle these. This way, not all
you idle cycles are being taken up with polling the interrupt register.
3
Note : The PDIUSBD11 Data Sheet would suggest that the Interrupt Register is cleared by reading the Read Endpoint Status
Command. This is an error that Philips Semiconductors acknowledges in their FAQ. Please refer to
http://www-eu3.semiconductors.com/usb/products/interface/pdiusbd11/faq.html#4.1 4.1 How is the Interrupt Flag cleared?
nd
Also note that this error is still not fixed in their latest revision of the Data Sheet dated 22 July 1999
Command 0x02 Select Control Out Endpoint Data Read One Byte Optional
0x03 Select Control In Endpoint
0x04 Select Generic Endpoint 1 IN
0x05 Select Generic Endpoint 1 OUT
0x06 Select Generic Endpoint 2 OUT
0x07 Select Generic Endpoint 2 IN
0x08 Select Generic Endpoint 3 OUT
0x09 Select Generic Endpoint 3 IN
7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 Power on Reset
Buffer
Reserved Reserved Reserved Reserved Reserved Reserved Reserved
Full
This command will select the desired endpoint (Set the Internal Pointer) for a subset of commands. Changing
endpoints will reset the pointer. An optional byte can be read to determine if the Endpoint Buffer selected is full or
empty. This is seldom used in the interest of efficiency, as the Read Endpoint Status command will indicate if the
Buffer is full plus other information. It bit 1 is set, then the Buffer is Full.
Command 0x42 Read Last Transaction Status for the Control Out Endpoint Data Read One Byte
0x43 Read Last Transaction Status for the Control In Endpoint
0x44 Read Last Transaction Status for the Generic Endpoint 1 IN
0x45 Read Last Transaction Status for the Generic Endpoint 1 OUT
0x46 Read Last Transaction Status for the Generic Endpoint 2 OUT
0x47 Read Last Transaction Status for the Generic Endpoint 2 IN
0x48 Read Last Transaction Status for the Generic Endpoint 3 OUT
0x49 Read Last Transaction Status for the Generic Endpoint 3 IN
7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 Power on Reset
Previous Data
Data 0/1 Setup Receive
Status Error Code Transmit
Packet Packet
not Read Success
This command is intended for debugging. It will return a byte showing the status of the last transaction on the
requested Endpoint without resetting any internal pointers set by the Set Endpoint Command.
Code Error
0000 No Error
0001 PID Encoding Error
0010 PID Unknown
0011 Unexpected Packet
0100 Token CRC Error
0101 Data CRC Error
0110 Time Out Error
0111 Babble Error
1000 Unexpected End of Packet
1001 Sent or Received NAK
1010 Sent Stall
1011 Overflow Error
1101 BitStuff Error
1111 Wrong DATA PID
Command 0x82 Read Control OUT Endpoint Status Data Read One Byte
0x83 Read Control IN Endpoint Status
0x84 Read Generic Endpoint 1 IN Endpoint Status
0x85 Read Generic Endpoint 1 OUT Endpoint Status
0x86 Read Generic Endpoint 2 OUT Endpoint Status
0x87 Read Generic Endpoint 2 IN Endpoint Status
0x88 Read Generic Endpoint 3 OUT Endpoint Status
0x89 Read Generic Endpoint 3 IN Endpoint Status
7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 Power on Reset
Buffer Data 0/1 Setup
Reserved Reserved Stalled Reserved Reserved
Full Packet Packet
The same command is sent to Read or Write Data. The desired operation is selected by the data phase. The
PDIUSBD11 contains an area of linear RAM segmented into Endpoint buffers. The Read or Write Commands will
not set the PDIUSBD11s Internal RAM pointer to the start of the particular 8 byte buffer. This is done using the
Select Endpoint Command.
After a byte has been written or read the internal pointer is incremented. Beware that there is no protection from
reading or writing into the next endpoints buffer.
Clear Buffer
After a packet has been received the buffer full flag is set and the PDIUSBD11 will issue NAK to additional packets
send to the endpoint until the Buffer Clear Flag is cleared. Therefore once data has been received it should be read
and on completion of reading the data the clear buffer command should be issued to enable subsequent packets to
be received. Failure to do so will inhibit an more packets being received on this endpoint.
Validate Buffer
Once data has been written to a IN Buffer, the Validate Buffer command should be set. This tells the PDIUSBD11
that the data is complete and should be sent when the next IN Token is received.
Command 0x42 Set Control OUT Endpoint Status Data Write one byte with the following format
0x43 Set Control IN Endpoint Status
0x44 Set Generic Endpoint 1 IN Endpoint Status
0x45 Set Generic Endpoint 1 OUT Endpoint Status
0x46 Set Generic Endpoint 2 OUT Endpoint Status
0x47 Set Generic Endpoint 2 IN Endpoint Status
0x48 Set Generic Endpoint 3 OUT Endpoint Status
0x49 Set Generic Endpoint 3 IN Endpoint Status
7 6 5 4 3 2 1 0
X X X X X X X 0 Power on Reset
Reserved Reserved Reserved Reserved Reserved Reserved Reserved Stalled
This command can be used to stall endpoints. Endpoints can be stalled, if they are not in use or if a command is
not supported, among other reasons. A Setup Packet will be received regardless if the endpoint is stalled or not.
Should the endpoint be stalled when it receives a Setup Packet, another Set Endpoint Status command will need to
be sent to stall the endpoint again.
If a Zero is written to un-stall an endpoint, even if the endpoint is already un-stalled, the buffer is cleared and If the
endpoint is an IN endpoint, the PDIUSBD11 will send a DATA 0 PID to the host. If the endpoint is an OUT Endpoint
the PDIUSBD11 will wait for a DATA0 PID. This procedure is the same should a Setup Packet un-stall the
Endpoint.
The Set Endpoint Status shares the same command numbering than the Read Last Transaction Status. The data
phase will determine which command is sought after.
Acknowledge Setup
When a Setup Packet is received, the PDIUSBD11 will clear the Control IN Endpoint Buffer, and disable the
Validate Buffer and Clear Buffer commands until the packet is acknowledged by the controller, by sending the
Acknowledge Setup Command to both IN & OUT Control Endpoints.
This prevents the Setup packet from being overridden and any packets being sent back to the host.
Send Resume
This command will send the resume signal upstream to the hub or host. This can be used to wake the host up.
The Read Current Frame Number can be used to return the current 16 Bit Frame Number of the last SOF received
successfully. The LSByte is returned first, followed by the MSByte.
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Do you know what named pipes you have on a system, quietly advertising for something to connect to it? Do
you know how secure each pipe is, whether the associated security descriptor is strong enough?. The Win32
Pipe Security Editor is the ideal tool for checking the security of your own pipe servers or to set up auditing of
existing pipe servers.
G:\pipeacl
\\.\pipe\POLICYAGENT
\\.\pipe\winlogonrpc
\\.\pipe\WMIEP_f0
\\.\pipe\net\NtControlPipe14
\\.\pipe\AlertRPC
\\.\pipe\ScanRPC
\\.\pipe\WMIEP_4dc
\\.\pipe\WMIEP_208
\\.\pipe\SfcApi
\\.\pipe\net\NtControlPipe15
\\.\pipe\WMIEP_5ac
\\.\pipe\WMIEP_760
\\.\pipe\net\NtControlPipe16
\\.\pipe\beyondexec-dispatch
Given a specific pipe, the security privileges can be viewed or modified via a standard Windows Security
Editor Property Page. The user may view or change the discretionary access-control list (DACL) changing the
access rights to the pipe, the system access-control list (SACL) used for auditing or the owner of the pipe.
This allows for security checks to be made of hidden system services and programs.
Most pipes have a security desciptor hardcoded into the service or executable responsible for the creation of
the pipe. As a result, any changes made to the security of the pipe will only last for the duration the service is
running for. If the pipe is recreated due to stopping the parent service, or if the PC is rebooted the default
security descriptor will be reloaded. This however gives a window of opportunity to audit a pipe while a server
remains operational.
Win32 pipes act as part of the network file system on SMB. As such authentication is required to connect to
most pipes. This authentication can be as weak as NULL session. A registry key dictates which Win32 Pipes
are allowed to be connected with a NULL session. This is a typical key from a Windows 2000 SP3 system.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters
\NullSessionPipes =
COMNAP COMNODE SQL\QUERY SPOOLSS LLSRPC EPMAPPER LOCATOR TrkWks TrkSvr
Usage
G:\pipeacl /?
Usage:
To display the Security Descriptor Editor for a Win32 Pipe on the local
computer use :
pipeacl \\.\pipe\
Download
Revision History
22nd June 2003 - Version 1.00
First release to public. Tested on Windows XP, Windows 2000 and Windows NT4 with the
Links :
Security Configuration Manager for NT4 - A required install to run the Win32 Pipe Security Editor on
Windows NT4 boxes.
acltools1.0 - LSA and SAM Security Editors - (Razor)
winsradacl.zip - Interactive Window Station / Desktop DACL Editor - (Keith Brown)
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
The Parallel Port is the most commonly used port for interfacing home made projects. This port will allow the input of up
to 9 bits or the output of 12 bits at any one given time, thus requiring minimal external circuitry to implement many
simpler tasks. The port is composed of 4 control lines, 5 status lines and 8 data lines. It's found commonly on the back
of your PC as a D-Type 25 Pin female connector. There may also be a D-Type 25 pin male connector. This will be a
serial RS-232 port and thus, is a totally incompatible port.
Newer Parallel Ports are standardized under the IEEE 1284 standard first released in 1994. This standard defines 5
modes of operation which are as follows,
1. Compatibility Mode.
2. Nibble Mode. (Protocol not Described in this Document)
3. Byte Mode. (Protocol not Described in this Document)
4. EPP Mode (Enhanced Parallel Port).
5. ECP Mode (Extended Capabilities Mode).
The aim was to design new drivers and devices which were compatible with each other and also backwards compatible
with the Standard Parallel Port (SPP). Compatibility, Nibble & Byte modes use just the standard hardware available on
the original Parallel Port cards while EPP & ECP modes require additional hardware which can run at faster speeds,
while still being downwards compatible with the Standard Parallel Port.
Compatibility mode or "Centronics Mode" as it is commonly known, can only send data in the forward direction at a
typical speed of 50 kbytes per second but can be as high as 150+ kbytes a second. In order to receive data, you must
change the mode to either Nibble or Byte mode. Nibble mode can input a nibble (4 bits) in the reverse direction. E.g.
from device to computer. Byte mode uses the Parallel's bi-directional feature (found only on some cards) to input a byte
Extended and Enhanced Parallel Ports use additional hardware to generate and manage handshaking. To output a byte
to a printer (or anything in that matter) using compatibility mode, the software must,
This limits the speed at which the port can run at. The EPP & ECP ports get around this by letting the hardware check
to see if the printer is busy and generate a strobe and /or appropriate handshaking. This means only one I/O instruction
need to be performed, thus increasing the speed. These ports can output at around 1-2 megabytes per second. The
ECP port also has the advantage of using DMA channels and FIFO buffers, thus data can be shifted around without
using I/O instructions.
Hardware Properties
Below is a table of the "Pin Outs" of the D-Type 25 Pin connector and the Centronics 34 Pin connector. The D-Type 25
pin connector is the most common connector found on the Parallel Port of the computer, while the Centronics
Connector is commonly found on printers. The IEEE 1284 standard however specifies 3 different connectors for use
with the Parallel Port. The first one, 1284 Type A is the D-Type 25 connector found on the back of most computers. The
2nd is the 1284 Type B which is the 36 pin Centronics Connector found on most printers.
IEEE 1284 Type C however, is a 36 conductor connector like the Centronics, but smaller. This connector is claimed to
have a better clip latch, better electrical properties and is easier to assemble. It also contains two more pins for signals
which can be used to see whether the other device connected, has power. 1284 Type C connectors are recommended
for new designs, so we can look forward on seeing these new connectors in the near future.
nSelect-Printer /
17 36 In/Out Control Yes
nSelect-In
18 - 25 19-30 Ground Gnd
Table 1. Pin Assignments of the D-Type 25 pin Parallel Port Connector.
The above table uses "n" in front of the signal name to denote that the signal is active low. e.g. nError. If the printer has
occurred an error then this line is low. This line normally is high, should the printer be functioning correctly. The
"Hardware Inverted" means the signal is inverted by the Parallel card's hardware. Such an example is the Busy line. If
+5v (Logic 1) was applied to this pin and the status register read, it would return back a 0 in Bit 7 of the Status Register.
The output of the Parallel Port is normally TTL logic levels. The voltage levels are the easy part. The current you can
sink and source varies from port to port. Most Parallel Ports implemented in ASIC, can sink and source around 12mA.
However these are just some of the figures taken from Data sheets, Sink/Source 6mA, Source 12mA/Sink 20mA, Sink
16mA/Source 4mA, Sink/Source 12mA. As you can see they vary quite a bit. The best bet is to use a buffer, so the
least current is drawn from the Parallel Port.
Centronics?
Centronics is an early standard for transferring data from a host to the printer. The majority of printers use this
handshake. This handshake is normally implemented using a Standard Parallel Port under software control. Below is a
simplified diagram of the `Centronics' Protocol.
Data is first applied on the Parallel Port pins 2 to 7. The host then checks to see if the printer is busy. i.e. the busy line
should be low. The program then asserts the strobe, waits a minimum of 1uS, and then de-asserts the strobe. Data is
normally read by the printer/peripheral on the rising edge of the strobe. The printer will indicate that it is busy processing
data via the Busy line. Once the printer has accepted data, it will acknowledge the byte by a negative pulse about 5uS
on the nAck line.
Quite often the host will ignore the nAck line to save time. Latter in the Extended Capabilities Port, you will see a Fast
Centronics Mode, which lets the hardware do all the handshaking for you. All the programmer must do is write the byte
of data to the I/O port. The hardware will check to see if the printer is busy, generate the strobe. Note that this mode
commonly doesn't check the nAck either.
Port Addresses
The Parallel Port has three commonly used base addresses. These are listed in table 2, below. The 3BCh base
address was originally introduced used for Parallel Ports on early Video Cards. This address then disappeared for a
while, when Parallel Ports were later removed from Video Cards. They has now reappeared as an option for Parallel
Ports integrated onto motherboards, upon which their configuration can be changed using BIOS.
LPT1 is normally assigned base address 378h, while LPT2 is assigned 278h. However this may not always be the case
as explained later. 378h & 278h have always been commonly used for Parallel Ports. The lower case h denotes that it
is in hexadecimal. These addresses may change from machine to machine.
Address Notes:
3BCh - 3BFh Used for Parallel Ports which were incorporated on to Video
Cards - Doesn't support ECP addresses
378h - 37Fh Usual Address For LPT 1
278h - 27Fh Usual Address For LPT 2
Table 2 Port Addresses
When the computer is first turned on, BIOS (Basic Input/Output System) will determine the number of ports you have
and assign device labels LPT1, LPT2 & LPT3 to them. BIOS first looks at address 3BCh. If a Parallel Port is found here,
it is assigned as LPT1, then it searches at location 378h. If a Parallel card is found there, it is assigned the next free
device label. This would be LPT1 if a card wasn't found at 3BCh or LPT2 if a card was found at 3BCh. The last port of
call, is 278h and follows the same procedure than the other two ports. Therefore it is possible to have a LPT2 which is
at 378h and not at the expected address 278h.
What can make this even confusing, is that some manufacturers of Parallel Port Cards, have jumpers which allow you
to set your Port to LPT1, LPT2, LPT3. Now what address is LPT1? - On the majority of cards LPT1 is 378h, and LPT2,
278h, but some will use 3BCh as LPT1, 378h as LPT1 and 278h as LPT2. Life wasn't meant to be easy.
The assigned devices LPT1, LPT2 & LPT3 should not be a worry to people wishing to interface devices to their PC's.
Most of the time the base address is used to interface the port rather than LPT1 etc. However should you want to find
the address of LPT1 or any of the Line PrinTer Devices, you can use a lookup table provided by BIOS. When BIOS
assigns addresses to your printer devices, it stores the address at specific locations in memory, so we can find them.
Note 1 : Address 0000:040E in the BIOS Data Area may be used as the Extended Bios Data Area in PS/2 and newer
Bioses.
The above table, table 3, shows the address at which we can find the Printer Port's addresses in the BIOS Data Area.
Each address will take up 2 bytes. The following sample program in C, shows how you can read these locations to
obtain the addresses of your printer ports.
#include <stdio.h>
#include <dos.h>
void main(void)
{
unsigned int far *ptraddr; /* Pointer to location of Port Addresses */
unsigned int address; /* Address of Port */
int a;
Note 1 : If the Port is Bi-Directional then Read and Write Operations can be performed on the Data Register.
The base address, usually called the Data Port or Data Register is simply used for outputting data on the Parallel Port's
data lines (Pins 2-9). This register is normally a write only port. If you read from the port, you should get the last byte
sent. However if your port is bi-directional, you can receive data on this address. See Bi-directional Ports for more
detail.
The Status Port (base address + 1) is a read only port. Any data written to this port will be ignored. The Status Port is
made up of 5 input lines (Pins 10,11,12,13 & 15), a IRQ status register and two reserved bits. Please note that Bit 7
(Busy) is a active low input. E.g. If bit 7 happens to show a logic 0, this means that there is +5v at pin 11. Likewise with
Bit 2. (nIRQ) If this bit shows a '1' then an interrupt has not occurred.
The Control Port (base address + 2) was intended as a write only port. When a printer is attached to the Parallel Port,
four "controls" are used. These are Strobe, Auto Linefeed, Initialize and Select Printer, all of which are inverted except
Initialize.
The printer would not send a signal to initialize the computer, nor would it tell the computer to use auto linefeed.
However these four outputs can also be used for inputs. If the computer has placed a pin high (e.g. +5v) and your
device wanted to take it low, you would effectively short out the port, causing a conflict on that pin. Therefore these lines
are "open collector" outputs (or open drain for CMOS devices). This means that it has two states. A low state (0v) and a
high impedance state (open circuit).
Normally the Printer Card will have internal pull-up resistors, but as you would expect, not all will. Some may just have
open collector outputs, while others may even have normal totem pole outputs. In order to make your device work
correctly on as many Printer Ports as possible, you can use an external resistor as well. Should you already have an
internal resistor, then it will act in Parallel with it, or if you have Totem pole outputs, the resistor will act as a load.
An external 4.7k resistor can be used to pull the pin high. I wouldn't use anything lower, just in case you do have an
internal pull up resistor, as the external resistor would act in parallel giving effectively, a lower value pull up resistor.
When in high impedance state the pin on the Parallel Port is high (+5v). When in this state, your external device can
pull the pin low and have the control port change read a different value. This way the 4 pins of the Control Port can be
used for bi-directional data transfer. However the Control Port must be set to xxxx0100 to be able to read data, that is
all pins to be +5v at the port so that you can pull it down to GND (logic 0).
Bits 4 & 5 are internal controls. Bit four will enable the IRQ (See Using the Parallel Ports IRQ) and Bit 5 will enable the
bi-directional port meaning that you can input 8 bits using (DATA0-7). This mode is only possible if your card supports
it. Bits 6 & 7 are reserved. Any writes to these two bits will be ignored.
Bi-directional Ports
The schematic diagram below, shows a simplified view of the Parallel Port's Data Register. The original Parallel Port
card's implemented 74LS logic. These days all this is crammed into one ASIC, but the theory of operation is still the
same.
The non bi-directional ports were manufactured with the 74LS374's output enable tied permanent low, thus the data
port is always output only. When you read the Parallel Port's data register, the data comes from the 74LS374 which is
also connected to the data pins. Now if you can overdrive the '374 you can effectively have a Bi-directional Port. (or a
input only port, once you blow up the latches output!)
What is very concerning is that people have actually done this. I've seen one circuit, a scope connected to the Parallel
Port distributed on the Internet. The author uses an ADC of some type, but finds the ADC requires transistors on each
data line, to make it work! No wonder why. Others have had similar trouble, the 68HC11 cannot sink enough current (30
to 40mA!)
Bi-directional ports use Control Bit 5 connected to the 374's Output Enable so that it's output drivers can be turned off.
This way you can read data present on the Parallel Port's Data Pins, without having bus conflicts and excessive current
drains.
Bit 5 of the Control Port enables or disables the bi-directional function of the Parallel Port. This is only available on true
bi-directional ports. When this bit is set to one, pins 2 to 9 go into high impedance state. Once in this state you can
enter data on these lines and retrieve it from the Data Port (base address). Any data which is written to the data port will
be stored but will not be available at the data pins. To turn off bi-directional mode, set bit 5 of the Control Port to '0'.
However not all ports behave in the same way. Other ports may require setting bit 6 of the Control Port to enable Bi-
directional mode and setting of Bit 5 to dis-enable Bi-directional mode, Different manufacturers implement their bi-
directional ports in different ways. If you wish to use your Bi-directional port to input data, test it with a logic probe or
multimeter first to make sure it is in bi-directional mode.
If your Parallel Port doesn't support bi-directional mode, don't despair. You can input a maximum of 9 bits at any one
given time. To do this you can use the 5 input lines of the Status Port and the 4 inputs (open collector) lines of the
Control Port.
The inputs to the Parallel Port has be chosen as such, to make life easier for us. Busy just happens to be the MSB (Bit
7) of the Status Port, then in ascending order comes Ack, Paper Out and Select, making up the most significant nibble
of the Control Port. The Bars are used to represent which inputs are Hardware inverted, i.e. +5v will read 0 from the
register, while GND will read 1. The Status Port only has one inverted input.
The Control port is used to read the least significant nibble. As described before, the control port has open collector
outputs, i.e. two possible states, high impedance and GND. If we connect our inputs directly to the port (For example an
ADC0804 with totem pole outputs), a conflict will result if the input is high and the port is trying to pull it down. Therefore
we use open collector inverters.
However this is not always entirely necessary. If we were connecting single pole switches to the port with a pull up
resistor, then there is no need to bother with this protection. Also if your software initializes the control port with
xxxx0100 so that all the pins on the control port are high, then it may be unnecessary. If however you don't bother and
your device is connected to the Parallel Port before your software has a chance to initialize then you may encounter
problems.
Another problem to be aware of is the pull up resistors on the control port. The average pull-up resistor is 4.7k. In order
to pull the line low, your device will need to sink 1mA, which some low powered devices may struggle to do. Now what
happens if I suggest that some ports have 1K pull up resistors? Yes, there are such cards. Your device now has to sink
5mA. More reason to use the open collector inverters.
Open collector inverters were chosen over open collector buffers as they are more popular, and thus easier to obtain.
There is no reason, however why you can't use them. Another possibility is to use transistors.
The input, D3 is connected via the inverter to Select Printer. Select Printer just happens to be bit 3 of the control port.
D2, D1 & D0 are connected to Init, Auto linefeed and strobe, respectively to make up the lower nibble. Now this is done,
all we have to do is assemble the byte using software. The first thing we must do is to write xxxx0100 to the Control
Port. This places all the control port lines high, so they can be pulled down to input data.
Now that this is done, we can read the most significant nibble. This just happens to be the most significant nibble of the
status port. As we are only interested in the MSnibble we will AND the results with 0xF0, so that the LSnibble is clear.
Busy is hardware inverted, but we won't worry about it now. Once the two bytes are constructed, we can kill two birds
with one stone by toggling Busy and Init at the same time.
We can now read the LSnibble. This just happens to be LSnibble of the control port - How convenient! This time we are
not interested with the MSnibble of the port, thus we AND the result with 0x0F to clear the MSnibble. Once this is done,
it is time to combine the two bytes together. This is done by OR'ing the two bytes. This now leaves us with one byte,
however we are not finished yet. Bits 2 and 7 are inverted. This is overcome by XOR'ing the byte with 0x84, which
Note: Some control ports are not open collector, but have totem pole outputs. This is also the case with EPP
and ECP Ports. Normally when you place a Parallel Port in ECP or EPP mode, the control port becomes totem
pole outputs only. Now what happens if you connect your device to the Parallel Port in this mode? Therefore,
in the interest of portability I recommend using the next circuit, reading a nibble at a time.
Nibble Mode.
Nibble mode is the preferred way of reading 8 bits of data without placing the port in reverse mode and using the data
lines. Nibble mode uses a Quad 2 line to 1 line multiplexer to read a nibble of data at a time. Then it "switches" to the
other nibble and reads its. Software can then be used to construct the two nibbles into a byte. The only disadvantage of
this technique is that it is slower. It now requires a few I/O instructions to read the one byte, and it requires the use of an
external IC.
The operation of the 74LS157, Quad 2 line to 1 line multiplexer is quite simple. It simply acts as four switches. When
the A/B input is low, the A inputs are selected. E.g. 1A passes through to 1Y, 2A passes through to 2Y etc. When the A/
B is high, the B inputs are selected. The Y outputs are connected up to the Parallel Port's status port, in such a manner
that it represents the MSnibble of the status register. While this is not necessary, it makes the software easier.
To use this circuit, first we must initialize the multiplexer to switch either inputs A or B. We will read the LSnibble first,
thus we must place A/B low. The strobe is hardware inverted, thus we must set Bit 0 of the control port to get a low on
Pin 1.
Once the low nibble is selected, we can read the LSnibble from the Status Port. Take note that the Busy Line is
inverted, however we won't tackle it just yet. We are only interested in the MSnibble of the result, thus we AND the
result with 0xF0, to clear the LSnibble.
Now it's time to shift the nibble we have just read to the LSnibble of variable a,
We are now half way there. It's time to get the MSnibble, thus we must switch the multiplexer to select inputs B. Then
we can read the MSnibble and put the two nibbles together to make a byte,
The last line toggles two inverted bits which were read in on the Busy line. It may be necessary to add delays in the
process, if the incorrect results are being returned.
The Parallel Port's interrupt request is not used for printing under DOS or Windows. Early versions of OS-2 used them,
but don't anymore. Interrupts are good when interfacing monitoring devices such as high temp alarms etc, where you
don't know when it is going to be activated. It's more efficient to have an interrupt request rather than have the software
poll the ports regularly to see if something has changed. This is even more noticeable if you are using your computer for
other tasks, such as with a multitasking operating system.
The Parallel Port's interrupt request is normally IRQ5 or IRQ7 but may be something else if these are in use. It may also
be possible that the interrupts are totally disabled on the card, if the card was only used for printing. The Parallel Port
interrupt can be disabled and enabled using bit 4 of the control register, Enable IRQ Via Ack Line. Once enabled, an
interrupt will occur upon a low to high transition (rising edge) of the nACK. However like always, some cards may trigger
the interrupt on the high to low transition.
The following code is an Interrupt Polarity Tester, which serves as two things. It will determine which polarity your
Parallel Port interrupt is, while also giving you an example for how to use the Parallel Port's Interrupt. It checks if your
interrupt is generated on the rising or falling edge of the nACK line. To use the program simply wire one of the Data
lines (Pins 2 to 9) to the Ack Pin (Pin 10). The easiest way to do this is to bridge some solder from DATA7 (Pin 9) to
ACK (Pin 10) on a male DB25 connector.
#include <dos.h>
void main(void)
{
int c;
int intno; /* Interrupt Vector Number */
int picmask; /* PIC's Mask */
clrscr();
printf("Parallel Port Interrupt Polarity Tester\n");
printf("IRQ %d : INTNO %02X : PIC Addr 0x%X : Mask 0x%02X\n",IRQ,intno,picaddr,
picmask);
interflag = 0; /* Reset Interrupt Flag */
delay(10);
outportb(DATA,0x00); /* High to Low Transition */
delay(10); /* Wait */
if (interflag == 1) printf("Interrupts Occur on High to Low Transition of ACK.\n");
else
{
outportb(DATA,0xFF); /* Low to High Transition */
delay(10); /* wait */
if (interflag == 1) printf("Interrupts Occur on Low to High Transition of ACK.
\n");
else printf("No Interrupt Activity Occurred. \nCheck IRQ Number, Port Address
and Wiring.");
}
At compile time, the above source may generate a few warnings, condition always true, condition always false,
unreachable code etc. These are perfectly O.K. They are generated as some of the condition structures test which IRQ
you are using, and as the IRQ is defined as a constant some outcomes will never change. While they would of been
better implemented as a preprocessor directive, I've done this so you can cut and paste the source code in your own
programs which may use command line arguments, user input etc instead of a defined IRQ.
To understand how this example works, the reader must have an assumed knowledge and understanding of Interrupts
and Interrupt Service Routines (ISR). If not, See Interfacing the PC : Using Interrupts for a quick introduction.
The first part of the mainline routine calculates the Interrupt Vector, PIC Addr & Mask in order to use the Parallel Port's
Interrupt Facility. After the Interrupt Service Routine (ISR) has been set up and the Programmable Interrupt Controller
(PIC) set, we must enable the interrupt on the Parallel Port. This is done by setting bit 4 of the Parallel Port's Control
Register using
outportb(CONTROL,inportb(CONTROL) | 0x10);
Before enabling the interrupts, we wrote 0xFF to the Parallel Port to enable the 8 data lines into a known state. At this
point of the program, all the data lines should be high. The interrupt service routine simply sets a flag (interflag), thus we
can determine when an IRQ occurs. We are now in a position to write 0x00 to the data port, which causes a high to low
transition on the Parallel Port's Acknowledge line as it's connected to one of the data lines.
If the interrupt occurs on the high to low transition, the interrupt flag (interflag) should be set. We now test this, and if
this is so the program informs the user. However if it is not set, then an interrupt has not yet occurred. We now write
0xFF to the data port, which will cause a low to high transition on the nAck line and check the interrupt flag again. If set,
then the interrupt occurs on the low to high transition.
However if the interrupt flag is still reset, then this would suggest that the interrupts are not working. Make sure your
IRQ and Base Address is correct and also check the wiring of the plug.
Today, most Parallel Ports are mulimode ports. They are normally software configurable to one of many modes from
BIOS. The typical modes are,
Printer Mode is the most basic mode. It is a Standard Parallel Port in forward mode only. It has no bi-directional feature,
thus Bit 5 of the Control Port will not respond. Standard & Bi-directional (SPP) Mode is the bi-directional mode. Using
this mode, bit 5 of the Control Port will reverse the direction of the port, so you can read back a value on the data lines.
EPP1.7 and SPP Mode is a combination of EPP 1.7 (Enhanced Parallel Port) and SPP Modes. In this mode of
operation you will have access to the SPP registers (Data, Status and Control) and access to the EPP Registers. In this
mode you should be able to reverse the direction of the port using bit 5 of the control register. EPP 1.7 is the earlier
version of EPP. This version, version 1.7, may not have the time-out bit. See Interfacing the Enhanced Parallel Port for
more information.
EPP1.9 and SPP Mode is just like the previous mode, only it uses EPP Version 1.9 this time. As in the other mode, you
will have access to the SPP registers, including Bit 5 of the control port. However this differs from EPP1.7 and SPP
Mode as you should have access to the EPP Timeout bit.
ECP Mode will give you an Extended Capabilities Port. The mode of this port can then be set using the ECP's Extended
Control Register (ECR). However in this mode from BIOS the EPP Mode (100) will not be available. We will further
discuss the ECP's Extended Control Register in this document, but if you want further information on the ECP port,
consult Interfacing the Extended Capabilities Port.
ECP and EPP1.7 Mode and ECP and EPP1.9 Mode will give you an Extended Capabilities Port, just like the previous
mode. However the EPP Mode in the ECP's ECR will now be available. Should you be in ECP and EPP1.7 Mode you
will get an EPP1.7 Port, or if you are in ECP and EPP1.9 Mode, an EPP1.9 Port will be at your disposal.
The above modes are configurable via BIOS. You can reconfigure them by using your own software, but this is not
recommended. These software registers, typically found at 0x2FA, 0x3F0, 0x3F1 etc are only intended to be accessed
by BIOS. There is no set standard for these configuration registers, thus if you were to use these registers, your
software would not be very portable. With today's multitasking operating systems, its also not a good idea to change
them when it suits you.
A better option is to select ECP and EPP1.7 Mode or ECP and EPP1.9 Mode from BIOS and then use the ECP's
Extended Control Register to select your Parallel Port's Mode. The EPP1.7 mode had a few problems in regards to the
Data and Address Strobes being asserted to start a cycle regardless of the wait state, thus this mode if not typically
used now. Best set your Parallel Port to ECP and EPP1.9 Mode.
As we have just discussed, it is better to set the Parallel Port to ECP and EPP1.9 Mode and use the ECP's Extended
Control Register to select different modes of operation. The ECP Registers are standardized under Microsoft's
Extended Capabilities Port Protocol and ISA Interface Standard, thus we don't have that problem of every vendor
having their own register set.
When set to ECP Mode, a new set of registers become available at Base + 0x400h. A discussion of these registers are
available in Interfacing the Extended Capabilities Port. Here we are only interested in the Extended Control Register
(ECR) which is mapped at Base + 0x402h. It should be stated that the ECP's registers are not available for port's with a
base address of 0x3BCh.
Bit Function
7:5 Selects Current Mode of Operation
000 Standard Mode
001 Byte Mode
010 Parallel Port FIFO Mode
011 ECP FIFO Mode
100 EPP Mode
101 Reserved
110 FIFO Test Mode
The table above is of the Extended Control Register. We are only interested in the three MSB of the Extended Control
Register which selects the mode of operation. There are 7 possible modes of operation, but not all ports will support all
modes. The EPP mode is one such example, not being available on some ports.
Modes of Operation
Standard Mode Selecting this mode will cause the ECP port to behave as a Standard Parallel
Port, without bi-directional functionality.
Byte Mode / PS/2 Mode Behaves as a SPP in bi-directional mode. Bit 5 will place the port in reverse
mode.
Parallel Port FIFO Mode In this mode, any data written to the Data FIFO will be sent to the peripheral
using the SPP Handshake. The hardware will generate the handshaking required.
Useful with non-ECP devices such as Printers. You can have some of the
features of ECP like FIFO buffers and hardware generation of handshaking
but with the existing SPP handshake instead of the ECP Handshake.
ECP FIFO Mode Standard mode for ECP use. This mode uses the ECP Handshake described in
Interfacing the Extended Capabilities Port. - When in ECP Mode though BIOS,
and the ECR register is set to ECP FIFO Mode (011), the SPP registers may
disappear.
EPP Mode/Reserved This will enable EPP Mode, if available. Under BIOS, if ECP mode is set then it's
more than likely, this mode is not an option. However if BIOS is set to ECP and
EPP1.x Mode, then EPP 1.x will be enabled. - Under Microsoft's Extended
Capabilities Port Protocol and ISA Interface Standard this mode is Vendor
Specified.
Reserved Currently Reserved. - Under Microsoft's Extended Capabilities Port Protocol
and ISA Interface Standard this mode is Vendor Specified.
FIFO Test Mode While in this mode, any data written to the Test FIFO Register will be placed into
the FIFO and any data read from the Test FIFO register will be read from the
FIFO buffer. The FIFO Full/Empty Status Bits will reflect their true value, thus
FIFO depth, among other things can be determined in this mode.
Configuration Mode In this mode, the two configuration registers, cnfgA & cnfgB become available at
their designated register addresses.
If you are in ECP Mode under BIOS, or if your card is jumpered to use ECP then it is a good idea to initialize the mode
of your ECP port to a pre-defined state before use. If you are using SPP, then set the port to Standard Mode as the first
thing you do. Don't assume that the port will already be in Standard (SPP) mode.
Under some of the modes, the SPP registers may disappear or not work correctly. If you are using SPP, then set the
ECR to Standard Mode. This is one of the most common mistakes that people make.
PDF Version
This page, Interfacing the Standard Parallel Port is also avaliable in PDF (Portable Document Format),
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Unlike a GUI based program, the output can be piped to file for quick storage and/or later appraisal.
Likewise it can be used in conjunction with BeyondExec to get details of remote computers.
Designed for Windows 2000 and Windows XP. Limited support for Windows NT4.
Please enquire about our Silent ODBC SQL version which logs all details to a central database. Supports
Microsoft SQL and mySQL.
General :
Computer Name : NEPTUNE
Operating System : Windows 2000 build 2195
Service Pack : Service Pack 4
Memory :
Installed Memory : 512 Mbytes
Virtual Memory : 2047 Mbytes
MemoryLoad : 43%
Network :
Description : Accton EN1207D/EN2242A Series NDIS 5.0 driver
Mac Address : 00:00:E8:8B:D5:D7
IP Address : 192.168.0.18
Gateway : 192.168.0.17
Primary WINS Server : 192.168.0.1
Secondary WINS Server : 0.0.0.0
DNS Server : 203.11.90.240, 203.11.90.1
Drive Information :
Drv Type Label Type Serial No. Free Space Disc Size Full
A:\ Removable
C:\ Fixed Local Disk NTFS 7073-C458 25,961MB 38,162MB 31%
D:\ CDROM
E:\ Fixed Win2k NTFS E43E-47F3 27,545MB 39,997MB 31%
F:\ Fixed Junk NTFS 7073-C458 1,835MB 2,047MB 10%
G:\ Fixed Data NTFS 9C03-B1B3 52MB 20,002MB 99%
VideoCards :
DeviceName : \\.\DISPLAY1
Display : WinFast GeForce2 MX Series (Primary Device)
DeviceName : \\.\DISPLAY3
Display : NetMeeting driver
CDROM Information :
Printers (2 Installed):
Download
Revision History
10th November 2003 - Version 1.01
Have you ever wanted to run a process such as an application installer, service pack, virus signature update
etc or shutdown a single or group of remote computers without having the burden of installing any remote
client on your target computers?
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Description.
This is the first interfacing example for the Parallel Port. We will start with something simple. This example doesn't
use the Bi-directional feature found on newer ports, thus it should work with most, if no all Parallel Ports. It
however doesn't show the use of the Status Port as an input. So what are we interfacing? A 16 Character x 2 Line
LCD Module to the Parallel Port. These LCD Modules are very common these days, and are quite simple to work
with, as all the logic required to run them is on board.
Schematic
Circuit Description
Above is the quite simple schematic. The LCD panel's Enable and Register Select is connected to the Control
Port. The Control Port is an open collector / open drain output. While most Parallel Ports have internal pull-up
resistors, there are a few which don't. Therefore by incorporating the two 10K external pull up resistors, the circuit
is more portable for a wider range of computers, some of which may have no internal pull up resistors.
We make no effort to place the Data bus into reverse direction. Therefore we hard wire the R/W line of the LCD
panel, into write mode. This will cause no bus conflicts on the data lines. As a result we cannot read back the
LCD's internal Busy Flag which tells us if the LCD has accepted and finished processing the last instruction. This
problem is overcome by inserting known delays into our program.
The 10k Potentiometer controls the contrast of the LCD panel. Nothing fancy here. As with all the examples, I've
left the power supply out. You can use a bench power supply set to 5v or use a onboard +5 regulator. Remember
a few de-coupling capacitors, especially if you have trouble with the circuit working properly.
#include <dos.h>
#include <string.h>
void main(void)
{
char string[] = {"Testing 1,2,3 "
"It' Works ! "};
char init[10];
int count;
int len;
init[0] = 0x0F; /* Init Display */
init[1] = 0x01; /* Clear Display */
init[2] = 0x38; /* Dual Line / 8 Bits */
len = strlen(string);
Above is the source code to get this example running. It's been written for Borland C, so if you are using a
Microsoft compiler, then you will have to change the outportb() function to outp() and inportb() to inp().
The LCD panel requires a few instructions to be sent, to order to turn on the display and initialise it. This is what
the first for loop does. These instructions must be sent to the LCD's Instruction Register which is controlled by the
Register Select (Pin 4). When pin 4 is low the instruction register is selected, thus when high the data register
must be selected. We connect this to the Parallel Port's Select Printer line which happens to be hardware inverted.
Therefore if we write a '1' to bit 3 of the Control Register the Select Printer line goes low.
We want to first send instructions to the LCD module. Therefore the Register Select line must be low. As it is
hardware inverted, we will want to set bit 3 of the Control Register to '1'. However we don't want to upset any other
bits on the Control Port. We achieve this by reading the Control Port and OR'ing 0x80 to it. e.g. outportb
(CONTROL, inportb(CONTROL) | 0x08); This will only set bit 3.
After we place a data byte on the data lines, we must then signal to the LCD module to read the data. This is done
using the Enable line. Data is clocked into the LCD module on the high to low transition. The Strobe is hardware
inverted, thus by setting bit 0 of the Control Register we get a high to low transition on the Strobe line. We then
wait for a delay, and return the line to a high state ready for the next byte.
After we initialize the LCD Module, we want to send text to it. Characters are sent to the LCD's Data Port, thus we
want to clear bit 3. Once again we must only change the one bit, thus we use outportb(CONTROL, inportb
(CONTROL) & 0xF7);. Then we set up another for loop to read a byte from the string and send it to the LCD
panel. This is repeated for the length of the string.
The delays should be suitable for most machines. If the LCD panel is not initializing properly, you can try
increasing the delays. Likewise if the panel is skipping characters, e.g. Tst ,2. On the other hand, If the LCD
module is repeating characters e.g. TTTeessttiinngg then you may have a faulting Enable connection. Check
your Enable to Strobe connection.
How to control HD44780-based Character- Should you want to know more about the LCD Modules, Peer
LCD Ouwehand has done a wonderful job of it or presenting it all. Well
worth a look.
LCD Information and Technical Forum A good web page which includes information on many different
types of LCD's. Also includes a LCD Forum.
Interfacing the Parallel Port Want to know some more details about interfacing your Parallel
Port? If so, then try out this Page.
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Hard disk drives are a mechanical part of your computer system. As such, they are more likely to fail than
a solid state processor, video card or stick of RAM. Typical HDD failures can include failure of the spindle
motor or bearings causing excessive heat or noise, head assembly failures including improper flying
height, head contamination, media degradation etc.
S.M.A.R.T. or Self-Monitoring Analysis and Reporting Technology was introduced into most modern hard
drives to help detect and predict these failures. Of cause not all hard drive failures are predictable.
Catastrophic events such as electronic component failure etc can occur however the majority of failures
occur from the HDD deteriorating over time.
MS Windows do not monitor HDDs for failures. BIOS can detect a failure, but only when a threshold is
exceeded on the drive. Third party applications exist to periodically monitor the drive and predict the failure
date, however these applications cost money and are required to be installed on the computer.
Smart and Simple on the other hands is just that. Its a simple command line utility to read back the
SMART attributes from a HDD while in service. Its a single 31kb executable which can be carried with you
on a floppy disk, giving you a quick indication of the health of any disk drive without the burden of installing
a sizeable application.
Usage
To use SMART & Simple is easy. To interrogate the parameters for drive C:, simply run
C:\>smart.exe
If you need to interogate a physical drive other than C:, the drive can be specified as a argument on the
command line. e.g.
smart.exe d:
Download
Revision History
21st December 2003 - Version 1.01
Fxied Exit Codes. Program exits with 0 if no error, otherwise value is first Attribute ID.
Have you ever wanted to run a process such as an application installer, service pack, virus signature update
etc or shutdown a single or group of remote computers without having the burden of installing any remote
client on your target computers?
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
The Enhanced Parallel Port (EPP) was designed in a joint venture between Intel,
Xircom & Zenith Data Systems. EPP Ports were first specified in the EPP 1.7
standard, and then later included in the IEEE 1284 Standard released in 1994. EPP
has two standards, EPP 1.7 and EPP 1.9. There are differences between the two
standards which may affect the operation of devices. This is further discussed latter.
EPP has a typical transfer rate in the order of 500KB/S to 2MB/S. This is achieved by
allowing the hardware contained in the port to generate handshaking, strobing etc,
rather that have the software do it, which was the case with Centronics.
For the hobbyist, EPP is more commonly used than ECP. EPP differs from ECP by the
fact that the EPP Port generates and controls all the transfers to and from the
peripheral. ECP on the other hand requires the peripheral to negotiate a reverse
channel and control the handshaking. This is harder to achieve with common glue
logic, thus really requires a dedicated controller or ECP Peripheral Chip.
When using EPP mode, a different set of tasks and labels are assigned to each line.
These are listed below in Table 4. It's very common to see both the SPP and EPP
names interchanged in Parallel Port Data Sheets and Literature. This can make it very
hard to focus on what is exactly happening. Therefore all the documentation here will
use the EPP names.
Paper Out, Select and Error are not defined in the EPP handshake. These lines can
be utilised in any way by the user. The status of these lines can be determined at
anytime by viewing the SPP Status Register. Unfortunately there are no spare
In order to perform a valid exchange of data using EPP we must follow the EPP
handshake. As the hardware does all the work, this handshake only requires to be
used for your hardware and not for software as the case with SPP. To initiate an EPP
cycle your software needs to perform only one I/O operation to the relevant EPP
Register. Details on this, latter.
1. Program writes to
EPP Data Register.
(Base + 4)
2. nWrite is placed low.
(Low indicates write
operation)
3. Data is placed on
Data Lines 0-7.
4. nData Strobe is
asserted if Wait is Low
(O.K. to start cycle)
5. Host waits for
Acknowledgment by
nWait going high (O.
K. to end cycle)
6. nData Strobe is de-
asserted.
Figure 1. Enhanced Parallel Port Data Write Cycle.
7. EPP Data Write
Cycle Ends.
1. Program writes
address to EPP's
Address Register
(Base + 3)
2. Write is placed low.
(Low indicates write
operation)
3. Address is placed
on Data Lines 0-7.
4. Address Strobe is
asserted if Wait is Low
(O.K. to start cycle)
5. Host waits for
Acknowledgment by
wait going high (O.K.
to end cycle)
6. nAddress Strobe is
Figure 2. Enhanced Parallel Port Address Write Cycle. De-asserted.
7. EPP Address Write
Cycle Ends.
1. Program reads
EPP Data Register.
(Base + 4)
2. nData Strobe is
asserted if Wait is
Low (O.K. to start
cycle)
3. Host waits for
Acknowledgment by
nWait going high
4. Data is read from
Parallel Port Pins.
5. nData Strobe is
de-asserted.
6. EPP Data Read
Cycle Ends.
Figure 3. Enhanced Parallel Port Data Read Cycle.
Note If implementing EPP 1.7 Handshake (Pre IEEE 1284) the Data and Address
Strobes can be asserted to start a cycle regardless of the wait state. EPP 1.9
will only start a cycle once wait is low. Both EPP 1.7 and EPP 1.9 require the
wait to be high to finish a cycle.
The EPP Port also has a new set of registers. However 3 of them have been inherited
from the Standard Parallel Port. Below is a table showing the new and existing
registers.
As you can see, the first 3 addresses are exactly the same than the Standard Parallel
Port Register and behave in exactly the same way. Therefore if you used a Enhanced
Parallel Port, you can output data to Base + 0 in exactly the same fashion than you
would if it was a Standard Parallel Port (SPP). If you were to connect a printer, and
use compatibility mode then you would have to check to see if the port is busy and
then assert & de-assert the strobe using the Control and Status Port, then wait for the
Ack.
If you wish to communicate with a EPP compatible device then all you have to do, is
place any data you wish to send in the EPP Data Register at Base + 4 and the card
will generate all the necessary handshaking required. Likewise if you wish to send an
address to your device, then you use the EPP Address Register at offset +3.
Both the EPP Address Register and the EPP Data Register are read / write, thus to
read data from your device, you can use the same registers. However the EPP Printer
Card has to initiate a read Cycle as both the nData Strobe and nAddress Strobe are
outputs. Your device can signal a read request via the use of the interrupt and have
your ISR perform the Read Operation.
The Status Port has one little modification. Bit 0, which was reserved in the SPP
register set, now becomes the EPP Time-out Bit. This bit will be set when an EPP time-
out occurs. This happens when the nWait line is not deasserted within approximately
10uS (depending upon the port) of the IOW or IOR line being asserted. The IOW and
IOR are the I/O Read and Write lines present on the ISA Bus.
The EPP mode is very depended of the ISA bus timing. When a read cycle is
performed, the port must undertake the appropriate Read/Write handshake and return
the data in that ISA cycle. Of course this doesn't occur within one ISA cycle, thus the
port uses the IOCHRDY (I/O Channel Ready) on the ISA bus to introduce wait states,
until the cycle completes. Now imagine if a EPP Read or Write is started with no
peripheral connected? The port never gets an acknowledgment (nWait), thus keeps
sending requests for wait states, and your computer locks up. Therefore the EPP
implements a type of watchdog, which times out after approximately 10uS.
The three registers, Base + 5, Base + 6 and Base + 7 can be used for 16 and 32 bit
read/write operations if your port supports it. This can further reduce your I/O
operations. The Parallel Port can only transport 8 bits at a time, thus any 32 or 16 bit
word written to the Parallel Port will be split into byte size blocks and sent via the
Parallel Port's 8 data lines.
EPP only has two main registers and a Time-out Status Flag, What could there
possibly be to set up?
Before you can start any EPP cycles by reading and writing to the EPP Data and
Address Ports, the port must be configured correctly. In the idle state, an EPP port
should have it's nAddress Strobe, nData Strobe, nWrite and nReset lines inactive,
high. Some ports require you to set this up before starting any EPP Cycle. Therefore
our first task is to manually initialise these lines using the SPP Registers. Writing
XXXX0100 to the control port will do this.
On some cards, if the Parallel Port is placed in reverse mode, a EPP Write cycle
cannot be performed. Therefore it is also wise to place the Parallel Port in forward
mode before using EPP. Clearing Bit 5 of the Control Register should result in an
more enjoyable programming session, without tearing your hair out.
The EPP Timeout bit we have already discussed. When this bit is set, the EPP port
may not function correctly. A common scenario is always reading 0xFF from either the
Address or Data Cycles. This bit should be cleared for reliable operation, and
constantly checked.
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Having trouble trying to work out why your VoIP ATA is not registering? Maybe you are not
receiving incoming calls?
Many ATAs (Analog Telephone Adaptors) do not have great reporting of errors. Some offer
sysloging of SIP messages, but many don't. While you can use protocol analysers such as
ethereal, often you need a Hub so you can sniff the packets between your router and your ATA.
In other cases, you may have a all-in-one router and don't have access to eves drop on its
communication.
The SIP debug proxy server is a quick and small utility which can assist in these issues. You can
run the single sipdebug.exe executable on a windows based PC within your local network. Then
you can point your ATA to register with the sipdebug proxy on your local machine. This will pass
SIP traffic via the sipdebug proxy, display it in realtime and alternatively log it to a file or syslog
server for later analysis.
Usage
C:\>sipdebug
SIP Debug Proxy Server V1.03
Copyright(C) 2006-2007 Craig.Peacock@beyondlogic.org
If your ATA registers with sip.xyz.com, simply start the sipdebug proxy with :
sipdebug sip.xyz.com
Then use ipconfig to find the IP address of the host you have sipdebug running on and set your
ATA or softphone to register with the IP address of this host. By default sipdebug listens on udp
5060, the default port for SIP.
Other switches
By default, sipdebug listens on udp 5060 for requests from your ATA. You can set a different
port to listen on using the -p switch.
Sipdebug will use a random, but free UDP port on the host to receive requests back from your
VSP (Voice Service Provider). A predefined source port can be defined using the -s switch.
Many softphones will use random source ports, like sipdebug, while many ATAs will use 5060 as
the source and destination ports. Some routers can do strange things when handling incoming
traffic on 5060, hence as part of your debugging you may need to set sipdebug's source for
traffic to your VSP to 5060. In this case, you will need to specify a SIP receiving port to
something other than 5060 using the -p switch.
For further analysis, you can log the SIP messages to file using the -f switch. You can also log to
a syslog server using -l. If the port number is omitted, the default syslog port of 514 will be used.
Download
Revision History
1st April 2007 - Version 1.00
Displays host IP address for DHCP enabled hosts preventing need to use
IPconfig.
10th April 2007 - Version 1.03
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
The Extended Capabilities Mode was designed by Hewlett Packard and Microsoft to be
implemented as the Extended Capabilities Port Protocol and ISA Interface Standard. This
protocol uses additional hardware to generate handshaking signals etc just like the EPP mode,
thus runs at very much the same speed than the EPP mode. This mode, however may work
better under Windows as it can use DMA channels to move it's data about. It also uses a FIFO
buffer for the sending and/or receiving of data.
Another feature of ECP is a real time data compression. It uses Run Length Encoding (RLE) to
achieve data compression ratio's up to 64:1. This comes is useful with devices such as
Scanners and Printers where a good part of the data is long strings which are repetitive.
The Extended Capabilities Port supports a method of channel addressing. This is not intended
to be used to daisy chain devices up but rather to address multiple devices within one device.
Such an example is many fax machines on the market today which may contain a Parallel Port
to interface it to your computer. The fax machine can be split up into separate devices such as
the scanner, modem/Fax and printer, where each part can be addresses separately, even if
the other devices cannot accept data due to full buffers.
While Extended Capabilities Printer Ports use exactly the same D25 connector as your SPP,
ECP assigns different tasks to each of the pins, just like EPP. This means that there is also a
different handshake method when using a ECP interface.
The ECP is backwards compatible to the SPP and EPP. When operating in SPP mode, the
individual lines operate in exactly the same fashion than the SPP and thus are labeled Strobe,
Auto Linefeed, Init, Busy etc. When operating in EPP mode, the pins function according to the
method described in the EPP protocol and have a different method of Handshaking. When the
port is operating in ECP mode, then the following labels are assigned to each pin.
The HostAck and PeriphAck lines indicate whether the signals on the data line are data or a
command. If these lines are high then data is placed on the data lines (Pins 2-7). If a command
cycle is taking place then the appropriate line will be low, ie if the host is sending a command,
then HostAck will be low or if the device/peripheral is sending a command the PeriphAck line
will be low.
A command cycle can be one of two things, either a RLE count or an address. This is
determined by the bit 7 (MSB) of the data lines, ie Pin 9. If bit 7 is a 0, then the rest of the data
(bits 0-6) is a run length count which is used with the data compression scheme. However if bit
7 is a 1, then the data present on bits 0 to 6 is a channel address. With one bit missing this can
only be a value from 0 to 127(DEC).
The ECP handshake is different to the SPP handshake. The most obvious difference is that
ECP has the ability at anytime to transmit data in any direction, thus additional signaling is
required. Below is the ECP handshake for both the Forward and Reverse Directions.
1. Host sets
nReverseRequest
Low to request a
reverse channel.
2. Peripheral
acknowledges
reverse channel
request via
asserting
nAckReverse low.
3. Data is placed
on data lines by
Peripheral.
4. Data cycle is
then selected by
Peripheral via
PeriphAck going
high.
5. Valid data is
indicated by the
Peripheral
setting
PeriphClk low.
6. Host sends its
acknowledgment
of valid data via
HostAck going
high.
7. Device/
Peripheral sets
Figure 3. Enhanced Capabilities Port Reverse Data Cycle.
PeriphClk high.
+ve edge used to
shift data into
the Host.
8. Host sends it's
acknowledgment
of the byte by de-
asserting HostAck
low.
1. Host sets
nReverseRequest Low
to request a reverse
channel.
2. Peripheral
acknowledges reverse
channel request via
asserting nAckReverse
low.
3. Data is placed on
data lines by
Peripheral.
4. Command cycle is
then selected by
Peripheral via PeriphAck
going low.
5. Valid data is
indicated by the
Peripheral setting
PeriphClk low.
6. Host sends its
acknowledgment of valid
data via HostAck going
high.
7. Device/Peripheral
sets PeriphClk high.
Figure 4. Enhanced Capabilities Port Reverse Command Cycle. +ve edge used to shift
data into the Host.
8. Host sends it's
acknowledgment of the
byte by de-asserting
HostAck low.
If we look back at the SPP Handshake you will realize it only has 5 steps,
and that the ECP handshake has many more steps. This would suggest that ECP would be
slower that SPP. However this is not the case as all of these steps above are controlled by the
hardware on your I/O control. If this handshake was implemented via software control then it
would be a lot slower that it's SPP counterpart.
As briefly discussed earlier, the ECP Protocol includes a Simple Compression Scheme called
Run Length Encoding. It can support a maximum compression ratio of 64:1 and works by
sending repetitive single bytes as a run count and one copy of the byte. The run count
determines how many times the following byte is to be repeated.
For example, if a string of 25 'A's were to be sent, then a run count byte equal to 24 would be
sent first, followed by the byte 'A'. The receiving peripheral on receipt of the Run Length Count,
would expand (Repeat) the next byte a number of times determined via the run count.
The Run Length Byte has to be distinguished from other bytes in the Data Path. It is sent as a
Command to the ECP's Address FIFO Port. Bytes sent to this register can be of two things, a
Run Length Count or an Address. These are distinguished by the MSB, Bit 7. If Bit 7 is Set (1),
then the other 7 bits, bits 0 to 6 is a channel address. If Bit 7 is Reset (0), then the lower 7 bits
is a run length count. By using the MSB, this limits channel Addresses and Run Length Counts
to 7 Bits (0 - 127).
The table below shows the registers of the Extended Capabilities Port. The first 3 registers are
exactly the same than with the Standard Parallel Port registers. Note should be taken,
however, of the Enable Bi-Directional Port bit (bit 5 of the Control Port.) This bit reflects the
direction that the ECP port is currently in, and will effect the FIFO Full and FIFO Empty bits of
the ECR Register, which will be explained later.
Configuration Register A
Read/Write
(Configuration Mode)
Configuration Register B
Base + 401h Read/Write
(Configuration Mode)
Extended Control Register (Used by
Base + 402h Read/Write
all modes)
Table 2 : ECP Registers
The most important register with a Extended Capabilities Parallel Port is the Extended
Control Register (ECR) thus we will target it's operation first. This register sets up the
mode in which the ECP will run, plus gives status of the ECP's FIFO among other
things. You will find the contents of this register below, in more detail.
Bit Function
7:5 Selects Current Mode of Operation
000 Standard Mode
001 Byte Mode
010 Parallel Port FIFO Mode
011 ECP FIFO Mode
100 EPP Mode
101 Reserved
110 FIFO Test Mode
111 Configuration Mode
4 ECP Interrupt Bit
3 DMA Enable Bit
2 ECP Service Bit
1 FIFO Full
0 FIFO Empty
Table 3 ECR - Extended Control Register
The three MSB of the Extended Control Register selects the mode of operation. There
are 7 possible modes of operation, but not all ports will support all modes. The
EPP mode is one such example, not being available on some ports. Below is a table of
Modes of Operation.
Modes of Operation
Standard Mode Selecting this mode will cause the ECP port to
behave as a Standard Parallel Port, without Bi-
directional functionality.
Byte Mode / PS/2 Mode Behaves as a SPP in Bi-directional (Reverse) mode.
Parallel Port FIFO Mode In this mode, any data written to the Data FIFO will
be sent to the peripheral using the SPP Handshake.
The hardware will generate the handshaking
required. Useful with non-ECP devices such as
Printers. You can have some of the features of ECP
like FIFO buffers and hardware generation of
handshaking but with the existing SPP handshake
instead of the ECP Handshake.
ECP FIFO Mode Standard Mode for ECP Use. This mode uses the
ECP Handshake, already described.
EPP Mode/Reserved On some chipsets, this mode will enable EPP to be
used. While on others, this mode is still reserved.
Reserved Currently Reserved
FIFO Test Mode While in this mode, any data written to the Test FIFO
Register will be placed into the FIFO and any data
read from the Test FIFO register will be read from the
FIFO buffer. The FIFO Full/Empty Status Bits will
reflect their true value, thus FIFO depth, among other
things can be determined in this mode.
Configuration Mode In this mode, the two configuration registers, cnfgA &
cnfgB become available at their designated Register
Addresses.
As outlined above, when the port is set to operate in Standard Mode, it will behave just
like a Standard Parallel Port (SPP) with no bi-directional data transfer. If you require bi-
directional transfer, then set the mode to Byte Mode. The Parallel Port FIFO mode and
ECP FIFO mode both use hardware to generate the necessary handshaking signals.
The only difference between each mode is that The Parallel Port FIFO Mode uses SPP
handshaking, thus can be used with your SPP printer. ECP FIFO mode uses ECP
handshaking.
The FIFO test mode can be used to test the capacity of the FIFO Buffers as well as to
make sure they function correctly. When in FIFO test mode, any byte which is written to
the TEST FIFO (Base + 400h) is placed into the FIFO buffer and any byte which is read
from this register is taken from the FIFO Buffer. You can use this along with the FIFO
Full and FIFO Empty bits of the Extended Control Register to determine the capacity of
The other Bits of the ECR also play an important role in the operation of the ECP Port.
The ECP Interrupt Bit, (Bit 4) enables the use of Interrupts, while the DMA Enable Bit
(Bit 3) enables the use of Direct Memory Access. The ECP Service Bit (Bit 2) shows if
an interrupt request has been initiated. If so, this bit will be set. Resetting this bit is
different with different chips. Some require you to Reset the Bit, E.g. Write a Zero to it.
Others will reset once the Register has been read.
The FIFO Full (Bit 1) and FIFO Empty (Bit 0) show the status of the FIFO Buffer. These
bits are direction dependent, thus note should be taken of the Control Register's Bit 5. If
bit 0 (FIFO Empty) is set, then the FIFO buffer is completely empty. If Bit 1 is set then
the FIFO buffer is Full. Thus, if neither bit 0 or 1 is set, then there is data in FIFO, but is
not yet full. These bits can be used in FIFO Test Mode, to determine the capacity of the
FIFO Buffer.
Configuration Register A is one of two configuration registers which the ECP Port has.
These Configuration Registers are only accessible when the ECP Port is in
Configuration Mode. (See Extended Control Register) CnfgA can be accessed at Base +
400h.
Bit Function
7 1 Interrupts are level triggered
0 Interrupts are edge triggered (Pulses)
6:4 00h Accepts Max. 16 Bit wide words
01h Accepts Max. 8 Bit wide words
02h Accepts Max. 32 Bit wide words
03h:07h Reserved for future expansion
3 Reserved
2 Host Recovery : Pipeline/Transmitter Byte included in FIFO?
In forward direction, the 1 byte in the transmitter
0
pipeline doesn't affect FIFO Full.
In forward direction, the 1 byte in the transmitter
1
pipeline is include as part of FIFO Full.
1:0 Host Recovery : Unsent byte(s) left in FIFO
00 Complete Pword
01 1 Valid Byte
10 2 Valid Bytes
11 3 Valid Bytes
Table 4 - Configuration Register A
Configuration Register A can be read to find out a little more about the ECP Port. The
MSB, shows if the card generates level interrupts or edge triggered interrupts. This will
depend upon the type of bus your card is using. Bits 4 to 6, show the buses width within
the card. Some cards only have a 8 bit data path, while others may have a 32 or 16 bit
width. To get maximum efficiency from your card, the software can read the status of
these bits to determine the Maximum Word Size to output to the port.
The 3 LSB's are used for Host Recovery. In order to recover from an error, the software
must know how many bytes were sent, by determining if there are any bytes left in the
FIFO. Some implementations may include the byte sitting in the transmitter register,
waiting to be sent as part of the FIFO's Full Status, while others may not. Bit 2
determines weather or not this is the case.
The other problem is that the Parallel Ports output is only 8 bits wide, and that you many
be using 16 bit or 32 bit I/O Instructions. If this is the case, then part of your Port Word
(Word you sent to port) may be sent. Therefore Bits 0 and 1 give an indication of the
number of valid bytes still left in the FIFO, so that you can retransmit these.
Configuration Register B, like Configuration Register A is only available when the ECP
Port is in Configuration Mode. When in this mode, cnfgB resides at Base + 401h. Below
is the make-up of the cnfgB Register.
Bit
Function
(s)
7 1 Compress outgoing Data Using RLE
0 Do Not compress Data
Interrupt Status - Shows the Current Status of the
6
IRQ Pin
5:3 Selects or Displays Status of Interrupt Request
Line.
000 Interrupt Selected Via Jumper
001 IRQ 7
010 IRQ 9
011 IRQ 10
100 IRQ 11
101 IRQ 14
110 IRQ 15
111 IRQ 5
2:0 Selects or Displays Status of the DMA Channel
the Printer Card Uses
000 Uses a Jumpered 8 Bit DMA Channel
001 DMA Channel 1
010 DMA Channel 2
011 DMA Channel 3
100 Uses a Jumpered 16 Bit DMA Channel
101 DMA Channel 5
110 DMA Channel 6
111 DMA Channel 7
Table 5 - Configuration B Register
Bit 7 of the cnfgB Register selects whether to compress outgoing data using RLE (Run
Length Encoding.) When Set, the host will compress the data before sending. When
reset, data will be sent to the peripheral raw (Uncompressed). Bit 6 returns the status of
the IRQ pin. This can be used to diagnose conflicts as it will not only reflect the status of
the Parallel Ports IRQ, but and other device using this IRQ.
Bits 5 to 3 give status of about the Port's IRQ assignment. Likewise for bits 2 to 0 which
give status of DMA Channel assignment. As mentioned above these fields may be read/
write. The disappearing species of Parallel Cards which have Jumpers may simply show
it's resources as "Jumpered" or it may show the correct Line Numbers. However these
of course will be read only.
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Linux is fast proving to be a popular operating system for embedded network devices. Just some of the many
advantages are listed below.
Royalty free licensing. With traditional off the shelf embedded platforms there would be a
significant licensing cost involved in shipping devices with a third party OS. This eats into your
margins and contributes to a higher priced device. Linux, on the other hand is free.
Reliable IP stack and TCP/IP Applications. Linux comes with some of the most established TCP/
IP stacks and applications. Linux has been on some servers and desktops for years. This same
code base has now made it to your embedded systems.
Source code for the OS Kernel is Open. How many times have you developed software which
relies on third party code, only to find the third party code is buggy? When you consult the vendor,
they either are not interested or take weeks or months to release a patch. With linux, you have the
source code in your hot little hands. You can get in and fix any bugs and recompile it. What more
you can contribute your patches to the community which results in a more polished and stable
kernel, benefiting everyone involved.
Source code for the Toolchains is Open. Toolchains are a name for the development tools which
are used to compile the kernel and usermode applications. Once again you have the source code
for these applications. While most developers these days expect to have buggy development tools,
you have the source to fix it, and the power to fix it.
Time to market. With an abundance of open source code and applications aimed at linux, you will
find time to market is decreased. Take for example the Memory Fax/Modem products which
appeared on the market a couple years back. These units were a fax/modem with memory which
allowed it to recieve faxes when your computer was switched off. To place such a product on the
market would of required a reasonable amount of work. However with uClinux, the developer can
base their product on open source code such as efax. It also allows the ability to include IP
Masquerading with little effort, thus adding more functionality to the product.. Linux also supports a
large range of peripherals and file systems.
With all these advantages, there are many target platforms and this is continuing to grow. uClinux now supports
the 68328 dragonball series, Coldfire, ARM7TDMI, ETRAX, I960.
uClinux Distribution
uClinux is the most popular form of embedded linux. uClinux (MicroController Linux) was first ported to the
Dragonball 68k series processors in 1998 has since grown exponentially to include a wide range of targets.
uClinux differs from its mainstream linux counterparts by having no support for memory management units
(MMU). The other important part of uClinux is a small footprint, which is essential for microcontrollers with little
resources and it's BFLT (Binary Flat) Executable Format.
Kernel 2.0.38
linux-2.0.38.tar.gz (7.5MB)
uClinux-2.0.38.1pre7.diff.gz (1.3MB)
The uClinux Kernel is where all the fuss is made. It is based on the 2.0.38 Linux kernel. Linux-2.0.38.tar.gz is the
original kernel you would use on your desktop computer. A uClinux patch is applied to bring the kernel up to a
level where it can be used on your microcontroller. This typically involves the device support and removing the
reliance on the MMU. Download the tarballs and place them in /opt/uClinux. Unpack and patch the kernel. You
will need to create the uClinux directory.
cd /opt/uClinux
tar xzf linux-2.0.38.tar.gz
gzip d uClinux-2.0.38.1pre7.diff.gz
cd linux
patch -p1 < ../uClinux-2.0.38.1pre7.diff
Once this is done, you now have yourself the code base for the uClinux Kernel. However you will now need to
build a compiler which can cross compile the code to M68K. Later in the uC-libc building, it will try to include files
in linux/include/asm. "asm" is an symbolic link which points to a folder asm-, where arch is the architecture of the
kernel. For example if we configure uClinux for m68k with no mmu, the asm folder will point to asm-m68knommu.
This is therefore a good place to start by configuring the kernel which can be done without needing the m68k-coff
compiler.
make menuconfig
The default configuration is for the uCSimm thus if you have other boards will need to configure it for your desired
target. There is no need to build the kernel, in fact you can't build the kernel yet due to a lack of development
tools. The make config will set up the asm links which are required laterfor the building of the standard c library,
uC-libc.
Toolchains
There are two different tool chains for uCLinux. One is used for the compilation of the kernel and produces 32 bit
M68K fixed position executables. The other is used for compilation of user-land binaries and produces 32 bit
M68K position independent code (PIC).
The kernel chain tool is nothing more than the standard run of the mill gcc version 2.7.2.3. The kernel diff makes
one small modification to the /config/m68k/t-m68kbare file inserting TARGET_LIBGCC2_CFLAGS = -
Dinhibit_libc to prevent it from requiring a libc library.
The user-land chain tool is a different matter. It has some quite extensive changes. These changes lie with the
requirement to have position independent binaries. No direct jumps are used, but instead these are replaced with
relative branches. Global data is retrieved relative to the A5 register.
Two options are given for building the tool chains. You can download uClinuxgcc-kit-160899.tar.gz which
contains all the patches and a makefile which automatically builds the binutils and gcc for both the kernel and
user environments. The other option is to patch and build the tools yourself and in the process learn what is
happing along the way. We detail both methods here.
binutils-2.9.1.tar.gz (5.6MB)
gcc-2.7.2.3.tar.gz (6.9MB)
uClinuxgcc-kit-160899.tar.gz (40KB)
Extract uClinuxgcc-kit-160899.tar.gz. The buildtools can be built in any directory, independent of /opt/uClinux
Edit the Makefile (first line) changing the INSTALLDIR to a suitable destination - /opt/uClinux is recommended.
Then make the m68k-coff and m68k-pic-coff tool chains by typing,
make
This creates the executables in /opt/uClinux/bin which is not in the current path. Therefore we could either add /
opt/uClinux/bin to the path, or link our newly created binaries to /usr/bin.
cd /opt/uClinux/bin
ln -f * /usr/bin
Now that was easy, wasnt it? Now that we have boosted your confidence, lets walk through what is happing by
examining the manual version.
We will start by building the M68K fixed position tools, m68k-coff. Download
binutils-2.9.1.tar.gz (5.6MB)
gcc-2.7.2.3.tar.gz (6.9MB)
gcc-2.7.2.3.kernel.diff.gz (1KB)
Extract the binutils src tarball to a suitable directory of your choice and enter its directory
Configure binutils for your target. We have started with m68k-coff first as it requires no patches.
make
make install
This will create a directory /opt/uClinux/m68k-coff which will have 5 subdirectories including bin, include, libs,
m68k-coff and man. This will contain headers which is needed when we create gcc. Change back to your
directory where gcc-2.7.2.3.tar.gz is present
Extract the gcc src tarball, patch it and then enter the gcc directory
Configure gcc for your target. The prefix must be the same than the binutils, as gcc will expect to see the header
files previously created by the binutils install.
Then make the m68k-coff C Cross Compiler. The LANGUAGES=c instructs make only to build the C Compiler
and not the C++ Compiler which will cause some unnecessary problems.
make LANGUAGES=c
make LANGUAGES=c install
You should now have a m68k-pic-gcc compiler capable of building the kernel. The executables should be located
in /opt/uClinux/m68k-coff/bin. To continue and build the pic-coff tools we must either delete the working
directories or rename them. Renaming them is recommended as one of the reasons why you are building the
source from scratch and not downloading an RPM is that you can later apply patches and bug fixes. Rename
binutil-2.9.1 to binutil-2.9.1.kernel and gcc-2.7.2.3 to gcc-2.7.2.3.kernel
binutils-2.9.1.tar.gz (5.6MB)
gcc-2.7.2.3.tar.gz (6.9MB)
gcc-2.7.2.3.pic.diff.gz (32KB)
binutils-2.9.1.pic.diff.gz (8KB)
Now we repeat the process for the m68k-pic-coff compiler. This time the binutils must be patched.
make
make install
This now has us ready to start making the gcc compiler. Extract the src tarball, patch it and then enter the gcc
directory.
Configure gcc for your target. The prefix must be the same than the binutils, as gcc will expect to see those
header files which binutils created.
make LANGUAGES=c
make LANGUAGES=c install
As neither m68k-pic-coff or m68k-coff is in the current path, most make files will attempt to call gcc using m68k-
pic-coff-gcc. We can either place these two directories in our path, or we can create hard links to them in /usr/bin.
cd /opt/uClinux/bin
ln -f * /usr/bin
Hard links are created instead of soft links. If an attempt is made to create an softlink, gcc/evecvp will complain
about "too many levels of symbolic links". The content of /opt/uClinux/bin is soft links which point to the bin
directories of the individual compilers.
At this stage we now have a C Compiler which makes position independent COFF binaries. What we don't have
is any standard C or standard maths libraries thus gcc will complain. uClinux also relies on flat binaries and not
coff binaries. Therefore we must add a coff to flat converter (coff2flt) which converts the coff images the compiler
generates into flat binaries which we can then run on uClinux.
In order to seemlessly create flat binaries with one command, the linker (LD) is replaced with a script which first
runs the linker that generates the .coff file, then runs coff2flt utility to generate the flat binary.
coff2flt-0.5.tar.gz (6KB)
This builds coff2flt. In the tarball is a script, ld. We must replace the pic-coff-ld with this script which in turns calls
coff2flt to create a flat binary from our coff binary. However before we do this, edit the line in LD to set %prefix%
to /opt/uClinux/m68k-pic-coff
mv /opt/uClinux/m68k-pic-coff/bin/ld /opt/uClinux/m68k-pic-coff/bin/gld
install -m 755 coff2flt /opt/uClinux/m68k-pic-coff/bin
cp ld /opt/uClinux/m68k-pic-coff/bin
chmod 755 /opt/uClinux/m68k-pic-coff/bin/ld
Standard C Library
uC-libc-310899.tar.gz (233KB)
Two libraries are used when compiling user-land binaries. These are the standard C library and standard math
library. These are static libraries which get linked at compilation time.
The uC Standard C Library has always been plagued with bugs. In particular they have had bad memory leaks
relating to their memory allocation functions. Some individuals have patches for the malloc functions which you
can manually apply and build.
The uC-libc is undergoing quite radical changes at the present moment. These experimental changes are
available through the uClinux CVS repository. A stable library should be avalible soon which will supersede these
early versions of uC-libc and provide a much more stable platform upon which to build your code. On a positive
note, the maths library has had little problems.
The uC-libc library has two symbolic links (include/linux and include/net) which should point to the headers of the
uClinux Kernel. These links expect a linux directory to be present in the same tree the uC-libc directory is present
in. If one doesn't exist due to a different install location, you may wish to create a link.
The uC-libc library in its present form has no setjmp or longjmp functions which are later needed by sh. The
easiest way to fix this, is to move uC-libc/machine/setjmp.S to uC-libc/sysdeps/ and include it (setjmp.o) to uC-
libc/sysdeps/makefile.objs
cd uC-libc
make
If you receive any errors about missing files typically in the asm, linux or net directories such as "/asm/types.h -
No such file or directory," then check that you have configured your kernel (/include/asm links are in place) and
that there is either the linux kernel source or a link to linux in the same directory that uC-libc is present in.
This compiles the uC-libc library (libc.a) and leaves it in the uClibc directory. We now need to make this available
to the m68k-pic-coff tools. Either a link can be made or the files copied.
cp libc.a /opt/uClinux/m68k-pic-coff/lib/libc.a
cp crt0.o /opt/uClinux/m68k-pic-coff/lib/crt0.o
The include/header files also need to be available. The chaintool has already placed assert.h in /opt/uClinux/
m68k-pic-coff/include therefore you may wish to rename the present directory.
mv /opt/uClinux/m68k-pic-coff/include /opt/uClinux/m68k-pic-coff/include.old
ln -sf include /opt/uClinux/m68k-pic-coff/include
uC-libm-0.9.1.tar.gz (101KB)
The standard maths library is far less problematic. Simply extract it into /opt/uClinux and make,
then create links in the m68k-pic-coff/lib to point to the library and header files. These header files will actually
find their way to the uC-libc/include directory by a symbolic link.
ln -f libmf.a /opt/uClinux/m68k-pic-coff/lib/libmf.a
ln -f libmf.a /opt/uClinux/m68k-pic-coff/lib/libm.a
ln -f mathf.h /opt/uClinux/m68k-pic-coff/include/mathf.h
ln -f mathf.h /opt/uClinux/m68k-pic-coff/include/math.h
genromfs-0.3.tar.gz (17KB)
genromfs-0.3.diff.gz (1KB)
"make install", will install genromfs in /usr/bin plus put its documentation in usr/man/man8
Genromfs can then be called on the command line to generate your own romfs.
The genromfs has some bugs relating to device nodes. If your romfs isn't correct, the kernel normally reports
problems opening initial console (can't open the device node) and then panics. Often it is useful to mount your
newly generated romfs to see if everything is correct. This can be done using
romdisk-0.9.1.tar.gz (184KB)
uC-src-0.9.1.tar.gz (526KB)
deftemplate.sh (1KB)
buildenv.sh (1KB)
The romdisk gziped tarball contains device nodes. As a result this file must be extracted as root into the /opt/
uClinux directory.
The romdisk forms the bases of your embedded systems filesystem. The genromfs utility will create a romfs.img
from this tree, thus any changes or files you place in this tree will be present in the uClinux filesystem. The
romdisk has the following directories (and file),
bin dev etc htdocs lib proc ramfs.img sbin tmp usr var
You will notice if you change into the bin directory that precompiled binaries are already present. Their source is
installed next.
If you experience problems building sh - undefined reference to 'setjmp' or 'longjmp' check that you have included
setjmp.S in the uC-libc build.
Running make will build all the sources listed in the SUBDIR define of the Makefile. Therefore if you add extra
sources here you must include them in the Makefile. At the completion of the build process, the binaries will be in
the src/bin directories. The deftemplate.sh script will copy the required binaries from /src to /romdisk/bin or sbin.
cp deftemplate.sh /opt/uClinux/
One last file is needed. buildenv.sh will set up the build environment from a clean directory, copying the required
sources and setting up a Makefile. Copy buildenv.sh to /opt/uClinux/bin and create a link in /usr/bin.
cp buildenv.sh /opt/uClinux/bin/
ln /opt/uClinux/bin/buildenv.sh /usr/bin/buildenv
and that is it. Now if you create an empty directory somewhere and type buildenv, a makefile will mysteriously
appear. Then type make, to see the userland sources, romdisk etc copied over and built.
gcc-2.7.2.3-pic-32bit.diff
crt0.S
or . . . gcc-2.7.2.3-pic-32bit.tar.gz (Gzip Archive of above two files)
With the current m68k-pic-coff compiler, a limitation exists which prevents building executables over 32k in size.
This size comes about by using 16 bit signed offsets. Erwin Authried has released some patches for m68k-pic-
coff-gcc to generate 32 bit offsets which removes this limitation. Code can be built normally with 16 bit offsets
without specifying anything special. If your program exceeds 32k, then you can call the compiler with -fPIC which
generates 32-bit offsets.
Code compiled with the -fPIC switch is larger, thus it should only be used where needed. In addition to the
compiler patch, a new C Startup file (crt0.S) is needed. This should be compiled and added to m68k-pic-coff/lib.
The startup file contains no _cleanup() function thus this must be included elsewhere.
Debugging
gdb-4.18.tar.gz (11.3MB)
gdb-4.18-gdbserver.diff.gz (2KB)
Debugging is an optional extra for the "smarter" uClinux programmers. It consists of two components, gdb-4.18
running on the host configured for m68k-coff and a gdbserver running on your uClinux platform. They talk
together over the network (IP). While the gdb client should compile with little effort, the gdb-server requires not
only patching but also support from the uClibc library, a debug uClibc library and support from the uClinux Kernel
- but don't run away yet.
gdbserver requires a trap in the uClinux Kernel to operate. The good news is that this has been included in the
later kernels and thus in many cases needs no attention. The uClinux-2.0.38.1pre7 kernel detailed here already
has this support.
Now configure the gdb client running on the host to debug m68k-coff code and built it.
./configure --target=m68k-unknown-coff
make
To build gdbserver requires some extra functions not found in the default uC-Libc library. The source is present in
the library but is not specified to be built by default. Change into the /uC-libc/sysdeps/m68k and edit ptrace.c
so that the ptrace.h path is correct. Change #include <sys/ptrace.h> to #include <linux/ptrace.h>.
Then add the source to be build by editing /uC-libc/sysdeps/makefile.objs and adding m68k/ptrace.
o to the end of the OBJS list, so that it looks like
waitpid.o \
write.o \
m68k/ptrace.o
Then rebuild the uC-libc library and add the new libc.a to /m68k-pic-coff/lib.
cd gdb-4.18/gdb/gdbserver
../../configure --target=m68k-linux-coff
make gdbserver
coff2flt -s 32768 -o gdbserver gdbserver.coff
Running make by itself will create a gdbserver flat binary, however it's default stack size is typically around 4k. As
a result, gdbserver may crash or fail to connect. Therefore it is recommended you link with a stack size of 32k
Keeping track of all the changes and providing diff files frequently can cause headaches. Some changes get
included while others dont. To ensure your development sources are always up to date Lineo has provided a
CVS server. The CVS server allows changes to be made from multiple users, while keeping track of what the
changes are and who made them. If something gets broken in the process it is simple to back track through the
changes.
The uClinux repository is available at http://cvs.uclinux.org. From there you can browse the source and check out
what changes have been made and why.
If you want to download the complete source then this can be done by logging into CVS using the CVS client on
your development box. uClinux provides anonymous read-only access to their repository.
This logs you into CVS using the username anonymous and password anonymous.
The z3 specifies the compression used. z3 is maximum compression. The co stands for check out, while P
specifies pruning directories (i.e. remove empty directories).
Then at a later date you can update your sources by using the following command in the relevant directory.
cvs z3 update d P
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
The
Parallel
Port
Debug
Tool is a
handy
DOS
utility
when
debugging
devices
connected
to the
Parallel
Port. It
gives a
visual
display of
the three
software
registers
used by
the
Standard
Parallel
Port.
Each
individual
bit can be
turned on
or off by
a simple
click of
the
mouse.
spp20.
zip
(14,839
Bytes)
A solution to this
problem would be to
have two sections to
the control port. One
section would be used
to set the outputs
which is stored as a
variable. When this
This
Graphical
Parallel
Port
Debug
Utility is a
contribution
from
Anders
Petersson.
Including
an End Of
Interrupt
(EOI)
Facility,
this
program is
driven by
either the
mouse or
Hotkeys.
panders.zip
(35,632
Bytes)
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
So you now have a uClinux Development System. Here is the summary of the setup.
There is two main areas of development. Work can be done on the uClinux kernel or on the userland binaries. As
the kernel is normally provided with many platforms, it is most common to work on the userland binaries. Never
the less, the uClinux Kernel should be set up first.
The kernel must be configured before building. For those who have configured their desktop kernels, this process
is no different except that uClinux doesnt support loadable modules. For others it will be a new experience. To
start jump into /opt/uClinux/linux and run the configuration utility.
cd /opt/uClinux/linux
make menuconfig
It is now time to configure the kernel. As you will be targeting different architectures and platforms there is no one
good choice here. Select your processor and board from the Platform Dependent Setup and then jump through
the menu configuring any extra parameters.
Once you have gotten over the configuration dilemmas, it is time to put your choices to code. Simply run the
following commands and sit back and watch. It can take some time to compile depending upon the speed of your
development system.
make dep
make clean
make linux.bin
Make dep will cause make to set up any dependencies. Clean will remove any old entries from previous builds,
and make image.bin will build image.bin which is the compiled kernel in pure binary.
Once this is complete you should have a couple of files in the linux directory (/opt/uClinux/linux). These will be
linux.text, linux.data, linux.bin and system map.
Building the kernel will first start by building the individual components/subsystems of the kernel. Once this is
done all the subsystem object files will be linked using the sections from the linker file (.LD) which will reside in
arch/$(ARCH)/platform/$(PLATFORM)/$(BOARD)/$(MODEL).ld, and the startup C asm code (crt0_rom.S) to
create a file called linux.
The linker file defines memory sections which tell the compiler how much memory is available and where to place
various pieces of code. The startup asm code is the code executed straight after the reset vector or bootloader
which sets up various parts of the microcontroller such as clock dividers, serial port, DRAM, SRAM, memory
banks, watchdogs etc which must be set up before the microcontroller can start running the linux kernel. It also
sets up the stack, zero outs the .bss segment, copies the .data segment into RAM and then jumps to start_kernel
() which is the entry point into the C Code.
A symbol/system map is then be generated from the linux file. This is handy for debugging showing where each
function is located in memory.
Linux.data, a file containing all the data segment code is then created from linux by removing all the readonly
segments and other non required segments.
A Linux.text file is also created containing all the text segment code (fixed code and variables/strings)
The .Text and .Data segments are then concatenated together to produce linux.bin.
We are then left with linux.bin which is the binary code of the kernel. This can actually be loaded into memory
and executed, however it will fail shortly after trying to expand the ROM filesystem and mounting the device
nodes contained within the romfs.
Building the kernel only needs to be done once while no modifications are made to the kernel. On each build of
the system, the rom filesystem will be concatenated with the linux.bin.
While there is only one common source directory for the linux kernel, you can have multiple projects of the rom
filesystem and userland binaries. On a central server you could have the one common kernel, but have multiple
software designers working on the one system using their own rom filesystems.
To set up a working environment simply create a directory in a convenient location, typically home/<username>/
for multiuser systems and then run buildenv
cd /home/cpeacock/
mkdir ucsimm
buildenv
buildenv will build a uClinux development environment, firstly my creating one Makefile in your directory. If you
then type make, the development environment is copied across from the /opt/uClinux/ directory, and a image.bin
file created.
make
This development environment consists of userland binaries in a ROM filesystem which is mounted by the kernel
at bootup. Every executable specified in the /src/makefile is built and its flat binary placed in /src/bin. The
deftemplate.sh file is then executed to copy specified binaries into the romdisk tree which will provide the base of
our romfs image. It should be noted that the deftemplate script only copies the binaries across to the romdisk
tree. It does not remove them, thus to do this you must uncomment the relevant line in the deftemplate script and
manually remove the file from the romdisk tree.
The romdisk tree also includes the configuration files and directory structure of the rom filesystem.
/bin /dev /etc /htdocs /lib /proc ramfs.img /sbin /tmp /usr /var
The romdisk.img file system is then automatically generated from the above tree using
The romdisk.img is then concatenated with /linux/linux.bin (the binary of the kernel we created earlier) to create
image.bin, a file which contains the linux kernel plus the rom filesystem. This image is now complete and ready to
download to your uClinux System. To get a better picture of the complete build process, a typical 2.0.38 uCsimm
memory map is shown here.
The bootloader flash is already present in the development system we are using, in this case the uCsimm. This is
a dragonball module from Lineo. The ROM Vectors, .TEXT and .DATA segments are created as part of the
kernel compilation. These three sections make up the linux.bin file which can be found in /opt/uClinux/linux.
The userland binaries are compiled into flat binary executables and placed in the romdisk directory. Genromfs
then packs this up into the romfs.img which is concatenated with linux.bin to provide the image.bin file. This will
grow or reduce in size depending upon what binaries and files you include in the ROM filesystem. The only
limitation is the maximum memory you have in your system.
This image.bin is a binary file which is loaded into the development system via the bootloader.
At the present moment we have built enough code to upload the image.bin and successfully log into the target
uClinux system. However we are using the default IP address and other parameters straight out of the box.
Enter into your romdisk directory. You should have a structure simular to this.
/bin /dev /etc /htdocs /lib /proc ramfs.img /sbin /tmp /usr /var
Just like any linux system, the critical configuration files can be found in /etc
#!/bin/sh
#
# system startup.
/sbin/ifattach \
--addr 192.168.1.200 \
--mask 255.255.255.0 \
--net 192.168.1.0 \
--gw 192.168.1.100 eth0
You will need to change the hostname and IP address, mask, network and gateway parameters to suit your
network. The other thing you will want to change is the nfs mount, /bin/mount -t nfs 192.168.1.11:/home/jeff/kit /
usr
NFS or Network File System is a way of exporting and mounting directories across UNIX and UNIX aware
systems. This may come in extremely handy during development, allowing the facility to export your working
directory to your uClinux platform. This allows the ability to compile code on your linux development system and
then run it on your embedded systems mounted network drive without the need of copying the flat binary or
flashing a new ROMFS. As you can imagine this save an enormous amount of time.
With a flashloader/ethernet flash loader utility for your desired platform, you can perform flash updates over the
wire. This also speeds up your development. Transferring a 1MB image.bin file over a 115,200 serial link is not
fast nor exciting.
To use NFS you will first need to set up your development box to export your desired directories. Exporting any
directories over the network can lead to security issues thus it is recommended you spend a little time tying your
machine down if you are on a public network or have a dial up Internet connection. NFS exports are defined in
the /etc/exports file. You will need to edit this file as root.
/home (ro)
This exports the home directories to anyone with read only rights. If you have other sensitive information in your
home directories you can either specify the exact development environment or specify which machines have
access to this exported directory eg,
/home/cpeacock/ucsimm uCSimm(ro)
where uCsimm is the host name of your uClinux based system. This would have to be included in your /etc/hosts
file or the IP address explicitly specified.
After changing the exports directory you can either restart your computer (mainstream windows users) or restart
the NFS daemons. This can be accomplished by
/etc/rc.d/init.d/nfs stop
/etc/rc.d/init.d/nfs start
on most systems. Please consult your linux distribution documentation if this does not work.
Once this has been successfully completed, modify the rc file to include your new mount details in my case,
You can also log into your uClinux system and run this at the command line. This is handy after your uClinux
systems have been committed to the field and you need to do a quick few things or a reimage.
uClinux has a RAM file system (ramdisk) for its scratch pad /tmp and /var areas in the absence of a hard disk
drive. The current distribution of uClinuxs romdisk comes with a ramfs of 256kbytes unformatted and is missing
a /var/tmp directory causing a cd tmp to report a bad directory. The /tmp directory in the root is a symbolic link
which points to /var/tmp. var is the mount point for the RAM file system.
It consists of a ext2 filesystem which is compressed using a Zero Run Length Encoding algorithm (ZRTE). This is
uncompressed using the expand utility to the RAM block device /dev/ram0. Once this process has been
completed it is then mounted as an ext2 file system with the mount point of /var.
If we have a need to fix the tmp link, we could simply add a command in the rc startup script to make a tmp
directory in var after the ramfs has been mounted. However if you need to increase the size of the ramdisk, this
isnt as simple. You will need to create a new ramfs.img. In some applications a larger ramdisk is required. You
may want to log data to a file that is then downloaded using anonymous FTP, HTTP etc.
Creating a new ramfs is a reasonably simple task. One of the problems you need to watch is byte order, whether
your system is big endian or little endian.
Start by zeroing out the ram block device. Later, we will use a zero run length compression utility, thus in the
interests of getting a more compressible image, its recommended you carry out this step. You will also need to
choose what size a ramdisk you need. A larger ramdisk will allow you to store more logs or temporary files but at
the expense of system RAM. It will normally depend upon what applications you are using with your uClinux
system.
Next we make a second extended file system. The v flag turns on verbose mode so we can see some of the
stats. By default 5% of the blocks is reserved for superuser. We turn this off using m0. We also turn off any
extra features of the ext2fs using -Onone. On post 2.2 kernel systems, sparse_super and filetype options are
automatically turned on when creating an ext2fs. However both these features are not correctly supported by
kernels pre 2.2 and as a result mount will report a failure when mounting the filesystem on your 2.0.38 uClinux
system.
The next step is to add extra folders or files to the ramdisk. This is an optional procedure thus you can omit this
step, if not needed. By default when the ext2 filesystem is created a lost+found directory is added. This will be
present in /var/lost+found once mounted on your uClinux system. It is also recommended to create a tmp folder
so the tmp symbolic link works. To add files and folders, first mount the file system as ext2.
Then once you are finished, unmount the file system to ensure a clean mount in the future.
# umount /mnt/ramdisk
Now its time to move the filesystem from the ram block device to a local file. This copies the file system byte for
byte to ramfsraw.img. For a 1MB ramfs, this file will be 1MB in size.
It would be quite inefficient to add this 1Mbyte file to the romdisk in its current form, and since the majority of the
filesystem is free, we can compress it extremely efficiently using ZRLE (Zero Run Length Encoding). You may
see some documentation describing the process as making a file with holes.
What ZRLE does is record the blocks of non-zero data, prefixing it with the length of the block and its position in
the file. As most of the data is zero, it can strip this out. The expand utility will simply zero out the entire length of
the expanded file, then copy the blocks of data back to its relevant locations indicated by its position header.
The compression can be done with a utility called holes. There are a couple of versions floating around which
have endian and/or block size reporting problems. You can download the source and compiled binaries from ftp://
ftp.beyondlogic.org/uClinux/ramfsutils.tar.gz These binaries will run on Linux little endian platforms.
Listing the two files will show the run length compression at work. Now we can add it to our romdisk and not
waste considerable space. Of course if you do put some files in the ramdisk, then it wont compress as well.
# ls ram* -l
-rw-r--r-- 1 root root 2639 Mar 4 16:00 ramfs.img
-rw-r--r-- 1 root root 1048576 Mar 4 15:59 ramfsraw.img
You may also notice that our generated ramfs.img is smaller than the uClinux stock ramfs.img (3340), even that
an extra folder has been added. Just another reason why you should update and generate your own. (For some
reason, the run length block sizes on the stock ramfs are no larger than 200-300 bytes even though expand.c
allocates a 2048 byte buffer when expanding the image).
You can test your newly created ramfs on your uClinux platform by firstly unmounting the existing ramfs and then
expanding and mounting your new ramfs.
/bin/umount /var
/sbin/expand /ramfs.img /dev/ram0
/bin/mount -t ext2 /dev/ram0 /var
However you may also wish to test it on your linux desktop. Coping the expand.c file from /src/init/ and
recompiling it for x86 linux is going to lead you into endian problems. Either fix up the ntohl() define, or use the
precompiled expand binary for x86 from the ramfsutils.tar.gz tarball.
Mounting your uClinux development directory to /usr helps to speed development along. This allows the
developer to compile the m68k binaries on the linux development system and have it instantly available via the
NFS mounted volume on the target.
However there are other situations where you may want to modify other files in FLASH, such as the configuration
files in /etc for your Internet daemons, http web servers etc. One option is the flash and burn method - simply
change the file, rebuild the image, download the image to your uClinux target system, hold your breath and hope
that the changes were correct. If not pull one more hair out and simply repeat the process.
A much speedier approach and thus the better option around this problem is to mount the root uClinux directory
as a NFS volume which is pulled from your development machine. This allows modifications to be performed on
any file in the file system and have it instantly available on your uClinux system. Quite clearly this can save
considerable time.
The downside is off course, speed. Every request will interrogate your NFS server causing latency on many
commands. However this process is normally only done during development, thus speed should not pose any
problems.
Setting up a root NFS filesystem requires a little tinkering with the kernel. First edit the setup.c file in /arch/
{arch}/kernel/ and add the \ following string copy command to place your NFS server and host details in the
kernel command line buffer.
ROOT_DEV = MKDEV(BLKMEM_MAJOR,0);
+ #ifdef CONFIG_ROOT_NFS
+ strcpy(command_line,
+ "root=/dev/nfs "
+ "nfsroot=192.168.0.2:/ucsimm/romdisk "
+
"nfsaddrs=192.168.0.200:192.168.0.2:192.168.0.1:255.255.255.0:"
+ "ucsimm:eth0:none");
+ #endif
root=/dev/nfs
This is used to enable root NFS. It is not a real device but a pseudo-NFS-device.
nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
server-ip is the IP address of the NFS server you wish to mount the filesystem from. The root directory specifies
the name of the directory on the NFS server to mount as root. This is followed by a comma and any standard
NFS options. The option field is normally left blank, as is the case in the example. Extra options can be found in
the nfsroot.txt file as part of the documentation you receive with the kernel.
nfsaddrs=<client-ip>:<server-ip>l:<gw-ip>:<netmask>:<hostname>:<device>:
<autoconf>
The client IP is the IP address you wish to give your embedded uClinux target. This is normally assigned by
ifattach in your rc file, but since this will no longer be available locally, you must provide these details here. The
server-ip once again specifies the NFS servers IP - the gateway and netmask should be self explanatory, the
hostname is your local devices name, the device specifies which interface to set up, while autoconf specifies if
BOOTP or rarp should be used. None specifies no auto-configuration.
These three parameters are all appended together. Note the space after each command.
Once these changes have been made and the changes saved, configure the uClinux kernel to support root NFS.
This is found in the Filesystems menu - select both "NFS filesystem support" and "Root file system on NFS".
Then rebuild your kernel. As the rom filesystem will be mounted from the NFS server there is no need to
generate the ROM file system and append this to the end of the linux.bin file. Simply load the linux.bin file as is.
At this point make sure the directory you specified in is exported correctly and reset your uClinux target. If all
goes well it should boot up with
eth0: Attempting TP
eth0: using 10Base-T (RJ-45)
Root-NFS: Got file handle for /ucsimm/romdisk via RPC
VFS: Mounted root (nfs filesystem).
And provide the user with a log-in prompt as per usual. If the NFS server is not present the following message
will result. The uClinux target will then keep trying in an endless loop until the NFS server comes on-line.
eth0: Attempting TP
eth0: using 10Base-T (RJ-45)
NFS server 192.168.0.2 not responding, still trying.
However should you get the following message, this would suggest that your exports are not set up correctly or
you are trying to export the directory from the wrong server. In this case, check your exports file and restart the
NFS service if required. After a kernel panic, you will need to reboot your uClinux target before it will attempt to
connect again.
eth0: Attempting TP
eth0: using 10Base-T (RJ-45)
Root-NFS: Server returned error 13 while mounting /ucsimm/romdisk
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Cannot open root device 02:00
Kernel panic: VFS: Unable to mount root fs on 02:00
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
The Serial Port is harder to interface than the Parallel Port. In most cases, any device you connect to the serial
port will need the serial transmission converted back to parallel so that it can be used. This can be done using
a UART. On the software side of things, there are many more registers that you have to attend to than on a
Standard Parallel Port. (SPP)
So what are the advantages of using serial data transfer rather than parallel?
1. Serial Cables can be longer than Parallel cables. The serial port transmits a '1' as -3 to -25 volts and a '0' as
+3 to +25 volts where as a parallel port transmits a '0' as 0v and a '1' as 5v. Therefore the serial port can
have a maximum swing of 50V compared to the parallel port which has a maximum swing of 5 Volts.
Therefore cable loss is not going to be as much of a problem for serial cables than they are for parallel.
2. You don't need as many wires than parallel transmission. If your device needs to be mounted a far distance
away from the computer then 3 core cable (Null Modem Configuration) is going to be a lot cheaper that
running 19 or 25 core cable. However you must take into account the cost of the interfacing at each end.
3. Infra Red devices have proven quite popular recently. You may of seen many electronic diaries and
palmtop computers which have infra red capabilities build in. However could you imagine transmitting 8 bits
of data at the one time across the room and being able to (from the devices point of view) decipher which
bits are which? Therefore serial transmission is used where one bit is sent at a time. IrDA-1 (The first infra
red specifications) was capable of 115.2k baud and was interfaced into a UART. The pulse length however
was cut down to 3/16th of a RS232 bit length to conserve power considering these devices are mainly used
on diaries, laptops and palmtops.
4. Microcontroller's have also proven to be quite popular recently. Many of these have in built SCI (Serial
Communications Interfaces) which can be used to talk to the outside world. Serial Communication reduces
the pin count of these MPU's. Only two pins are commonly used, Transmit Data (TXD) and Receive Data
(RXD) compared with at least 8 pins if you use a 8 bit Parallel method (You may also require a Strobe).
Table of Contents
DTE/DCE Speeds
Flow Control
The UART (8250's and Compatibles)
Type of UARTS (For PC's)
Part 2 : Serial Ports' Registers (PC's)
Port Addresses and IRQ's
Table of Registers
DLAB ?
Interrupt Enable Register (IER)
Interrupt Identification Register (IIR)
First In / First Out Control Register (FCR)
Line Control Register (LCR)
Modem Control Register (MCR)
Line Status Register (LSR)
Modem Status Register (MSR)
Scratch Register
Part 3 : Programming (PC's)
Polling or Interrupt Driven?
Source Code - Termpoll.c (Polling Version)
Source Code - Buff1024.c (ISR Version)
Interrupt Vectors
Interrupt Service Routine
UART Configuration
Main Routine (Loop)
Determining the type of UART via Software
Part 4 : External Hardware - Interfacing Methods
RS-232 Waveforms
RS-232 Level Converters
Making use of the Serial Format
8250 and compatable UART's
CDP6402, AY-5-1015 / D36402R-9 etc UARTs
Microcontrollers
Hardware Properties
Devices which use serial cables for their communication are split into two categories. These are DCE
(Data Communications Equipment) and DTE (Data Terminal Equipment.) Data Communications
Equipment are devices such as your modem, TA adapter, plotter etc while Data Terminal Equipment is
your Computer or Terminal.
The electrical specifications of the serial port is contained in the EIA (Electronics Industry Association)
RS232C standard. It states many parameters such as -
Above is no where near a complete list of the EIA standard. Line Capacitance, Maximum Baud Rates etc
are also included. For more information please consult the EIA RS232-C standard. It is interesting to
note however, that the RS232C standard specifies a maximum baud rate of 20,000 BPS!, which is rather
slow by today's standards. A new standard, RS-232D has been recently released.
Serial Ports come in two "sizes", There are the D-Type 25 pin connector and the D-Type 9 pin connector
both of which are male on the back of the PC, thus you will require a female connector on your device.
Below is a table of pin connections for the 9 pin and 25 pin D-Type connectors.
D-Type-25 Pin
D-Type-9 Pin No. Abbreviation Full Name
No.
Pin 2 Pin 3 TD Transmit Data
Pin 3 Pin 2 RD Receive Data
Pin 4 Pin 7 RTS Request To Send
Pin 5 Pin 8 CTS Clear To Send
Pin 6 Pin 6 DSR Data Set Ready
Pin 7 Pin 5 SG Signal Ground
Pin 8 Pin 1 CD Carrier Detect
Pin 20 Pin 4 DTR Data Terminal Ready
Pin 22 Pin 9 RI Ring Indicator
Table 1 : D Type 9 Pin and D Type 25 Pin Connectors
Pin Functions
CTS Clear to Send This line indicates that the Modem is ready to exchange data.
DCD Data Carrier Detect When the modem detects a "Carrier" from the modem at the
other end of the phone line, this Line becomes active.
DSR Data Set Ready This tells the UART that the modem is ready to establish a link.
DTR Data Terminal Ready This is the opposite to DSR. This tells the Modem that the UART
is ready to link.
RTS Request To Send This line informs the Modem that the UART is ready to exchange
data.
RI Ring Indicator Goes active when modem detects a ringing signal from the PSTN.
Null Modems
A Null Modem is used to connect two DTE's together. This is commonly used as a cheap way to network
games or to transfer files between computers using Zmodem Protocol, Xmodem Protocol etc. This can
also be used with many Microprocessor Development Systems.
Above is my preferred method of wiring a Null Modem. It only requires 3 wires (TD, RD & SG) to be wired
straight through thus is more cost effective to use with long cable runs. The theory of operation is reasonably
easy. The aim is to make to computer think it is talking to a modem rather than another computer. Any data
transmitted from the first computer must be received by the second thus TD is connected to RD. The second
computer must have the same set-up thus RD is connected to TD. Signal Ground (SG) must also be connected
so both grounds are common to each computer.
The Data Terminal Ready is looped back to Data Set Ready and Carrier Detect on both computers. When the
Data Terminal Ready is asserted active, then the Data Set Ready and Carrier Detect immediately become
active. At this point the computer thinks the Virtual Modem to which it is connected is ready and has detected
the carrier of the other modem.
All left to worry about now is the Request to Send and Clear To Send. As both computers communicate
together at the same speed, flow control is not needed thus these two lines are also linked together on each
computer. When the computer wishes to send data, it asserts the Request to Send high and as it's hooked
together with the Clear to Send, It immediately gets a reply that it is ok to send and does so.
Notice that the ring indicator is not connected to anything of each end. This line is only used to tell the
computer that there is a ringing signal on the phone line. As we don't have a modem connected to the phone
LoopBack Plug
This loopback plug can come in extremely handy when writing Serial /
RS232 Communications Programs. It has the receive and transmit
lines connected together, so that anything transmitted out of the Serial
Port is immediately received by the same port. If you connect this to a
Serial Port an load a Terminal Program, anything you type will be
immediately displayed on the screen. This can be used with the
examples later in this tutorial.
Please note that this is not intended for use with Diagnostic Programs
and thus will probably not work. For these programs you require a
differently wired Loop Back plug which may vary from program to
Figure 2 : Loopback Plug Wiring Diagram program.
We have already talked briefly about DTE & DCE. A typical Data Terminal Device is a computer and a typical
Data Communications Device is a Modem. Often people will talk about DTE to DCE or DCE to DCE speeds.
DTE to DCE is the speed between your modem and computer, sometimes referred to as your terminal speed.
This should run at faster speeds than the DCE to DCE speed. DCE to DCE is the link between modems,
sometimes called the line speed.
Most people today will have 28.8K or 33.6K modems. Therefore we should expect the DCE to DCE speed to
be either 28.8K or 33.6K. Considering the high speed of the modem we should expect the DTE to DCE speed
to be about 115,200 BPS.(Maximum Speed of the 16550a UART) This is where some people often fall into a
trap. The communications program which they use have settings for DCE to DTE speeds. However they see
9.6 KBPS, 14.4 KBPS etc and think it is your modem speed.
Today's Modems should have Data Compression build into them. This is very much like PK-ZIP but the
software in your modem compresses and decompresses the data. When set up correctly you can expect
compression ratios of 1:4 or even higher. 1 to 4 compression would be typical of a text file. If we were
transferring that text file at 28.8K (DCE-DCE), then when the modem compresses it you are actually
transferring 115.2 KBPS between computers and thus have a DCE-DTE speed of 115.2 KBPS. Thus this is
why the DCE-DTE should be much higher than your modem's connection speed.
Some modem manufacturers quote a maximum compression ratio as 1:8. Lets say for example its on a new
33.6 KBPS modem then we may get a maximum 268,800 BPS transfer between modem and UART. If you only
have a 16550a which can do 115,200 BPS tops, then you would be missing out on a extra bit of performance.
Buying a 16C650 should fix your problem with a maximum transfer rate of 230,400 BPS.
However don't abuse your modem if you don't get these rates. These are MAXIMUM compression ratios. In
some instances if you try to send a already compressed file, your modem can spend more time trying the
compress it, thus you get a transmission speed less than your modem's connection speed. If this occurs try
turning off your data compression. This should be fixed on newer modems. Some files compress easier than
others thus any file which compresses easier is naturally going to have a higher compression ratio.
Flow Control
So if our DTE to DCE speed is several times faster than our DCE to DCE speed the PC can send data to your
modem at 115,200 BPS. Sooner or later data is going to get lost as buffers overflow, thus flow control is used.
Flow control has two basic varieties, Hardware or Software.
Software flow control, sometimes expressed as Xon/Xoff uses two characters Xon and Xoff. Xon is normally
indicated by the ASCII 17 character where as the ASCII 19 character is used for Xoff. The modem will only
have a small buffer so when the computer fills it up the modem sends a Xoff character to tell the computer to
stop sending data. Once the modem has room for more data it then sends a Xon character and the computer
sends more data. This type of flow control has the advantage that it doesn't require any more wires as the
characters are sent via the TD/RD lines. However on slow links each character requires 10 bits which can slow
communications down.
Hardware flow control is also known as RTS/CTS flow control. It uses two wires in your serial cable rather than
extra characters transmitted in your data lines. Thus hardware flow control will not slow down transmission
times like Xon-Xoff does. When the computer wishes to send data it takes active the Request to Send line. If
the modem has room for this data, then the modem will reply by taking active the Clear to Send line and the
computer starts sending data. If the modem does not have the room then it will not send a Clear to Send.
UART stands for Universal Asynchronous Receiver / Transmitter. Its the little box of tricks found on your serial
card which plays the little games with your modem or other connected devices. Most cards will have the
UART's integrated into other chips which may also control your parallel port, games port, floppy or hard disk
drives and are typically surface mount devices. The 8250 series, which includes the 16450, 16550, 16650, &
16750 UARTS are the most commonly found type in your PC. Later we will look at other types which can be
used in your homemade devices and projects.
The 16550 is chip compatible with the 8250 & 16450. The only two differences are pins 24 & 29. On the 8250
Pin 24 was chip select out which functioned only as a indicator to if the chip was active or not. Pin 29 was not
connected on the 8250/16450 UARTs. The 16550 introduced two new pins in their place. These are Transmit
Ready and Receive Ready which can be implemented with DMA (Direct Memory Access). These Pins have
two different modes of operation. Mode 0 supports single transfer DMA where as Mode 1 supports Multi-
transfer DMA.
Mode 0 is also called the 16450 mode. This mode is selected when the FIFO buffers are disabled via Bit 0 of
the FIFO Control Register or When the FIFO buffers are enabled but DMA Mode Select = 0. (Bit 3 of FCR) In
this mode RXRDY is active low when at least one character (Byte) is present in the Receiver Buffer. RXRDY
will go inactive high when no more characters are left in the Receiver Buffer. TXRDY will be active low when
there are no characters in the Transmit Buffer. It will go inactive high after the first character / byte is loaded
into the Transmit Buffer.
Mode 1 is when the FIFO buffers are active and the DMA Mode Select = 1. In Mode 1, RXRDY will go active
low when the trigger level is reached or when 16550 Time Out occurs and will return to inactive state when no
more characters are left in the FIFO. TXRDY will be active when no characters are present in the Transmit
Buffer and will go inactive when the FIFO Transmit Buffer is completely Full.
All the UARTs pins are TTL compatible. That includes TD, RD, RI, DCD, DSR, CTS, DTR and RTS which all
interface into your serial plug, typically a D-type connector. Therefore RS232 Level Converters (which we talk
about in detail later) are used. These are commonly the DS1489 Receiver and the DS1488 as the PC has +12
and -12 volt rails which can be used by these devices. The RS232 Converters will convert the TTL signal into
RS232 Logic Levels.
The UART requires a Clock to run. If you look at your serial card a common crystal found is either a 1.8432
MHZ or a 18.432 MHZ Crystal. The crystal in connected to the XIN-XOUT pins of the UART using a few extra
components which help the crystal to start oscillating. This clock will be used for the Programmable Baud Rate
Generator which directly interfaces into the transmit timing circuits but not directly into the receiver timing
circuits. For this an external connection mast be made from pin 15 (BaudOut) to pin 9 (Receiver clock in.) Note
that the clock signal will be at Baudrate * 16.
If you are serious about pursuing the 16550 UART used in your PC further, then would suggest downloading a
copy of the PC16550D data sheet from National Semiconductors Site. Data sheets are available in .PDF
format so you will need Adobe Acrobat Reader to read these. Texas Instruments has released the 16750
UART which has 64 Byte FIFO's. Data Sheets for the TL16C750 are available from the Texas Instruments Site.
8250 First UART in this series. It contains no scratch register. The 8250A was an improved version
of the 8250 which operates faster on the bus side.
8250A This UART is faster than the 8250 on the bus side. Looks exactly the same to software than
16450.
8250B Very similar to that of the 8250 UART.
16450 Used in AT's (Improved bus speed over 8250's). Operates comfortably at 38.4KBPS. Still
quite common today.
16550 This was the first generation of buffered UART. It has a 16 byte buffer, however it doesn't
work and is replaced with the 16550A.
16550A Is the most common UART use for high speed communications eg 14.4K & 28.8K Modems.
They made sure the FIFO buffers worked on this UART.
16650 Very recent breed of UART. Contains a 32 byte FIFO, Programmable X-On / X-Off
characters and supports power management.
16750 Produced by Texas Instruments. Contains a 64 byte FIFO.
Above is the standard port addresses. These should work for most P.C's. If you just happen to be lucky
enough to own a IBM P/S2 which has a micro-channel bus, then expect a different set of addresses and
IRQ's. Just like the LPT ports, the base addresses for the COM ports can be read from the BIOS Data
Area.
The above table shows the address at which we can find the Communications (COM) ports addresses in
the BIOS Data Area. Each address will take up 2 bytes. The following sample program in C, shows how
you can read these locations to obtain the addresses of your communications ports.
#include <stdio.h>
#include <dos.h>
void main(void)
{
unsigned int far *ptraddr; /* Pointer to location of Port Addresses */
unsigned int address; /* Address of Port */
int a;
Table of Registers
DLAB ?
You will have noticed in the table of registers that there is a DLAB column. When DLAB is set to '0' or '1'
some of the registers change. This is how the UART is able to have 12 registers (including the scratch
register) through only 8 port addresses. DLAB stands for Divisor Latch Access Bit. When DLAB is set to
'1' via the line control register, two registers become available from which you can set your speed of
communications measured in bits per second.
The UART will have a crystal which should oscillate around 1.8432 MHZ. The UART incorporates a
divide by 16 counter which simply divides the incoming clock signal by 16. Assuming we had the 1.8432
MHZ clock signal, that would leave us with a maximum, 115,200 hertz signal making the UART capable
of transmitting and receiving at 115,200 Bits Per Second (BPS). That would be fine for some of the faster
modems and devices which can handle that speed, but others just wouldn't communicate at all.
Therefore the UART is fitted with a Programmable Baud Rate Generator which is controlled by two
registers.
Lets say for example we only wanted to communicate at 2400 BPS. We worked out that we would have
to divide 115,200 by 48 to get a workable 2400 Hertz Clock. The "Divisor", in this case 48, is stored in
the two registers controlled by the "Divisor Latch Access Bit". This divisor can be any number which can
be stored in 16 bits (ie 0 to 65535). The UART only has a 8 bit data bus, thus this is where the two
registers are used. The first register (Base + 0) when DLAB = 1 stores the "Divisor latch low byte" where
as the second register (base + 1 when DLAB = 1) stores the "Divisor latch high byte."
Below is a table of some more common speeds and their divisor latch high bytes & low bytes. Note that
all the divisors are shown in Hexadecimal.
Bit Notes
Bit 7 Reserved
Bit 6 Reserved
Bit 5 Enables Low Power Mode (16750)
Bit 4 Enables Sleep Mode (16750)
Bit 3 Enable Modem Status Interrupt
Bit 2 Enable Receiver Line Status Interrupt
Bit 1 Enable Transmitter Holding Register Empty Interrupt
Bit 0 Enable Received Data Available Interrupt
Table 7 : Interrupt Enable Register
The Interrupt Enable Register could possibly be one of the easiest registers on a UART to understand.
Setting Bit 0 high enables the Received Data Available Interrupt which generates an interrupt when the
receiving register/FIFO contains data to be read by the CPU.
Bit 1 enables Transmit Holding Register Empty Interrupt. This interrupts the CPU when the transmitter
buffer is empty. Bit 2 enables the receiver line status interrupt. The UART will interrupt when the receiver
line status changes. Likewise for bit 3 which enables the modem status interrupt. Bits 4 to 7 are the easy
ones. They are simply reserved. (If only everything was that easy!)
Bit Notes
Bits 6 and 7 Bit 6 Bit 7
0 0 No FIFO
0 1 FIFO Enabled but Unusable
1 1 FIFO Enabled
Bit 5 64 Byte Fifo Enabled (16750 only)
Bit 4 Reserved
Bit 3 0 Reserved on 8250, 16450
The interrupt identification register is a read only register. Bits 6 and 7 give status on the FIFO Buffer.
When both bits are '0' no FIFO buffers are active. This should be the only result you will get from a 8250
or 16450. If bit 7 is active but bit 6 is not active then the UART has it's buffers enabled but are unusable.
This occurs on the 16550 UART where a bug in the FIFO buffer made the FIFO's unusable. If both bits
are '1' then the FIFO buffers are enabled and fully operational.
Bits 4 and 5 are reserved. Bit 3 shows the status of the time-out interrupt on a 16550 or higher.
Lets jump to Bit 0 which shows whether an interrupt has occurred. If an interrupt has occurred it's status
will shown by bits 1 and 2. These interrupts work on a priority status. The Line Status Interrupt has the
highest Priority, followed by the Data Available Interrupt, then the Transmit Register Empty Interrupt and
then the Modem Status Interrupt which has the lowest priority.
Bit Notes
Bits 6 and 7 Bit 7 Bit 6 Interrupt Trigger Level
0 0 1 Byte
0 1 4 Bytes
1 0 8 Bytes
1 1 14 Bytes
Bit 5 Enable 64 Byte FIFO (16750 only)
Bit 4 Reserved
DMA Mode Select. Change status of RXRDY & TXRDY pins from
Bit 3
mode 1 to mode 2.
Bit 2 Clear Transmit FIFO
Bit 1 Clear Receive FIFO
Bit 0 Enable FIFO's
Table 9 : FIFO Control Register
The FIFO register is a write only register. This register is used to control the FIFO (First In / First Out)
Bit 0 enables the operation of the receive and transmit FIFO's. Writing a '0' to this bit will disable the
operation of transmit and receive FIFO's, thus you will loose all data stored in these FIFO buffers.
Bit's 1 and 2 control the clearing of the transmit or receive FIFO's. Bit 1 is responsible for the receive
buffer while bit 2 is responsible for the transmit buffer. Setting these bits to 1 will only clear the contents
of the FIFO and will not affect the shift registers. These two bits are self resetting, thus you don't need to
set the bits to '0' when finished.
Bit 3 enables the DMA mode select which is found on 16550 UARTs and higher. More on this later. Bits
4 and 5 are those easy type again, Reserved.
Bits 6 and 7 are used to set the triggering level on the Receive FIFO. For example if bit 7 was set to '1'
and bit 6 was set to '0' then the trigger level is set to 8 bytes. When there is 8 bytes of data in the receive
FIFO then the Received Data Available interrupt is set. See (IIR)
The Line Control register sets the basic parameters for communication. Bit 7 is the Divisor Latch Access
Bit or DLAB for short. We have already talked about what it does. (See DLAB?) Bit 6 Sets break enable.
When active, the TD line goes into "Spacing" state which causes a break in the receiving UART. Setting
this bit to '0' Disables the Break.
Bits 3,4 and 5 select parity. If you study the 3 bits, you will find that bit 3 controls parity. That is, if it is set
to '0' then no parity is used, but if it is set to '1' then parity is used. Jumping to bit 5, we can see that it
controls sticky parity. Sticky parity is simply when the parity bit is always transmitted and checked as a '1'
or '0'. This has very little success in checking for errors as if the first 4 bits contain errors but the sticky
parity bit contains the appropriately set bit, then a parity error will not result. Sticky high parity is the use
of a '1' for the parity bit, while the opposite, sticky low parity is the use of a '0' for the parity bit.
If bit 5 controls sticky parity, then turning this bit off must produce normal parity provided bit 3 is still set
to '1'. Odd parity is when the parity bit is transmitted as a '1' or '0' so that there is a odd number of 1's.
Even parity must then be the parity bit produces and even number of 1's. This provides better error
checking but still is not perfect, thus CRC-32 is often used for software error correction. If one bit
happens to be inverted with even or odd parity set, then a parity error will occur, however if two bits are
flipped in such a way that it produces the correct parity bit then an parity error will no occur.
Bit 2 sets the length of the stop bits. Setting this bit to '0' will produce one stop bit, however setting it to
'1' will produce either 1.5 or 2 stop bits depending upon the word length. Note that the receiver only
checks the first stop bit.
Bits 0 and 1 set the word length. This should be pretty straight forward. A word length of 8 bits is most
commonly used today.
Bit Notes
Bit 7 Reserved
Bit 6 Reserved
Bit 5 Autoflow Control Enabled (16750 only)
Bit 4 LoopBack Mode
Bit 3 Aux Output 2
Bit 2 Aux Output 1
Bit 1 Force Request to Send
Bit 0 Force Data Terminal Ready
Table 11 : Modem Control Register
The Modem Control Register is a Read/Write Register. Bits 5,6 and 7 are reserved. Bit 4 activates the
loopback mode. In Loopback mode the transmitter serial output is placed into marking state. The
receiver serial input is disconnected. The transmitter out is looped back to the receiver in. DSR, CTS, RI
& DCD are disconnected. DTR, RTS, OUT1 & OUT2 are connected to the modem control inputs. The
modem control output pins are then place in an inactive state. In this mode any data which is placed in
the transmitter registers for output is received by the receiver circuitry on the same chip and is available
at the receiver buffer. This can be used to test the UARTs operation.
Aux Output 2 maybe connected to external circuitry which controls the UART-CPU interrupt process.
Aux Output 1 is normally disconnected, but on some cards is used to switch between a 1.8432MHZ
crystal to a 4MHZ crystal which is used for MIDI. Bits 0 and 1 simply control their relevant data lines. For
example setting bit 1 to '1' makes the request to send line active.
Bit Notes
Bit 7 Error in Received FIFO
Bit 6 Empty Data Holding Registers
Bit 5 Empty Transmitter Holding Register
Bit 4 Break Interrupt
Bit 3 Framing Error
Bit 2 Parity Error
Bit 1 Overrun Error
Bit 0 Data Ready
Table 12 : Line Status Register
The line status register is a read only register. Bit 7 is the error in received FIFO bit. This bit is high when
at least one break, parity or framing error has occurred on a byte which is contained in the FIFO.
When bit 6 is set, both the transmitter holding register and the shift register are empty. The UART's
holding register holds the next byte of data to be sent in parallel fashion. The shift register is used to
convert the byte to serial, so that it can be transmitted over one line. When bit 5 is set, only the
transmitter holding register is empty. So what's the difference between the two? When bit 6, the
transmitter holding and shift registers are empty, no serial conversions are taking place so there should
be no activity on the transmit data line. When bit 5 is set, the transmitter holding register is empty, thus
another byte can be sent to the data port, but a serial conversion using the shift register may be taking
place.
The break interrupt (Bit 4) occurs when the received data line is held in a logic state '0' (Space) for more
than the time it takes to send a full word. That includes the time for the start bit, data bits, parity bits and
stop bits.
A framing error (Bit 3) occurs when the last bit is not a stop bit. This may occur due to a timing error. You
will most commonly encounter a framing error when using a null modem linking two computers or a
protocol analyzer when the speed at which the data is being sent is different to that of what you have the
UART set to receive it at.
A overrun error normally occurs when your program can't read from the port fast enough. If you don't get
an incoming byte out of the register fast enough, and another byte just happens to be received, then the
last byte will be lost and a overrun error will result.
Bit 0 shows data ready, which means that a byte has been received by the UART and is at the receiver
buffer ready to be read.
Bit Notes
Bit 7 Carrier Detect
Bit 6 Ring Indicator
Bit 5 Data Set Ready
Bit 4 Clear To Send
Bit 3 Delta Data Carrier Detect
Bit 2 Trailing Edge Ring Indicator
Bit 1 Delta Data Set Ready
Bit 0 Delta Clear to Send
Table 13 : Modem Status Register
Bit 0 of the modem status register shows delta clear to send, delta meaning a change in, thus delta clear
to send means that there was a change in the clear to send line, since the last read of this register. This
is the same for bits 1 and 3. Bit 1 shows a change in the Data Set Ready line where as Bit 3 shows a
change in the Data Carrier Detect line. Bit 2 is the Trailing Edge Ring Indicator which indicates that there
was a transformation from low to high state on the Ring Indicator line.
Bits 4 to 7 show the current state of the data lines when read. Bit 7 shows Carrier Detect, Bit 6 shows
Ring Indicator, Bit 5 shows Data Set Ready & Bit 4 shows the status of the Clear To Send line.
Scratch Register
The scratch register is not used for communications but rather used as a place to leave a byte of data.
The only real use it has is to determine whether the UART is a 8250/8250B or a 8250A/16450 and even
that is not very practical today as the 8250/8250B was never designed for AT's and can't hack the bus
speed.
Compiling the new m68k uClinux 2.4 kernel requires an upgrade of the development tools to m68k-elf. The latest
patched m68k toolchain is based on gcc-2.95.3. In preparation for building this compiler, download the following
files.
http://www.uclinux.org/pub/uClinux/m68k-elf-tools/tools-20010610/binutils-2.10.tar.bz2 (5.3MB)
http://www.uclinux.org/pub/uClinux/m68k-elf-tools/tools-20010610/binutils-2.10-elfPICgot.patch (5kB)
http://www.uclinux.org/pub/uClinux/m68k-elf-tools/tools-20010610/binutils-2.10-wdebug.patch (1kB)
http://www.uclinux.org/pub/uClinux/m68k-elf-tools/tools-20010610/gcc-2.95.3.tar.gz (12.3MB)
http://www.uclinux.org/pub/uClinux/m68k-elf-tools/tools-20010610/gcc-2.95.3-elfPICgot.patch (25kB)
http://www.uclinux.org/pub/uClinux/m68k-elf-tools/tools-20010610/elf2flt-20010606.tar.gz (8kB)
http://www.uclinux.org/pub/uClinux/m68k-elf-tools/tools-20010610/genromfs-0.3.1.tar.bz2 (16kB)
http://www.uclinux.org/pub/uClinux/m68k-elf-tools/tools-20010610/genromfs-0.3.uclinuxdiff (4kB)
David McCullough has done a wonderful job at writing an automated script that builds the m68k toolchain. This
automatically builds the following components,
http://www.uclinux.org/pub/uClinux/m68k-elf-tools/tools-20010610/build-m68k-elf.sh (12kB)
You are therefore given the option to download the script and automate the entire build process or manually build
the tools yourself. While a great deal of effort has gone into making the script as fool proof as possible, changes to
the uClibc library and other dependants can break the script causing headaches trying to hack all the headers
together or trying to diagnose where the build has failed. The script also installs the tools in /usr/local which is not
everyones preferred location.
The top of the build-m68k-elf.sh script details instructions on how to built your toolchain and what files are needed.
In order to build using the script, edit the following two variables found in the script.
UCLIBC="$BASEDIR/uClibc"
KERNEL="$BASEDIR/uClinux-2.0.x"
BASEDIR is set to your current directory, thus in most cases you only need to change uClinux-2.0.x to uClinux-
2.4.x if you are compiling for version 2.4 of the uClinux kernel. Once you are satisfied with your settings, start the
ball rolling with
This will build everything except for the multi-lib versions of uClibc. To build these run,
./build-m68k-elf.sh uclibc
binutils-2.10
First start by extracting the binary utilities, change to the binutil directory and apply the two binutil patches.
Note : While the patches are aimed at binutils-2.10 as apposed to binutils-2.10.1, the patches have been
tested to work on version 2.10.1 without any known side effects.
Configure the bin utilities for the m68k-elf target and give a suitable installation directory. Then make and
install the tools.
Now add the binaries to your path for gcc. During the gcc build process, a couple of libraries will be made
for the target architecture and thus the newly created gnu archiver is required. Either add a path or create
symbolic links to your binaries in /usr/bin (preferred).
cd /opt/uClinux/bin
ln s * /usr/bin/
gcc-2.95.3
Start on the gcc cross compiler by extracting the source and patching it.
Configure gcc with a target of m68k-elf, set the install path, enable version specific runtime libaries and
explicitly order it only to make the C compiler.
If an attempt is make to build the m68k-elf cross compiler now, it will fail complaining of two missing files,
stdlib.h and unistd.h. To prevent this edit gcc-2.95.3/gcc/config/m68k/t-m68k-elf and insert
TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc
make
make install
Now we can make elf2flt and install it in the appropriate location. The elf2flt utility will convert an ELF file
created by the toolchain into a binary flat (BFLT) file for use with uClinux. Start by extracting the tarball and
copying the flat.h header file from your kernels include directory.
During the build of the elf2flt utility, the libbfd.a (Binary File Descriptor Library) and libiberty.a (GNU Library)
is required. Edit the Makefile for elf2flt changing prefix= to prefix=../binutils-2.10.1 so these
two files can be found and linked with elf2flt. Now make the elf2flt utility and copy it to the following
locations.
make
cp elf2flt /opt/uClinux/m68k-elf/bin
ln f /opt/uClinux/bin/elf2flt /usr/bin
cp elf2flt.ld /opt/uClinux/m68k-elf/lib
and move the GNU binutils m68k-elf linker to linker.real (There are two copies)
mv /opt/uClinux/bin/m68k-elf-ld m68k-elf-ld.real
mv /opt/uClinux/m68k-elf/bin/ld ld.real
cp ld-elf2flt /opt/uClinux/bin/m68k-elf-ld
cp ld-elf2flt /opt/uClinux/m68k-elf/ld
When called, the linker script will look for the -elf2flt argument. If it is not passed to the linker (e.g.
compiling a kernel or library) the script will act transparent and pass all the arguments onto the real linker.
However, if elf2flt is present it will link the required files, then spawn the elf2flt utility to generate a flat
binary file.
genromfs
Extract the genromfs (Generate ROM FileSystem) utility, patch the source, build and install it.
And to finish it off, add all the binaries to your path. Either add a path or create links to your binaries in
/usr/bin (preferred)
cd /opt/uClinux/bin
ln sf * /usr/bin/
The uClibc library is available from CVS. For this you will need a CVS client installed.
We earlier built gcc with mulitilib support. This allows the use of one compiler for a subset of m68k architectures
including the m68000, m5200 coldfire and mcpu32 by specifying each cpu type by a switch. Gcc will then link your
source with the appropriate library based upon what switch you selected.
None /opt/uClinux/m68k-elf/lib
-msoft-float /opt/uClinux/m68k-elf/lib/msoft-float
-m5200 /opt/uClinux/m68k-elf/lib/m5200
-m5200 msep-data /opt/uClinux/m68k-elf/lib/m5200/msep-data
-m68000 /opt/uClinux/m68k-elf/lib/m68000
-m68000 msep-data /opt/uClinux/m68k-elf/lib/m68000/msep-data
-mcpu32 /opt/uClinux/m68k-elf/lib/mcpu32
-mcpu32 msep-data /opt/uClinux/m68k-elf/lib/mcpu32/msep-data
Therefore we must compile the uClibc library with the appropriate switch and place the compiled libraries in its
designated path. The build-m68k-elf.sh script has a extra option invoked by ./build-m68k-elf.sh uclibc
which will compile uClibc for all the above CPUs and copy them to the appropriate place. Where this script comes
unstuck, is if you have your tools installed in a location other than /usr.local. If you do use the script for compiling,
make sure you have set up the uClinux kernel and toolchain paths.
In many instances you will only need to compile two or three different versions. For example if you have a uCsimm,
then you will only need to target the m68000 and m68000 msep-data. In this case you may opt to compile multi-lib
support of uClibc manually.
Start with preparing uClibc. uClibc has support for a variety of architectures each having its own configuration file
stored away in the Configs directory.
cp /extra/Configs/Config.m68k Config
Edit the Config file, uncommenting the #CROSS=m68k-elf- line. Point KERNEL_SOURCE to the directory
containing your kernel source and add any architecture specific flags (eg. m68000) to the ARCH_CFLAGS towards
the end of the config file. If you are using Coldfire, you will also need to tell the assembler to use m5200
(eg. -m5200 -Wa,-m5200). Then start building uClibc.
make
Once completed, copy the libraries into the designated library directory. For example if we were compiling for
m68000, we would of added m68000 to the ARCH_CFLAGS of the uClibc Config file. After compilation we would
copy crt0.o, libc.a, libcrypt.a, libm.a, libresolv.a and libutil.a (all found in the libs directory) to /lib/m68000/.
cp lib/* /opt/uClinux/m68k-elf/lib/m68000/
These non-pic (Position Independent Code) binaries are compiled with an origin of zero. Position
Independence is achieved at run time using a relocation table appended to the end of the data segment
with the offset of each location-dependent address within the program. At execution, the binflat loader
copies the text and data segments into RAM, and then adds the start address of the relevant text or data
segment of where the binary is loaded at to each address specified in the relocation table.
The outcome is a relatively simple binary which can be loaded (fully relocated) anywhere in memory and
relocations performed before control is passed to it. As parts of the code is modified at runtime, the binary
must be loaded entirely into RAM in order for the relocation touch-ups to occur. Multiple copies must have
both different text and data segments for each instance. Its not uncommon for a single line printf(Hello
World\n); program to have 150 relocations. In this case as each relocation entry is 4 bytes there is a 600
byte relocation table overhead appended to the end of the Hello World binary. At run time, these 150
relocations must be individually touched up before the tread can be started.
The advantages fully relocated binaries have over PIC is it is supported on a wider number of platforms.
This is good if your platform doesnt support PIC. It also has fewer, less reachable limits than PIC. For
example m68k processors only support a 16 bit offset, thus restricting the GOT (Global Offset Table) to a
bit over 8000 relocations. Therefore if you needed more than 8000 relocations, a fully relocated binary may
be a good choice.
The m68k-elf compiler has an option (fpic / fPIC) to generate position independent code. This is achieved
by making all jump and subroutine calls PC relative rather than absolute. Data access is performed in the
form of a GOT (Global Offset Table). A GOT is a 16 bit look-up table which contains 32 bit address pointers
and resides at the start of the data segment, terminated by a minus 1.
The only problem with (fpic / fPIC) is its dependence that the data segment must immediately follow the
text segment. This is what occurs when the program is first compiled at location zero, thus branches can
be safety made.
-msep-data, short for separate data allows for the data and text segments to be separated and placed in
different regions of memory. Separate text and data segments come in useful with XIP (eXecute In Place)
where the code (.text) is executed from FLASH/ROM and the data segment is loaded into RAM where the
program can modify its variables. -msep-data will turn on the fPIC option. fPIC and fpic should not be
used with m68k-elf.
Therefore the main advantage of msep-data is the ability for binaries to do XIP. It also has a lot less
relocations, which helps to keep the file size smaller and saves in memory.
Advantages Disadvantages
Works for most targets Includes quite a few relocations that cause a
Has fewer limits Good for larger programs larger executable size and takes longer to load
& relocate.
Doesnt support XIP, thus .TEXT, .DATA &
.BSS must be in RAM. This must be duplicated
for multiple instances.
Advantages Disadvantages
Supports XIP. Can be executed from Maximum of about 8000 relocations.
FLASH/ROM. Multiple instances only need
one copy of .TEXT segment.
Smaller executable size.
Less relocations.
Compressed Binaries
Advantages Disadvantages
Smaller executable size. Latency at load to decompress executable.
Good for less frequently used executables Doesnt support XIP as .text must be
(e.g. flashloader etc) decompressed into RAM.
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Table of Contents
UART Configuration
Main Routine (Loop)
Determining the type of UART via Software
Part 4 : External Hardware - Interfacing Methods
RS-232 Waveforms
RS-232 Level Converters
Making use of the Serial Format
8250 and compatible UART's
CDP6402, AY-5-1015 / D36402R-9 etc UARTs
Microcontrollers
When writing a communications program you have two methods available to you. You can
poll the UART, to see if any new data is available or you can set up an interrupt handler to
remove the data from the UART when it generates a interrupt. Polling the UART is a lot
slower method, which is very CPU intensive thus can only have a maximum speed of
around 34.8 KBPS before you start losing data. Some newer Pentium Pro's may be able to
achieve better rates that this. The other option is using a Interrupt handler, and that's what
we have used here. It will very easily support 115.2K BPS, even on low end computers.
Polling the UART should not be dismissed totally. It's a good method for diagnostics. If you
have no idea of what address your card is at or what IRQ you are using you can poll the
UART at several different addresses to firstly find which port your card is at and which one
your modem is attached to. Once you know this information, then you can set up the
Interrupt routines for the common IRQs and by enabling one IRQ at a time using the
Programmable Interrupt Controller you can find out your IRQ, You don't even need a screw
driver!
Note: The source code above is not a really good example on how to program
but is rather cut down to size giving quick results, and making it easier to
understand. Upon executing your communications program, it would be
wise to store the status of the UART registers, so that they all can be
restored before you quit the program. This is to cause the least upset to
other programs which may also be trying to use the communications ports.
The first step to using interrupts is to work out which interrupt services your serial card.
Table 13 shows the base addresses and IRQ's of some standard ports. IRQ's 3 and 4 are
the two most commonly used. IRQ 5 and 7 are sometimes used.
Interrupt Vectors
Once we know the IRQ the next step is to find it's interrupt vector or software interrupt as
some people may call it. Basically any 8086 processor has a set of 256 interrupt vectors
numbered 0 to 255. Each of these vectors contains a 4 byte code which is an address of
the Interrupt Service Routine (ISR). Fortunately C being a high level language, takes care
of the addresses for us. All we have to know is the actual interrupt vector.
The above table shows only the interrupts which are associated with IRQ's. The other 240
are of no interest to us when programming RS-232 type communications.
For example if we were using COM3 which has a IRQ of 4, then the interrupt vector would
be 0C in hex. Using C we would set up the vector using the instruction setvect(0x0C,
PORT1INT); where PORT1INT would lead us to a set of instructions which would service
the interrupt.
However before we proceed with that I should say that it is wise to record the old vectors
address and then restore that address once the program is finished. This is done using
oldport1isr = getvect(INTVECT); where oldport1isr is defined using void
interrupt (*oldport1isr)();
Not only should you store the old vector addresses, but also the configuration the UART
was in. Why you Ask? Well it's simple, I wrote a communications program which was fully
featured in the chat side of things. It had line buffering, so no body could see my spelling
mistakes or how slowly I typed. It included anti-bombing routines and the list goes on.
However I couldn't be bothered to program any file transfer protocols such as Zmodem etc
into my communications program. Therefore I either had to run my communications
program in the background of Telemate using my communications program for chat and
everything else it was designed for and using Telemate to download files. Another method
was to run, say Smodem as a external protocol to my communications program.
Doing this however would mean that my communications program would override the
original speed, parity etc and then when I returned to the original communications program,
everything stopped. Therefore by saving the old configuration, you can revert back to it
before you hand the UART back over to the other program. Makes sense? However if you
don't have any of these programs you can save yourself a few lines of code. This is what
we have done here.
Now, could we be off track just a little? Yes that's right, PORT1INT is the label to our
interrupt handler called a Interrupt Service Routine (ISR). You can put just about anything
in here you want. However calling some DOS routines can be a problem.
bufferin++;
if (bufferin == 1024) bufferin = 0;
}
} while (c & 1);
outportb(0x20,0x20);
}
From the example above we check to see if there is a character to receive and if their is we
remove it from the UART and place it in a buffer contained in memory. We keep on
checking the UART, in case FIFO's are enabled, so we can get all data available at the
time of interrupt.
The last line contains the instruction outportb(0x20,0x20); which tells the
Programmable Interrupt Controller that the interrupt has finished. The Programmable
Interrupt Controller (PIC) is what we must go into now. All of the routines above, we have
assumed that everything is set up ready to go. That is all the UART's registers are set
correctly and that the Programmable Interrupt Controller is set.
The Programmable Interrupt Controller handles hardware interrupts. Most PC's will have
two of them located at different addresses. One handles IRQ's 0 to 7 and the other IRQ's 8
to 15. Mainly Serial communications interrupts reside on IRQ's under 7, thus PIC1 is used,
which is located at 0020 Hex.
Multi-Comm ports are getting quite common, thus table 16 includes data for PIC2 which is
located at 0xA0. PIC2 is responsible for IRQ's 8 to 15. It operates in exactly the same way
than PIC1 except that EOI's (End of Interrupt) goes to port 0xA0 while the disabling
(Masking) of IRQ's are done using port 0xA1.
7 IRQ15 Reserved
6 IRQ14 Hard Disk Drive
5 IRQ13 Maths Co-Processor
4 IRQ12 PS/2 Mouse
3 IRQ11 Reserved
2 IRQ10 Reserved
1 IRQ9 IRQ2
0 IRQ8 Real Time Clock
Table 16 : PIC2 Control Word (0xA1)
Most of the PIC's initiation is done by BIOS. All we have to worry about is two instructions.
The first one is outportb(0x21,(inportb(0x21) & 0xEF); which selects which
interrupts we want to Disable (Mask). So if we want to enable IRQ4 we would have to take
0x10 (16) from 0xFF (255) to come up with 0xEF (239). That means we want to disable
IRQ's 7,6,5,3,2,1 and 0, thus enabling IRQ 4.
But what happens if one of these IRQs are already enabled and then we come along and
disable it? Therefore we input the value of the register and using the & function output the
byte back to the register with our changes using the instruction outportb(0x21,
(inportb(0x21) & 0xEF);. For example if IRQ5 is already enabled before we come
along, it will enable both IRQ4 and IRQ5 so we don't make any changes which may affect
other programs or TSR's.
UART Configuration
It's a good idea to turn off the interrupt generation on the UART as the first instruction.
Therefore your initialization can't get interrupted by the UART. I've then chosen to set up
our interrupt vectors at this point. The next step is to set the speed at which you wish to
communicate at. If you remember the process, we have to set bit 7 (The DLAB) of the LCR
so we can access the Divisor Latch High and Low Bytes. We have decided to set the speed
to 38,400 Bits per second which should be find for 16450's and 16550's. This requires a
divisor of 3, thus our divisor latch high byte will be 0x00 and a divisor latch low byte, 0x03.
In today's standards the divisor low latch byte is rarely used but it still pays us to write 0x00
to the register just in case the program before us just happened to set the UART at a very
very low speed. BIOS will normally set UARTs at 2400 BPS when the computer is first
booted up which still doesn't require the Divisor Latch Low byte.
The next step would be to turn off the Divisor latch access bit so we can get to the Interrupt
Enable Register and the receiver/transmitter buffers. What we could do is just write a 0x00
to the register clearing it all, but considering we have to set up our word length, parity as so
forth in the line control register we can do this at the same time. We have decided to set up
8 bits, no parity and 1 stop bit which is normally used today. Therefore we write 0x03 to the
line control register which will also turn off the DLAB for us saving one more I/O instruction.
The next line of code turns on the FIFO buffers. We have made the trigger level at 14
bytes, thus bits 6 and 7 are on. We have also enabled the FIFO's (bit 0). It's also good
practice to clear out the FIFO buffers on initialization. This will remove any rubbish which
the last program may of left in the FIFO buffers. Due to the fact that these two bits are self
resetting, we don't have to go any further and turn off these bits. If my arithmetic is correct
all these bits add up to 0xC7 or 199 for those people which still work in decimal.
Then DTR, RTS and OUT 2 is taken active by the instruction outportb(PORT1 +
4,0x0B);. Some cards (Both of Mine) require OUT2 active for interrupt requests thus I'm
normally always take it high. All that is left now is to set up our interrupts which has be
deliberately left to last as to not interrupt our initialization. Our interrupt handler is only
interested in new data being available so we have only set the UART to interrupt when data
is received.
do {
if (bufferin != bufferout){
ch = buffer[bufferout];
bufferout++;
if (bufferout == 1024) bufferout = 0;
printf("%c",ch);
}
if (kbhit()){
c = getch();
outportb(PORT1, c);
}
} while (c !=27);
which keeps repeating until c = 27. This occurs when the ESC key is hit.
The next if statement checks to see if a key has been hit. (kbhit()) If so, it gets the
character using the getch() statement and outputs it to the receiver buffer. The UART
then transmits the character to the modem. What we have assumed here, is that the person
using the Communications Program can't type as fast as the UART can send. However if
the program wishes to send something, then a check should be made to see if BIT 5 of the
Line Status Register is set before attempting to send a byte to the transmitter register.
The type of UART you have installed in your system can be determined without even
needing a screwdriver in most cases. As you can see from Types of UART's each UART
has minor differences, all we have to do it test these.
The first procedure we do is to set bit 0 to '1' in the FIFO control register. This tries to
enable the FIFO buffers. Then we read bits 6 and 7 from the interrupt identification register.
If both bits are '1' then the FIFO buffers are enabled. This would mean the UART is a
16550a. If the FIFO's were enabled but not usable then it would be a 16550. If there is no
FIFO buffer enabled it is most likely to be a 16450 UART, but could be a 8250, 8250A or
8250B on very old systems.
AT's have a fast bus speed which the 8250 series of UART can't handle to well thus it is
very unlikely to be found in any AT. However if you wish to test for them as well you can
follow the same test as above to distinguish 16550's or 16550A's from the rest. If no FIFOs
are enabled then a possible UART is the 16450, 8250, 8250A or 8250B. Once it is
established the it could be one of these four chips, try writing a byte to the scratch register
and then read it back and compare the results. If the results match then you must have a
scratch register, if they don't you either don't have a scratch register, or it doesn't work to
well.
From the descriptions of the UART above if you read back your byte from the scratch
register then the UART must be a 16450 or 8250A. (Both have scratch registers) If you
don't read back your byte then it's either a 8250 or 8250B.
The 16750 has 64 byte FIFO's, thus the easiest way to test for it's presence is to enable the
64 byte buffer using the FIFO Control Register and then read back the status of the
Interrupt Identification Register. However I have never tested this.
RS-232 Waveforms
The diagram above, shows the expected waveform from the UART when using the
common 8N1 format. 8N1 signifies 8 Data bits, No Parity and 1 Stop Bit. The RS-232 line,
when idle is in the Mark State (Logic 1). A transmission starts with a start bit which is (Logic
0). Then each bit is sent down the line, one at a time. The LSB (Least Significant Bit) is sent
first. A Stop Bit (Logic 1) is then appended to the signal to make up the transmission.
The diagram, shows the next bit after the Stop Bit to be Logic 0. This must mean another
word is following, and this is it's Start Bit. If there is no more data coming then the receive
line will stay in it's idle state(logic 1). We have encountered something called a "Break"
Signal. This is when the data line is held in a Logic 0 state for a time long enough to send
an entire word. Therefore if you don't put the line back into an idle state, then the receiving
end will interpret this as a break signal.
The data sent using this method, is said to be framed. That is the data is framed between a
Start and Stop Bit. Should the Stop Bit be received as a Logic 0, then a framing error will
occur. This is common, when both sides are communicating at different speeds.
The above diagram is only relevant for the signal immediately at the UART. RS-232 logic
levels uses +3 to +25 volts to signify a "Space" (Logic 0) and -3 to -25 volts for a
"Mark" (logic 1). Any voltage in between these regions (ie between +3 and -3 Volts) is
undefined. Therefore this signal is put through a "RS-232 Level Converter". This is the
signal present on the RS-232 Port of your computer, shown below.
The above waveform applies to the Transmit and Receive lines on the RS-232 port. These
lines carry serial data, hence the name Serial Port. There are other lines on the RS-232
port which, in essence are Parallel lines. These lines (RTS, CTS, DCD, DSR, DTR, RTS
and RI) are also at RS-232 Logic Levels.
Almost all digital devices which we use require either TTL or CMOS logic levels. Therefore
the first step to connecting a device to the RS-232 port is to transform the RS-232 levels
back into 0 and 5 Volts. As we have already covered, this is done by RS-232 Level
Converters.
Two common RS-232 Level Converters are the 1488 RS-232 Driver and the 1489 RS-232
Receiver. Each package contains 4 inverters of the one type, either Drivers or Receivers.
The driver requires two supply rails, +7.5 to +15v and -7.5 to -15v. As you could imagine
this may pose a problem in many instances where only a single supply of +5V is present.
However the advantages of these I.C's are they are cheap.
Another device is the MAX-232. It includes a Charge Pump, which generates +10V and -
10V from a single 5v supply. This I.C. also includes two receivers and two transmitters in
the same package. This is handy in many cases when you only want to use the Transmit
and Receive data Lines. You don't need to use two chips, one for the receive line and one
for the transmit. However all this convenience comes at a price, but compared with the
price of designing a new power supply it is very cheap.
There are also many variations of these devices. The large value of capacitors are not only
bulky, but also expensive. Therefore other devices are available which use smaller
capacitors and even some with inbuilt capacitors. (Note : Some MAX-232's can use 1 micro
farad Capacitors). However the MAX-232 is the most common, and thus we will use this
RS-232 Level Converter in our examples.
In order to do anything useful with our Serially transmitted data, we must convert it back to
Parallel. (You could connect an LED to the serial port and watch it flash if you really want
too, but it's not extremely useful). This in the past has been done with the use of UART's.
However with the popularity of cheap Microcontroller's, these can be more suited to many
applications. We will look into the advantages and disadvantages of each method.
We have already looked at one type of UART, the 8250 and compatibles found in your PC.
These devices have configuration registers accessible via the data and address buses
which have to be initialized before use. This is not a problem if your device which you are
building uses a Microprocessor. However if you are making a stand alone device, how are
you going to initialize it?
Most Microprocessors / Microcontrollers these days can be brought with build-in Serial
Communication Interfaces (SCI). Therefore there is little need to connect a 40 pin 16550 to,
for example a 68HC11 when you can buy one built in. If you are still in love with the Z-80 or
8086 then an 16550 may be option! (or if you are like myself, the higher chip count the
better. After all it looks more complicated and impressive! - But a headache to debug!)
Pin
Name Notes
No.
Pin
D0:D7 Data Bus
1:8
Receiver Clock Input. The frequency of this input
Pin 9 RCLK
should equal the receivers baud rate x 16
Pin 10 RD Receive Data
Pin 11 TD Transmit Data
Pin 12 CS0 Chip Select 0 - Active High
Pin 13 CS1 Chip Select 1 - Active High
Pin 14 nCS2 Chip Select 2 - Active Low
Baud Output - Output from Programmable Baud
Pin 15 nBAUDOUT
Rate Generator. Frequency = (Baud Rate x 16)
External Crystal Input - Used for Baud Rate
Pin 16 XIN
Generator Oscillator
Pin 17 XOUT External Crystal Output
Pin 18 nWR Write Line - Inverted
Pin 19 WR Write Line - Not Inverted
Pin 20 VSS Connected to Common Ground
Pin 21 RD Read Line - Inverted
For more information on the 16550 and compatible UART's see The UART (8250's and
Compatibles) in the first part of this tutorial.
However one disadvantage of these chips over the 8250's is that these UART's have no
inbuilt Programmable Baud Rate Generator, and no facility to connect a crystal directly to it.
While there are Baud Rate Generator Chips such as the AY-5-8116, a more cheaper (and
common) alternative is the 74HC4060 14-bit Binary Counter and Oscillator.
The 74HC4060, being a 14 bit binary counter/divider only has outputs for some of it's
stages. Only Q4 to Q14 is available for use as they have external connections. This means
higher Baud Rates are not obtainable from common crystals, such as the 1.8432 Mhz and
2.4576 Mhz. The UART requires a clock rate 16 times higher than the Baud Rate you will
be using. eg A baud rate of 9600 BPS requires a input clock frequency of 153.6 Khz.
The 1.8432 Mhz crystal gives some unfamiliar Baud Rates. While many of these won't be
accepted by terminal programs or some hardware, they are still acceptable if you write your
own serial programs. For example the PC's baud rate divisor for 7200 BPS is 16, 3600 BPS
is 32, 1800 BPS is 64 etc. If you require higher speeds, then it is possible to connect the
UART to the OUT2 pin. This connection utilizes the oscillator, but has no frequency division
applied. Using OUT2 with a 1.8432 Mhz crystal connected gives a baud rate of 115,200
BPS. The CMOS CDP6402 UART can handle up to 200 KBPS at 5 volts, however your
MAX-232 may be limited to 120 KBPS, but is still within range.
Microcontrollers
It is also possible to use microcontrollers to transmit and receive Serial data. As we have
already covered, some of these MCU's (Micro Controller Units) have built in UART's among
other things. Take the application we have used above. We want to monitor analog
voltages using a ADC and then send them serially to the PC. If the Microcontroller also has
a ADC built in along with the UART or SCI, then we could simply program the device and
connect a RS-232 Line Driver. This would minimize your chip count and make your PCB
much smaller.
Take the second example, displaying the serial data to a common 16 character x 2 line
LCD display. A common problem with the LCD modules, is they don't accept cartridge
returns, line-feeds, form-feeds etc. By using a microcontroller, not only can you emulate the
UART, but you can also program it to clear the screen, should a form-feed be sent or
advance to the next line should a Line-feed be sent.
The LCD example also required some additional logic (An Inverter) to reset the data
receive line on the UART, and provide a -ve edge on the enable of the LCD to display the
data present on the pins. This can all be done using the Microcontroller and thus reducing
the chip count and the cost of the project.
Talking of chip count, most Microcontrollers have internal oscillators thus you don't require
the 74HC4060 14 Bit Binary Counter and Oscillator. Many Microcontrollers such as the
68HC05J1A and PIC16C84 have a smaller pin count, than the 40 Pin UART. This not only
makes the project smaller in size, it reduces complexity of the PCB.
But there are also many disadvantages of the Microcontroller. The major one, is that you
have to program it. For the hobbyist, you may not have a development system for a
Microcontroller or a method of programming it. Then you have to learn the micro's code and
work out how to tackle the problem. At least with the UART, all you did was plug it in, wire it
up and it worked. You can't get much simpler that that.
So far we have only discussed Full Duplex Transmission, that is that we can transmit and
receive at the same time. If our Microcontroller doesn't have a SCI then we can Emulate a
RS-232 port using a Parallel line under software control. However Emulation has it's dis-
advantages. It only supports slow transmission speeds, commonly 2400, 9600 or maybe
even 19,200 BPS if you are lucky. The other disadvantage is that it's really only effective in
half duplex mode. That is, it can only communicate in one direction at any one given time.
As there are many different types of Micro-Controllers all with their different instruction sets,
it is very hard to give examples here which will suit everyone. Just be aware that you can
use them for serial communications and hopefully at a later date, I can give a limited
number of examples with one micro.
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
bFLT:not found.
bad magic/rev(4,need 2)
Each flat binary is preceded by a header of the structure shown below in listing 1. It
starts with 4 ASCII bytes, bFLT or 0x62, 0x46, 0x4C, 0x54 which identifies the
binary as conforming to the flat format. The next field designates the version number
of the flat header. As mentioned there are two major versions, version 2 and version
4. Each version differs by the supported flags and the format of the relocations.
The next group of fields in the header specify the starting address of each segment
relative to the start of the flat file. Most files start the .text segment at 0x40
(immediately after the end of the header). The data_start, data_end and bss_end
fields specify the start or finish of the designated segments. With the absence of
text_end and bss_start fields, it is assumed that the text segment comes first,
followed immediately by the data segment. While the comments for the flat file
header would suggest there is a bss segment somewhere in the flat file, this is not
true. bss_end is used to represent the length of the bss segment, thus should be set
to data_end + size of bss. Figure 1 : Flat File Format
struct flat_hdr {
char magic[4];
unsigned long rev; /* version */
unsigned long entry; /* Offset of first executable instruction
with text segment from beginning of file */
unsigned long data_start; /* Offset of data segment from beginning of
file */
unsigned long data_end; /* Offset of end of data segment
from beginning of file */
unsigned long bss_end; /* Offset of end of bss segment from beginning
of file */
/* (It is assumed that data_end through bss_end forms the bss segment.) */
beginning of file */
unsigned long reloc_count; /* Number of relocation records */
unsigned long flags;
unsigned long filler[6]; /* Reserved, set to zero */
};
Following the segments start and end pointers comes the stack size field specified in bytes. This is normally set to
4096 by the m68k bFLT converters and can be changed by passing an argument (-s) to the elf2flt / coff2flt utility.
The next two fields specify the details of the relocations. Each relocation is a long (32 bits) with the relocation table
following the data segment in the flat binary file. The relocation entries are different per bFLT version.
Version 2 specified a 2 bit type and 30 bit offset per relocation. This causes a headache with endianess problems.
The 30 bit relocation is a pointer relative to zero where an absolute address is used. The type indicates whether the
absolute address points to .text, .data or .bss.
#define FLAT_RELOC_TYPE_TEXT 0
#define FLAT_RELOC_TYPE_DATA 1
#define FLAT_RELOC_TYPE_BSS 2
struct flat_reloc {
#if defined(__BIG_ENDIAN_BITFIELD) /* bit fields, ugh ! */
unsigned long type : 2;
signed long offset : 30;
#elif defined(__LITTLE_ENDIAN_BITFIELD)
signed long offset : 30;
unsigned long type : 2;
#endif
This enables the flat loader to fix-up absolute addressing at runtime by jumping to the absolute address specified by
the relocation entry and adding the loaded base address to the existing address.
Version 4 removed the need of specifying a relocation type. Each relocation entry simply contains a pointer to an
absolute address in need of fix-up. As the bFLT loader can determine the length of the .text segment at runtime
(data_start - entry) we can use this to determine what segment the relocation is for. If the absolute address before fix-
up is less that the text length, we can safety assume the relocation is pointing to the text segment and this add the
base address of this segment to the absolute address.
On the other hand if the absolute address before fix-up is greater than the text length, then the absolute address
must be pointing to .data or .bss. As .bss always immediately follows the data segment there is no need to have a
distinction, we just add the base address of the data segment and subtract the length of the text segment. We
subtract the text segment as the absolute address in version 4 is relative to zero and not to the start of the data
segment.
Now you could say we may take it one step further. As every absolute address is referenced to zero, we can simply
add the base address of the text segment to each address needing fix-up. This would be true if the data segment
immediately follows the text segment, but we now have complications of -msep-data where the text segment can be
in ROM and the data segment in another location in RAM. Therefore we can no longer assume that the .data+.bss
segment and text segment will immediately follow each other.
The last defined field in the header is the flags. This appeared briefly in some version 2 headers (Typically ARM) but
was cemented in place with version 4. The flags are defined as follows
Early version 2 binaries saw both the .text and .data segments loaded into RAM regardless. XIP (eXecute in Place)
was later introduced allowing programs to execute from ROM with only the data segment being copied into RAM. In
version 4, it is now assumed that each binary is loaded from ROM if GOTPIC is true and FLAT_FLAG_GZIP and
FLAT_FLAG_RAM is false. A binary can be forced to load into RAM by forcing the FLAT_FLAG_RAM flag.
The FLAT_FLAG_GOTPIC informs the loader that a GOT (Global Offset Table) is present at the start of the data
segment. This table includes offsets that need to be relocated at runtime and thus allows XIP to work. (Data is
accessed through the GOT, thus relocations need not be made to the .text residing in ROM.) The GOT is terminated
with a -1, followed immediately by the data segment.
The FLAT_FLAG_GZIP indicates the binary is compressed with the GZIP algorithm. The header is left untouched,
but the .text, .data and relocations are compressed. Some bFLT loaders do not support GZIP and will report an error
at loading.
Acknowledgments to Pauli from Lineo for pointing out some minor errors.
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
The Netcomm NB5 is an ADSL / ADSL-2/2+ modem/router incorporating unique features such as Quality of Service
(QoS) not commonly found in many domestic units. Being a simple single ethernet port, single USB port modem, the
NB5 has proven itself to be a rock solid unit built on a rugged embedded linux platform. This linux platform can allow
the ability to exploit the hardware to its full potential, by running your own binaries on it.
# cat version
Linux version 2.4.17_mvl21-malta-mips_fp_le (guest1@localhost) (gcc version
2.95.3
20010315 (release/MontaVista)) #1 Thu Mar 25 18:10:36 CST 2004
The Netcomm NB5 is built around the Texas Instrument's TNETD7300 AR7 Router which features a 32-bit RISC
MIPS 4KEc V4.8 processor integrated with a DSP based digital transceiver and ADSL front end. Running at 150
BogoMIPS, it incorporates 2MB of Flash, 8 MB of RAM, a single 10/100 ethernet port and USB 1.1 port. The
manufacturer builds upon the AR7 ADSL Network Support Package (NSP) as the software base. The 2Mbytes of
flash stores the ADAM2 bootloader, MontaVista Linux 2.4.17 kernel and a squash 1.x read-only filesystem.
# cat cpuinfo
processor : 0
cpu model : MIPS 4KEc V4.8
BogoMIPS : 149.91
wait instruction : no
microsecond timers : yes
extra interrupt vector : yes
hardware watchpoint : yes
VCED exceptions : not available
VCEI exceptions : not available
The unit accepts a telnet or ssh session, spawning a BusyBox v0.61.pre Built-in shell (ash) allowing you to explore
the NB5 filesystem and run your own binaries. The proc file system is always a good place to start. . .
Password:
# ls
# cat /proc/avalanche/avsar_modem_stats
[ATM Stats]
[Upstream/TX]
Good Cell Cnt: 26
Idle Cell Cnt: 12747
[Downstream/RX)]
Good Cell Cnt: 13
Idle Cell Cnt: 153323
Bad Hec Cell Cnt: 0
Overflow Dropped Cell Cnt: 0
[OAM Stats]
Near End F5 Loop Back Count: 0
Near End F4 Loop Back Count: 0
Far End F5 Loop Back Count: 0
Far End F4 Loop Back Count: 0
After you have had a look around, its now a good time to get serious and start compiling some of your own binaries
for the NB5. As mentioned the NB5 runs on the MIPS processor, hence a MIPS toolchain or cross compiler is
needed. Although you can build your own cross complier & uClibc C libraries, if youre like me its quicker to
download one.
With the compiler installed, its now time to test it. What better than the traditional Hello World program. We save the
following source code as hello.c.
#include
void main(void)
{
printf("Hello World!\n");
}
Once the binary is built, we must now get it onto the NB5 filesystem. The NB5 includes a tftp client and wget. My
preference is to load the binary to a web server and use wget. You will need to use the writable ramfs mounted at /
var.
# cd /var
# wget http://www.beyondlogic.org/nb5/hello
hello 100% |*****************************| 9860 00:00 ETA
# chmod 700 hello
# ./hello
Hello World!
If hello world doesn't turn you on, you could try compiling something useful like pppstats.
# wget http://www.beyondlogic.org/nb5/pppstats
pppstats 100% |*****************************| 24716 00:00 ETA
# chmod 700 pppstats
# ./pppstats -c 10
IN PACK VJCOMP VJUNC VJERR | OUT PACK VJCOMP VJUNC NON-VJ
139971257 124187 0 0 0 | 3565109 72378 0 0 72378
74485 61 0 0 0 | 1360 34 0 0 34
67815 57 0 0 0 | 1280 32 0 0 32
67735 55 0 0 0 | 1200 30 0 0 30
102565 82 0 0 0 | 1760 44 0 0 44
100220 80 0 0 0 | 1720 43 0 0 43
68163 58 0 0 0 | 1325 33 0 0 33
67823 57 0 0 0 | 1365 34 0 0 34
79090 64 0 0 0 | 1400 35 0 0 35
114520 91 0 0 0 | 1920 48 0 0 48
Dynamic DNS
www.no-ip.com is just one company providing free Dynamic DNS services. You can download the source code for a
Linux / BSD / Unix Dynamic Update Client at : http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz (2.1.1) This can
be downloaded and re-compiled to execute on the NB5.
# cd /var
# mkdir noip
# cd noip
# wget http://www.beyondlogic.org/nb5/noip2
noip2 100% |*****************************| 125 KB 00:00 ETA
# chmod 700 noip2
By default this client wants to store its configuration at /usr/local/etc/no-ip2.conf. As this is not a writable area on the
NB5 filesystem, we must specify where to put the configuration file (-c /var/noip/noip.conf).
# ./noip2 -C -c /var/noip/noip.conf
There appears to be a bug with noip running on the NB5. It erroneously reports another instance is running. I use the
-M switch to get around this for the time being.
# ./noip2 -M -c /var/noip/noip.conf
Running new applications on the RAM filesystem is great for testing and debugging. However when the router is
rebooted, the files are lost. In some cases it may also be handy to modify the start-up script to start some custom
daemons at boot.
The read-only Squash FS resides in MTD0 and is mounted at boot by the kernel. A ramfs is mounted to /var and
provides room to store volatile files. The current read-only file system makes heavy use of symbolic links for files that
are required to be writable. These symbolic links point to /var and is initialised by the startup script /etc/rc.d/init.d/rcS
by extracting the var.tar tarball found in the root directory.
Netcomm provides the original 38.51.2-001 firmware for download from their support site. The file consists of a zip
archive that includes a handful of files including the ADAM2 bootloader binary (int_ephy.adam2.AR7RD.bin), the
Linux Kernel (ram_zimage_pad.ar7rd.nsp.squashfs.bin) and the squashfs (nsp.annexA.img) among others.
Extract the nsp.annexA.img to your linux box and mount the squashFS to give read-only access to the base
filesystem used by the NB5, e.g.
mkdir /mnt/squash
mount -t squashfs nsp.annexA.img /mnt/squash -o loop
Then copy this filesystem to writable folder where you can modify the filesystem. e.g
mkdir /home/cpeacock/squashrw
cd /mnt/squash
cp -r * /home/cpeacock/squashrw
Now you can modify the filesystem. Please note some writable files are found in var.tar. Once you are finished
modifying your filesystem, you need to create a new Squash 1.x filesystem.
The web based firmware updater requires any new kernel or filesystem to have a correct checksum appended to the
end of the file before it will be accepted as valid firmware.
To create the checksum you will need the TI_chksum-0.1orig.tar.gz package released under a GPL.
Once the checksum has been successfully added to your file, it is ready to be updated to your NB5. Please be
warned that re-flashing your firmware can break your modem. You must also note that the NB5 filesystem is
restricted by the size of the flash. Currently the 2Mbyte flash is partitioned as follows,
# cat mtd
dev: size erasesize name
mtd0: 00160000 00010000 "mtd0" 1447192 (1408kb) SquashFS
mtd1: 00080000 00010000 "mtd1" 524288 (512KB) Kernel
mtd2: 00010000 00008000 "mtd2" 65536 (64KB) ADAM2 Bootloader/Monitor
mtd3: 00010000 00010000 "mtd3" 65536 (64KB) Config.xml (RAW)
Currently the kernel appears to occupy the entire 524,288 bytes, and excluding the small amount of room allocated
to the configuration and bootloader, the compressed Squash filesystem must fit into 1447192 bytes. The default
filesystem shipped from Netcomm currently requires 1433600 bytes leaving a little more that 13kbytes left
(compressed) for your own binaries. Therefore if it is intended to modify the filesystem, some existing files must be
deleted to make room for any new ones.
Prior to firmware version 62.51.1, the squash filesystem contained within the NB5 was compressed using the
conventional ZLIB library. There has been a shift in recent times to LZMA due to better compression size. There are
some claims that LZMA can offer up to 30% better compression over ZLIB, however a 10 to 15% gain is normally
achievable on the typical squashFS images found in modems such as the NB5.
Should your NB5 no longer boot, don't despair. The ADAM2 FTP Server can assist in reloading a bootable image.
Otherwise if you want to find out at what stage the modem is halting, try using the console port with the ADAM2
Bootloader.
Other sources
The Texas Instruments AR7, ADAM 2 Bootloader and AR7 ADSL Network Support Package is a common platform
for many ADSL routers. The following links are applicable to this platform.
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
Fed up with hyperterminal or just want a quick and light terminal for DOS, Windows 95/98/ME and
Windows NT4/2000/XP? Cycle through COM Ports using F1, change bit rates using F2 and quit using
Alt-X. Couldn't be simpler. . .
Download
http://www.beyondlogic.org/terminal/terminal.htm13/02/2008 16:49:14
Exploring the Netcomm NB5 - SquashFS & LZMA Compression
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
There has been a lack of interest from the linux kernel maintainers to implement LZMA compression or decompression
into the kernel, as they claim ZLib does just fine. As a consequence, SquashFS doesn't natively come with LZMA
compression out of the box (or tarball). SquashFS using LZMA currently requires patches, and unfortunately there is a
couple of versions floating around were the format of the headers/properties are different and hence cause
incompatibility problems. The patches here, are designed to be compatible with the LZMA squashfs support found in
the linux kernel of the Texas Instrument's NSP.
Building mksquashfs
The squashfs version found in the TI NSP MontaVista 2.4.17_mvl21 linux kernel is still version 1.x. Therefore if you
intend to create a Squash filesystem compatible with the kernel in the NB5, you will need to use SquashFS v1.3r3. We
have observed further size improvements of approximately 9 to 10% using the current SquashFS 2.2. Therefore the
LZMA patches here have been designed to compile as a LZMA library which has the same function calls exported than
ZLib. This allows any version of SquashFS to be easily linked to the LZMA library in the future.
Download the LZMA SDK, patch and build the LZMA Library.
mkdir lzma427
cd lzma427
tar -xjf ../lzma427.tar.bz2
patch -p1 < ../lzma427_zlib.patch
cd SRC/7zip/Compress/LZMA_Lib
make
This should successfully build a mksquashfs tool that you can use to create LZMA Squash filesystems for use with the
NB5 firmware version 62.51.1 and later.
Now that you have a utility to make a LZMA tightly compressed squash filesystem, you will more than likely require
LZMA support in your desktop kernel to open/modify existing filesystems or test your own. There is no requirement for a
older version of SquashFS as support is backwards compatible. This patch will provide LZMA support to a linux-2.6.12
kernel that has squash2.2 installed.
linux-2.6.12.2_squashfs2.2_lzma.patch
The firmware for the NB5 appears to be distributed as three separate files, the kernel, squashfs & config.xml. However
to assist users in upgrading the NB5plus4 and NB5plus4W units, a single firmware upgrade file is used with the three
files concatenated together and a header attached to the front.
To mount the squash filesystems from these images, you need to know where the squashfs starts in the file. The
easiest way of doing this is looking at the address in the header at 0x80 or searching for the magic "hsqs". You can
then use this offset to mount the filesystem. e.g. for the NB5plus4W firmware upgrade, use :
Links
Wednesday, February
13th, 2008
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
In need for a cheap but effective RS-232 Protocol Analyser? Just make your own Y adaptor to enable
the logging or display of data transmitted and/or received in ASCII, Hex, Decimal or Hex-Dump formats.
A configuration file is included to allow quick setup and analysis.
You can make your own "Y" cable by following the diagram below. It consists of a pass-through cable
which is connected in-line with the link under test. The TXD and RXD lines are broken out and sent into
a second "Protocol Analyser" computer via two com ports, each monitoring one line each. The second
computer then runs the Protocol Analyser Software.
Download
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
The PIC16F877 was the first Microchip Microcontroller to have in-built debugging capabilities. The actual silicon
area used for the debug facilities is tiny compared to the major peripherals. Microchip initally kept the operation
of the debug facilities pretty well under raps, but has recently released the specifications under DS51242A.
Fancy making your own ICD? I wouldnt imagine it would be any cheaper, considering the development time.
Microchip has released the silk screen overlays and schematics for their ICD in Appendix A of the MPLAB ICD
Users Guide (DS51184A). The code was suppose to be restricted, preventing you from making them. However
d877.hex first appeared in the MPLAB 4.x directory. Upon closer examination of this file, you discover its the
source code for the ICD complete with embedded (retlw x-opcode) debug code which is loaded into the target
at 0x1F00.
The code is for a PIC16F876 device which is the little brother of the 16F877. The PIC16F876 is a 28 pin device
with a few less I/O ports, and the Parallel Slave Port. What this means, is you can use a PIC16F877 as the
heart of the ICD if you are having difficulties sourcing the 16F876.
What Microchip hasnt released is the licensing information for the D877.HEX. Is it freely available for private
and commercial use? Ive already seen some making derivatives of the I CD for commercial gain. My guest
would be that they are using the D877.hex in its raw unaltered form, bearing in mind that dis-assembly is most
cases is not legal either.
When Microchip released MPLAB v5.00 in March 2000, they shipped new firmware for the ICD, firmware
version 2.04 (MPL876.HEX in your MPLAB 5 directory). This gave the end user support for the PIC16F873/874,
supposedly better serial communications and the ability to perform flash upgrades over the wire with one
mouse click.
They also released a Engineering Technical Note ETN#21, Upgrading MPLAB ICD Flash and Operating ICD
below 4.5V. This included two modifications, one for better support when operating the ICD from a supply
voltage lower than 4.5V and the other to enable flash upgrades.
The first modification involved changing R21 and R22 which make up a voltage divider monitoring the VPP.
These resistors were increased by a factor of 10 to reduce the load when low currents are available as a result
of running the unit from under 4.5V.
Most of the early ICDs included OTP 16C73B. These of course cannot be updated over the wire, thus the
second modification is to replace the 16C73 with a 16F876 which is pin to pin compatible, only in a re-
programmable flash version. This enables to user to update the code at a later date.
Links
http://icdprog.sourceforge.net - Linux Software which can program 16F87x devices using the ICD. Geir
Thomassen has been examining the protocol between the ICD and MPLAB.
References
PICmicro Firmware is copyrighted by Microchip Technology Inc., and is intended for Microchip Development Tools only.
Modified firmware code will not be supported by Microchip Technology Inc.
Gippsland Circus - The Bald Hill Debate turns to Parrot Politics - Part II
Australias Greenhouse Future liesin the hands of Roam Consulting - or does it?
Integrated Gasification Combined Cycle (IGCC)
The approximate costs to produce power in Australia is listed in the table below. This price includes
the cost of fuel, fixed and capital costs to build the plant. Excluded from the figures is transmission/
grid connection costs. These figures are approximate and should only be used for comparison
between energy sources.
To provide incentives to produce renewable power and reach Australias mandatory renewable energy
target (MRET) the Renewable Energy (Electricity) Act 2000 introduces RECs (Renewable Energy
Certificates) which trade at approximately $35 to $40. This, on top of the wholesale price of electricity
makes many forms of renewable energy economically sustainable, thus allowing them to compete in
the National Electricity Market. The current Mandatary Renewable Energy Target is to have 9,500
GWh of renewable energy installed Australia-wide by 2010.
In March 2003, a panel was formed to review the Commonwealths Mandatory Renewable
Energy Target (MRET) legislation and provide a report into their findings by the end of
September 2003. It was to determine, among other things, if the scheme should be abolished
in favour for a common carbon-trading scheme as suggested by the Parer/COAG report, or if
the target should be increased to a true 2%, 5% or 10% (in line with UK and Germany).
The report recommends the scheme should continue with the current target of 9,500GWh to
2010 and then introduce steady increases to reach a 20,000 GWh target by 2020. As one
could imagine this lack of support for renewable energy and the reduction of greenhouse
gases has angered many community and green groups. Even many state governments are
wondering why it cant be increased to a true 2% or 4% when the report indicates it would
have little effect to the GDP and wholesale electricity prices.
However the report suggests given that we are only 6 years away from the target date it is not
enough time to raise the 9,500GWh 2010 target and the generate enough investment to meet
it. Yet, the report suggests a 20,000 GWh target for 2020 which is still only 2% of the 1997
baseline. If time was really an issue why isnt the 2020 target raised higher than 2% of the
1997 baseline? If the Federal Government was serous about a 2% target, why not at the very
least have a true 2%.
While Australia produces more greenhouse gas per capita that any other country, Australias
low price of electricity makes most renewable energy more expensive than coal and gas
generated electricity. In countries like Germany where a 10% target is supported, electricity
prices are double that of Australias hence more renewable energy can be installed without
grossly upsetting the economy with higher electricity prices.
While the Parer Report led to much investment uncertainty and the stalling of investment with
in the renewable energy sector, this last report should not be seen as negative despite the
rock bottom target. The 2% target still exists like it has since 2001. The report forecasts $215
million will be spent on new renewable energy in 2004, increasing to $454 the following year in
the lead up to $2.025 billion in 2006. If this proves to be correct, it should make renewable
energy a growth industry of the next 3 years with Wind Energy being the biggest benefactor.
Pacific Hydro To Transfer Us$723 MLN In Development Offshore - 19th October 2004
Novera Energy scales back Australian operations - 9 August 2004
Mandatory Renewable Energy Target to Continue 16 January 2004
Download Report (Renewable Opportunities, A Review of the Operation of the
Renewable Energy (Electricity) Act 2000)
Renewable Energy (Electricity) Act 2000
www.10x10.com.au
Australian Governments Renewable Energy Initiatives
The majority of South Australias power generation comes from gas turbines with
approximately 53 percent of the states gas supply being consumed for electricity generation
in power station turbines and cogeneration plants. This gas was, until recently, supplied by a
single production plant at Moomba and a single gas pipeline from Moomba to Adelaide. This
can lead to significant restrictions when a breakdown occurs like was the case in February
2003 and which is presently occurring once again in January 2004.
Origin Energy, International Power and TXU have completed the construction of the $500
million, 690km SEA gas pipeline which is now piping gas from Victoria into South Australia.
The extra 125 PJ per annum will provide extra security for both gas customers and electricity
generation.
Press Release :
SEAGAS Delivers New Energy to Adelaide - Just in Time (2nd January 2003)
All the natural gas fired plants listed above except for Pelican Point all Natural Gas Open
Cycle. Pelican Point, one of S.A.s newer plants uses Natural Gas Combined Cycle (NGCC)
which is more economical to run. Omitted from the above table is a small portfolio of non-
scheduled, peaking or cogeneration plants such as a 60MW plant at Whyalla, 20MW
Cummings Plant at Lonsdale and the newly commissioned 4.4MW cogeneration facility at
Coopers Regency Park premises.
prices are creating uncertain market conditions with many generators re-evaluating their
positions.
Also in the Pipeline is the South Australia / New South Wales Interconnect, nicknamed the
SNI. It is a 250MW link being proposed by Transgrid, a NSW government owned High Voltage
Network Provider. It was first planned in 2001 when average spot prices in NSW was $19MW/
h dearer than S.A, however its benefits are depleting considering another regulated
transmission line will only increase transmission costs further for South Australians, already
suffering from excessively high ETSA and ElectraNet SA transmission costs.
While we dont focus at the many smaller power plants under 1MW, the North Terrace power
stations are a good indication of the position of Photovoltaic Solar Cells and their current
prohibited costs for mainstream grid connected systems.
The first North Terrace Power Station was opened in November 2002. It consisted of 112 BP
Solar Panels providing a total of 19.8kW. The panels are mounted on the north, main facing
roof of the SA Museum in the CBD. Seven smaller inverters were used to convert the DC
current into AC current. The project funded by the South Australia Government at a cost of
$200,000 produces 25,950kW/h of electricity a year, enough to power 7 homes. At the time of
opening it was the largest PV array in South Australia.
In July 2003 a second North Terrace Power Station was brought on-line. This time, 129
panels were bolted to the Art Gallery at a cost of $250,000 to the state government. It is
suggested this station will produce approximately 31,000kW/hrs a year, cutting carbon dioxide
emissions by 35 tonnes.
Looking at infrastructure and construction costs, these two solar projects cost about $10,000 a
kW to install. When we later look at wind power you will typically see infrastructure/
construction costs around $1500/kW. As renewable energy has no fuel costs and often little
maintenance costs, the cost of power is directly attributable to the infrastructure and
construction costs.
One can quickly see these two plants have little chance of being viable and only makes for a
good advertising campaign. It makes the choice easy when it comes to spending tens of
thousands to put solar panels on your roof or to invest it in the many renewable energy
companies in Australia where your money could be more effectively pooled together to reduce
carbon dioxide emissions ten fold. These current figures put power from Photovoltaic Solar at
in excess of 30c kW/h. Even AGL SAs excessive Domestic Light/Power tarrif is no where
close at approximately 17.7c kW/h. (Even next years summer tarrif @ 20.944c)
Its not to say photovoltaic Solar Panels have no place. They are wonderful in remote locations
such as the township of Parachilna where their 21kW system is saving money compared to
the diesel generators which have previously ran 24 hours a day. They are just not competitive
when you have a good connection to the grid. Solar panels will become more efficent and
hence cheaper over time. For example research is being carried out into using a tantalum
oxide film rather than traditional silicon oxide which reflects more light with initial results seeing
a 25% increase in efficiency.
Links:
Landfill gas and biomass renewable energy plants are proven with some being in existence in
Australia since the early 90s. While electricity from these plants is cheaper to produce than
Wind, they are very limited in size. Typical South Australian plants such as Wingfield I,
Wingfield II, Tea Tree Gully, Pedlers Creek and Highbury have an output of a couple of MW
each. These five plants are operated by Energy Developments (ASX:ENE). One of Energy
Developments larger Australian landfill gas plants is the 12.7MW site at Lucas Heights.
Landfill gas and biomass do however have the advantage of suppling base loads (24 hours
operation except for maintenance).
Landfill gas is not the only good source for Methane. The decomposition of sludge using
anaerobic digestion in Waste Water Treatment can also provide a good source. SA Water has
turbines installed at three of its waste water treatment sites, listed below. However all this
energy is used to power the plants pumps, air blowers and other equipment. Much of the
energy is used to maintain optimum conditions for anaerobic digestion which requires the
sludge to be maintained at 36degrees. There is no electricity pumped back into the grid.
Babcock & Brown and National Power has announced preliminary plans for a $60 million
Plantation and Timer Waste BioMass plant to be build around Millicent or Mt Gambier. The
plant is suggested to be operational by 2005 supplying a larger 30MW of electricity. Auspine
Limited has also announced plans for a simular plant at Tarpeena generating 60MW from
Biomass scheduled for completion by Mid 2004.
Links:
Wingfield Waste Management Centre Landfill Gas Management
Energy Developments
While South Australia doesnt have an abundance of suitable rivers and lakes, it doesnt rule
out the development of "mini" hydro projects. SA Water in conjunction with Hydro Tasmania is
installing the first 1.9MW Terminal Storage Mini Hydro plant on S.As Water Supply. The plant
at Tea Tree Gully consists of a stainless steel turbine inserted into pipes carrying water to the
Adelaide Metro area. This is the first time such a project has developed in Australia with great
care being taken not to reduce the reliability of the existing water supply. The plant is expected
to be completed by the end of June 2003.
The Hydro Tasmania / SA Water joint venture partnership also includes development of a mini
hydro plant at Mt Bold Reservoir in the states south.
Links:
Mini-Hydro - SA Water
First Sun, then Wind - Now its Water Power! - 12th September 2003
South Australia mini hydro major milestone - 2nd June 2003
Hydro Tasmanias Partnership with South Australia Water - 19th May 2002
Wind has proven itself to be the most viable and successful form of renewable energy to date,
having a current renewable energy market share of 11% (August 2003) in Australia and is expect to
grow to 41% by 2020. However like many renewable energies, while Wind Power is zero emission,
it is not capable of supplying base loads, i.e if the wind stops, so does the power. Wind power at
suitable sites in Australia has a 80-85% availability. Due to the size of the turbines, typically greater
than 60 meters in diameter and siting on towers 70-100 meters tall, Wind turbines can lend themself
to greater visual "pollution" than other forms of renewable generation.
One solution is to place the large turbines out at sea which has been done for many years in other
countries. However while there is better wind speeds out at sea due to the flatter surface (less
resistance), there is a large cost penalty caused by sea based electricity grids, wind tower
foundations, construction costs and the life of plant. Denmark and other such countries already
operating sea based wind farms have electricity prices much greater than Australia, in the case of
Denmark as much as three times (Source : Electricity Supply Association of Australia 2003). As
Australia has the second cheapest electricity of any major developed nation (second only to South
Africa), it is considered sea based wind farms are just not yet currently viable in Australia.
The concept of wind is not new for South Australia. Wind energy was first studied by ETSA in the
1950s with a Wind Energy Committee set up in 1984. The first wind monitoring units were
established on the Fleurieu Peninsula in mid 1985 with a total of 30 sites monitored around SA by
1988. A single 150kW Nordex Wind Turbine was installed in Cooper Pedy and was commissioned
However South Australia only comissioned its first large scale plant in July 2003. Being developed
by Tarong Energy (A Queensland Government owned electricity generator), the $65 million dollar
project is situated north of Cape Jervis with a total of 13 NEG Micon 1.5 MW NM64C/1500 wind
turbines generating 34.5MW. This is enough energy to power approximately 18,000 South
Australian homes. The farm connects to the ETSA Utilities Yankalilla Substation via a 66KV High
Voltage Transmission Line.
Another farm in construction is Babcock & Brown WindPower Pty Ltds Lake Bonney Stage One, an
80.5MW Wind Farm costing more than $100 Million. Work has begun on the first of 46 foundations
and 76 metre towers to support the Vestas 1.75MW Wind Generators having blades 66 meters in
diameter. The farm was under threat in 2001 when "outstanding issues associated with the
connection of the wind farms to the high voltage grid system" was hindering the farms commercial
viability according to a Spokesman for Babcock & Brown Windpower. It appears many farms are
having trouble with monopoly ElectraNet S.A. in connecting to the H.V. transmission grid at
reasonable prices.
No doubt you will notice Wind farms are having a few publicity problems at the present. This
appears to have stemmed from a minority of residents who have legitimate concerns about a farm
being built nearby and the possibility of visual pollution. Coupled with the media who really doesnt
care if it is fact or fiction, provided it makes a good story, the problem has escalated from myth to
myth.
Wind power is not base load and we will need to build extra generation to supplement wind
power when the wind is not blowing. Typically availability is quoted 30%.
The energy payback time for a wind farm is too great.
Wind Farms and the power they generate are expensive.
Wind Farms cause visual pollution.
Wind Farms are noisy.
Wind Farms kill birds.
Myth #1 Wind power is not base load and has an availability of 30%.
Wind farms are the most successful form of renewable energy to date. As a result it carries the
weight of some far-fetched ideas that wind farms will one-day replace fossil fuel power stations. Its
probably easy to guess why someone would jump to this conclusion. After all the growth of wind
farms have been quite significant in the past couple of years.
However if some how it was possible, so called experts would point out wind is intermittent form of
energy and wind only blows 30% of the time. Well the statement is not entirely correct but what they
are talking about is the capacity factor (CF). There is no hidden secret. The capacity factor of a
wind farm is approximately 30%. What is capacity factor?
"So ask yourself the question: If South Australia was stupid enough to go for wind, how would you
run air-conditioners or, indeed, hospitals and industry for the other 244 days of the year? " - David
Bellamy
Pacific Hydro which has built both the Codrington Farm and more recently Australias Largest Wind
Farm, Chalicium Hills, quotes Capacity Factor on the fact sheets for its farms. Codrington (18.2MW)
was expected to be about 32%. In the 2002/03 Annual Report, Codrington generated 47.8GWh of
clean renewable energy. Thats a 29.98% capacity factor which is not bad for the first couple of
years when the farm is still being fine tuned and serviced under the manufacturers warrantee.
So the media is right. A 18.2MW wind farm really only generates 30% of the name plate capacity.
This then requires scheduled generation when the wind is not blowing. This is not a significant
problem as gas fired peaking plants or hydro can be brought on line quickly. So what does the
media (the people in the know) suggest as alternatives? Solar? Yep. Wave? sure do.
Unlike wind, the sun doesnt shine 80-85% of the time. At worst case from sunset to sunrise, you
would be really scratching at a maximum of 14 hours or 58%. Then you have cloudy days, which
can see the output drop 5-20%, and maximum power output at certain conditions no different to
wind. Most solar panels dont track the sun, and they are less efficient at higher temperatures.
The North Terrace Power Station (PV Solar), has an installed capacity of 19.8KW. Each year it
generates 25,950kW/hrs so we can conclude it has a capacity factor of 14.9% (19.8KW x 24
hours x 365 days = 173,448kW / 25,950). Gee, thats poor. The North Terrace Power Station was
commissioned in November 2002, Codrington was in November 2001 so both use about that same
era of technology. To be fair, the Redding Report states CF figures for Solar at a slightly higher
18%.
Unfortunately we are still a few months of seeing the first prototype wave power plants being
installed in Australia and there is no comprehensive wave studies in Australia. Economics has been
the main reason why wave has not let taken off. While I prefer to work on actual production data, we
will have to base our wave capacity on research.
Like wind, Wave power is said to have an approximate availability of 80% in Australia. However in a
report from the Australian Greenhouse Office, it is suggested Wave power has a capacity factor
of 7% upwards to 25% based on the device used.
"The efficient use of every form of energy is a must. In your sunburnt country, surely solar power
can bridge the gap until wave power begins to provide real base load power to solve the problem. "
- David Bellamy.
So David Bellamy, if we adopt solar power how do we run our air-conditioners or, indeed, hospitals
and industry for the other 310 days of the year?
It has never been suggested Intermittent Renewable Energy such as Wind would replace fossil
fuels. Most renewable technologies simple do not scale up well. However they are designed to
supplement power generation, and we must start somewhere. We cant keep putting of construction
hoping for some miracle solution to come along.
It is hard to understand how Wind could ever overtake fossil fuels without some significant shift in
Federal Government Policy. The Mandatary Renewable Energy Target calls for 9,500 GWh of
renewable energy by 2010, or about 1.5% of electricity to come from renewable sources. At present
Wind makes up 11% of renewable energy and is expect to grow to 40% by 2020. Therefore Wind
would be predicted to make up approximately 0.6% of generation. Any further generation would
have no RECs to support it. Even if MRET was increased to 10%, Wind would only ever make up
4% of total generation. AusWEA suggests that up to 20% of electricity could be generated by Wind
before it would cause problems.
Myth #2 The energy payback time for a wind farm is too great.
The energy payback time is the time taken to repay all the energy used to manufacture, install,
operate and decommission the plant. The payback time for wind is in the order of a couple of
months, typically anywhere from 3 to 8 months depending upon the wind speed at the location.
In comparison solar cells have a payback time of around 1 to 4 years depending upon the
technology. Its typically around 4 years for todays multicrystalline-silicon cells and 3 years for
thin-film modules.
It can be expected both will continue to decrease as technologies get better. Only two years ago it
was common to use 1.3MW wind turbines, today they are using 1.75MW turbines economically.
Myth #3 Wind Farms and the power they generate are expensive.
The comparison of capital costs for various forms of generation is normally expressed as cost to
install 1kW of name plate generation. It is not a true comparison, as Capacity Factor will effect
viability of the project.
While Australia is a good location for Solar Power its price still makes it prohibitive on a large scale.
Wave is predicted to be better, but would still be many years away.
Extract from Adelaides NewsPapers : Picture of decade old wind farms which the media love to recycle.
These photos originate from overseas. No one needs to worry about a farm ending up like this. Being so
old and inefficient, its simply not economically viable to build such a monstrosity.
This is true to some extent. However it is highly dramatised by the media. Early farms overseas
used smaller turbines and consequently many more of them. They were all placed on top of each
other in a small density polluted farm. The media has these first images and have never let go from
them. In reality turbines today are much larger and placed much further apart.
The other myth is the speed of the blades. People visualise fans spinning around. In fact the speed
of the blades spin around at a typical speed of 15 to 17 revolutions per minute, or 3 and a half
seconds to do a single revolution. I can remember approaching my first farm from a distance and
actually thought they were aseptically pleasing to watch.
Wind farms normally have all cables buried underground. Therefore if I was given the option to have
a wind farm across the road or a couple of gas/coal turbines complete with rusting chimney stack
and high voltage switch yard or an open cut coal mine, I think I would take the first option.
Australian Wind
Energy Association
Fact Sheet on Noise
Yes, its a given that the turbines can and will kill birds. However its important to get it in proportion.
Motor Vehicles, Buildings & Windows, Power Lines, Communication Towers, Global Warming and
even Domestic Cats will kill many times more. An Australian Study suggested mortality rates of
0.23 birds per year per turbine, quite insignificant when compared to mortality rates caused by
domestic cats or motor vehicles. The study showed after a farm was installed, birds would change
their flight a couple hundred meters before approaching the blades and actually fly over it, as they
would other obstacles.
Now that most of the myths are out of the way, its hard to see what all the fuss about wind farms
are . . . . ?
News:
Global Wind Partners Lake Bonney Stage 1 Completion - 3rd May 2005
Pacific Hydro To Transfer Us$723 MLN In Development Offshore - 19th October 2004
Novera Energy scales back Australian operations - 9 August 2004
Clements Gap Windfarm Gains Approval - 14th August 2003
Cathedral Rocks Windfarm Gains Council Approval - 28th August 2003
Links:
While it is known some individuals strongly oppose wind farms, what is only just becoming
evident is the length some groups will go to when lead on by the media, and of course a
federal election! The recent Gippsland Circus in Victoria is a prime example of this.
At stake is the 52 turbine Bald Hill wind farm on the Bass Coast of South Gippsland said to
produce 104 megawatts of power. The developer Wind Power Pty Ltd estimates the project
will cost $220million.
It starts with the British Professor of Botany, David Bellamy who helped to heavily promote
wind farms in Britain in the 1980s. Today, he has changed his mind, rather leading the
campaign in Britain against wind farms. The UK has older first generation wind turbines,
which are noisier, smaller and less efficient than todays turbines. Their smaller size and lower
efficiency requires many more turbines to be placed together to generate the same power
achievable with just a couple of todays high tech, high efficient units. For example, the
Australian Financial Review used capacity factor (CF) figures from German wind farms, which
were in the vicinity of 11%, and tried to incorrectly apply these to the Australian Market using
newer technology where 30% CF is normal. Doing this introduced almost a 200% error in CF
used by the AFR to support views they were ineffective. Bellamy makes the same mistakes.
"The wind is indeed a useful element all over this world. One thing is certain; when all
the reserves of fuel, like coal and oil, have been used up there will still be the wind. You
see the winds which blows around this planet remain largely untapped: A huge and
constant source of energy for a power hungry world." - Prof David Bellamy - 1989
Hence Bellamy is quite justified complaining about the situation in the UK. His complaints
stem around the capacity factor for wind farms and the number of old and aging turbines
required over their country side. Because the wind is not blowing all the time, it is only
reasonable to expect to obtain 30% output from new wind farm. Bellamy however
recommends Australia focuses on solar energy - something which is at best six times more
expensive and has a capacity factor of only 15% or at best, half the capacity of Wind.
Channel nines Sixty Minutes paid for Professor David Bellamy to stir up a small delegation of
800 residents concerned about the consequences of Bald Hill in a public meeting in Foster, a
town in Gippsland and the marginal Federal electorate of Macmillan. Some conservationists
liken it to scientists being paid in the fifties to travel around and say cigarettes dont kill you.
Other journalists armed with questions about Bellamys controversial and somewhat
misleading views were prevented from raising their concerns directly with Bellamy :
But at the end of the staged public forum, the circus was just getting started. With a federal
election just around the corner, why cant the Federal Government enter into the debate? At
the time, it was thought little could be done at the federal level. The necessary planning and
development approvals, which include impact statements regarding bird mortalities had been
obtained. The Victorian Government had signed off on the project in August.
But liberal candidate for the seat of McMillan, Russell Broadbent enlisted the help of
Environment Minister Ian Campbell. He creatively found a way to halt the project under the
federal governments silver bullet - the Environment Protection and Biodiversity Conservation
Act. This is an extremely rare occurrence. In the history of the act only two major projects
have ever been halted or vetoed.
Ian Campbell said the project should be delayed until the operator supplied more information
about the economic and social impacts of the project and potential effects on bird life.
Ironically some conservationists are now suggesting we may not have to worry about this
problem in 2050 as many of the hundreds of species of birds will no longer exist if CO2
emissions continue to grow.
Links:
British professor campaigns against wind farms - PM ABC - 30th September 2004
Canberra buys into wind farm battle - The Age October 14th, 2004
Wind bid a stunt - The Australian October 14, 2004
Bellamys views are full of hot air - Australian Wind Energy Association - 30 September 2004
The wind industry is concerned about David Bellamys 60 Minutes funded trip to South
Gippsland this week in the lead up to the federal election. . . .
Gippsland Circus - The Bald Hill Debate turns to Parrot Politics - Part II
With the election over, you would think the circus would finish at least until the lead up to the
next election. But nope its time to play Parrot Politics.
" Word is out this morning that the Federal Government is going to try and scuttle the Bracks
Government's plan for a large wind farm at Bald Hills in south Gippsland. Federal Environment
Minister Ian Campbell is due to make an announcement this afternoon that a two year
investigation indicates the wind farm's 52 turbines will disrupt migratory birds. So is this the
end of the Bald Hills wind farm and indeed perhaps other wind farm proposals?" - Libby Price,
The ABC. Wednesday, 05/04/2006.
Indeed it would seem so. As expected, the Federal Environment Minister intervened and
overruled the development of the farm. The reason? The need to protect the orange-bellied
parrot.
But interesting enough the report concluded not a single orange-bellied parrot was observed
near the proposed Bald Hills wind farm. Where too next? The developers take Federal court
action against the decision. (Even the Victorian Government offered to take federal court
action to overturn the federal decision to stop the farm)
By June, and with the court in session, Federal Environment Minister Ian Campbell was in
damage control, denying reports he ignored explicit advice from his own department which
recommended approving the farm.
The federal court battle ends in August when Federal Environment Minister Ian Campbell
agrees to reconsider his decision. The court issues orders by consent for the Minister to
reconsider and pay the developers legal costs. (More tax payers money)
Planning Minister Rob Hulls said "This court order today makes it pretty clear that his original
decision to knock back the Bald Hills wind farm was a purely political decision"
So surely there is closure now? Nope. There is Victorian Elections in November. Unbelievably
now its the Greens wanting to stop the farm. No, you are reading this correct The GREENS.
Greens candidate, Jackie Dargaville contested the local seat. She indicated while the Greens
support renewable energy over coal and nuclear electricity generation, "we do believe that
renewables should be in the right place". Yep, you guessed it. It turns out she lives close by
the old NIMBY problem Not in my backyard.
Finished yet? Nope two days later (August 17th) Vandals cause $100,000 damage too two
Wind Monitoring tower at the proposed site. Twelve days later, on the 29th August, Federal
Environment Minister Ian Campbell announces a $3.2 million dollar fund to protect the
endangered orange-bellied parrot.
Stay tuned for part III. Another Federal Election coming up next year . . . . . Sadly, In the mean
time Global Warming isnt slowing.
Links:
Feds try to scuttle Bald Hills wind farm ABC, 5th April 2006
Wind farm decision overturned due to endangered bird - ABC, 6th April 2006
Vic Govt to challenge wind farm ban - ABC, 28th April 2006
Campbell denies claims he ignored wind farm advice - ABC, 26th July 2006
Campbell in parrot U-turn - Herald Sun, 4th August 2006
Campbell reconsiders wind farm ban ABC, 4th August 2006
Greens to campaign against Bald Hills wind farm - ABC, 15th August 2006
Vandals damage wind towers The ABC, 17th August 2006
Campbell 'playing politics' with parrot The Age, 29th August 2006
Anti-windfarm campaigners welcome parrot funding - ABC, August 30th 2006
Parrot politics Herald Sun Aug 31, 2006
Certainly worthy of mention is South Australias world class HFR (Hot Fractured Rock) or HDR
(Hot Dry Rock) geothermal energy resources. The Cooper Basin is one of the worlds hottest
locations for HFR energy and is the site for the Geodynamics (ASX:GDY) demonstration
plant. The operation consists of drilling two wells approximately 5 kilometres into the ground. A
heat exchanger is then formed by hydraulic stimulation where the temperature of the granites
is approximately 270C. The technology and concept is not new. France has the Soultz HDR
project which is considered the most advanced HDR geothermal project in the world. HDR
geothermal energy uses proven binary power plants and proven drilling techniques used
everyday in the mining industry. HDR geothermal exploration in Australia was kick started by
SA and NSWs recognition of HDR by granting Geothermal Exploration Licences (GELs) and
the Governments Renewable Energy (Electricity) Act 2000.
The ability of industry to innovate and promote new technology is exemplified by the
experimental Hot Dry Rocks Project. I am quietly confident that this project, dependent
on high heat flow of basement rocks in the Moomba - Gidgealpa region, will be the
beginning of new era of clean green energy production for South Australia. This project
has the potential to provide a significant proportion of South Australias energy
requirements. I await the results from the first geothermal well, the 4.5 km hole
Habanero 1, with great interest."-Paul Holloway - Part of the SAs Minister for Mineral Resources
Development opening speech for the South Australian Resources and Energy Investment Conference
in Adelaide. 30th May 2003
Geodynamics has successfully obtained a technological transfer agreement and sub licence
for the use of Kalina Cycle technology. Kalina Cycle is the worlds highest efficiency heat to
power conversion technology which when used in the proposed binary geothermal power
plant can increase the efficiency by as much as 25%. Such increases has been demonstrated
in a plant in Iceland. Traditional plants have used an Organic Rankine Cycle (ORC) based on
organic fluids where the Kalina Cycle uses a water ammonia mixture.
One of the problems with producing power of this quantity in the Cooper Basin is the cost of
connecting it to the High Voltage Transmission Network. As Geodynamics has another GEL
for the Hunter Valley (close to Sydney) some wonder why this site was not chosen for the
demonstration plant. However Geodynamics points out the temperature of the granites may
be tens of degrees lower at the Hunter Valley site which can cause power output to be cut
substantially.
"It is also worth noting that South Australia is now a hotbed of exploration for
geothermal energy with investment coming from Geodynamics, Minotaur,
Scopenergy, Perilya and Green Rock Energy. There opens some chance for an
emissions free energy future - not just for the State - but for the nation. Some of you
may have noticed the recent announcement by Queenslands Premier Peter Beattie of
Geo-thermal licences. Im sorry Pete, but youre three years behind us. Not only that,
Geodynamics already have a well near Inniminka that I am told is coming along nicely. -
One year after Paul Holloways first mention of HDR, he is at it again - SA Resources and Energy
Investment Conference - 10th May 2004
The 275MWe scaled up plant could be connected to the High Voltage Distribution Grid with a
line to Olympic Dam. This proposal is suggested to cost approximately $5 to $10MW/h still
making the project very viable. The 275MWe plant harnesses an area of HDR 2.5 x 2.5
kilometres. Geodynamics GEL97 & GEL98 HDR geothermal exploration tenements in South
Australia alone cover an area of 991 square kilometres and with mention of future capacities
in the thousands of MWe, We can only wait and see what eventuates of this exciting
technology. The 1000 square kilometre HDR resource is the equivalent of 50 billion barrels of
oil or 10.3 billion tonnes of coal. This is 20 times larger than all the known Australian oil
reserves and equivalent to 40 years current black coal production.
Habanero 1 & 2, Geodynamics first two geothermal wells (named after a hot chilly pepper)
has produced very exciting results. Hydraulic stimulation of the underground heat exchanger,
the most riskiest part of the project, has been successfully completed. It was reported to have
exceeded all expectations with a heat exchanger seven times larger than expected. A initial
water circulation test in mid April 2005 lasting 40 hours reached temperatures of 198.5C. A
five week diagnostic flow test programme is now expected to start the week beginning 2nd
May 2005 and after completion, a 3MW geothermal power plant will be built to demostrate
HFR geothermal energy. Literally its full steam ahead for Geodynamics.
Petratherm Limited (ASX:PTR) has a different strategy to that of its peers. Instead of
focusing on obtaining the highest temperatures, they are aiming to find hot dry rock in excess
of 220C but at a depth less than 3.5 kilometres and positioned close to infrastructure. They
believe finding hot dry rock close to established infrastructure but at lower temperatures out
weighs the cost of drilling deeper and running transmission lines across the state.
Unfortunately we will have to wait a couple of years to see if this strategy proves correct.
Petratherm has announced it will drill its first exploration well in the forth quarter of 2004, kick
starting a two-year exploration program. Petratherm have identified three areas of interest and
have obtained geothermal exploration licences GEL156 Paralana and GEL157 Callabona,
both northeast of Leigh Creek and GEL158 Ferguson Hill, approximately 70 kilometres north
of Olympic Dam.
Eden Energy, a subsidiary of Tasman Resources (ASX:TAS) has applied for seven
geothermal licences in South Australia. It intends to harness Hot Dry Rock energy not only for
electricity generation, but also for the production of hydrogen fuels.
Eden Energy has a significant stake of Brehon Energy, which holds world leading technology
and patents for the cryogenic storage of hydrogen and the production and use of Hythane, a
mixture of compressed natural gas (CNG) and hydrogen. This technology has initially been
developed over the past 15 to 20 years as part of the NASA space program, been trialed in a
wide range of applications and is now ready for full-scale commercialisation.
Eden has just announced details of a joint project to replace Beijings 10,000 diesel buses with
low emission Hythane alternatives. This technology will be ready and on show to the world at
the up coming 2008 Beijing Olympics.
Green Rock Energy Limited (ASX:GRK), formally Mokuti Mining Limited has acquired
Perilya Geothermal Energy Pty Ltd & Green Rock Energy Pty Ltd which each own a 50%
share of five geothermal exploration licences around the Olympic Dam area covering 2200
square kilometres. Green Rock Energy will start drilling investigation wells in the 2nd quarter
of 2005 and subject to good results will drill its first geothermal exploration well in 2006.
Renewable energy company, Pacific Hydro is also hot on hot rocks. Pacific Hydro has a
record eighteen geothermal exploration licences in South Australia covering a total of 8,894
square kilometres.
While South Australia and New South Wales were the first to recognise Hot Rock Geothermal
exploration, it would appear the NT, Victorian, Queensland and more recently Western
Australia are busy passing legislation allowing the exploration of Hot Rocks.
New Qld laws allow hot rock exploration Yahoo News (ABC) - 20th May 2004
Mining laws keep hot rock power underground (NT) Yahoo News (ABC) - 29th May 2004
Hot rocks on the cards (Vic) - Melbourne Herald Sun, 13 March 2006
WA looks at hot rock power Sunday Times, 16th November 2006
Links:
Geodynamics Limited
Energy company to harness the power of hot rocks - ABC, 4th May 2005
Energy firm up-beat about hot rocks power plan - ABC, 5th May 2005
SAs new source of energy - hot water - The Advertiser, 5th May 2005
Renewables to see the light The Age, 4th May 2005
First HFR geothermal flow in Australia - 26th April 2005
Habanero 2 well head installed and tested; preparing for geothermal reservoir testing
programme - 10th January 2005
Deep underground connection between Habanero #1 and Habanero #2; drilling
temporarily suspended at 4,343m (14,245ft). - 18th October 2004
Habanero #2 On schedule at 3,200 metres - 23rd August 2004
New Kalina Cycle Design Patent - 26th July 2004
Habanero 2 Drilling is underway - 12th July 2004
Geodynamics raises $7 million to drill second HFR well - 11 March 2004
Hydraulic Stimulation programme successfully completed overall project risk
significantly reduced - 21st January 2004
Completion of Kalina Cycle Acquisition Leads to formation division: Geodynamics
Power Systems - 21st January 2004
Hydraulic Stimulation #1 completed - results exceed expectations - 19th December 2003
Petratherm Limited
Paralana 1 and Callabonna Update - 2nd March 2005
Drilling Begins at Paralana - 12th January 2005
New Licences and Field Activity - 6th September 2004
Petratherm to drill first hot rock well early in fourth quarter - 27th July 2004
Tasman Resources
Major Green Energy Initiative - Tasman Resources - 16 June 2004
Havilah Resources NL
Havilah announces Geothermal Energy Project - 6th May 2005
For quite some years there has been talk about a $80 million Solar Oasis Project to be built in
Whyalla on South Australias Spencer Gulf. Using technology being developed by engineering
professor Stephen Kaneff from the ANU, the project is suggested to consist of two hundred
22.6m wide parabolic dishes. The dishes would concentrate the sun on a boiler which
produces steam and hence is suggested to produce 22.2MW electricity. The heat from this
process could also be used to distil some 20 megalitres per day of water.
A team of scientists from the University of NSWs Centre for Materials and Energy
Conversion, believe within seven years they will be able to produce a solar panel which
produces hydrogen. It has been suggested if 1.6 million individual households equipped their
roofs with 10m x 10m of solar hydrogen panels they would meet all of Australias energy
needs.
The panels would use a special titanium oxide ceramic that harvests sunlight and splits water
to produce hydrogen fuel without creating any greenhouse gases or other pollutants. This
hydrogen gas could then be used for transport, heating and cooking, or used in fuel cells to
generate electricity.
The UNSW work is currently backed by Rio Tinto, Sialon Ceramics and Austral Bricks.
For 7 years between 1982 and 1989, Spain had a 195m high Solar Tower generating 50kW of
renewable power at Manzanares, about 150 km south of Madrid. The project was designed by
Professor Jrg Schlaich, a German structural engineer and successfully proved the concept
while providing useful data for the optimisation of the design.
The principle of Enviromissions Solar Tower is simple. A large greenhouse covering 13sqKm
with a height of 2m at the permimeter to 5m at the centre heats the air. As hot air rises, it
escapes up a 990m tower in the centre of the structure. Multiple pressure-staged wind
turbogenerators mounted in the chimney convert this 50 km/h rush of hot air into electricity.
However unlike Solar Panels which can only produce power when the sun is shining, if heat
absorbing materials are placed in the greenhouse they can later radiate heat during the night
to get a renewable power source which is capable of supplying base loads.
Related Links:
View an Artist Rendition of the Solar Tower - Large Download 6.7MB Windows Media
Format
Beyond 2000 Video Clip on Solar Tower - Large Download 12.5MB Windows Media
Format
Preliminary Report Shows Power Station Gains - 29 October 2004
New Technologies Identified to Improve Solar Tower Performance - 22 September 2004
EnviroMission to Purchase Solar Tower Site - 1st July 2004
Solar Tower Prefeasibility Success - Go Ahead Decision - 2nd February 2004
Chinese join up as solar power dream aims high
Ecos - Siphoning the Sun
The Solar Chimney (PDF, 360KB) Schlaich Bergermann and Partner
Solar Mission Technologies
It is estimated some 2,000,000MW of energy could be derived by wave action from the worlds
oceans. However harvesting this energy has proven to be problematic with fouling and
durability problems causing on-going maintenance and a greatly reduced life.
To date, wave energy has been converted to electricity by funnel like turbines mounted on the
surface of the water. As the water rises, air is funnelled through a turbine to generate
electricity. This creates an obstacle along the coast and a hazard with underwater high voltage
transmission lines connecting the units to the grid.
Seapower Pacific is set to change this. Using patented technology, the CETO wave power
plant consists of two parts. The magic is in a submerged unit that does not protrude above the
water line and consists of a flexible diaphragm. As waves pass the diaphragm, compression
and expansion occurs which can be used to pump sea water to shore under high pressure
(1000psi). On shore this high-pressure water is converted to electricity using a conventional
non-marine qualified Pelton turbine.
The construction of the underwater unit is made of concrete, steel and rubber which are all
proven in sea conditions. With the generator located on shore, no special requirements are
needed for grid connection. The by-product of the plant is highly pressurised sea water which
can be used in reverse osmosis desalination to produce fresh water.
On the 26th of July 2005, it was reportedthat CETO underwent its inaugural operational
testing 300m west from Rous Head where it successfully transmitted high pressure seawater
to shore at in excess of 500 psi. In the second half of 2005, typical pressures of between 620
to 850 PSI was obtained on-shore. In late November, the company had ordered desalination
equipment which will be installed once delivered. The company has a plan to produce its first
commercial CETO by the end of 2006.
In 2005, Seapower Pacific Pty Ltd was acquired by UK based Renewable Energy Holdings
PLC. As part of the acquisition, the original Australian owners, Carnegie Corporation (ASX:
CNM), Pacific Hydro, Burns group & Seapower Pty Ltd each have an interest in REH. The
project is said to have attracted great interest from overseas renewable energy bodies and
with most Australian states now investigating desalination, such a plant which doesnt
consume plentiful amounts of electricity but rather generates it can only be a winner for
reducing GHG emissions while ensuring Australia doesnt run out of fresh water.
Related Links:
The Western Australian Government has announced plans to build a reverse osmosis
desalinisation plant capable of producing 45 gigalitres (17% of Perths water supply) a year.
Using conventional electric pumps to force the salt water through the micro filters, it is being
built 40km south of Perth next to the Kwinana power station due to its hungry power
requirements. While its still early days to see Seapowers Technology commercialised, WAs
plant will help other states see desalination as a viable opportunity and will most certainly
strive to do things better.
As utilities try to squeeze more profit from their expensive electricity grids while at the same
time adversely effecting their reliability, large scale and lengthy power outages are becoming
more frequent. One way of safe guarding this is by installing your own efficient, low emission
generation.
One of the fastest growing sectors in the energy industry at the moment is Distributed
Generation (DG) also known as Decentralised Energy (DE). Currently about 7% of world wide
generation is DG with some countries such as Germany having as much as a 13% DG market
share.
One type of Distributed Generation is mini-turbines such as the Capstone C30. These are
miniature Gas Turbines which are connected up to either Natural Gas or LPG. One of the
benefits of DG is the co-generation capability often referred to as CHP (Combined Heat
Power). This allows the consumer not only to generate their own power, but also to use the
otherwise wasted heat for room or water heating.
The other fast growing type of DG is fuel cells. Fuel cells are still a little way off from
participating in the zero emission hydrogen economy, part due to the availability of hydrogen,
but they are a very real option today for DG from natural gas.
There are many types of fuel cells, but the common ones are :
Polymer Electrolyte Membrane Fuel Cells (PEM) - Used in fast starting applications
such as UPSs and typically operate on pure Hydrogen.
Molten Carbonate Fuel Cells - More suited to commercial applications and larger power
plants.
Solid Oxide Fuel Cells - High electrical efficiency and well suited for small to large scale
generation.
Ballard Power Systems is leading the world in PEM Fuel Cells. Today, You can purchase a
1kW AirGen Fuel Cell Generator which is a small portable unit which can generate electricity
for up to 8 hours from its three internal hydrogen cartridges. After this the unit can switch to
an external higher capacity Hydrogen Cylinder. These units are more aimed at back up UPS
power supplies for computer rooms, telecommunications etc but can have a range of other
uses. Running on pure Hydrogen means they generate no emissions making them ideal for
indoor use.
In the Solid Oxide Fuel Cell (SOFC) arena, a world renowned Melbourne based company,
Ceramic Fuel Cells Limited (ASX:CFU) is considered to be leading the world market. CFCL is
working to commercialise a 1kW SOFC later this year that also functions as a Domestic Hot
Water service that can service a family of 4. Larger units up to 5kW will also be avalible to suit
businesses.
The Residential Micro CHP produces electricity from natural gas (Methane), LPG, Propane
without combustion, noise or moving parts providing for a greater electrical efficiency of up to
50%, while reducing CO2 emissions by 60%. By harnessing the 850 degree heat generated
by the fuel cell, the owner can gain hot water and an overall system efficiency of 85%. This
makes the SOFC much more efficient that the large scale CCGT (Combined Cycle Gas
Turbine) that your power station may use, and without loosing another 10% power from losses
in the grid.
The Australian Technology Park in Sydney is one site in Australia who uses a large fuel cell to
generate 200kW of electricity from natural gas for use within the park, while at the same time
reducing greenhouse gas emissions.
Ceramic Fuel Cells has recently set up a subsidiary in the United Kingdom where it intends to
set up a large scale manufacturing plant. It has the backing of many large shareholders
including Woodside Petroleum, Energex, Western Power, BHP Billiton, CSIRO & the
Commonwealth of Australia.
Related Links:
CFCL New energy deal across the Tasman (NZ) - 18th November 2004
Ceramic Fuel Cells Partnership to design mass production plant - 3rd September 2004
Ceramic Fuel Cells Product Demonstration Program - Includes photos of Technology
Demostrators
CFCL Submission to the Victorian Government Greenhouse Challenge for Energy
Comparision of Fuel Cell Technologies
Australias Greenhouse Future lies in the hands of Roam Consulting - or does it?
Coal is the predominant fuel used in Australia for the generation of electricity and unfortunately has the
highest greenhouse intensity of most fuels. Thirty three per cent of Australias greenhouse emissions
come from electricity generation, with 92 per cent of this from coal.
Today, coal is typically used in PV (pulverised fuel) power stations which have a thermal efficiency of
approximately 33%. A new technology is being demonstrated around the world called Integrated
Gasification Combined Cycle (IGCC) which can increase efficiencies by greater than 50% and thus
minimally reduce GHG emissions. However coupled with carbon capture and storage the emissions can
be greatly reduced or more accurately stored, preventing them from reaching the atmosphere.
So far IGCC has only been used overseas in demonstration plants and is still considered uneconomical to
be used in larger scale plants. For this reason there are no IGCC plants in Australia but as the technology
improves this should change.
To say the least, IGCC is quite an impressive technology. It involves converting coal into a synthetic gas
called syngas consisting of hydrogen and carbon dioxide. This gas can then be burnt in traditional CCGT
(Combined Cycle Gas Turbine) plants that would traditionally run on natural gas. IGCC plants are also
visioned to be the stepping stone to the hydrogen economy where Syngas can be separated into carbon
dioxide and hydrogen with the latter being used for cars, heating or electricity generation via fuel cells.
However the problem occurs with the carbon capture and storage more commonly known as
Geosequestration. While some technologies to support the concept exist today, as a whole
Geosequestration is currently an unproven technology which requires many more significant years of
development should it ever be economically viable. While the oil industry has in the past injected gas into
active wells, little is known about the long-term storage of C02 in disused wells. The consequences of
vast amounts of CO2 escaping could be devastating, possible affixiating nearby communities while
undoing billions of dollars of work by storing it in the first place.
Despite little being known about the technology and the huge development risks involved, the Howard
government known for its good economic management, is going the next step. It has put all its eggs in
one basket by throwing large amounts of tax payers money into what some consider a short sighted
distant and ambitious technology of Geosequestration, while abolishing Australias only renewable energy
CRC, ACRE. After all, renewable energy is not needed anymore.
Currently there are few used oil and gas wells or coal seams that could be used for storage. It is
considered some may come available in about 2030 but would not be available in all states. The greatest
potential for storing CO2 is in Western Australia, yet most of the CO2 is generated in the eastern states. It
should be noted, that the technology is not perfect and is never expected to be. It is not Zero Emission
Coal as some incorrectly call it. While a good 80% of the emissions can be collected using proven
technology today, there will still be some CO2 escaping the system and entering the atmosphere.
But more important, while there are hundreds of good ideas in existence, it must be economically viable to
survive. The International Energy Agency (IEA) has calculated, full geosequestration from either an IGCC
or natural gas CCGT would cost approximately $67.50 AUD a tonne of CO2. This would include the
capture, compression, transportation and storage. A typical IGCC plant produces about 0.7 tonnes of
CO2 per MW/h of electricity produced. Therefore at current prices (assuming you can build an IGCC plant
economically) Australia is looking at about $100MW/h. For comparison, a wind farm can produce power at
a cost of approximately $70MW/h and Hydro is about $60MW/h.
So how does government come to such a decision to funnel money from renewable energy and place all
its eggs in one extremely risky basket for the benefit of all Australians, . . . sorry, benefit of Rio Tinto?
It starts with the Prime Ministers Science, Engineering and Innovation Council (PMSEIC) which Mr
Howard personally chairs twice a year. It is his governments principal source of independent advice on
issues of science, engineering and innovation. In the 9th meeting on the 5th of December a paper was
presented titled "Beyond Kyoto - Innovation and Adaptation"
The paper proposed and heavily supported only one emerging solution - something that will be
economically viable within 10 years - The sequestration of CO2. But if, in isolation you read the report
yourself, you would of come to the same conclusions. There is only one way forward for Australia. Stop
wasting money on renewables. The solution cant be simpler.
The reason why the Howard Government will not increase MRET is that it will marginally increase the
price of power. This will make some industries uneconomic, causing job losses and the GDP to fall. In the
report Geosequestration was suggested to cost as low as $10 per tonne, a figure quoted from Roam
Consultings unpublished data. Roam Consulting is a small Queensland based consultancy agency. The
report goes on to say Such figures compare favourably with other options offering large reductions in
emissions, i.e the ones that cause job loses and a fall in the GDP such as wind, hydro and wave.
The comparative cost of power. Note how cheap "zero" emission coal is compared to Hot Dry Rock. (Its also
interesting to see Wind so cheap).
So one has to wonder where this $10 a tonne figure comes from? Roam Consulting? No, interesting
enough they deny the claim and do not understand how their name was associated with this data. So who
better to ask, than Australias Chief Scientist, Dr Robin Batterham who just happens to be Chief
Technologist and a board member of Rio Tinto. In fact, thats just what the ABCs 7:30 report did. When
asked, he clammed up and suggested to ABCs Andrew Fowler to check the Hansard, after all it was the
same question Greens leader Senator Bob Brown had asked when recently grilled in Parliament. Dr
Batterham did eventually give an answer to the question on the 7:30 report - unpublished data.
Another quite intriguing part of the report was a table on page 30 of the report showing a comparison of
energy abatement options. It suggests should Australia take the option of "zero emission" coal, we can
begin to see a rapid decline in CO2 emissions from as early as 2006. Somehow it assumed a significant
amount of research will be conducted, the technology developed, tested & refined and made economically
viable, and a couple of large scale plants built and a couple of old large scale PV coal power plants shut
down in - well less than 3 years flat. While its debateable that Geosequestration may be a miracle if it
becomes economically viable on a large scale, I think you will certainly agree that if all the developments
occur above, then it will definitely be a miracle.
Even though the country now has three Cooperative Research Centres (CRCs) devoted to fossil fuel
research under the Howard Government, to date there has been no significant breakthrough in
Geosequestration.
The best indication of the realistic future of this technology comes interestingly enough from within the
Howard Government. In March 2004, Industry Minister Ian Macfarlane told the ABC, "We have got to
realise that the first of these technologies may not be ready to test, even in a pilot situation, for five-10
years". He goes on to say "Certainly 2015 would be optimistic in terms of a significant pilot plant. If we can
get to the stage where 20 per cent of the electricity in Australia is being generated by zero emissions
technology in coal fired power stations by 2030, we will have done well."
Ironically, the paper listed two other technologies, Hot Dry Rock Geothermal and Fuel Cells running on
Hydrogen that were dismissed as being future options, 50 or more years away.
Geodynamics Limited is streets ahead of ICGG in proving economic viability by extracting heat from Hot
Fractured Rock (HFR). Unlike other renewables, HFR has a huge potential as it can deliver large base
load, true zero emissions power. Economic modelling conducted by world recognised organisations such
as the energy lab at MIT and Sinclair Knight Merz suggest HFR energy can be extracted using ORC
(Organic Rankine Cycle) at $39/MWh. A discount of up to 30% can be added with Kalina Cycle
Technology which Geodynamics have licenced and is currently improving, making the technology either in
line with, or cheaper than present day Coal.
In 2003, Geodynamics started spudding Habanero 1 in South Australias Cooper Basin to a depth of
4400metres where they successfully formed a much larger than expected heat exchanger and
significantly reduced the risk of the project. The drilling of Habanero 2 is currently under way where it has
penetrated the heat exchanger formed under Habanero 1 making way for circulation tests later this year
and into early 2005. This will prove if HDR is economic and if so Geodynamics will build a demonstration
plant, only some impressive 50 years ahead of schedule to the governments paper.
The 975 square kilometre tenancy in the cooper basin is estimated to have a phenomenal energy
equivalent of 50 billion barrels of oil. This project has sparked so much interest, that the Queensland
government whizzed though a Geothermal Energy Exploration Bill in May 2004 so interested prospectors
could start searching for Hot Dry Rock in Queensland. Following suit, the Northern Territory government
is now doing the same, and a second hot dry rock Geothermal company Petratherm has listed on the
stock exchange and is preparing to drill its first exploration well. Geodynamics has additional exploration
licences for the Hunter Valley in NSW.
You can only wonder where Australias renewable energy industry would be today, if for example Lyall
Howard, John Howards nephew was head of government relations of Geodynamics instead of his current
position as head of Rio Tintos government relations?
Further Reading :
Update :
Chief scientists dual roles damaging - The Age - 6th August 2004
A Senate committee has found no evidence that Dr Batterhams acted "inappropriately or
improperly" in regards to his conflict of interest between Rio Tinto and his Chief Scientist post. The
committee did however recommend the Federal Governments chief scientist position should be
made full-time to prevent such issues arising in the future. The Senate committee was established,
following the Howard Government acting to prevent Dr Batterham to appear before a Senate
Estimates Committee to answer conflict of interest allegations.
Halve gas emissions: top scientist - The Age - July 19, 2004
"Talk of such a target by the Federal Governments most senior scientific authority, who recently
defended himself before a Senate committee, is in stark contrast to the recently released white
paper on energy policy, which tied Australias future energy mix and economic base to the high-
emission coal and aluminium industries. . . "
Scientist sets high target for emissions - The NZ Herald - August 2, 2004
"Australias Chief Scientist wants his country to halve its emissions of global warming gases by
2050 - a far bolder target than the Howard Government has adopted. . . "
Australian Scientists Reduce Coal Greenhouse Emissions By 33% - Yahoo News - 3rd August 2004
"CANBERRA, Aug 3 Asia Pulse - Australian scientists today reported the successful trial of a
process for drying brown coal which could reduce greenhouse emissions by one third. . . ."
On the 16th of June 2004, Prime Minister John Howard released his energy package titled
Securing Australias Energy Future. In some circles, the whitepaper has been nicknamed
Securing the Coalitions Political Future, or Securing Australias Coal Industry.
Starting with an early pre-election sweetener, it promises fuel excise tax cuts worth a
staggering $1.5 billion. On top of this comes another $1.5 billion worth for the coal industry to
pursue Howards ambitious dream of "Super Dooper" (Howards own words - LETAG 6 June
04) low emission coal technologies - we fund $500 million of that. Then theres $100 million for
renewable energy development (over 7 years) and $75 million for a solar cities trial.
By specifically funnelling money into solar panels with a capital cost of around $10,000 per
KW (see advertising for governments), Howard can ensure the money is not spent on more
economically viable technologies, indicating it is nothing to do with climate change but rather
demonstrating to the Australian public he is actually doing something.
For example $75 million would buy 7.5MW of solar power producing 9.85GWh/year and
abating 8,865 tonnes of C02. Spending it on Wind power may not win any political votes, but
would buy 50MW of generation producing 131GWh/year and abating 118,000 tonnes of C02.
Investing $75 million in newer HDR geothermal technology, which is only a couple years away
from being demostrated in Australia, would buy 30MW of generation producing 249GWh/year
of base load zero emission electricity abating some 224,000 tonnes of C02. Australia has
some of the best hot rock resources in the world.
But probably the biggest disappointment is hidden deep in the report, indicating MRET would
remain unchanged with no increase, now, or in the future. This has effectively stalled
investment and job creation in this sector. Not fazed by this, Senator Meg Lees introduced her
Renewable Energy Amendment (Increased MRET) Bill 2004 on the same day of the report,
calling for a sensible increase of the MRET target to 4.5%.
It appears the government has learnt some lessons. In this report, zero emission coal is now
referred to as low emission coal. On page 142 there are estimates of the $/MWh cost to
produce power from various sources in 2010. Anything that includes geosequestration now
has a cost indicated as N/A . .
Securing Australias Energy Future - Department of the Prime Minister and Cabinet
PM Delivers a Black Energy Future - Australian Business Council for Sustainable
Energy - June 15, 2004
Green industry sees red at stall in funds - The Sydney Morning Herald - June 16, 2004
Howard goes for clean, not green - The Sydney Morning Herald - June 16, 2004
Renewable Energy Amendment (Increased MRET) Bill 2004
Pacific Hydro To Transfer Us$723 MLN In Development Offshore - 19th October 2004
The 25th October 2006 saw the first successful grants being announced. $75 million was
contributed towards a project by Solar Systems to build a solar concentrator.
The 154MW plant is expected to generate up to 270,000 MWh per annum (CF or 20%) during
daylight hours when full commissioning is complete in 2013. Total capital cost is $420 Million
or $2,727 per KW.
A further $50 million from the fund was awarded to UK based International Power for a $369
pilot brown coal drying with post production CO2 capture and storage. The demonstration
retrofit is expected to be fully operational by 2009 and provide up to 30% reduction in
emissions.
The 1,600 MW Hazelwood power plant in the Latrobe Valley has more than 500 years of
brown coal reserves and had previously topped a international list of the dirtiest power stations
world's major industrialised countries with a CO2 intensity of 1.58Mt/TWh.
An investigative unit of the ABC has made an intriguing find into the formation of the Howard
Governments fossil fuel dominated energy white paper, Securing Australias Energy Future.
The ABC has obtained leaked meeting minutes, emails and memos suggesting the
government invited a hand picked group of 12 companies from the big side of town to provide
exclusive input into the report and its recommendations.
"Fossil fuel producers - Exxon Mobil, Rio Tinto, BHP Billiton and high level fossil fuel users
and generators - Alcoa, Holden, Boral, Amcor, Energex, Edison Mission and Origin Energy
were part of the Governments exclusive invitation only group." - Andrew Fowler.
"This leaked document provides a remarkable insight into how the policy agenda is really set
under the Howard Government. Its quite clear now that when the Prime Minister wanted new
policy directions to deal with climate change, he decided to call a secret meeting with
Australias biggest polluters and said, Tell me what I need to do." - Clive Hamilton.
"According to notes taken by one of the executives during a LETAG meeting the Industry
Minister Ian Macfarlane stressed the need for absolute confidentiality. The Minister saying that
if the renewables industry found out there would be a huge outcry."
Notes of LETAG Meeting - Taken by Sam Walsh, Rio Tinto. - Includes draft Industry
Communication on greenhouse policy in the PMs Energy Statement compiled by Lyall
Howard (John Howards Nephew)
Leaked documents reveal fossil fuel influence in White Paper - ABC Local Radio - PM -
Tuesday, 7 September , 2004 18:42:14
Govt denies energy white paper claims - The Age - 8th September 2004
Comments or Suggestions?
If you have any comments or suggestions or would like to discuss a topic in more detail,
please post them on the Web Board
What is VoIP?
Do I need to make a lot of calls to save using VoIP?
What do I need to make a VoIP call?
Is my Broadband reliable enough?
Choosing a VSP?
VoIP is Skype?
Free peering VSPs?
Hardware or Software?
Voxalot Web Callback No need for hardware or software.
The Phase in Period . . .
Do I need a DID?
How much Bandwidth does VoIP use?
Now that I have VoIP, how can I make further savings?
QoS The miracle cure ?
Australian VoIP Providers
Australian VoIP Hardware
What is VoIP?
Voice over IP is an emerging technology allowing access to free or cheaper phone calls. Typically calls between two users using the
same Voice Service Provider is free. Calls to the Public Switched Telephone Network (PSTN) come at heavily discounted prices.
Timed STD calls are generally not heard of among VoIP providers. Most Voice Service Providers (VSPs) offer 10 cent untimed calls to
any land line in Australia. Calling next door costs 10 cents, while calling across the nation or to remote country towns also costs just 10
cents untimed.
International calls are normally on par with calling card services or cheaper. Unfortunately mobile phone calls still carry a premium,
mostly due to the wholesale costs of terminating a call into the countrys Mobile phone networks. Ironically, its often cheaper to call a
mobile phone somewhere in the world, than it is to call one in Australia or the person standing next to you in your living room.
While heavy phone users have more to gain from VoIP, even the lightest of users can gain some advantage if they already have a
suitable broadband connection.
Today, most landline users are on a Homeline Plus ($29.95) or Homeline Complete ($26.95) plans from Telstra or an equivalent plan
from a third party Telco.
Telstra offers a Home Line Budget plan for $19.95, immediately saving you $10.00 or $7.00 a month before you even start to consider
cheaper calls.
The HomeLine Budget plan provides cheaper line rental, but the cost of calls are dearer. This doesn't worry VoIP users, as they make
no phone calls on the traditional PSTN servvice. One of the conditions of the service is you must pre-select Telstra for STD and
International calls and agree not to access other carriers by dialing access override codes. When this plan was introduced, Telstra had
no restrictions regarding ADSL services. They have since introduced a requirement that the subscriber "must not acquire a broadband
service from another service provider which is provided using line sharing technology". This anti-competitive move means you must use
a broadband service that uses Telstra DSLAM Infrastructure.
The features of VoIP also makes it more appealing compared to traditional telephony. Services such as Caller Number Display (CND) is
normally provided free of charge, unlike Telstra who charges $6 a month for the service. Likewise is voice mail services, with many
providers even emailing you a .wav file of left messages. (Note however if you choose to use the PSTN for incoming calls, you will still
need to purchase these services from your PSTN Telco, be that Telstra or a third party)
VoIP services are also portable. Provided you have access to broadband and comply with your VSPs term and conditions, you can take
the service anywhere. This comes in handy when moving house or business Premises. You can retain your existing phone number and
there are no disconnection or reconnection fees. Many VSPs can activate your new service and phone number within minutes of signing
up.
Some providers such as Engin will also offer concurrent multiple calls subject to your available bandwidth. If you have to wait in line to
use the phone at home, just add another box. There is no need for the expense of that second line.
VoIP is also finding itself popular in share accommodation or among teenagers wanting their own phone line.
While you may have no trouble with a bit of light browsing on the weekends, your realtime VoIP connection can only be as reliable as
your broadband connection.
If you have ADSL, consider how long you can keep DSL sync for? If you are on a long copper line, and suffer from regular dropouts,
anytime your ADSL drops so will your VoIP connection. Any drop outs may mean ringing the person back and this not only comes as an
inconvenience but erodes any savings being made.
Also consider congestion on your ISP. A budget, oversubscribed ISP with packet loss may be a good cheap option for web browsing,
albeit a little slow. However with real time VoIP, it may lead to packets being dropped causing breaks in your conversation or at worst
case terminated calls.
Cable broadband services typically share a finite amount of bandwidth among users on your cable segment. If you have a lot of users
downloading in your area, this can reduce your available bandwidth. Many cable users witnessed degraded services over the Christmas
holidays when everyone was home and hammering their cable modems.
Wireless Broadband services such as Unwired and iBurst are also another excellent way of ridding the so called telstra tax by removing
the need for a copper phone and associated sky rocking line rental. However signal strength can play a big part in the reliability of your
connection. Many people have reported good success with VoIP on non-line of sight wireless services, others have not. It can depend
on location and proximity to the nearest tower.
Choosing a VSP
No one Voice Service Provider (VSP) fits all. Typically there are two types of service providers, full service providers and limited service
providers.
Full service providers will provide call termination for local, national, international and mobile calls as well as 13, 1800 service
numbers and 000 emergency services. Full service providers can provide you a DID (Direct Inwards Dialing) number, i.e. a phone
number on the PSTN that friends and family can use to ring you via VoIP.
Limited service providers may provide call termination for local, national, international and mobile calls, but not offer 13, 1800 calls or
emergency service calls. They may not be able to offer you a DID. These providers rely on hardware with dialplans and FXO (ports that
connect back to your PSTN line) so unsupported calls can be routed via the PSTN. Alternately, gateways can be used route these calls
via another VSP who does provide these services.
Some providers charge a monthly fee, others have a prepaid service with no monthly fee. Some support BPAY, others only Credit Card.
Some are geared towards users that make a lot of local calls, others towards users that make a lot of national calls, and even some
towards user that make a lot of international calls. When determining a VSP, What you need to is get you last phone bill and find a plan
that best suits your calling patterns. One VSP may save Joe Bloggs lots of money, but actually cost Mr brown more than his current
Telstra line.
Technical support (If you think you may need it). Most if not all VSP will provide support for billing, or call routing issues.
However many may not provide good assistance, if any at all, towards configuring router X with Analog Telephone Adaptor Y on
ISP Z. Not only are there so many possible configurations, there is different firmware revisions and bugs to consider. It is
unrealistic to expect good telephone support for so many different combinations of routers/ATAs. VoIP is a high volume, low
margin business and sadly good technical support suffers. You may be better considering a cluey friend or family for configuration
assistance. They can also visit your site/home to assist you with these issues.
Where the VSP's servers are located and how they peer/connect with your ISP. For the best quality you want to sign up with
a VSP with servers in Australia. Overseas connections can cause latency or delay in your Voice Calls. You may also want to
consider if they peer with the same transit providers than your ISP uses. Its common to find voice quality issues attributable to the
subscribers ISP and two customers of the same VSP having widely different call quality. Unfortunately most VSPs only have
control of your VoIP data while it is on their network. They have no control over what Internet Service Provider you connect too,
and the quality of backbone transit links can vary.
For example say you live in Brisbane and you sign up with a VSP who has servers located in Brisbane. The VSP connects to
Optus. It is possible your ISP doesnt peer with Optus in Brisbane, but the transit network they use connects to Optus in
Melbourne. What you may find, is your VoIP traffic being routed to Melbourne where it is routed onto the Optus network and then
back to Brisbane. Yet, your next door neighbor may be signed up with the same VSP, but uses a different ISP who peers with
Optus in Brisbane. In their case, their VoIP traffic stays within the state. Speak with other VoIP users on your ISP and gain their
feedback on providers to use or providers to stay away from.
Hardware / Codec Compatibility. While this is becoming less of an issue as VoIP maturers, it has been observed that some
hardware provides bad quality calls with certain VSPs. This same hardware may provide excellent calls for all VSP but not the
http://www.beyondlogic.org/VoIP/ (4 of 15)13/02/2008 16:53:32
An Introduction to VoIP in Australia
Do you have friends or family already using VoIP? Most VSPs will offer free calls between subscribers on the same network.
However at present there is no peering between providers. If you sign up with engin, but you have a friend on MyNetFone, then to
ring that friend, your call must go via the PSTN and at the cost of a call. If you have friends or family already on another VoIP and
you frequently ring them, you may consider signing up with the same provider to utilise free calls. After all, there is no point
making Telstra rich.
Possibly one of the good things about the VoIP industry in Australia is the absence of contracts. Most providers will allow you to
terminate your service at any time. Many are also prepaid, so you can sign up with them and pay the minimum credit, maybe $10 for a
risk free trial. If it doesn't turn out, you may be able to keep the account as a backup. Some providers such as engin offer special deals
such as the first month free, to assist subscribers in a relatively risk free trial of their service.
The biggest risk is normally the capital purchase of VoIP hardware, only to find out VoIP is not for you.
VoIP is Skype?
If your new to VoIP and have heard about it in the media, you could be mistaken for thinking Skype is VoIP and VoIP is Skype.
However, this is not the case. VoIP or Voice over Internet Protocol is simply a technology used by even some of our largest telcos for
the haulage of voice. Skype, owned by online auction company Ebay, is a piece of very well marketed software that uses VoIP
technology to allow Skype users to call other Skype users for free.
Used my millions of tech savy users around the world, Skype has very little infrastructure but relies on a P2P (peer 2 peer) supernode
architecture to connect your call to your destination. This can have one side effect if youre not careful. If you install Skype on a
computer with a publicly accessible internet address and without a firewall, then your computer can turn into a Supernode used to
connect and transfer voice data between other Skype users. This could result in your computer downloading and uploading a large
volumne of data and exceeding bandwidth quotas. For most users behind a firewall or NAT enabled router, this is not a problem.
As calls dont go directly to your designation, but rather via other peoples computers Skype claims to encrypt your calls so other third
party Skype users cant listen to your conversations. A risk occurs that one day, if it has not already been done that someone will work
out how to decrypt these calls.
That aside, probably the biggest problem with Skype is in-flexibility and upgradeability. Skype, in its current form is a propriety software
application you must run on your computer. This means in order to receive calls, your computer must be switched on all the times. Often
this is impractical, hence users have to resort to prearranged times to call other Skype users.
Being software, most Skype users use a headset connected to their computers. Skype adaptors and handsets are starting to become
available to allow users the ability to use existing cordless phones or handsets, returning the feel of conventional telephony, but as this
hardware still needs the Skype software, you are still restricted to the requirement of having your PC on.
While one of Skypes features is ease to setup, due to these restrictions you may consider a solution running on an industry standard
protocol. A solution where you can mix and match service providers and hardware.
For example, you could choose to buy a hardware based ATA or download a softphone and sign up with a free provider such as
FreeWorldDialup or Voxalot. In this case, you get the advantage of free calls between users connected to FreeWorldDialup or Voxalot,
no different to Skype, while at the same time the hardware based solution means there is no need to have your computer on all the time
to receive calls - a much less power hungry power box connected directly between your phone and broadband router handles this.
As the softphone and hardware ATA work on the same protocols, you can take the free option of downloading a softphone first, and
when ready, seamlessly upgrade to a hardware option without the need to giving family and friends a new VoIP number. Using the
industry standard SIP protocol means, you are not locked into a specific piece of hardware or one particular softphone, but rather have
an extensive choice. Don't like one, try another.
As you will see in the next section, this option also has the added advantage in allowing subscribers not using VoIP to ring you via
PSTN to VoIP gateways around the world, and possibly for the cost of a local call.
If you have no need to make calls to the traditional PSTN but want to use VoIP among friends or family, then there are free providers
such as Free World Dialup or Voxalot. In simple terms, these providers act as a telephone directory. For example, you can register for a
free account with free world dialup (known as FWD) or Voxalot and get a phone number unique to the provider that anyone connected
to the same provider can call. Calls between users on the service travel entirely on the internet direct from ATA to ATA. Third parties
sometimes offer Free PSTN Access Numbers to these providers in many countries so users of the PSTN can ring your VoIP service.
In Australia, the Australian PSTN to VoIP Gateway offers this service. Australian PSTN users can ring 1300 558 592 followed by 393
and your FWD phone number to call your FWD registered VoIP phone. While the service doesnt have any guarantee of uptime or if it
will operate on the longer term, it does open up possibilities for interstate friends and family to call you for the cost of an untimed 1300
call.
Early users of this service will know it once had a 1800 freecall number. During those days, I had family go interstate on a holidays.
They would see a Telstra payphone on the side of the road, and without any change dial the freecall number and we would have a 10
minute conversation. They then checked into their hotel and made enquiries on how much a free call 1800 number would cost from the
phone in the hotel room. The answer - free. We had regular 30 minute plus interstate calls throughout the period of the week and the
best thing, when they checked out of the hotel the calls on the phome came to a grand total of $0.00. The cost to myself was a hardware
ATA and a bit of bandwidth. The call quaility was close to excellent.
This also opens up possibilities for friends and family traveling overseas. If they can find a Telco in the country they are visiting that
provides a gateway into the FWD, then the same deal applies. They can call you back home for typically the cost of a local call, no
different to any foreigners visiting Australia using the Australian PSTN to VoIP Gateway to call family (with a FWD service) back in their
home country. VoIP can certainly open up some interesting possibilities.
SIPBroker doesn't offer SIP based accounts (You can't register your ATA with them, but Sister company Voxalot can provide this
service)), but provides means to peer between VSPs. The idea is, if your VSP peers with SIPBroker, then via SIPBroker you can access
many other VoIP networks around the world. Unfortunately many Australian VSPs do not peer with anyone due to commercial reasons,
but you can use SIPBroker with your Voxalot or FWD account.
SIPBroker have PSTN access numbers in many countries, including Argentina, Australia, Canada, Ireland, Mexico, Netherlands,
Portugal, Spain, U.K, and the U.S.A. For example if you are in Manchester, U.K and want to call your FWD service for a cost of a locl
call, you can dial the Manchester PSTN to VoIP access number, +44-161-660-8447 and when prompted enter 393 for FWD followed by
your FWD number. SIPBroker peers with these providers worldwide.
Hardware or Software?
There are two ways to utilise VoIP. You can obtain or download software onto your computer which acts as
a softphone, or you can get a hardware based solution.
The software option is the cheapest with many voice providers offering free software. Alternatively you
may download softphones such as Xten X-lite. Using a softphone requires a PC with a soundcard or USB
based handset. While call quality can depend upon your setup, the main disadvantage is the requirement
for your computer to be on to make or receive calls. This can be ideal if you are traveling with your laptop,
but most people like the feel of the traditional handset with the advantage that it doesnt require your
computer to be on 24 hours a day to receive calls.
Hardware comes in a few varieties. The simplest and cheapest is the standalone analog
telephone adaptor (ATA). It is typically a bland little box that accepts an Ethernet lead (to connect
to your broadband router) and has a RJ-12 phone socket or FXS port where you can connect your
traditional handset or cordless phone. With this style of box, there is no intergration with the
traditional PSTN line. Its sole purpose is to turn your phone into a pure VoIP phone and is ideal
where a PSTN line doesnt exist (i.e. You finally got rid of Telstra completely, and are now using
wireless, cable etc) or if you want a spare 2nd line for your teenagers etc.
ATA: The Netcomm V100 single FXS port ATA
The next style of box integrates your VoIP service with your PSTN landline service. It is essentially a box that connects in between
your existing phone and landline. It allows incoming calls on your Telstra PSTN line to ring your handsets as normal. However outgoing
calls are routed via VoIP to provide you a cost saving. This allows you to introduce VoIP without having to provide people with a new
phone number. Everyone calls you via your existing Telstra phone number, but outgoing calls go via VoIP.
The other big advantage is the lifeline feature. If your ADSL or VoIP service goes down, or your ATA loses power, calls automatically
fall back to your Telstra PSTN line. This ensures you always have a phone service. Most ATAs can also be programmed to route 000
emergency calls via the PSTN. When calls are made from the traditional PSTN to emergency services, the operator is shown the
physical location or address of the service on their screens. While handling of 000 emergency calls via VoIP is improving many VSPs
cannot guarantee the service, operators can sometimes be given the location of "unknown" and where the VSP does provide
information of the location, the ATA is portable and the onus is on the user to update the location details with the VSP. There is nothing
stopping you taking the service interstate or even overseas on a holiday or when you move house you may forget to update your details
http://www.beyondlogic.org/VoIP/ (7 of 15)13/02/2008 16:53:32
An Introduction to VoIP in Australia
As VoIP becomes mainsteam, phones that natively support VoIP are starting to hit the
markets. These desktop phones are typically aimed at the corporate sector, but can be of
interest to some home users. They look just like a traditional desk phone, but instead of
having a RJ-12 socket for connection to the PSTN, they accept an Ethernet cable and require
a IP address. Cordless phones that natively support VoIP are also emerging in the market
place.
Deskphone: The Netcomm V85 VoIP Speaker Phone
Having a cordless phone base station connected to an ATA and then connected to your broadband router, all with there own plug packs
can create a mess of wires, lack of power points and a confusion on how to hook them all up. VoIP by nature of its connectionless
protocols do not work well behind most common domestic NAT based broadband routers. Most modern modems run firmware to identify
SIP (VoIP Signaling) traffic and open the necessary RTP (VoIP Voice Streams) so as to make VoIP as transparent and painless to the
end user. However older routers will require special port forwards, DMZs or firmware updates. Some NAT implementations can drop the
call after a fixed delay, eg 5m32s. If your ADSL link goes down, it can take a while for your ATA to notice that it has gone. When it
comes back up, there is often a delay of minutes or tens of minutes before the ATA will realise you have a link again. In some cases, the
ATA may never reattempt a connection.
Integrated VoIP/ADSL routers help alleviate many of the above problems. The ATA component sits on a public IP address eliminating
NAT issues, while being intergrated with the ADSL modem, it also knows when your link goes down, immediately switching to the
PSTN. When the link comes back up, it takes a few seconds before the integrated ATA registers and switches outgoing calls back to
VoIP. As there is only one box, there is only one plug pack and the numbers of cables are cut down dramatically. These devices are
becoming quite popular among ADSL users.
This allows you to make use of VoIP call pricing while needing no special hardware or software just a web browser or mobile phone.
Once you enter the two phone numbers into the Web Callback form on the Voxalot webpage, the Voxalot server via your VoIP account dials your
number first. When you pick up this phone, it then dials the second number. When the 2nd party picks up it connects the two calls.
With many VoIP service providers offering untimed calls anywhere in Australia for 10 cents, this service allows anyone with a VoIP account and a web
browser to make calls to any landline in Australia for 20c untimed (The voxalot server makes two outgoing calls using your VoIP account.) Alternatively
you can also make mobile and international calls.
The service offers plenty of flexibility giving you a choice of VoIP provider. The only requirement is your VSP must support two or more concurrent
connections. Otherwise you will need to enter two VoIP accounts One to ring your phone and the other to ring the other party.
This service has endless uses. It is just the thing to establish personal STD calls at work or at your friends place.
Switching from your solid, decades old PSTN landline to VoIP can have its teething problems. It wouldnt be recommended to sign up
and switch the household or business over on the first day. Nor would it be smart to send the shiny new VoIP phone number to the
printers for your business stationary straight away.
You may want to sign up, get the hardware sorted, do a couple of calls and phase the service in over a period of weeks. This gives you
time to make sure your ATA retains its registration to your VSP, so you dont lose dialtone. If you are using a DID, loss of registration will
mean no incoming calls.
The first couple of calls after signup may sound fantastic but it's not to say there are not loading issues with your VSP or ISP that effects
your call quality at 9am on Monday mornings or during other busy periods of the week.
These issues, if any, take a few days to surface and can take even more time to rectify. But there is no doubt when you get any issues
sorted, VoIP provides a continuous good quaility service at a excellent price.
Do I need a DID?
A DID (Direct Inwards Dialing) Phone number is used by users of the PSTN to ring your VoIP service. If you are using VoIP as your
primary phone service (you dont have a landline connected) and want people to be able to ring you, you will need a DID.
A common configuration for ADSL users is to use the PSTN for incoming calls and use VoIP for outgoing calls, taking advantage of the
excellent calling rates. This means you can switch over to VoIP without the need to give anyone your new phone number, as they can
call you on your existing number. In fact, you dont even need a VoIP DID phone number, which is good as DIDs normally attract a
monthly fee.
However note that services without a DID is unable to provide any Caller ID to the receiving party. When you ring someone, Caller ID
will indicate the number is Private. In todays world with the influx of Telemarketers, some recipients may not answer your call when no
valid number is displayed.
Once the ATA registers with your voice service provider, it will periodically send messages back and forth to ensure your ATA hasnt
dropped of the internet and that the VSP knows how to contact your ATA should a incoming call come in. The frequency of these
messages will depend upon the registration time set in your ATA and the replies it gets back from the VSP. Generally this traffic is no
more than a couple of Mbytes a day.
The bandwidth required during a phone call will depend upon the codec your ATA and VSP has negotiated and if you have silence
suppression enabled.
The two commonly used codecs used are G.711A (or G.711U) and G.729. G711 transmits VoIP data uncompressed and provides the
same Voice Quality than the PSTN. With overheads it uses about 87.2Kbps in both directions at the Ethernet layer. During a call, you
are transmitting approximately 87.2Kbps while at the same time receiving 87.2Kbps. This equates to about 39Mbytes a hour of incoming
traffic.
As a comprise between data traffic and quality, the G.729 codec is preferred by many VSP and users alike. It compresses data to
provide a good quality call with a data rate of approximately 31.2Kbps or 14Mbytes a hour.
Fortunately most ISPs only base your download quota on incoming traffic. Before moving to VoIP you will need to work out how many
VoIP minutes you will likely to use in the month and ensure you will have adequate quota on top of your normal data traffic. Once you
have VoIP you will need to monitor your usage to ensure you do not become shaped.
Some VoIP subscribers have used 256/64Kbps services without any issue. Some have even reported successfully international calls
using dialup. So while you may be able to get good call quality while shaped, it is recommended you have at least a 512/128k service.
While substantial savings can be made on local, national and international calls, calls to 13x and mobile phones are often only
marginally cheaper if not very similar to your traditional landline Telco. The reason is normally due to the call termination costs the
carriers charge for these services.
In 2004, the ACCC (Australian Competition and Consumer Commission) determined that the price mobile phone carriers charge for call
termination is at least twice the cost of delivering the service and as a result has put in a plan to regulate the call termination costs. This
plan sees the termination costs fall three cents per minute on the 1st of January each year until it reaches 12 cents per minute in
January 2007.
However while we wait for mobile phone call termination costs to fall, many mobile phone carriers already offer excellent mobile to
mobile call costs, capped calls or monthly plans. You may want to evaluate your mobile phone call charges and decide to make calls to
mobiles on your mobile phone, rather than VoIP.
13x calls attract a similar premium. Some VSP's such as Engin once offered these calls as 10 cents untimed, but has been forced in
recent times to increase the price on these loss making calls to a more sustainable price. For example, Engin currently charge 28 cents
untimed on 13x calls, but only 10 cents untimed to any landline in Australia.
Many businesses offer 13x numbers as a single local call number to customers regardless of what state they are in. However as VoIP
now introduces 10 cent untimed calls to any landline in Australia, you may find it cheaper ringing what was a STD number rather than
the 13x number. Most businesses are only happy to give you a (0x) xxxx xxxx landline number to ring instead of more expensive 13x
numbers. VoIP may one day negate any purpose to have 13x numbers.
High traffic or congestion on your internet link will lead to high latency and high latency is one thing VoIP doesnt like. The most common
result is your conversation will break up very much like when you are on a mobile phone call in a poor reception area. You will only hear
part of a conversation.
The easiest way to overcome this problem is not to download or use your internet connection while on a phone call. This may be easy
when you live by yourself, but become increasingly difficult when several people in your household use the internet and/or phone.
QoS or Quality of Service may be touted as the miracle cure. It can be in certain cases, but not all. QoS can be used to prioritise your
Voice traffic giving it a higher priority than other traffic such as your Web downloads or emails. It normally consists of two parts.
Your router will contain a buffer holding your internet packets that are queued for sending. QoS settings can be applied to your VoIP
traffic, enabling VoIP traffic to be sent first before all other traffic. This works well on your upstream link, as your router decides what it
needs to send first. However your downstream link is controlled by your ISPs router. This router you have no control over and can be
where a problem lies.
IP packet headers have ToS or Type of Service bits which can be set to describe how to best handle the packet (minimize delay,
maximize throughput etc) as it passes through multiple routers on the way to your VSPs servers. This is just like putting an airmail
priority stamp on a letter to ensure it goes by air mail and not on a slow boat to china.
The idea here is routers downstream can read the bits and best determine on a packet by packet basis how to handle the data. You
could set the bits in the header of your voice traffic to give it priority and expedite its movement though the internets routers. With any
luck your VoIP server could send back the packets with the same settings and your ISPs router will prioritise your downstream data.
This makes such a good idea that next week while your are waiting for your web download from the states to compete with everyone
elses traffic on a congested international link, you think what happens if I flag all my traffic as high priority?
For this reason your ISPs routers will only respond the ToS bits of packets coming from trusted routers, typically routers that the ISP or
backbone link provider own. They will certainly not respond to flags your modem or other equipment set. You are untrusted, so as other
network providers. If your ISP uses, for example, Telstra as its backbone provider, Telstra is not going to honor flags your ISP sets,
So the only time any priority will be given to VoIP data on your downlink is when you sign up with a VSP that your ISP runs, i.e. that your
ISP has control of the entire network right up to the VoIP server (e.g. Internodes Nodephone) or when your ISP has a special
arrangement with the VSP to offer QoS - e.g your ISP may be wholesaling VoIP services from a third party.
If, however you dont meet the above two criteria, like most of us, you will have QoS on your upstream traffic but have no control over
what happens on your downstream link. Now is QoS the miracle cure everyone touts it as?
Below is a list of the more common Voice Service Providers offering services in Australia :
Astratel
ATP
BBPGlobal
Broad IP
Broadband Solutions
Clarinet
Delacon
Engin
Faktortel
Freshtel
GoTalk
i-fone (nehos)
Koala Telecom
MyNetFone
MyTel
NodePhone (Internode)
OzTell
PennyTel
Primus "Talk"broadband
Siphone (FreeCall)
SipMe
Sipphone
SpanTalk
TalkScape
ThinkTel
VCall
VoipBuster
http://www.beyondlogic.org/VoIP/ (13 of 15)13/02/2008 16:53:32
An Introduction to VoIP in Australia
Voise
Voxalot
1 FXS Port :
2 FXS Port :
Desk Phones :
http://www.beyondlogic.org/VoIP/ (14 of 15)13/02/2008 16:53:32
An Introduction to VoIP in Australia
Netcomm V85
Sipura SPA-841
D-Link DPH-120S
As the effects of climate change is further debated, a new gold rush is underway in Australia. But his time the search is not for
gold, not copper, or oil, no - not even uranium, but close. This hive of exploration is centered around the search for Hot Rock, or Content
Hot Rock Geothermal
Hot Granite three to five kilometres under the earths surface. Eden Energy
Geodynamics
Geothermal Resources
Harnessing the heat from Hot Dry Rock (HDR) or Hot Fractured Rock (HFR) consists of drilling two or more wells approximately Green Rock Energy
Greenearth Energy
three to five kilometres into the ground. A heat exchanger is then formed by hydraulic stimulation where the temperature of the KUTh Energy
Licences
granites is approximately 250 degree C. Water is then pumped down the injection well, where it is heated by the hot granite and Petratherm
Torrens Energy
returned to the surface via the production well. On the surface, this hot water is converted to electricity using a binary geothermal
Archives
January 2008
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
April 2007
February 2007
March 2006
November 2005
May 2005
Categories
Hot Rock (30)
Geodynamics (4)
Geothermal Resources (1)
Green Rock Energy (1)
Greenearth Energy (1)
KUTh (1)
Osiris Energy (1)
Petratherm (3)
Video 1: How to harness Hot Rock Geothermal Energy Torrens Energy (3)
Victoria (2)
Wave (1)
The technology and concept is not new. The first concept of HDR was developed at Los Alamos in the 1970s and later CETO (1)
demonstrated at the Fenton Hill site. The following EnviroVideo special shows the details of this site. France has the Soultz HDR Links
project which is considered the most advanced HDR geothermal project in the world. In November 2007, they have installed the CETO
Eden Energy Ltd
Geothermal loop and are working on the installation of the power plant.
Geodynamics Ltd
Geothermal Resources Ltd
Green Rock Energy Ltd
Hot Dry Rocks (Consultants)
NEMMCO (Electricity Market)
Origin Energy Ltd
Osiris Energy Pty Ltd
Pacific Hydro
Petratherm Ltd
Scopenergy
Seapower Pacific
Torrens Energy Ltd
HDR geothermal energy uses proven binary power plants and proven drilling techniques used everyday in the mining industry.
Despite the many years of development on HDR overseas, HDR geothermal exploration in Australia was only kick started by South
Australias and New South Wales recognition of HDR/HFR by granting Geothermal Exploration Licences (GELs) and the
Geodynamics, the pioneer of HFR in Australia, is undoubtedly the most advanced being the only company that has tested a
geothermal flow from Hot Fractured Rock. On the days leading up to the 26th of April 2005, Habanero #2 produced over 10MW of
thermal power. The following video from Geodynamics was filmed in the months later and demonstrates the progress
The most is known about the ASX listed companies exploring for Hot Rocks. Here is a list of these listed companies in order of
listing date :
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
What I have done is modified the WDM ISO USB driver distributed with the Windows Device Driver Kit for use with the
Cypress Digital Themometer. I've kept it basically the same, so you can actually run the Digital Temperature
Application on this driver to see that in-fact it does work! I will cop some flap for this, as the driver isn't really a good
example to start with, especially if you know little about WDM Programming, as you will learn some bad habits. I'll point
these out.
As the driver is based on copyright material developed by Microsoft, I will not distribute the entire driver. What I will
attempt to do, is show you the modifications necessary to change the driver so that it works with the Cypress USB
Starter Kit. This hopefully will also give you a better understanding as we work through the example.
The driver is simply the ISO_USB driver featured in the Microsoft DDK with modifications in
IsoUsb_CreateDeviceObject so you can talk to the Kernel Mode Device Driver using "\.\\Thermometer_0". This allows
the Cypress application to talk to the driver, rather than using the GUID which Microsoft uses in their example.
The IOCTL handler has been totally modified to handle calls from the thermometer application which comes with the
Cypress Kit. This allows you to run the Cypress Thermometer Application on this device driver. It includes all the
IOCTL Control Code 4 Functions such as Set LED Brightness, Read Thermometer, Read Port, Write Port, Read RAM,
Write RAM & Read ROM as per the Cypress Starter Kit User Guide(Ver 0.993) Page 48.
O.K., forget the modifications. We will start the handler for the IRP_MJ_DEVICE_CONTROL from scratch. Delete or
rename IOCTLISO.C.
Below is the table of functions we will have to implement. This is simular to the table provided by Cypress for
compatibility.
At first glance, you would expect the Cypress USB MCU to send the temperature using an Interrupt transfer
periodically. After all, the Cypress USB MCU returns an Endpoint Descriptor for EP1 as type equals Interrupt,
Maximum Packet Size of 8 Bytes and an Interrupt Interval of 10mS. The String Descriptor for this Endpoint returns
"Endpoint1 10ms Interrupt Pipe".
At this stage you jump straight to the vector table. The 128us timer is not used, the 1024us timer is, and the endpoint1
interrupt is not used. The Interrupt Service Routine for the 1024us interrupt, simply checks for activity, sets the suspend
accordantly, helps with the button de-bounce. Maybe the 10mS Temperature Interrupt is done in the main loop?
Jumping to the code for the main loop shows we wait for enumeration, Set the Enumeration LED, Read Temperature,
Update Brightness, and Set new Brightness. Maybe it's in the Read Temperature Routine? The Read Temperature
Routine firstly initialises the results, reads the temperature from the DS1620 and stores it in the FIFO for Endpoint 1.
So where is the code for the Interrupt Transfer? Good question, you tell me? (Have I overlooked something?)
Now what if we were to implement a couple of functions. Maybe ReadRAM, WriteRAM? We could then check the
status of the switch by reading a value in RAM. We could read the temperature, provided the temperature was stored
in a RAM Location. Umm, life would be easy. We could change the LED Brightness if we write the brightness to a
location and set the Update Brightness Semaphore!
This is what I believe has been done. Please correct me if I'm mistaken!
IOCTL Codes.
The documentation for the Cypress kit would suggest there is only one valid IO Control Code, IOCTL 4. All driver
functions are called within this IOCTL Code. This is certainly not recommended practice. Microsoft has a macro called
CTL_CODE which is defined in DEVIOCTL.H which is included in the Device Driver Kit.
// Macro definition for defining IOCTL and FSCTL function control codes. Note
// that function codes 0-2047 are reserved for Microsoft Corporation, and
// 2048-4095 are reserved for customers.
//
The two least significant bits (Method) map the buffer transfer type which
determines how the buffer is passed in IOCTL calls. We need to use Method
Buffered, thus both bits must be zero.
#define METHOD_BUFFERED 0
#define METHOD_IN_DIRECT 1
#define METHOD_OUT_DIRECT 2
#define METHOD_NEITHER 3
The function defines which function we wish to call. The Kits has used Function 1, thus generating an IOCTL code of 4.
The Access Type is FILE_ANY_ACCESS (0x00), and the Device Type is Zero. This is not defined in DEVIOCTL.H and
Microsoft has reserved Device Types of 0-32767. We should probably be using something like
FILE_DEVICE_UNKNOWN 0x00000022. Likewise Function Codes codes 0-2047 are reserved for Microsoft
Corporation, and 2048-4095 are reserved for customers.
On top of the IOCTL4, I have added extra IOCTL Calls to all the descriptors, Get the Status, and Send custom
URB_FUNCTION_VENDOR_ENDPOINT Commands, should you wish to later add more Vendor Commands to the
firmware.
Download CypressDrv.zip Source Code and Driver for Cypress USB Starter Kit. Includes IOCTL MAP and PDF
Documentation of IOCTL Calls (42KB)
A special thanks must go to Burkhard Kainka who has found some bugs in the driver and have corrected them
for us. The last compiliation has in fact done by Burkhard.
This driver is still very much in development. The Cypress USB Starter Kit was loaned to me for a duration of
time and I have since given it back. As a result, I cannot test any additional modifications or support this driver in
any way.
Links
Linux device driver for the Cypress Romain Livin has developed a Linux Device Driver for the
Thermometer Cypress Thermometer Kit.
Device Driver Fiddler Writing Device Drivers? Perhaps playing with Cypress
Semiconductor's USB Starter Kit? If so, the Device Driver
Fiddler allows you to test DeviceIOCommand() Calls before
you write your User Mode Application. . .
USB Webboard Ask for Help, or have you say with the USB Webboard.
USB Designer Links Quite a comprehensive page of links to manufacturers and
products. Great starting point to see what is out there.
There is a new urban sport, and Australia is high up on the leader board. The objective - Who can crash the economy first. As
simple as it sounds, when it does happen, there may not be a clear winner. Which is just as well, as for all your hard efforts there Content
Who will crash the economy?
is no prize money, just heartache and tears. Household Debt
Household Savings
House Asset Prices
The Baby Boomers will no doubt say it was Generation Y, or Generation Debt as they are sometimes known. Generation Y will say The Wealth Effect
The effects on the broader economy
it was the Baby Boomers insatiable appetite for housing stock driving up asset prices way beyond fundamentals - or even the The Australian Stock Market
growth of equity release products such as reverse mortgages to free up extra spending money to pump straight into the economy
Archives
for goods and services. February 2008
January 2008
December 2007
The financial regulators will say it was the credit providers lax lending practices - everyone knew lending money to people who
November 2007
cant afford it would end in disaster. Not to mention the endless adverts tempting people with So you can have it now!. The October 2007
September 2007
banks and lenders will blame the mortgage brokers for fudging the figures on those low doc, no doc, whats up doc? loans.
August 2007
July 2007
The politicians and treasurer prior to turning the economys auto pilot switch off will blame the central bank after all they control June 2007
May 2007
interest rates (except in election years) and if that doesnt work, its the 1 in 100 year drought (no, its not climate change).
April 2007
March 2007
Categories
Australian economy (57)
Australian Housing (44)
UK economy (12)
US economy (57)
Links
Chicken Smith
Global House Price Crash
Ozonomics
Steve Keens Oz Debtwatch
http://www.whocrashedtheeconomy.com/13/02/2008 16:54:04
interfacing : Interfacing the PC
Yahoo!
My Yahoo!
Mail
Make Y! your home page
Tech -
Groups -
Blog -
Help
and nominate Re: Help in interfacing using VB6 Miroy, Roger (UK)
your group. Peter, Suggest you go to http://www.altavista.com Advanced search roger.miroy@...
and type / copy "jan axelson parallel port". You should get lots : Roger Send Email
in
Posted - Mon Oct 1, 2007 8:45 am
Help in interfacing using VB6 Peter Williams A. Men...
im Peter from the Philippines... School is at Technological Institute of weephweeph15
the Philippines can anybody help me in interfacing using parallel port Offline
using visual Send Email
Posted - Mon Oct 1, 2007 8:19 am
Add interfacing to your personalized My Yahoo! page What's This?
Message History
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2007 13 32 6 33 10 21 13 12 3 1 1
2006 68 75 82 36 44 36 48 45 33 21 31 17
2005 93 69 79 79 99 78 88 63 54 77 42 70
2004 159 197 115 61 58 101 69 106 89 69 68 81
2003 156 133 175 169 123 120 102 108 118 167 154 165
2002 122 159 200 202 217 136 286 91 93 102 122 155
2000 235 353 293 254 182 123 151 112 153 181 130 204
SPONSOR RESULTS
Windows Filesystem/Device Driver Design
www.kerneldrivers.com - Kernel Drivers designs device drivers for Windows platforms. Device
driver to control hardware, custom filesystems and filter drivers.
Copyright
2008
Yahoo!
Inc. All
rights
reserved.
Privacy
Policy -
Copyright/
IP Policy
- Terms
of Service
-
Guidelines
- Help
Universal Serial Bus Embedded Internet Legacy Ports Device Drivers Miscellaneous
The following example is a kernel mode driver which displays kernel debug messages when an interrupt is
generated on the Parallel Port. The ISR queues a DPC (Deferred Procedure Call). The source and makefiles can
be downloaded here
/******************************************************************/
/* Example NT/2000/XP Interrupt & DPC Driver */
/* Copyright 2001 Craig Peacock, Craig.Peacock@beyondlogic.org */
/* See http://www.beyondlogic.org for a complete description */
/* Last Updated 11th November 2001 */
/******************************************************************/
#include <ntddk.h>