Code: Select all
program test;
{ Declarations section }
const spi_buffsize : word =7;
type spi_channel_type = record
head,
tail,
termflag,
match : byte;
empty,
full : boolean;
delimiter : string[5];
rx_buff,
tx_buff : array[0..spi_buffsize] of byte;
end;
const
max_slave = 3;
Crlf : Array[3] Of Byte = (13,10,0);
var spi_channels : array[0..max_slave] of spi_channel_type;
this_channel : ^spi_channel_type;
spi_ik ,
spi_channel ,i,j : byte;
spi_txbuff : array[0..max_slave] of array[0..spi_buffsize] of byte;
spi_rxbuff : array[0..max_slave] of array[0..spi_buffsize] of byte;
spi_txhead,
spi_txtail,
spi_rxhead,
spi_rxtail : array[0..max_slave]of byte;
spi_termflag,
spi_match : array[0..spi_buffsize] of byte;
spi_rxb_full : array[0..max_slave] of boolean;
begin
i := 2;
j := 7;
this_channel := @spi_channels[1];
this_channel^.head := 7;
this_channel^.tx_buff[j] := 'x';
spi_rxbuff[i][j] := 'x';
end.
the generated code is very different , the actual PIC compiler needs math-library code to calculate the pointer which makes also huge difference on the required ROM, 1818 for the PIC , only 260 for the AVR.
It looks like we can expect a great step forward !