Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/11/04 11:43
Read: times


 
#70167 - managing different states & timer
Just want to find out how to manage different states for individual bit ( as done in state machine example on this website).
Just want to know how i should write the code for a signal bit in such a way that later if i add more input bits so the program is flexible enough to manage those.

Program requirements are as follows;

P1 (outport) : sents 8 bit data to a device, this device will be common for n-number of input bits (max input bit 8). And for each bit there are two different form of data one for HIGH STATE and ONE FOR LOW STATE.

P2.1 (input bit); when where change in logic state from 1 to 0 occurs following states must be checked, this high and low does not require any debouncing checks further this high and low comes from Human action on a device so the time of this low and high will be not be too fast.

There will be a Scan list for checking low on input bits i.e. P2 in my case.

DATA:- the data which is required to be sent for P2.0 is; ( only for P2.0 there will be different data for other bits if added)

1) If low comes :- 00000001B
2) If High comes:- 11110000B



States for a Bit:-

1) STATE1: checking if really low has come.

2) STATE2: Check if still low if so sent 8 bits data from P1.

3) STATE3: counter of 5 seconds starts now if high comes within 5 seconds, second type of data is sent through P1 or if low is there upto 5 seconds then also the second type of data through P1 is sent and move that bit again in logic low scanning list.Also reseting the counter.


Now my question is:

1)How to make the lookup tables considering that i know the data which is required to be sent on High and low of each bit.

2) What method of scanning should i do.

3) How to divide time for each bit and its three states. 1.25msec for each bit or for all four states. That i don;t understand how to manage time setting in code should all states of each bit be checked or all main scanning is checked after each bit and if low comes on any bit its state is worked but it might be possible that at a time one bit is in state 3 and the other is in state 2 and a new bit comes in action.

Advice needed to make code for one bit in such a way that later 8 bits can be managed.

regards,
Amir hayat

List of 24 messages in thread
TopicAuthorDate
managing different states & timer            01/01/70 00:00      
   RE: managing different states & timer            01/01/70 00:00      
      Thanks            01/01/70 00:00      
      Understanding your code            01/01/70 00:00      
         RE: Understanding your code            01/01/70 00:00      
      Please only show for two bits            01/01/70 00:00      
         he amazing Waqar with his many names            01/01/70 00:00      
            Two Bits expalin if possible            01/01/70 00:00      
               Warning: Waqar Zaka is back.            01/01/70 00:00      
                  RE: Warning: Waqar Zaka is back.            01/01/70 00:00      
                     RE: Warning: Waqar Zaka is back.            01/01/70 00:00      
                     RE: Warning: Waqar Zaka is back.            01/01/70 00:00      
                        How to close Posts            01/01/70 00:00      
         RE: Please only show for two bits            01/01/70 00:00      
            Few Questions about the working of code            01/01/70 00:00      
   Ya waqar zaka is back SO            01/01/70 00:00      
      RE: Ya waqar zaka is back SO            01/01/70 00:00      
      RE: Ya waqar zaka is back SO            01/01/70 00:00      
   Please Oleg Sergeev            01/01/70 00:00      
      RE: Please Oleg Sergeev            01/01/70 00:00      
      RE: Please Oleg Sergeev            01/01/70 00:00      
         RE: Please Oleg Sergeev            01/01/70 00:00      
            RE: no please anymore            01/01/70 00:00      
               Thankyou ALL            01/01/70 00:00      

Back to Subject List