PHOTO 4. The screw terminal legend
pretty much tells the story behind this break-away portion of the eM8. The legend for the
well versed in both by the time we finish the
eM8 assembler-to-C port. Who knows, you
might even find a robotic application for the
eM8.
Duplicate the
Definitions
To be successful, we must pay attention
to detail and take whatever clues about the
code and hardware we can get. At the very
top of the source code, Sam has provided
what I call a definition schematic:
; Processor Pin Assignments
; ———————\/———————
; MCLR -|1 MCLR 28 |- ISPDAT
; AN1 -|2 AN0 27 |- ISPCLK
; AN2 -|3 AN1 RB5/nT1G 26 |- IO8
; AN3 -|4 AN2/Vref- B4/P1D 25 |- IO7
; AN4 -|5 AN3/Vref+ RB3/AN9 24 |- IO6
; IO1 -|6 RA4 RB2 23 |- IO5
; IO2 -|7 RA5 RB1 22 |- SO_SEL—-
; GND -|8 Vss RB0/INT 21 |- INT_IO
RB0
; IO3 -|9 RA7 Vdd 20 |- +5V
; IO4 -|10 RA6 Vss 19 |- GND
; <> SO0 -|11 RC0 RC7/RX 18 |- RX
; <> SO1 -|12 RC1 RC6/TX 17 |- TX
; <> SO2 -|13 RC2 RC5 16 |- SO3 <>
; SCL -|14 RC3/SCL RC4/SDA 15 |- SDA
; ——————————————
The eM8 original fuse configuration is easily duplicated
by employing the services of the CCS C compiler Project
Wizard. All we have to do to port the fuse settings is
specify identical configuration fuse definitions. Here’s the
CCS C compiler version of the fuse configuration:
#include <16F882.h>
#device ICD=TRUE
#device adc=8
#FUSES NOWDT
#FUSES INTRC_IO
#FUSES PUT
#FUSES MCLR
#FUSES NOPROTECT
Sam’s assembler equates are associated with the
PIC16F882’s actual I/O pin layout. The comments that
follow the definition schematic tell us that the PIC16F882 is
running on its 8 MHz internal oscillator. We are also told
that TIMER 0 is used as the system timer and is running at
1 kHz. Here’s the rest of the configuration story as told by
the assembler code:
#FUSES NOCPD
#FUSES NOBROWNOUT
#FUSES NOIESO
#FUSES NOFCMEN
#FUSES NOLVP
__CONFIG _CONFIG1, _LVP_OFF &
_FCMEN_OFF &
_IESO_OFF &
_BOR_OFF &
_CPD_OFF &
_CP_OFF &
_MCLRE_ON &
_PWRTE_ON &
_WDT_OFF &
_INTRC_OSC_NOCLKOUT
#FUSES NODEBUG
#FUSES BORV40
#FUSES NOWRT
//No Watch Dog Timer
//Internal RC Osc, no
//CLKOUT
//Power Up Timer
//Master Clear pin enabled
//Code not protected from
//reading
//No EE protection
//No brownout reset
//Internal External Switch
//Over mode disabled
//Fail-safe clock monitor
//disabled
//No low voltage prgming,
//B3(PIC16) or B5(PIC18)
//used for I/O
//No Debug mode for ICD
//Brownout reset at 4.0V
//Program memory not write
//protected
#use delay(clock=8000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,
rcv=PIN_C7,bits=8)
__CONFIG _CONFIG2, _WRT_OFF &
_BOR40V
PHOTO 5. From left to right: the ICSP
programming/debugging adapter, the
Microchip MCP9701A temperature sensor,
and the OMRON G6K relay board.
SERVO 11.2010 53