View the step-by-step solution to:

Question

Hi,

I am working on dsp c5515 using CCS 6.1.0 which i started a week back

Could someone help me on

what's happening in the code?

Sorry its a big code to explain though.


thanks in advance

/* * Copyright 2010 by Spectrum Digital Incorporated. * All rights reserved. Property of Spectrum Digital Incorporated. */ /* * OSD9616 OLED Test * */ #include"usbstk5515.h" #include"usbstk5515_i2c.h" #include"usbstk5515_gpio.h" #include"lcd.h" #define OSD9616_I2C_ADDR 0x3C // OSD9616 I2C address /* ------------------------------------------------------------------------ * * * * Int16 OSD9616_send( Uint16 comdat, Uint16 data ) * * * * Sends 2 bytes of data to the OSD9616 * * * * ------------------------------------------------------------------------ */ Int16 OSD9616_send( Uint16 comdat, Uint16 data ) { Uint8 cmd[2]; cmd[0] = comdat & 0x00FF; // Specifies whether data is Command or Data cmd[1] = data; // Command / Data return USBSTK5515_I2C_write( OSD9616_I2C_ADDR, cmd, 2 ); } /* ------------------------------------------------------------------------ * * * * Int16 OSD9616_multiSend( Uint16 comdat, Uint16 data ) * * * * Sends multiple bytes of data to the OSD9616 * * * * ------------------------------------------------------------------------ */ Int16 OSD9616_multiSend( Uint8* data, Uint16 len ) { Uint16 x; Uint8 cmd[10]; for(x=0;x<len;x++) // Command / Data { cmd[x] = data[x]; } return USBSTK5515_I2C_write( OSD9616_I2C_ADDR, cmd, len ); } /* ------------------------------------------------------------------------ * * * * Int16 printLetter(Uint16 l1,Uint16 l2,Uint16 l3,Uint16 l4) * * * * Send 4 bytes representing a Character * * * * ------------------------------------------------------------------------ */ Int16 printLetter(Uint16 l1,Uint16 l2,Uint16 l3,Uint16 l4) { OSD9616_send(0x40,l1); OSD9616_send(0x40,l2); OSD9616_send(0x40,l3); OSD9616_send(0x40,l4);
Background image of page 1
OSD9616_send(0x40,0x00); return 0; } /* ------------------------------------------------------------------------ * * * * Int16 oled_test() * * * * Testing function for the OSD9616 display * * * * ------------------------------------------------------------------------ */ Int16 oled_test() { Int16 i; Uint8 cmd[10]; // For multibyte commands /* Initialize I2C */ USBSTK5515_I2C_init( ); /* Initialize LCD power */ USBSTK5515_GPIO_setDirection( 12, 1 ); // Output USBSTK5515_GPIO_setOutput( 12, 1 ); // Enable 13V /* Initialize OSD9616 display */ OSD9616_send(0x00,0x00); // Set low column address OSD9616_send(0x00,0x10); // Set high column address OSD9616_send(0x00,0x40); // Set start line address cmd[0] = 0x00 & 0x00FF; // Set contrast control register cmd[1] = 0x81; cmd[2] = 0x7f; USBSTK5515_I2C_write( OSD9616_I2C_ADDR, cmd, 3 ); OSD9616_send(0x00,0xa1); // Set segment re-map 95 to 0 OSD9616_send(0x00,0xa6); // Set normal display cmd[0] = 0x00 & 0x00FF; // Set multiplex ratio(1 to 16) cmd[1] = 0xa8; cmd[2] = 0x0f; USBSTK5515_I2C_write( OSD9616_I2C_ADDR, cmd, 3 ); OSD9616_send(0x00,0xd3); // Set display offset OSD9616_send(0x00,0x00); // Not offset OSD9616_send(0x00,0xd5); // Set display clock divide ratio/oscillator frequency OSD9616_send(0x00,0xf0); // Set divide ratio cmd[0] = 0x00 & 0x00FF; // Set pre-charge period cmd[1] = 0xd9; cmd[2] = 0x22; USBSTK5515_I2C_write( OSD9616_I2C_ADDR, cmd, 3 ); cmd[0] = 0x00 & 0x00FF; // Set com pins hardware configuration cmd[1] = 0xda; cmd[2] = 0x02; USBSTK5515_I2C_write( OSD9616_I2C_ADDR, cmd, 3 ); OSD9616_send(0x00,0xdb); // Set vcomh OSD9616_send(0x00,0x49); // 0.83*vref cmd[0] = 0x00 & 0x00FF; //--set DC-DC enable cmd[1] = 0x8d; cmd[2] = 0x14; USBSTK5515_I2C_write( OSD9616_I2C_ADDR, cmd, 3 );
Background image of page 2
Show entire document
Sign up to view the entire interaction

Top Answer

View the full answer
oled_test.c

/*
* Copyright 2010 by Spectrum Digital Incorporated.
* All rights reserved. Property of Spectrum Digital Incorporated.
*/
/*
* OSD9616 OLED Test
*
*/
/* Basically this program shows how to send...

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question