#FUSES RTCOSC_T1
//RTCC uses Secondary Oscillator as reference
//source
#FUSES NODSBOR
//BOR disabled in Deep Sleep
#FUSES NODSWDT
//Deep Sleep Watchdog Timer disabled
#FUSES DSWDT2147483648
//DSWDT uses 1:2147483648 Postscale
#FUSES IOL1WAY
//Allows only one reconfiguration of
//peripheral pins
#FUSES ADC10
//ADC is 10-bits
#FUSES MSSPMSK7
//MSSP uses 7 bit Masking mode
#FUSES WPFP
//Write/Erase Protect Page Start/End Location
#FUSES NOWPCFG
//Configuration Words page is not
//erase/write-protected
#FUSES WPDIS
//All Flash memory may be erased or written
#FUSES WPEND
//Flash pages WPFP to Configuration Words
//page protected
PmodUSBUART combination to a PC USB port and kick
off your favorite terminal emulator. I’ve provided the C
source code for download at the article link, so all you
have to do is compile the code and load it into your
version of the PIC18F27J13-based hardware described in
this text.
Connecting to the Moray
You can download the Moray schematic from the
Ackme website (https://ack.me). You will see that all you
really have to do is bypass the Moray’s USB portal. You
can power the Moray with an external + 5 volt power
supply if you decide to tap in before the Moray’s onboard
voltage regulator. You will only need a + 3. 3 volt supply if
you bypass the regulator all together. The Moray’s UART
Rx and Tx signals are available at the Moray’s male I/O
header.
#device ICD=TRUE
#use delay(internal=8000000)
#use FIXED_IO( A_outputs=PIN_A2 )
#define user_led PIN_A2
The Moray technical documentation describes in
detail the commands and responses that pass over the
serial connection. You can emulate the sequences by
sending them to the PIC18F27J13 using the terminal
emulator. The CCS C compiler IDE debugger allows you
to peek into the PIC18F27J13’s EUSART receive ring
buffer and examine the Moray’s responses.
#use rs232(baud=115200,parity=N,xmit=PIN_C6,rcv=
PIN_C7,bits=8,stream=MORAY)
Thanks to the CCS compiler and a PIC18F27J13, you
can now add embedded Wi-Fi to your Design Cycle. NV
Following the inclusion of the PIC hardware definition
file 18F27J13.h, all of the fuse settings we selected and the
default fuse settings are exposed to the compiler. Recall
that we opted to have a means of debugging the code,
which resulted in the #device ICD=TRUE directive. You
can also see the obvious declarations alluding to the delay
functions’ time base, the LED I/O pin, and the LED alias,
respectively. The final line of code in the main.h file sets
up the PIC18F27J13’s EUSART with a CCS compiler #use
rs232 directive. All of the directive code that follows the
fuse declarations replaces code we would normally write
to set up the CPU clock and LED I/O pin.
We machine it
and ship to you a
professionally finished product,
no minimum quantity required
The Convenient All-in-One Solution
for Custom-Designed Front Panels & Enclosures
FREE
Software
ONLY $90.24
with custom
logo engraving
To-Dos No More
You design it
to your specifications using
our FREE CAD software,
Front Panel Designer
I’ve filled in the blanks. The receive interrupt skeleton
generated by the Project Wizard has been populated with
a nifty serial receive interrupt handler that feeds a 256-
byte circular buffer. I’ve also written a function called
recvchar that pulls characters out of the circular buffer in
the order in which they arrive. There’s also a routine to
check for characters in the circular buffer that are yet to
be retrieved. The main application blinks the activity LED
every 100 mS and looks for incoming characters. All
incoming characters are echoed back to the sender.
;;;;; ; Cost effective prototypes and production
runs with no setup charges
;;;;; Powder-coated and anodized finishes in
various colors
;;;;; Select from aluminum, acrylic or provide
your own material
;;;;Standard lead time in 5 days or express
manufacturing in 3 or 1 days
So, all you have to do is hook up the PIC18F27J13/
March 2015 77
FrontPanelExpress.com
1(800)FPE-9060