'---------------Title-------------- ' File......pic_as_sink.pbp ' Started....7/7/09 ' Microcontroller used: Microchip Technology 16F88 ' microchip.com ' PicBasic Pro Code: micro-Engineering Labs, Inc. ' melabs.com '--------Program Desciption-------- ' PIC acts a sink and turns on LED on for 2 second, then ' turns off the LED for 100 msec. '----------Related Lesson---------- ' pic_as_sink.pbp is used in the lesson Source and Sink Outputs / ' Active High and Low Inputs at: ' http://www.cornerstonerobotics.org/curriculum/lessons_year2/erii19_active_high_active_low.pdf '----------PIC Connections--------- ' 16F88 Pin Wiring ' --------- ---------- ' RB0 LED to 150 Ohm resistor to +5 V ' RB4 4.7K Resistor to +5 V ' RB5 Ground ' RB14 +5 V '-----------Initialization--------- TRISB = %11111110 ' Sets up RB0 pin of PORTB as an output ' and pins RB7-RB1 of PORTB as inputs OSCCON = $60 ' Sets the internal oscillator in the ' 16F88 to 4 MHz '-------------Main Code------------ loop: ' Label for beginning loop high 0 ' Sets pin PORTB.0,(RB0), output at HIGH (+5 volts) Pause 100 ' Pause 100 milliseconds (0.1 seconds) with LED off low 0 ' Sets pin PORTB.0,(RB0), output at LOW (0 volts) Pause 2000 ' Pause 2000 milliseconds (2 second) with LED on GoTo loop ' Jump to loop label ' Makes the program run forever. End