APSC 160 Chapter 5: DAQ and Strings

3 Pages
Unlock Document

University of British Columbia
Applied Science
APSC 160
Jonatan Schroeder

APSC 160 Mar 3 Mar 3 DAQ (Data Acquisition) or Hardware Module - Sensors, user input or devices to get data acquisition - Processing; c programming or spreadsheets Hardware Module: two-part arm; sensors, toggle switches and display DAQ Functions Library Functions: setupDAQ() and continueSuperLoop() : used for initialization control of the flow of the program o Setup is like fopen, continue is like fscanf digitalRead() and digitalWrite() o Used for IO to read from a digital input or write to a digital output device (reads only 0 FALSE or 1 TRUE) o Digitalread is like fscanf, digitalwrite is like fprintf #include If( setupDAQ(setupNum) == TRUE) testing to see if the DAQ is working // Else Printf(“error”); Super loop Int continueSuperLoop(void); - Function tells us if the user wants to continue or quit program While( continrueSuperLoop() == TRUE ){ //stuff } Continue to loop until program is stoped, like fscanf in files which continues as long as there numbers to be scanned DigitalRead#define SWITCH 0 Int switch_status Switch_status = digitalRead(SWITCH) Turn on LED #define ON 1 digitalWrite(LED,ON) 7 Segment Displays Using binary and demical 1111111 and 0000000, decimal 0 to 255 - Each number is a byte, 8 bits - Writing LEDs DisplayWrite Void DisplayWrite( int data, int position) Data: value determines which segment of the byte to turn on or off, range of 0 to 255 Position: which LED to turn on, right most is 0 position increasing to 7 to the left - Use arrays to store values static in digits[] = {} - Look up table o Digits[n] find the digit n Controlling Timing - Perform certain activities at specific time intervals, like a traffic light - Sleep( ) suspend
More Less

Related notes for APSC 160

Log In


Don't have an account?

Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.