/*
* main.c
*/
//display the frequency and amplitude
#ifndef __LCD_MODULE_H__
#define __LCD_MODULE_H__
#endif
#ifndef TARGET_IS_BLIZZARD_RB1
#define TARGET_IS_BLIZZARD_RB1
#endif
#ifndef PART_TM4C123GH6PM
#define PART_TM4C123GH6PM
#endif
#include<stdint.h>
#include<stdbool.h>
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include"driverlib/sysctl.h"
#include "driverlib/timer.h"
#include"driverlib/rom.h"
#include "inc/tm4c123gh6pge.h"
#include "LCD_module.h"
extern uint8_t LCD_ASCII[127][16];
float Frequency=12345.12,Amplitude=0;
void display(void)
{ uint8_t i;
uint8_t temp_frequency[7];
// uint8_t temp_amplitude[4];
LCD_string_16x8(1,1,"Frequency:");
//get the value of the array
temp_frequency[0]=(int)Frequency/10000;//10k
temp_frequency[1]=((int)Frequency%10000)/1000;//1k
temp_frequency[2]=((int)Frequency/100)%10;//100
temp_frequency[3]=((int)Frequency/10)%10;//10
temp_frequency[4]=(int)Frequency%10;//1
temp_frequency[5]=((int)Frequency*10)%10;//0.1
temp_frequency[6]=((int)Frequency*100)%10;//0.01
//display the frequency
for(i=1;i<=5;i++)
{
if(temp_frequency[i]!=0)
LCD_char_16x8(2,i+2,temp_frequency+i);
}
//display "."
LCD_char_16x8(2,8,LCD_ASCII[46]);
//display the point
for(i=1;i<=2;i++)
LCD_char_16x8(2,i+8,temp_frequency+i+4);
//display "Hz"
LCD_string_16x8(2,10,"Hz");
}