Download presentation
Presentation is loading. Please wait.
Published byBlaze Lucas Carr Modified over 9 years ago
1
Introduction to PIC-C
2
Required Software PIC-C Compiler Firmware Downloader Driver for the USB->Serial Adapter
3
Topics you need to learn Basic I/O, Sensors, Output Control, Simple “hello world” Interrupts Timer I/O Other
4
1. Writing a“Hello world” program You 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 firmware downloader to view the output of your program
5
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
6
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”
7
Using Sensors (Analog input): 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-7 delay_us(10); // wait for ADC to stabilize value = read_adc();
8
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
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.