Kostas Katsinas
Kostas Katsinas

Reputation: 1

How can I fix in Pascal: Incompatible types ("complex type" to "simple type")

I'm working on a project at school and I have to do some calculations using Pascal and show it on an LC Display. My calculations are the following:

adc_rd := ADC_read(2);
   textlong := adc_rd*5;
   adc_rd := textlong/1023;
   decim_i := 0.4*adc_rd;
   decim_ii := pow(2.71828,decim_i);
   decim_i := 8.9116*decim_ii;
   FloatToStr_FixLen(decim_i, text4, 6);
   Lcd_Chr(2,6,text4);

decim_i and decim_ii are reals. I get the following error on the last line Lcd_Chr(2,6,text4);:

Incompatible types ("complex type" to "simple type")

Does anyone know how to fix it?

Upvotes: 0

Views: 177

Answers (1)

LU RD
LU RD

Reputation: 34939

Text4 is a string, but Lcd_Chr() expects a single character.

To solve the problem, loop through all characters in the string:

for i := 1 to Length(text4) do Lcd_Chr(1+i,6,text4[i]);

Upvotes: 1

Related Questions