td micro
Member level 5
hi,
In our project we are using 18f4620 controller, ccs compiler 4.119, 3 common cathode 7segment displays, modbus(rs 485).
If we are not using modbus, the 7segment is working properly. If we add code for modbus and read the holding registers, the display is blinking. ie, if modbus code is executed, then the display will be off for approx 500m sec. We directly use modbus driver file.
Code for reading hold register is
How can we over come the blinking (display off) problem?
please help
In our project we are using 18f4620 controller, ccs compiler 4.119, 3 common cathode 7segment displays, modbus(rs 485).
If we are not using modbus, the 7segment is working properly. If we add code for modbus and read the holding registers, the display is blinking. ie, if modbus code is executed, then the display will be off for approx 500m sec. We directly use modbus driver file.
Code for reading hold register is
Code:
if(modbus_kbhit())
{
//check address against our address, 0 is broadcast
if((modbus_rx.address == MODBUS_ADDRESS) || modbus_rx.address == 0)
{
switch(modbus_rx.func)
{
case FUNC_READ_HOLDING_REGISTERS:
case FUNC_READ_INPUT_REGISTERS:
if(modbus_rx.data[0] || modbus_rx.data[2] ||
modbus_rx.data[1] >= 15 || modbus_rx.data[3]+modbus_rx.data[1] > 15)
modbus_exception_rsp(MODBUS_ADDRESS,modbus_rx.func,ILLEGAL_DATA_ADDRESS);
else
{
if(modbus_rx.func == FUNC_READ_HOLDING_REGISTERS)
modbus_read_holding_registers_rsp(MODBUS_ADDRESS,(modbus_rx.data[3]*2),hold_regs+modbus_rx.data[1]);
else
modbus_read_input_registers_rsp(MODBUS_ADDRESS,(modbus_rx.data[3]*2),input_regs+modbus_rx.data[1]);
event_count++;
}
break;
default: //We don't support the function, so return exception
modbus_exception_rsp(MODBUS_ADDRESS,modbus_rx.func,ILLEGAL_FUNCTION);
}
}
How can we over come the blinking (display off) problem?
please help