User manual

DSM tutorials
unsigned 4 Count1;
unsigned 4 Count2;
unsigned 4 Count3;
signal <unsigned 4> CountSig;
while (1)
{
/*
* Increment up to 15, then wrap round to 0
*/
Count1++;
par
{
CountSig = Count1 * 2; /* Assign value to the signal, */
Count2 = CountSig; /* use the value from the signal */
Count3 = CountSig + 1; /* and use it again here */
}
/*
* Write Count2 and Count3 to display
*/
PalSevenSegWriteDigit (PalSevenSegCT (0), Count2, 0);
PalSevenSegWriteDigit (PalSevenSegCT (1), Count3, 0);
}
4.2 Creating a device driver
The handel-C source code for the driver should be in a separate .hcc file, with a .hch header file
containing prototypes for the API. These files can then be used directly in a project, or compiled into a
library. By doing this the header and source file can be included directly in projects during their
development, and later the Handel-C file can be linked into a PSL library, and the prototypes for the
macros pasted into the PSL library header.
4.2.1 Example device driver: seven-segment display
The TutorialSevenSeg1 workspace contains a library project with the code for a seven-segment driver, with
the interface pins set up for the Celoxica RC200 board. There is also an example project using the
library, again set up for the RC200. The workspace can be opened by selecting
Start>Programs>Celoxica>Platform Developer's Kit>Tutorials>TutorialSevenSeg1.
The driver provides control of the display state. It is possible to write a raw shape to the display, or a digit
which will be interpreted by the driver to display the correct shape.
www.celoxica.com
Page 53