Sheshebens
New Member
I want to make 3s charger to use Charger 9 click,but When I use Charger 9 click code ı encountered malloc error.I will show you code.I took this code from microelectronica web site. https://www.mikroe.com/charger-9-click**broken link removed** am using microC PRO for PIC32.
void applicationTask()
{
rx_dat = UART_Rdy_Ptr();
if (rx_dat != 0)
{
rx_dat = UART_Rd_Ptr();
switch (rx_dat)
{
case 'e' :
{
if (en_flag == _CHARGER9_DISABLE)
{
charger9_enable( _CHARGER9_ENABLE );
en_flag = _CHARGER9_ENABLE;
mikrobus_logWrite( "** Charger 9 is enabled **", _LOG_LINE );
alarmOn();
}
else
{
mikrobus_logWrite( "** Charger 9 is already enabled **", _LOG_LINE );
}
break;
}
case 'd' :
{
if (en_flag == _CHARGER9_ENABLE)
{
charger9_enable( _CHARGER9_DISABLE );
en_flag = _CHARGER9_DISABLE;
mikrobus_logWrite( "** Charger 9 is disabled **", _LOG_LINE );
alarmOff();
}
else
{
mikrobus_logWrite( "** Charger 9 is already disabled **", _LOG_LINE );
}
break;
}
case 's' :
{
charge_state = charger9_fullChargeInd();
if (charge_state == _CHARGER9_IND_ACTIVE)
{
mikrobus_logWrite( "** Full-Charge state **", _LOG_LINE );
}
charge_state = charger9_fastChargeInd();
if (charge_state == _CHARGER9_IND_ACTIVE)
{
mikrobus_logWrite( "** Fast-Charge state **", _LOG_LINE );
}
break;
}
case 'l' :
{
writeLegend();
break;
}
default :
{
mikrobus_logWrite( "** Invalid command **", _LOG_LINE );
writeLegend();
break;
}
}
}
charge_state = charger9_faultInd();
if (charge_state == _CHARGER9_IND_ACTIVE)
{
charger9_enable( _CHARGER9_DISABLE );
en_flag = _CHARGER9_DISABLE;
mikrobus_logWrite( "** Fault condition! **", _LOG_LINE );
mikrobus_logWrite( "** Charger 9 is disabled **", _LOG_LINE );
alarmFault();
}
}
When I used this code I have some error.
Error name :4622 393 'malloc' Identifier redefined __Lib_dlmalloc.c
I don't have any idea how can ı solve this problem.
How can ı solve this malloc error.
Thanks.
void applicationTask()
{
rx_dat = UART_Rdy_Ptr();
if (rx_dat != 0)
{
rx_dat = UART_Rd_Ptr();
switch (rx_dat)
{
case 'e' :
{
if (en_flag == _CHARGER9_DISABLE)
{
charger9_enable( _CHARGER9_ENABLE );
en_flag = _CHARGER9_ENABLE;
mikrobus_logWrite( "** Charger 9 is enabled **", _LOG_LINE );
alarmOn();
}
else
{
mikrobus_logWrite( "** Charger 9 is already enabled **", _LOG_LINE );
}
break;
}
case 'd' :
{
if (en_flag == _CHARGER9_ENABLE)
{
charger9_enable( _CHARGER9_DISABLE );
en_flag = _CHARGER9_DISABLE;
mikrobus_logWrite( "** Charger 9 is disabled **", _LOG_LINE );
alarmOff();
}
else
{
mikrobus_logWrite( "** Charger 9 is already disabled **", _LOG_LINE );
}
break;
}
case 's' :
{
charge_state = charger9_fullChargeInd();
if (charge_state == _CHARGER9_IND_ACTIVE)
{
mikrobus_logWrite( "** Full-Charge state **", _LOG_LINE );
}
charge_state = charger9_fastChargeInd();
if (charge_state == _CHARGER9_IND_ACTIVE)
{
mikrobus_logWrite( "** Fast-Charge state **", _LOG_LINE );
}
break;
}
case 'l' :
{
writeLegend();
break;
}
default :
{
mikrobus_logWrite( "** Invalid command **", _LOG_LINE );
writeLegend();
break;
}
}
}
charge_state = charger9_faultInd();
if (charge_state == _CHARGER9_IND_ACTIVE)
{
charger9_enable( _CHARGER9_DISABLE );
en_flag = _CHARGER9_DISABLE;
mikrobus_logWrite( "** Fault condition! **", _LOG_LINE );
mikrobus_logWrite( "** Charger 9 is disabled **", _LOG_LINE );
alarmFault();
}
}
When I used this code I have some error.
Error name :4622 393 'malloc' Identifier redefined __Lib_dlmalloc.c
I don't have any idea how can ı solve this problem.
How can ı solve this malloc error.
Thanks.