??? 04/01/10 10:11 Read: times |
#174726 - Limit Watchdog feed Responding to: ???'s previous message |
Hello,
Regarding all your ideas and things I would try, I'm trying to clean program by limiting the calls to my function which feed the watchdog. I realize that the best code is to have only one call to this function in my main loop, but it's impossible. About this, I have a question or a tip to ask to you : I've got a serial port communication between my board (the micro) and any device (PC, modem or else). currently I proceed as follow : When I've to send data from micro : - I feel a char* buffer (using sprintf) - I enter a function (flush) which do this : + Activate serial interrupt (setting TI0=1) + enter an infinite loop while the number of chars to send isn't equal to 0 - In my serial interrupt I do if (TI0 == 1) : + SOBUF = char to send + feed watchdog (PCON=PCON|0x10; and T3=0x00;) + decrease number of chars to send + TI0 = 0 I would like to write a more suitable code for this algorithme. The problem is that I can't send all the chars without feed the watchdog. baudrate can be between 300bds and 19200bds and the amount of data is about 250 chars at once and never excede a frame of 1000 chars (4 sprintf and 4 call to the flush function In addition, I checked the init of the RAM at start (after a reset). Good news : the RAM isn't initialized, so I'm writing a code to set a variable in start of each function of my program which is displayed at start of the micro. So I'll can see in which function the program freezed. |