Hi Jacob
Thank you for the information. It appears you are using the Intrusion sample apps.
Here are the modifications to show the direction on the console.
Modifications:
Under Application Variable Declarations
Add the following line:
| Code: |
unsigned char cDirection; //Motion detection direction
|
In main() function, Find the code (close to the end):
| Code: |
TxQueue(' ');
TxCharAsDecimal(TxMotionCount); // Send out the count of detections
TxString(" @ ");
TxIntAsDecimal(TxSecondCount); // Send out the time stamp
|
Insert the following:
| Code: |
TxString(" D: ");
TxCharAsDecimal(cDirection);
|
In the interrupt isrTimer0() function,
Find the code:
| Code: |
///////////////////////////////////////////////////////////
// Check for motion detected and update the output as needed
///////////////////////////////////////////////////////////
else if((ePIR_SC0 & SC0_MOTION_DETECTED) && !cMDCheck) // If the engine indicates a motion event
{
LED_ON; // Turn on the LED Output port (turned off in T0 int)
|
Add the following code:
| Code: |
cDirection = ((ePIR_SCO & SC0_MOTION_DIRECTION) ? 1 : 0);
|
When the application runs, you should now see a direction indicator (D:)
Let me know how it goes.