Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

7 segment display off while executing modbus

Status
Not open for further replies.

td micro

Member level 5
Joined
Jun 26, 2012
Messages
86
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,929
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
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
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top