I have 2 atmega644 processors that need to pass data 2 each other. Serial and SPI is not available on one of the processors. So I have 2 free pins on one processor and the other processor is largely unused.
The logic flow is as follows
1. a 4 x 3 numeric keypad to be scanned for keypress on the first processor
2. Each keypress to be sent to the second processor (to be displayed on an LCD screen)
3. When a 7 digit string is available and the OK button is pressed it is sent to a decoding function on the first processor (already written)
4. The function returns a integer between 0 and 3 which should be passed to the second processor.
Tasks assgined to each processor (P1 and P2)
Processor 1
Scan and decode 4 x 3 keypad.
Send 'start sequence' #FF to P2
Send keypad press to P2 (0 - 9 , del ) ('OK' button to be ignored untill 7digits string entered)
Send 'end sequence' #FE to P2
Receive date string from P1
Decode the 7 digit string resulting in an integer (S) between 0-3
Pass '$S$' to P2
Timeout of 10 seconds between keypress to trigger 'end transaction ' #FD;
Processor 2
Interupt to wait for #FF or #FD from P1 on input pin.
if #FF then send incoming digits to display function
wait for 'end sequence' from P2 and return a date string
Wait for $S$ from P1
#FD used to reset sequence and return to 'wait' state.
How this is solved is entirely up to you and this logic flw is only a guidline.
We are a group of professional freelancer embedded system engineers. We provide research and development services for mechatronics and real-time embedded systems.