Hi
I am reading four voltages into separate variables and I just want to display the highest number.
The code below works OK but is there a simpler or neater way to do this?
Main:
readadc 0,b0
readadc 1,b1
readadc 2,b2
readadc 3,b3
if b0>b1 and b0>b2 and b0>b3 then sertxd (#b0,cr,lf)endif
if b1>b0 and b1>b2 and b1>b3 then sertxd (#b1,cr,lf)endif
if b2>b0 and b2>b1 and b2>b3 then sertxd (#b2,cr,lf)endif
if b3>b0 and b3>b1 and b3>b2 then sertxd (#b3,cr,lf)endif
goto main
I am reading four voltages into separate variables and I just want to display the highest number.
The code below works OK but is there a simpler or neater way to do this?
Main:
readadc 0,b0
readadc 1,b1
readadc 2,b2
readadc 3,b3
if b0>b1 and b0>b2 and b0>b3 then sertxd (#b0,cr,lf)endif
if b1>b0 and b1>b2 and b1>b3 then sertxd (#b1,cr,lf)endif
if b2>b0 and b2>b1 and b2>b3 then sertxd (#b2,cr,lf)endif
if b3>b0 and b3>b1 and b3>b2 then sertxd (#b3,cr,lf)endif
goto main