Operations and setup

Specifications on PIC24FJ256GA110 100 pin-out

Figure 12.1 � Pin-out specificationson 100 pin package of the PIC24FJ256GA110 μProcessor. PIC24 Datasheet � page 6. http://ww1.microchip.com/downloads/en/DeviceDoc/39905e.pdf

 

 

Pins used:

         A/D Input Pins: AN0-AN11 � 25, 24, 23, 22, 21, 20, 26, 27, 32, 33, 34, 35

         UART Pins: RP10 (U2RX), RP17 (U2TX) � 49,50

         A/D Reference Pins: VREF-, VREF+ � 28, 29


 

Serial Communications Setup

Communications between the Hong Kong PIC24 Board and a computer running terminal requires the following settings and wiring.

 

Terminal 1.9b Settings:

1.       Baud rate: 28800

2.       Data bits: 8

3.       Parity: None

4.       Stop bits: 1

5.       Handshaking: None

 

Figure 12.2 � Screenshot of Terminal program settings.

 

Cabling wiring:

 

Wiring between a computer and the PIC24 is typically done with a DB9F to DB9M straight through cable. The minimum wiring required is the following

 

DB9F Pin

Pin Name

DB9M Pin

2

Receive (RX)

2

3

Transmit (TX)

3

5

Ground

5

7

Request to Send (RTS)

7

8

Clear to Send (CTS)

8

 

Figure 12.3 � Example of DB9F to DB9M serial cable.

 

Compiler Setup

The compiler used within the MPLab X IDE was the C30 compiler from Microchip, which is based on the standard Linux gcc compiler.

 

The directory structure used in developing this project used the following format:

Directory

Description

C:\cclass\

Base directory for C programming project files.

C:\cclass\headers\

Base directory for SSEL developed include files used by projects.

C:\cclass\imu-2011-xx-xx\

Project directories with Year/Month/Day in the name to differentiate between various milestones while developing the project. (Ie. Imu-2011-12-12)

 

The directory structure used within the project:

Project Sub-directories

Description

\

main.c and various files during debugging phase.

\headers\

Header include files for the project.

\drivers\

Driver files for the project.

 

The settings required for the program to compile when setting up the project for the C30/gcc compiler:

 

Include Directories for Project

C:\cclass\imu-2011-xx-xx\headers\

C:\cclass\headers\drivers\

C:\cclass\headers\modules\

C:\cclass\headers\os\

C:\cclass\headers\pic24\

 

Compiler Directive

Description

-std=c99

Allows for newer gcc C compiler functionality

 

 

Figure 12.4 � Screenshot showing some of the compiler settings required by this project.

 

 

Serial Command Formats to Send to the PIC24F

The following commands have been designed for controlling the IMU μProcessor:

 

Command

Description

MM00NN

Switch System into pre-launch mode (default startup).

MM11NN

Switch System into data acquisition mode (automatic when launch detected).

MM22NN

Switch System into command mode for data retrieval operations

FF00GG

Turn on output during data acquisition of ASCII formatted output for debugging purposes.

FF11GG

Turn on output during data acquisition of Hexadecimal formatted output for debugging purposes.

FF22GG

Turn on output during data acquisition of Binary formatted output for debugging purposes.

FFxxGG

Turn off output during data acquisition (default).

DDxxxxxxxxEE

Request data using retrieval using two 32-bit long integers.