THE DESIGN CYCLE
Screenshot 3 tells the story. The alternate Flash drive
worked. The reset operation caused the version to be
displayed, followed by an on-line indication. Next, you
can see the sync characters being acknowledged. The
carriage return that I issued after the sync() function call
forced the NO Disk message.
Here's where I sucked it up and issued a real VDIP2
monitor command. The firmware version of the VNC1L
is returned when the character set FWV followed by a
carriage return is issued to the VDIP2's monitor. The
version information begins with the characters MAIN in
Screenshot 3. Note that a prompt is issued even though
a Flash drive was not mounted.
ONE MORE HURDLE
Everything has worked as designed up to this point.
However, we have one more test to perform before
moving on to put the rest of the meat into the API.
Here's the code we'll execute:
//*MAIN MAIN MAIN MAIN MAIN
void main() {
init();
cleaner();
vreset();
sync();
sendchar(0x0D);
do{
++sync_loops;
}while(1);
}
■ SCREENSHOT 4. Our VDIP2 and PIC18LF2620 are playing
nicely together. Now that I've found a compatible Flash
drive, we can move on to complete the API coding task.
Detected P2 message was sent when I mounted the Flash
drive. The No Upgrade monitor
message is telling us that the upgrade file (FTRFB.FTD)
was not found in the root directory of the newly
mounted Flash drive. Most importantly, the D:\> prompt
indicates that the Flash drive I mounted is read/write
compatible with the VDIP2. Welcome to Flash
Drive City!
DOWNLOAD YOUR COPY OF
THE API CODE
You have witnessed what it takes to issue a
command. Therefore, you won't have any problems
deciphering the C source in the download package
that makes up the VDIP2 API. I've written the VDIP2
API to include Disk Commands, Monitor Configuration
Commands, and I/O Commands. I've also included a
example file read/write application in the download
package.
Using the VDIP2 API coupled with the VDIP2
hardware interface we've designed and built, you should
have no problems including USB Flash drives in your
Design Cycle. NV
I'll run the code without
mounting a Flash drive. Once the
VDIP2 indicates that it is initialized
and synced (the on-board VDIP2
LEDs stop flashing and extinguish),
I'll mount a Flash drive. Follow along
referencing Screenshot 4 and let's
see if we're ready to start reading
and writing to the Flash drive.
All of the monitor messages up
through No Disk in Screenshot 4
were issued immediately after
power-up with no Flash drive
mounted. The monitor message
Device Detected P2 says that a
Flash drive was detected on USB
Port 2. This is good as the Device
NEW! HIDmaker FS for Full Speed FLASH PIC18F4550
Creates complete PC and Peripheral
programs that talk to each other over
USB. Ready to compile and run!
• Large data Reports
• 64,000 bytes/sec per Interface
• Easily creates devices with multiple
Interfaces, even multiple Identities!
• Automatically does MULTITASKING
• Makes standard or special USB HID
devices
NEW! “Developers Guide for USB HID
Peripherals” shows you how to make
devices for special requirements.
Both PC and Peripheral programs
understand your data items (even odd
sized ones), and give you convenient
variables to handle them.
PIC18F Compilers: PICBASIC Pro,
MPASM, C18, Hi-Tech C.
PIC16C Compilers: PICBASIC Pro,
MPASM, Hi-Tech C, CCS C.
PC Compilers: Delphi, C++ Builder,
Visual Basic 6.
HIDmaker FS Combo: Only $599.95
DOWNLOAD the HIDmaker FS Test Drive today!
www.TraceSystemsInc.com
301-262-0300
January 2009 79