Working with Serial.mod
Posted: Sun Sep 14, 2014 9:25 am
Hi,
I am trying to run the "variableBlinker" demo on my lpc1768 board and can't seem to get the serial.mod initialized. I have modified the code for the 1768. Am I missing something?
Also, do I need to call Serial.init? I get "too many parameters" with Serial.init(0,115200);
Thanks
I am trying to run the "variableBlinker" demo on my lpc1768 board and can't seem to get the serial.mod initialized. I have modified the code for the 1768. Am I missing something?
Also, do I need to call Serial.init? I get "too many parameters" with Serial.init(0,115200);
Thanks
Code: Select all
MODULE VariableBlinker;
IMPORT Main, MCU, Serial, SYSTEM, Timer;
PROCEDURE Run();
CONST
(* led connected to pin P0.22 *)
ledBit = {18};
VAR
direction: SET;
ch: CHAR;
n, delay: INTEGER;
BEGIN
(* Set led pin as output by setting the direction bit *)
SYSTEM.GET(MCU.FIO1DIR, direction);
SYSTEM.PUT(MCU.FIO1DIR, direction + ledBit);
Serial.init(0,115200); (* returns error "too many parameters"*)
ch := 0X;
delay := 500;
WHILE TRUE DO
IF Serial.RxReady() & (ch = 0X) THEN
Serial.GetCh(ch);
n := ORD(ch) - ORD("0");
IF n IN {1..9} THEN delay := n * 100 END
END;
IF Serial.TxReady() & (ch # 0X) THEN
Serial.PutCh(ch);
ch := 0X
END;
SYSTEM.PUT(MCU.FIO1CLR, ledBit);
Timer.MSecDelay(delay);
SYSTEM.PUT(MCU.FIO1SET, ledBit);
Timer.MSecDelay(delay)
END
END Run;
BEGIN
Run()
END VariableBlinker.