140 likes | 155 Views
A real-time multitasking system to display and monitor various data on an electric bicycle, including speed, distance, motor's state, power, battery level, and duty cycle.
E N D
Electrics Bicycle Display By Philippe Ng April 26, 2005 Western Washington University Electronics Engineering Department
Kernel Selection MicroC/OS-II • Real-time multitasking
Tasks and Priorities • Start Task Priority: 4 • Data Task Priority: 5 • Key Task Priority: 6 • User Interface Task Priority: 7
Start Task • Initializes MicroC/OS and creates the other tasks • Priority: 4 • Period: Executes once at startup • Execution Time: ~50μs estimated • CPU Load: approximately zero
Data Task • Initializes and monitors CAN bus • Receives CAN frames • Determines throttle percentage • Priority: 5 • Period: Periodic – 10ms • Execution Time: 14μs • CPU Load: 0.0014
Key Task • Scans pushbuttons for keypress and stores entry in buffer • Priority: 6 • Period: Sporadic – 10ms • Execution Time: 2us • CPU Load: 0.000 2
User Interface Task • Allows users to change LCD display and to select user mode. • Updates the LCD screen with new values displays speed, distance, motor’s state, power, battery level, and duty cycle. • Priority: 7 • Period: Periodic – 500ms • Execution Time: 3ms • CPU Load: 0.03
Modules • eBike.c • LCD.c • ATD.c • UcosKey.c • CAN.c
Dataflow Diagram eBike.c Push buttons I/O Keypad Driver Module Left_key Right_key Regen_key 10ms KeyInit() KeyTask() Key.buffer KeyPend() Key.flag
Dataflow Diagram eBike.c LCD Screen LCD Driver Module KeyInit() LcdSpeed() LcdDistance() LcdState() LcdPower() LcdBattery() LcdDuty() LcdClrLine() LcdClrDisp() LcdDispStrg() 100ms UITask() LCD
Dataflow Diagram eBike.c A-to-D Throttle I/O ATD Driver Module KeyInit() ATDCTL5 10ms ATD0DR0 DataTask() ATDRead() ATD0 Throttle ATD0DR1 ATD0DR2 Avg
Dataflow Diagram CAN Bus Physical Layer eBike.c CAN Driver Module CANInit() CANFilter() CANGetStatus() DataTask() TXCAN0 RXCAN0 CAN0Controller Transmit Buffer CANPushMessage() ID Filter Receive Buffer CANPullMessage()