Hello All,
I am trying to figure out how best to write a sequential code execution monitoring diagnostic for my 8051 project. I want to be able to prove that the code execution has hit all of my 8 tasks before resetting the watchdog timer.
Each task is done at 1.25msec time intervals, they must happen in order, and it takes all 8 to complete the sequence.
It seems like there might be a way to encode a single byte that's end value proves I went through all 8 states and in the right order.
My first instinct is to simply advance a counter, but that can be fooled if stuck in the same task the right number of times. Maybe if I folded in an 8-bit CRC to a register?
Any suggestions are appreciated. (except for the condesending type)
Yes, I was just contemplating that issue.
i.e. what happens if I did a state twice. Checking almost seems mandatory.
Let task 1 set the 0x01 bit if the original value is 0. Let task 2 set the 0x02 bit if the original value is 1. Let task 3 set the 0x04 bit if the original value is 3. ... Let task 8 set the 0x80 bit if the original value is 254.
As an addendum, you could let a task that finds the incorrect value instead set an error flag - either because it has run more than once, or in the wrong order.