uart write text for big strings

General discussion on mikroPascal for dsPIC30/33 and PIC24.
Post Reply
Author
Message
Skydec
Posts: 39
Joined: 30 Jan 2009 12:38

uart write text for big strings

#1 Post by Skydec » 03 Feb 2009 17:03

Is there a function, or does anyone made one to send bigger strings over the uart? the standard write text function can only send 20 chars at once but I want to send 100 chars at once.

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#2 Post by yo2lio » 03 Feb 2009 17:20

Code: Select all

program test;

var my_data : string[1024];

procedure Uart1_Write_Text_(var uart_text : string[$FFFF]);
var pt1 : ^byte;
    data_in : byte;
begin
  pt1 := @uart_text;
  while true do
    begin
      data_in := pt1^;
      if data_in = 0 then break; // end of string
      Uart1_Write_Char(data_in);
    end;
end;

begin
  my_data := '123456789';
  Uart1_Init(9600);
  Uart1_Write_Text_(my_data);
end.
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

Skydec
Posts: 39
Joined: 30 Jan 2009 12:38

#3 Post by Skydec » 03 Feb 2009 18:30

Thanks,

But it doesn't work..
I think there is an overrun on Uart1_Write_Char (I don't know if the controller is waiting till the caracter is send out, I believe not and the while loop runs at highspeed)

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#4 Post by yo2lio » 03 Feb 2009 20:05

Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

Skydec
Posts: 39
Joined: 30 Jan 2009 12:38

#5 Post by Skydec » 03 Feb 2009 22:49

No I didn't but I don't think that's the issue, because when I use the standard write text, it works fine, as long as I stay under the 20 chars.
Maybe I'll rewrite the code a bit to run it interrupt driven, hooefully that will fix it.

Thanks!

Post Reply

Return to “mikroPascal for dsPIC30/33 and PIC24 General”