Hal component cannot assign variable to output ?
I am just trying to build a component for my VFD.
So I am playing arround with the mesa_uart.comp
the examle shows how to use send and receive with UART.
here is my problem.
in the beginning there are some declarations for the pins.....
I have access to all of these pins. But here comes the weird thing.pin in u32 tx-data-##[16] "Data to be transmitted";
pin out u32 rx-data-##[16] "Data received";
pin in s32 tx-bytes "Number of bytes to transmit";
pin out s32 rx-bytes "Number of Bytes received";
This function also does as aspected.FUNCTION(receive){/* This function uses the hm2_uart_send function to transmit data.See man hm2_uart_send for more information. 16 bytes in the Rx buffer*/
int i;unsigned char data[16];
rx_bytes = hm2_uart_read(name, data);
for (i = 0 ; i < rx_bytes ; i++){rx_data(i) = data;}}
But the pin hm2_5i25.0.uart.0.rx-bytes shows "0" all the time and not the number of bytes received.
Always, when I assign a variable to rx_bytes, the output is "0".
When I say rx_bytes = 10; it will show 10 or 0x0A.
When I say
int test = 10;
rx_bytes = test;
the pin will show 10 (0x0A).
What am I missing?
I really want to generate an "variable" output....
Please Log in or Create an account to join the conversation.
the rx-data-00 is "0" (overwritten?)int i;
unsigned char data[16];
rx_bytes = hm2_uart_read(name, data);
for (i = 0 ; i < rx_bytes ; i++){
rx_data(i) = data;
}
rx_data(i) = rx_bytes;
rx-data-01, 02, etc keep the values from UART
and the additional rx-data- keeps the rx_byte value...
I really don't get it
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
yesterday I tested this only in terminal with halrun and a test.hal
I checked it today in LinuxCnc and guess what.
The rx-bytes Pin get the output, but just for a second (period) and after it get zero again.
In halrun I just were to slow to see it with "show pin".
Think this is normal behaviour for the UART when there aren't new bytes in RX buffer?
This is no problem for me, I just got mad yesterday not being able to set an output
Please Log in or Create an account to join the conversation.