Programming in C for PCs and PICs - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Programming in C for PCs and PICs

Description:

Compile time compiler traps. Run-time: Divide by zero, Number conversion, No file ... To set conditions on breakpoint operation. To pause the program. ... – PowerPoint PPT presentation

Number of Views:16
Avg rating:3.0/5.0
Slides: 14
Provided by: johnal1
Category:

less

Transcript and Presenter's Notes

Title: Programming in C for PCs and PICs


1
Programming in C for PCs and PICs
  • Contents Term 1
  • Week 1 Introduction The C IDE
  • Week 2 Basic C Code Data types and
    expressions
  • Week 3 - Program Flow 1 Decisions (if)
  • Week 4 - Program Flow 2 , Loops (while)
  • Week 5 Arrays and structures
  • Week 6 Methods
  • Week 7 Debugging
  • Week 8 File Input and Output
  • Week 9 Test

2
Programming in C for PCs and PICs
  • Topics
  • Errors
  • Debug Window
  • Debugger Options
  • Breakpoints
  • Stepping and running program
  • Conditional Breakpoints
  • Debug windows

3
Programming in C for PCs and PICs
  • Errors
  • Your programs will have errors
  • Compile time compiler traps
  • Run-time
  • Divide by zero, Number conversion, No file
  • Logic Errors fault in brain
  • Debugger provides tools to correct errors

4
Programming in C for PCs and PICs
  • Writing to the Debug Window
  • Can write to window
  • Use code
  • System.Diagnostics.Debug.WriteLine(data)
  • Appears in Debug Window
  • Display with DebuggtWindowsgtOutput

5
Programming in C for PCs and PICs
  • 2. Debugger options
  • Run the program to the cursor or breakpoint(s).
  • To view, disable, enable and delete breakpoints.
  • To set conditions on breakpoint operation.
  • To pause the program.
  • To restart in different ways after breakpoint or
    pause.
  • To view, evaluate and modify variables.

6
Programming in C for PCs and PICs
  • 3. Setting breakpoints
  • a) Run to cursor
  • Right-click line choose run to cursor
  • b) Click the line of code - Its highlighted.

7
Programming in C for PCs and PICs
  • 3. Setting breakpoints
  • Run program
  • Program stops, line highlighted in yellow
  • Place cursor over variables to see them

8
Programming in C for PCs and PICs
  • 4. Continuing
  • Inspect variables
  • Run at full speed (F5)
  • Step into code (F10) steps through methods
  • Step over code (F11) runs methods at full speed
  • Step out (ShiftF11)
  • Debug toolbar

9
Programming in C for PCs and PICs
  • Conditional Breakpoints
  • Full version only
  • Break on a pass count and variable values
  • Express edition?
  • Add in your code, e.g
  • if ((loopCounter 34) (variable 123))
  • // set breakpoint here

10
Programming in C for PCs and PICs
  • Debug windows (not all in Express edition)
  • 1. Local displays local variables
  • 2. Watch displays specific variables

11
Programming in C for PCs and PICs
  • Debug windows - 2
  • 3. Immediate Evaluate expressions
  • 4. Call stack how did we get here?

12
Programming in C for PCs and PICs
  • Summary
  • Errors
  • Debug Window
  • Debugger Options
  • Breakpoints
  • Stepping and running program
  • Conditional Breakpoints
  • Debug windows

13
Programming in C for PCs and PICs
  • If you want to, try it now. Do
  • Week 7 tasks at
  • www.det.mmu.ac.uk/staff/allwork
Write a Comment
User Comments (0)
About PowerShow.com