





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Professor: Traylor; Class: MICROPROCESSOR SYSTEM DESIGN; Subject: Electrical & Computer Engineer; University: Oregon State University; Term: Unknown 1989;
Typology: Assignments
1 / 9
This page cannot be seen from the preview
Don't miss anything!






Some basic thoughts:
A debugging methodology: (adoped with changes from: Gansel, The Art of Designing Embedded Systems) -make the bug repeatable -observe the behavior, getting information to isolate the apparent bug -create a suspect list (remain rational in this step) -generate a hypothesis to pinpoint the bug -create an experiment to test the hypothesis -fix the bug -test the fix and then everything else You must have good controlability and obserability into the system.
Bugs that mysteriously go away will mysteriously reappear!
- Find the problem, or your customer will. Random probing will often give some hints as to what is broken. Just as often you will find weird things that are completely normal and think them to be bugs.
If possible, with both new hardware and new software....... -build a little hardware, -write a little software, -test at each step The sure path to frustration is to build all the hardware, write all the software and expect the whole mess to come up and work as expected.
Next, try testing to make sure the segments are connected correctly and that the digits are enabled correctly. int main(){ DDRA = 0xFF; //set port A to all outputs DDRB = 0xF0; //set port bits 47 B as outputs DDRD = 0x00; //set port D all inputs PORTD = 0xFF; //set port D all pullups PORTA = 0x00; //set port A to all zeros while(1){ PORTB = ~PIND; //push button selects segment } //while } //main
Next, try walking through the segments and digits separately. uint16_t i; //big counter uint8_t k, j; //small counters while(1){ k++; j = (k % 5); //j varies from 0 to 4 PORTB = (j << 4); //walk through the digits PORTA = ~0x01; for (i=0; i<100000; i++){} //A PORTA = ~0x02; for (i=0; i<100000; i++){} //B PORTA = ~0x04; for (i=0; i<100000; i++){} PORTA = ~0x08; for (i=0; i<100000; i++){} PORTA = ~0x10; for (i=0; i<100000; i++){} PORTA = ~0x20; for (i=0; i<100000; i++){} PORTA = ~0x40; for (i=0; i<100000; i++){} //G PORTA = ~0x80; for (i=0; i<100000; i++){} //colon } //while