Code - #include<16F877.h>#include#fuses HS NOWDT...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <16F877.h> #include <stdio.h> #fuses HS, NOWDT, NOPROTECT, NOPUT, NOBROWNOUT #use delay(clock=8000000) #use rs232(baud=9600,xmit=PIN_c6, rcv=PIN_C7, PARITY=N, BITS=8) void main() { float arraya[6]; float arrayb[6]; int i; float max,stmp; float valuea; float valueb; float valuec; float valued; float valuee; float valuef; printf( "#1 p1300 t3000 \n\r" ); // move servo 1 to initial position delay_ms(8000); // delay for 8000 milliseconds while (1) { printf( "#0 p750 t3000 \n\r" ); //move servo 2 to first position delay_ms(8000); set_tris_a(0xff); setup_adc_ports(ALL_ANALOG); setup_adc(adc_clock_internal); set_adc_channel(1); valuea=read_adc(); // To read in the analog values from the solar panel, which is attached to pin RA1/AN1 of the PIC 16F877, and convert analog to digital. arraya[0]=arrayb[0]=valuea; printf( "#0 p1000 t3000 \n\r" ); //move servo 2 to second position delay_ms(8000); set_tris_a(0xff); setup_adc_ports(ALL_ANALOG); setup_adc(adc_clock_internal); set_adc_channel(1);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Code - #include<16F877.h>#include#fuses HS NOWDT...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online