FIGURE 11. PC to
Analog data demo.
FIGURE 13. Rotary ProcessIO.
up diagram is provided in Figure 4 that shows how to
connect the Mini-Kit to the Experimenter. Let’s get started.
PS/2 Keyboard to USB Demo
This demo uses the PS/2 keyboard as a data source. It
uses the Mini-Kit that is connected to the Experimenter.
Data typed on PS/2 keyboard is displayed simultaneously
on both the Experimenter LCD, as well as the PC terminal.
48 February 2012
Open EXP32KeyboardLCD.mcp in the keyboard demo
example code folder. Build and download code using the
Microchip IDE and PICKIT3 debugger/programmer or
equivalent. Both an include file and driver code designated
PS2T4 for the keyboard driver are contained in the project
workspace. The ProcessIO() function in Main is as follows:
The ProcessIO blinks the Experimenter LEDs based on
the USB connection status. It then determines if the USB
is connected to a PC before proceeding. If connected, it
checks the USB transmitted status; if the transmit is ready,
it retrieves a key and sends it out over USB using API
putsUSBUART(). As a side note, before transmitting, it calls
USBUSARTis Tx TrFReady(). The key is also displayed on the
LCD display. Before exiting, the CDCTxService() function is
called to initiate a transmit service. As another side note, the
getcKBD() function (to retrieve a keyboard key c) was originally
written as a blocking function and had to be rewritten to
incorporate a state machine structure for proper USB operation.
PC to Experimenter
USB Display Demo
This demo simply displays characters received from
the PC over USB by the Experimenter and displays them
on the LCD display. The workspace is included in the
terminal demo folder. Open EXP32HyperterminalLCD.mcs,
then build and download to the Experimenter. The
ProcessIO() is as follows: The ProcessIO() checks if the
USB transmitter is ready and if so, reads the USB buffer
through API getsUSBUSART() and then echoes back the
received character through a Transmit API putsUSBUART(),
as well as writes to the Experimenter display.
Analog Sensor Data
USB Transfer Demo
This demo uses a 10K pot tied between + 3. 3 VDC and
GND with a pot wiper connected to analog input 4 or AN4
of the PIC32, or pin 8 of the Experimenter JP2 connector.
For power to the pot, it uses the externally available + 3.3V
output at pin 10 of the BOT Experimenter connector and
GND output from pin 9 of BOT. The pot value is digitized via
the Experimenter ADC and then reported in ASCII format to
the PC over USB on demand. The demand in this case occurs
when SW1 pushbutton of the Experimenter is depressed.
This analog demo utilizes the following ADC library which
is included in ADC.h and ADC.C in the demo workspace:
• int readADC(int ANpin) — Perform ADC operation on
designated pin and return digitalized result.
• initADC(int ANpin) — Initialize ADC operation using
designated pin as the analog input.
• ADCoff(void) — Turn off ADC peripheral.
The workspace is included in the analog demo folder.
Open EXP32ADC.mcs, then build and download to the
Experimenter. The ProcessIO() is as follows: In this example, we