Search:

Return to previous page

Contents of file 'main.c':



    1   /*=============================================================================
    2    * File:        main.c
    3    * Summary:     The main() routine here merely illustrates the usage of the
    4    *              dogm16x display driver for the Microchip PIC32 family of
    5    *              microcontrollers. See dogm16x.c for details on the driver
    6    *              routines.
    7    * Created:     September 12, 2010 [v.1.0]
    8    * Last change: September 12, 2010 [v.1.0]
    9    * Author:      Fredrik Jonsson <http://jonsson.eu/>
   10    *
   11    * Copyright (C) 2010, Fredrik Jonsson <http://jonsson.eu/>
   12    * Non-commercial copying welcome.
   13    *===========================================================================*/
   14   #include <stdio.h>    /* To access sprintf() in the driver example */
   15   #include <math.h>     /* To access sin() in the driver example     */
   16   #include "dogm16x.h"
   17   
   18   int main(void)
   19   {
   20      char buf[128];
   21      float x=0.4711;
   22   
   23      initialize_display();
   24      clear_display();
   25      write_string_to_display("Hello World!\n");  /* 1st row of display */
   26      sprintf(buf,"sin(%f)=%f\n",x,sin(x));
   27      write_string_to_display(buf);               /* 2nd row of display */
   28      while(1);                                   /* Infinite loop      */
   29   }
   30   

Return to previous page

Generated by ::viewsrc::

Last modified Wednesday 15 Feb 2023