Float multiply and show result on LCD


Interface routines for driving a alphanumeric Liquid Crystal Display module using 8051 micro-controller. LCD is driven by only 4 data lines ( 4-bit mode )
Also show show to multiply 2 float numbers and show result on LCD

Toolkit:SDCC 8051 Development System

Location:/bipom/devtools/SDCC/examples/lcd/float

Code Example


#include <stdio.h>
#include <stdarg.h>
#include <8052.h>
#include <mcs51\bipomlib\types.h>
#include <mcs51\bipomlib\bipomlib.h>
#include <mcs51\bipomlib\lcd.h>

void main()
{
	float num1, num2, result;
	
	num1 = 1.25;
	num2 = 2.5;
	
	result = num1 * num2;
	
   	// Initialize the serial port 

   	serinit(CBR_19200);
    
	puts( "\rSDCC LCD Float Multiply" );
	
	// Initialize the LCD 

	LCD_Init();

	// Write a simple message to the LCD 

	LCD_SetTopLine();
	LCD_Printf("MUL %.2f BY %.2f", num1, num2);
	
	LCD_SetBottomLine();
	LCD_Printf("RESULT: %f", result);

	puts( "\rDone" );
	while(1);
}