' Name : MAXMIN.pbp ' Compiler : PICBASIC PRO Compiler 2.6 ' Assembler : PM or MPASM ' Target PIC : 12F, 16F or 18F ' Hardware : PC serial connection & terminal for result display ' Oscillator : 4MHz internal or external ' Keywords : MAX, MIN, SEROUT ' Description : PICBASIC PRO program to demonstrate MAX/MIN Operators. ' Uses MAX and MIN operators to Bound [0..9] to [3..7]. ' Include "modedefs.bas" ' Include serial modes SO Con 0 ' Define serial out pins B0 Var byte B1 Var byte mainloop: For B0 = 0 To 9 ' B0 = 0..9 B1 = B0 Max 3 Min 7 ' B1 = B0 Bounded to [3..7] Serout 0,N2400,[#B0," ",#B1,10,13] ' Display results Next B0 Serout 0,N2400,[10] ' Line Break Goto mainloop ' Forever End