#include <bitirme_projesi.h>
#define GLCD_CS1 PIN_B0
// Chip Selection 1
#define GLCD_CS2 PIN_B1
// Chip Selection 2
#define GLCD_DI PIN_B2
// Data or Instruction input
#define GLCD_RW PIN_B3
// Read/Write
#define GLCD_E PIN_B4
// Enable
#define GLCD_RST PIN_B5
// Reset
#include <HDM64GS12.c>
#include <graphics.c>
#use delay(clock=4000000)
unsigned int16 adc2;
float sarj_akimi;
unsigned char akim_sarj[15];
void akim_okuma(void)
{
set_adc_channel(1);
delay_us(20);
adc2=read_adc();
sarj_akimi=(adc2*4.89)/(5.0);
sprintf(akim_sarj, "Isarj= %f mA",sarj_akimi);
glcd_text57(1,10,akim_sarj,1,ON);
delay_ms(100);
}
void main()
{
setup_adc(ADC_CLOCK_INTERNAL);
setup_adc_ports(AN0_AN1_AN2_AN3_AN4);
glcd_init(ON);
set_tris_a(0x17);
set_tris_d(0x00);
while(TRUE)
{
akim_okuma();
}
}