writeln redirect to usart lazarus / 79-Embedded - ARM ---------------------------------------------------------------------- diego bertotti · 2020-07-17 15:09 hello somebody knows how i can redirect de write and writeln functions to use as output the usart tx? thanks ---------------------------------------------------------------------- MarkMLl · 2020-07-17 16:39 Console app? Lazarus? Operating system? type of hardware? Come on old chap, give us a clue. MarkMLl ---------------------------------------------------------------------- ccrause · 2020-07-17 17:00 Quote from: diego bertotti on July 17, 2020, 05:09:47 pmsomebody knows how i can redirect de write and writeln functions to use as output the usart tx? One has to provide the required character read & write implementations and pass pointers to these functions to OpenIO.  OpenIO is defined in the consoleio unit.  An example of this redirection can be seen in the avrsim unit.  Of course in avrsim the redirection just dump the character in a special register, in your case WriteChar() needs to implement the UART call to transmit a character. ---------------------------------------------------------------------- ccrause · 2020-07-17 17:07 Quote from: MarkMLl on July 17, 2020, 06:39:10 pmConsole app? Lazarus? Operating system? type of hardware? Come on old chap, give us a clue. MarkMLl The location of Diego's question gives the necessary context.  Don't worry, I have been baffled before by apparently context-less questions before, only to later realize it is all about the specific subforum.  Something that is easy to miss when looking at the Recent list. ---------------------------------------------------------------------- MarkMLl · 2020-07-17 19:45 Quote from: ccrause on July 17, 2020, 07:07:21 pmThe location of Diego's question gives the necessary context.  Don't worry, I have been baffled before by apparently context-less questions before, only to later realize it is all about the specific subforum.  Something that is easy to miss when looking at the Recent list. I agree, my apologies :-) MarkMLl ---------------------------------------------------------------------- diego bertotti · 2020-07-17 20:37 Quote from: MarkMLl on July 17, 2020, 06:39:10 pmConsole app? Lazarus? Operating system? type of hardware? Come on old chap, give us a clue. MarkMLl excuseme embedded arm stm32f103c8t6 bluepill board...just in case ---------------------------------------------------------------------- diego bertotti · 2020-08-15 12:17 hello once more in embedded enviroment..what happens if i use writeln('something') if i dont write a specific code to redirect? where they go? thanks ---------------------------------------------------------------------- ccrause · 2020-08-15 16:02 Quote from: diego bertotti on August 15, 2020, 02:17:36 pmin embedded enviroment..what happens if i use writeln('something') if i dont write a specific code to redirect? where they go? Good question.  If you include the consoleio unit then the standard handles (input, output, StdOut etc) are initialized with functions that basically do nothing.  I suspect (but cannot confirm) that in general read/write operations will check for valid configurations and do nothing if not properly initialized. ---------------------------------------------------------------------- diego bertotti · 2020-08-24 14:24 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Unit consoleio;     procedure SysInitStdIO;      begin        OpenIO(Input, @EmptyWrite, @EmptyRead, fmInput, nil);        OpenIO(Output, @EmptyWrite, @EmptyRead, fmOutput, nil);        OpenIO(ErrOutput, @EmptyWrite, @EmptyRead, fmOutput, nil);        OpenIO(StdOut, @EmptyWrite, @EmptyRead, fmOutput, nil);        OpenIO(StdErr, @EmptyWrite, @EmptyRead, fmOutput, nil);      end;      function EmptyWrite(ACh: char; AUserData: pointer): boolean;      begin        EmptyWrite:=true;      end;     function EmptyRead(var ACh: char; AUserData: pointer): boolean;      begin        EmptyRead:=true;      ACh:=#0;      end;   do nothing! you right