Mark A Carter
Joined: 28 Aug 2011 Posts: 5 Location: Vail Arizona USA
|
Working code for the exercise B in to USB Master book. |
Posted: Wed Nov 06, 2013 11:54 pm |
|
|
Dear programers.
This blinks the three LEDs contained in the PIC18F67J10 trainer PCB.
This is a working example to do the question B under the FURTHER STUDY section.
Thank you.
Mark A Carter
Code: |
#include <18F67J10.h>
#device ICD=TRUE
#fuses HS,NOWDT
#use delay (clock=10000000)
#define GREEN_LED PIN_D5
#define YELLOW_LED PIN_D1
#define RED_LED PIN_D0
#define delay_in_seconds delay_seconds
void delay_seconds(int n) {
for (;n!=0;n--) {
delay_ms (1000);
}
}
void main () {
while (TRUE) {
output_low (GREEN_LED);
delay_in_seconds (5);
output_high (GREEN_LED);
delay_in_seconds (5);
output_low (YELLOW_LED);
delay_in_seconds (1);
output_high (YELLOW_LED);
delay_in_seconds (1);
output_low (RED_LED);
delay_in_seconds (5);
output_high (RED_LED);
delay_in_seconds (5);
}
}
|
_________________ Mark A Carter
KD7PHW |
|