1 Wait_state 2 running_stete 3 find_road_state 4 road_not_found_state
- PH3 (Timer4)
- INA - PK0 (ADC8)
- INB - PK1 (ADC9)
- ENA - PK2 (INPUT)
- ENB - PK3 (INPUT)
- Timer1
- PWM - PB5 (OC1A)
- Timer5
- Signal - PL2 (T5)
- RX - PD2 (RXD1)
- TX - PD3 (TXD1)
- PC0 - led0
- PC1 - led1
*(HIGH when not pushed)
- PE5 (INT5)
#Done / ToDo List
###Already completed
- Different states for "Find tract", "drive", "wait", "track lost permanetly"
- Set state -function
- handling routine for "find track timer" timeout
- event timer routines to setup future events
- PID
- Loop cycle time synchronizer & constant loop time value
-
Timer 0 clock & mode (event timer)
-
Timer 1 clock & mode (servo pwm)
-
Timer 5 clock & mode (tachometer)
-
enable global interrups
-
servo init (center pos)
- DDR values (port directions)
- Timer 4 clock & mode (motor pwm)
- Count loops
- Check if "max loops" reached
- enable timer for finding track (timeout for search)
- Calculate operation logic based on errors / states
- Calculate turning degree based on PID
- (optional) WatchDog routine
- Read bumpers
##Servo (turning)
- Initilize timer clock / prescaler
- Functions
##Motor & Tachometer (speed, direction, feedback)
- Calc speed
- Read tachometer
- Calculate PI
- SetMotorSpeed
- Tachometer value to speed (scaling)
##User Interface (diagnostics)
- Read button (ISR)
- Set next state based on current state
- Report errors
- Send text to LCD (lib?)
- Update LCD status information
- Set LED states based on "operation mode"