Reputation: 800
I am writting firmware for AT90CAN32 using AVR Studio + WinAVR.
It seems simple for experienced AVR programmers.
I pass int
argument to function, but inside the function it is always zero.
There is inside protocol.c
file:
#include <uart.h>
static char packet[16] = ":AA111122223!f\r\n";
void vDivRequesting(void)
{
uint8_t cntOfBms = getCountOfBms( );
for(uint8_t i=0; i<cntOfBms; i++)
{
createPacket(getBmsNetworkNumber(i), REQUEST_V_DIV, 1);
usartSendString(packet,11);
_delay_ms(200);
}
}
There is uart.c file:
void usartSendString( char *data, uint8_t len )
{
uint8_t i=0;
usartSendByte(len + 0x30);
for( i=0; i<len; i++)
{
usartSendByte(*data);
*data++;
}
}
And it prints me that len
argument is zero. usartSendString
function is defined in uart.h
file. What is wrong with that code?
Upvotes: 0
Views: 57