Hi All,
Recieving 5 bytes of information continually.The data being sent
serially is hex numbers, but when i see the data recieved it shows
characters. How do i change these characters back into integers?
i tried strtoint but it dit not work:
procedure TForm1.VaComm1RxChar(Sender: TObject; Count: Integer);
var
character: string;
begin
character:= VaComm1.ReadText;
Label1.Caption:=label1.Caption +character;
Label3.Caption:= strtoint(Label1.Caption); // gives me error of
imcompatible types
end;
I also want to seperate these 5 bytes.
first byte(actually a bit) is a start byte value 0, the 3 bytes that follow i want to
assign to 3 different variables, the last byte is a stop byte value 0.
how do i seperate these bytes?
The data being recieved is what i am transmitting from PIC16f877a
the transmiting code is
start =0; //declared as bits
stop=0;
TXREG = start; //transmission start bit
while(TRMT == 0){};
TXREG = id; //variable 1 which depicts the id i
require
while(TRMT == 0){};
TXREG = mux_number; //variable 2 depicting the mux number in use
while(TRMT == 0){};
TXREG = grid_number; //variable 3 depicting the grid being read
while(TRMT == 0){};
TXREG = stop; //transmits Stop bit
while(TRMT == 0){};
The goal is to display the id on a GUI relative to the physical setup.
I am a programming novice.
I have written most of the Delphi code such that i recieve 3 intereger
variables(as above), based on which i display the id. This part of my
code works, i have checked it by generating random numbers.
Now stuck with characters which has no start or end it seems! Any help
would be much appreciated.
Also,
VaComm1 allows for one stop bit should this be a 0 or a 1?
Recieving 5 bytes of information continually.The data being sent
serially is hex numbers, but when i see the data recieved it shows
characters. How do i change these characters back into integers?
i tried strtoint but it dit not work:
procedure TForm1.VaComm1RxChar(Sender: TObject; Count: Integer);
var
character: string;
begin
character:= VaComm1.ReadText;
Label1.Caption:=label1.Caption +character;
Label3.Caption:= strtoint(Label1.Caption); // gives me error of
imcompatible types
end;
I also want to seperate these 5 bytes.
first byte(actually a bit) is a start byte value 0, the 3 bytes that follow i want to
assign to 3 different variables, the last byte is a stop byte value 0.
how do i seperate these bytes?
The data being recieved is what i am transmitting from PIC16f877a
the transmiting code is
start =0; //declared as bits
stop=0;
TXREG = start; //transmission start bit
while(TRMT == 0){};
TXREG = id; //variable 1 which depicts the id i
require
while(TRMT == 0){};
TXREG = mux_number; //variable 2 depicting the mux number in use
while(TRMT == 0){};
TXREG = grid_number; //variable 3 depicting the grid being read
while(TRMT == 0){};
TXREG = stop; //transmits Stop bit
while(TRMT == 0){};
The goal is to display the id on a GUI relative to the physical setup.
I am a programming novice.
I have written most of the Delphi code such that i recieve 3 intereger
variables(as above), based on which i display the id. This part of my
code works, i have checked it by generating random numbers.
Now stuck with characters which has no start or end it seems! Any help
would be much appreciated.
Also,
VaComm1 allows for one stop bit should this be a 0 or a 1?