Tuesday, 12 November 2013

lcd main fuction for beaglebone black

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <time.h>

#include "beagle_gpio.h"
#include "beagle_hd44780.h"

/**
 *  @brief     This program (example_04.c) describes how to interface with a
 *             HD44780 display in a BeagleBone
 *  @details   Compile, and run, this code on the beagleBone terminal with the
 *             commands:
 *   rm -f a.out ; gcc -c beagle_gpio.c ; gcc -c beagle_hd44780.c ; gcc beagle_gpio.o beagle_hd44780.o example_04.c ; ./a.out
modified by abhishek gowda
 * @return Returns a 1 upon succesful program termination
 **/

int main()
{
int i=0;
//specifies the pins that will be used
int selectedPins[]={P8_14,P8_12,P8_11,P9_15,P9_13,P9_12};
   

    system("./build.sh");
printf("done\n");
//adding a simple description for each pin
const char *pinDescription[] = {"DB7","DB6","DB5","DB4","RS","E"};

struct gpioID enabled_gpio[6];  

    initialize_Screen(enabled_gpio,selectedPins);
    //enableBlinkingCursor(enabled_gpio);
//clear screen
clear_Screen(enabled_gpio);
    //printf("hello\n");
for(i=0; i<=4;i++)
{
//types "hi!" to the screen
stringToScreen("hi BBB",enabled_gpio);
sleep(1);
clear_Screen(enabled_gpio);
}
//go to the bottom line and write something else
//note: goto_ScreenLine(0,enabled_gpio) will go to the top line.
//goto_ScreenLine(1,enabled_gpio);
//stringToScreen("there!",enabled_gpio);

//really... don't forget to terminate the screen
clear_Screen(enabled_gpio);
    terminate_Screen(enabled_gpio,selectedPins);

return 1;
}

No comments:

Post a Comment