I have begun to play with my new "Clicker for Kinetis" card.
I have also bought the "mikroProg for Kinetis" and everything go well.
But I have lost a couple of hours about the setting of a register.
The idea was to use the UART0 with the interrupt.
Here is the code
Code: Select all
program Test;
var LD1 : sbit at PTA_PDOR.B5;
LD2 : sbit at PTA_PDOR.B12;
procedure UART0_RX_TX_INT(); iv IVT_INT_UART0_RX_TX; ics ICS_AUTO;
var
DataRX:byte;
begin // UART0_RX_INT
LD2:=not LD1;
if UART0_Data_Ready()
then
begin
DataRX := UART0_Read();
UART0_Write(DataRX);
end;
end; // UART0_RX_INT
// main function
begin
// Set PTA_PDOR pins 5 and 12 as digital output
GPIO_Digital_Output(PTA_PDOR, _GPIO_PINMASK_5 or _GPIO_PINMASK_12);
UART0_Init(9600);
// enable interrupt vector
NVIC_IntEnable(IVT_INT_UART0_RX_TX);
// now I have to enable the interrupt of the receiver setting RIE_UART0_C2_bit
// here is the problem --------------------------
// I have tried:
// UART0_C2.RIE_UART0_C2_bit:=1; // <-- This way the application hangs
// UART0_C2.B5:=1; // <-- Also this way tha application hangs
// RIE_UART0_C2_bit:=1; // <-- And also this way the application hangs
UART0_C2:=UART0_C2 or $20; // <-- This work!!!
EnableInterrupts();
UART0_Write_Text('Hello!');
LD2:=0;
while true do
begin
LD1:=not LD1;
Delay_ms(500);
end;
end.
Have you any suggestion?
Compiler used "mikroPascal PRO for ARM v 4.9.0" registered
Thank you,
Danilo