One of the main hurdles we were facing implementing this system was finding a way to store enough data on the PIC. We ordered the larger PIC18F2550 microcontrollers, but were encountering the same issues declaring space on the PIC for large arrays even when configured for the 18F2550. In the end though, we were able to pre-allocate space on the PIC for the large matrices we were using in two general purpose registers thanks to advice obtained from Sam Sun over the summer. For the benefit of future PoE teams, this translates to simply:

#pragma idata BVALS = 0x200

unsigned char vals3D_B[4][60] = {{0}, {0}, {0}, {0}};

#pragma idata CVALS = 0x500

unsigned char vals3D_C[4][60] = {{0}, {0}, {0}, {0}};

#pragma idata

The first and third lines denote where to start using PIC memory; for instance, the first line says that you will be using PIC memory corresponding to general purpose register 2, which begins at 0x200 (this can be verified with the 18F2550 linker script); “BVALS” is an arbitrary name to assign to the space. After that, you can start to declare your matrix or array (up to 255 entries). Make sure that you initialize the matrix or array (i.e.: to zero in this case); otherwise, this takes up too much space.

There were a few other alterations to the firmware, namely in implementing the delays necessary to achieve persistence of vision. In order to create a 3D system, we needed to spin a 2D plane of LEDs. Because a single PIC microcontroller does not have enough digital output pins to directly control the 40 LEDs we used, we created this planar image by scanning through each of the four posts quickly enough to appear like a constant image, requiring only fourteen pins on the PIC to be connected. Implementing the delay between adjacent frames of an image is also different in the 3D system–because the four concentric LED posts travel different distances within the same amount of time as the display spins, each post requires a different delay time. As a result, while the 2D system automatically implements this delay after  clearing all of the pins, blank spaces between pixels on the 3D system must be drawn in with the user-supplied image. As previously mentioned, there is a lot that could be improved with the user interface for this new system.

Advertisements