Introduction to PIC-C. Installing PIC-C Goto //sw.e-cpe.org/ Username/pass = guest/cpecmu Download...
-
Upload
diana-houston -
Category
Documents
-
view
220 -
download
0
Transcript of Introduction to PIC-C. Installing PIC-C Goto //sw.e-cpe.org/ Username/pass = guest/cpecmu Download...
![Page 1: Introduction to PIC-C. Installing PIC-C Goto //sw.e-cpe.org/ Username/pass = guest/cpecmu Download and install: IDEUTIL PCWHD.](https://reader035.fdocuments.net/reader035/viewer/2022072111/56649f335503460f94c4fee9/html5/thumbnails/1.jpg)
Introduction toPIC-C
![Page 2: Introduction to PIC-C. Installing PIC-C Goto //sw.e-cpe.org/ Username/pass = guest/cpecmu Download and install: IDEUTIL PCWHD.](https://reader035.fdocuments.net/reader035/viewer/2022072111/56649f335503460f94c4fee9/html5/thumbnails/2.jpg)
Installing PIC-C
Goto http://sw.e-cpe.org/ Username/pass = guest/cpecmu Download and install:
IDEUTIL PCWHD You need the files in registry.zip to register
![Page 3: Introduction to PIC-C. Installing PIC-C Goto //sw.e-cpe.org/ Username/pass = guest/cpecmu Download and install: IDEUTIL PCWHD.](https://reader035.fdocuments.net/reader035/viewer/2022072111/56649f335503460f94c4fee9/html5/thumbnails/3.jpg)
Installing Supporting Sotware GoGo Firmware Downloader
http://www.gogoboard.org – download page
Putty http://files.e-cpe.org/gogo
![Page 4: Introduction to PIC-C. Installing PIC-C Goto //sw.e-cpe.org/ Username/pass = guest/cpecmu Download and install: IDEUTIL PCWHD.](https://reader035.fdocuments.net/reader035/viewer/2022072111/56649f335503460f94c4fee9/html5/thumbnails/4.jpg)
Topics you need to learn
Simple “hello world” Basic I/O, Sensors, Output Control Interrupts
Timer I/O Other
I2C Bus
![Page 5: Introduction to PIC-C. Installing PIC-C Goto //sw.e-cpe.org/ Username/pass = guest/cpecmu Download and install: IDEUTIL PCWHD.](https://reader035.fdocuments.net/reader035/viewer/2022072111/56649f335503460f94c4fee9/html5/thumbnails/5.jpg)
1. Writing a“Hello world” programYou will need to
Configure RS232 on the PIC using the PIC Wizard
Write a simple C program Compile the source to generate a HEX file Download the HEX file to the PIC using the
firmware downloader Use putty to view the output of your program
![Page 6: Introduction to PIC-C. Installing PIC-C Goto //sw.e-cpe.org/ Username/pass = guest/cpecmu Download and install: IDEUTIL PCWHD.](https://reader035.fdocuments.net/reader035/viewer/2022072111/56649f335503460f94c4fee9/html5/thumbnails/6.jpg)
Reflection
What is the spec of your PIC? RAM, EEPROM, Clock Speed
How much ROM/RAM did your program use?
Using PIC-C’s help
![Page 7: Introduction to PIC-C. Installing PIC-C Goto //sw.e-cpe.org/ Username/pass = guest/cpecmu Download and install: IDEUTIL PCWHD.](https://reader035.fdocuments.net/reader035/viewer/2022072111/56649f335503460f94c4fee9/html5/thumbnails/7.jpg)
2. BASIC I/O
Write a program to blink the USER LED
Turn on the USER_LED only when the RUN BUTTON is pressed
Make the board “BEEP”
![Page 8: Introduction to PIC-C. Installing PIC-C Goto //sw.e-cpe.org/ Username/pass = guest/cpecmu Download and install: IDEUTIL PCWHD.](https://reader035.fdocuments.net/reader035/viewer/2022072111/56649f335503460f94c4fee9/html5/thumbnails/8.jpg)
Using Sensors (Analog input):Control the USER_LED with a light sensor Setting up your sensor ports using:
#device adc=10
setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_INTERNAL);
Read from a sensor port using:set_adc_channel(2); // channel = 0-7delay_us(10); // wait for ADC to stabilize
value = read_adc();
![Page 9: Introduction to PIC-C. Installing PIC-C Goto //sw.e-cpe.org/ Username/pass = guest/cpecmu Download and install: IDEUTIL PCWHD.](https://reader035.fdocuments.net/reader035/viewer/2022072111/56649f335503460f94c4fee9/html5/thumbnails/9.jpg)
Exercise II
Write a program that allows the user to turn on/off the USER_LED or BEEP by typing the following commands in putty: ON OFF BEEP