7 segment LED function debugging notes

// ***********************************************************************
// display7SegLed031.h
// ***********************************************************************

#include "config031.h"
#include "delay031.h"
#include "gpio032.h"

// ***********************************************************************
// 7 segment LED functions
// ***********************************************************************

// ***********************************************************************
// Function -
// Input    -
// Output   -
// ***********************************************************************

void displayOneDigit(portPinArrayPointerArray sevenSegmentPortPinArrayPointerArray, \
int digitNumber, int onTime, int offTime, int blinkCount)
{
int count = 0;

portPinArray *portPinArrayPointerClock;
portPinArray *portPinArrayPointerData;
portPinArray *portPinArrayPointerLatch;

portPinArrayPointerClock = sevenSegmentPortPinArrayPointerArray[SCLK_INDEX];
portPinArrayPointerData  = sevenSegmentPortPinArrayPointerArray[DIN_INDEX];
portPinArrayPointerLatch = sevenSegmentPortPinArrayPointerArray[LATCH_INDEX];

// setGpioDataPinHigh01(portPinArrayPointerClock); // debugging p1.8
// setGpioDataPinHigh01(portPinArrayPointerData);  // debugging p1.9
// setGpioDataPinHigh01(portPinArrayPointerLatch); // debugging p1.10
// setGpioDataPinLow01(portPinArrayPointerClock);  // debugging p1.8
// setGpioDataPinLow01(portPinArrayPointerData);   // debugging p1.9
// setGpioDataPinLow01(portPinArrayPointerLatch);  // debugging p1.10

// Latch low before shifting in 8 segment data bits
setGpioDataPinLow01(portPinArrayPointerLatch);

// Clock low before sending high clock pulse
setGpioDataPinLow01(portPinArrayPointerClock);

// Now shifting in 8 segment data signals, each followed by a clock pulse

setGpioDataPinHigh01(portPinArrayPointerData);
setGpioDataPinHigh01(portPinArrayPointerClock);
setGpioDataPinLow01(portPinArrayPointerClock);

setGpioDataPinLow01(portPinArrayPointerData);
setGpioDataPinHigh01(portPinArrayPointerClock);
setGpioDataPinLow01(portPinArrayPointerClock);

setGpioDataPinHigh01(portPinArrayPointerData);
setGpioDataPinHigh01(portPinArrayPointerClock);
setGpioDataPinLow01(portPinArrayPointerClock);

setGpioDataPinLow01(portPinArrayPointerData);
setGpioDataPinHigh01(portPinArrayPointerClock);
setGpioDataPinLow01(portPinArrayPointerClock);

setGpioDataPinHigh01(portPinArrayPointerData);
setGpioDataPinHigh01(portPinArrayPointerClock);
setGpioDataPinLow01(portPinArrayPointerClock);

setGpioDataPinLow01(portPinArrayPointerData);
setGpioDataPinHigh01(portPinArrayPointerClock);
setGpioDataPinLow01(portPinArrayPointerClock);

setGpioDataPinHigh01(portPinArrayPointerData);
setGpioDataPinHigh01(portPinArrayPointerClock);
setGpioDataPinLow01(portPinArrayPointerClock);

setGpioDataPinLow01(portPinArrayPointerData);
setGpioDataPinHigh01(portPinArrayPointerClock);
setGpioDataPinLow01(portPinArrayPointerClock);

// Latch high to transfer 8 segment data bits to parallel register
setGpioDataPinHigh01(portPinArrayPointerLatch);
}

// ***********************************************************************
// Function - Display all digits
// Input    -
// Output   -
// ***********************************************************************
// ***********************************************************************
// WhutBoardSevenSegmentLedPortPinArraySclk
// ***********************************************************************

// #define SCLK_INDEX 0
// #define DIN_INDEX 1
// #define LATCH_INDEX 2

// portPinArray WhutBoardSevenSegmentLedPortPinArraySclk  = {PORT2, PIN1}; // Serial Clock
// portPinArray WhutBoardSevenSegmentLedPortPinArrayDin   = {PORT2, PIN3}; // Data in
// portPinArray WhutBoardSevenSegmentLedPortPinArrayLatch = {PORT2, PIN0}; // Latch

// #define MAX_7_SEG_LED_PIN_NUMBER 3

// portPinArrayPointerArray \
WhutBoardSevenSegmentLedPortPinArrayPointerArray[MAX_7_SEG_LED_PIN_NUMBER] = \
{&WhutBoardSevenSegmentLedPortPinArraySclk, \
&WhutBoardSevenSegmentLedPortPinArrayDin, \
&WhutBoardSevenSegmentLedPortPinArrayLatch};

void displayAllDigits(int onTime, int offTime, int repeatCount)
{
int digitNumber;

initializeAllOutputPins(WhutBoardSevenSegmentLedPortPinArrayPointerArray, \
MAX_7_SEG_LED_PIN_NUMBER);

   for (digitNumber = 0; digitNumber < 10; digitNumber++)
    {
    displayOneDigit(WhutBoardSevenSegmentLedPortPinArrayPointerArray, digitNumber, \
    onTime, offTime, repeatCount);
    }
}

// ***********************************************************************
// End
// ***********************************************************************

No comments:

Post a Comment