This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Saturday, November 14, 2015

MAX7219 7-Segment Display

Do you like the 7-segment displays?
This board has a MAX7219, the board has eight digits connected in cascade. The board works at 5V and has SPI interface.
 
Video.

Description of library.

Initializes the MAX7219.

MAX7219_Init(void)
Example:
MAX7219_Init();

Writes a single digit.
MAX7219_WriteDigit(c, digit)

  • c: Sets the 7-segment character.
  • digit: Sets the digit.
Example:
MAX7219_WriteDigit('2', 5);

Writes constant numbers.
MAX7219_ConstDigit(buffer);

  • buffer: Sets the numbers.
Example:
MAX7219_ConstDigit("00001234");

Writes numbers.
MAX7219_Digit(buffer);

  • buffer: Sets the numbers.
Example:
unsigned int i;
char buffer2[20];

i = 25;
sprintf(buffer2, "%8d", i);
MAX7219_Digit(buffer2);

Clears the 8 digits.

MAX7219_Clear(void);
Example:
MAX7219_Clear();

Schematic.


Thursday, November 12, 2015

DS3231 Library.

Professional library for projects where a RTC is implemented. Version 3.
Request a copy.
You can  send a request  to:

armicrocontroller@gmail.com

This function initializes the RTC.
DS3231_Init(void)

Example:
DS3231_Init();


This function gets the time and calendar information of the RTC.

DS3231_GetInfo(void)
Example:
DS3231_GetInfo(); 

This function can be used to configure a new time and calendar information.
DS3231_AddData(dat, inc_dec)

  • dat: This parameter selects seconds, minutes, hours, day, date, month or year.
  • 1 Seconds.
  • 2 Minutes.
  • 3 Hours.
  • 4 Day.
  • 5 Date.
  • 6 Month.
  • 7 Year.
  • inc_dec: This parameter sets the increment or decrement.
  • 1 increment.
  • 2 decrement.
Example:
DS3231_AddData(3, INC_DAT);


This function does a conversion AM to PM or PM to AM.
DS3231_AMPM(void)
Example:
DS3231_AMPM();


This function does a conversion 12hr to 24hr or 24hr to 12hr.
DS3231_HourMode(void)
Example:
DS3231_HourMode();


This function gets the full calendar. "Day Date Month Year" <<Mon 12 Jan 15>>
DS3231_GetCalendar(*p, dat)

  • *p: This parameter saves the date information in a variable.
  • dat: This parameter is used to select the day, date, month, year or the full calendar.
  • 0 Full Calendar.
  • 4 Day.
  • 5 Date.
  • 6 Month.
  • 7 Year.
  • 9 Resume Calendar.
Example:
char calendar[40];

DS3231_GetInfo();
DS3231_GetCalendar(calendar, 0);


This funtion gets the time information. "Hours:Minutes:Seconds" <<01:35:12>>
DS3231_GetTime(p1)

  • *p: This parameter saves the time information in a variable.
  • Return 0 if time is in 24 format.
  • Return 1 if time is in 24 format.
  • Return 2 if time is in AM format.
  • Return 3 if time is in PM format.
Example:
char time[10];
unsigned char ampm;

DS3231_GetInfo();
ampm = DS3231_GetTime(time);

How to use this library in a project.
Basic example:
We have  two buttons, where Button 1 selects the information to configure and Button 2 adds a new time or data information.

main()
{
 unsigned char i = 1;
 unsigned char ampm;
 char time[20];
 char calendar[40];

 DS3231_Init();
 while(1)
 {
  if(BUTTON1 == 1 && i < 8)
  {
   i++;
  }

  if(BUTTON2 == 1)
  {
   DS3231_AddData(i, INC_DAT);
  } 
  DS3231_GetInfo();
  ampm = DS3231_GetTime(time); 
  DS3231_GetCalendar(calendar, 0);
  LCD_Print(time);
  LCD_Print(calendar);
 }
}