int iValue = 0; int vrednostADC = 0; float fVrednost = 0; char vrednsotADC1[] = ""; char vredADC[] = ""; ADCInit(4400000); //set 4.4MHz while (1) { vrednostADC = ADCRead(5); fVrednost = vrednostADC * (3.3 / 4096); //calculate voltage of ADC iValue=(int)fVrednost; //convert form int to float itoa(iValue, vrednsotADC1, 10); itoa(vrednostADC, vredADC, 10); PotisniChar(16, 5, 1, vrednsotADC1); //look conversion value PotisniChar(16, 6, 1, vredADC); //look value from ADC (int) //LCDPocisti(); } |
int vrednostADC; char buf[10]; vrednostADC = ADCRead(5); itoa(vrednostADC, buf, 10); PotisniChar(16, 5, 1, buf); vrednostADC = (vrednostADC * 3300) / 4096; itoa(vrednostADC, buf, 10); PotisniChar(16, 6, 1, buf); |
char vrednsotADC1[] = ""; char vredADC[] = ""; |
char vrednsotADC1[12]; char vredADC[12]; |
iValue=(int)fVrednost; //convert form int to float |