Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "16F690_Test1.h"
- int16 value;
- void main() {
- setup_adc_ports(sAN0 | VSS_VDD);
- setup_adc(ADC_CLOCK_DIV_64);
- setup_spi(SPI_SS_DISABLED);
- setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
- setup_timer_1(T1_DISABLED);
- setup_timer_2(T2_DISABLED,0,1);
- setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
- setup_oscillator(OSC_8MHZ);
- while(TRUE) {
- set_adc_channel(0);
- value = read_adc();
- delay_us(100); //Give time for conversion to complete
- output_c((int8) (value >> 6)); //Shift 4 MSBs into lower nibble
- delay_us(40); //Simulate PWM to dim LEDs
- output_c(0x00);
- delay_us(10);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement