Mark A Carter
Newbie level 1
- Joined
- Nov 6, 2013
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Location
- Vail Arizona
- Activity points
- 12
I am trying to get the exercise B under the "USB Master Exercise Book" function.
:-?
Dear programmers.
I am trying to get the exercise B under the "USB Master Exercise Book" to function. Under the FURTHER STUDY section of the book to write a MACRO called "delay_seconds" from the CCS compiler company.
I am a novice C programmer just starting out.
It should turn on the Green LED D5 for five seconds then turn it off for five seconds then turn on the Yellow D1 LED for one second then turn it off for one second then finally turn the RED LED D0 on for five seconds then turn it off for five seconds then this program repeats this sequence. Please see my code below. I have attempted this exercise using an example code clip from a CCS compiler help topic. This work is done on the CCS Company PIC18F67J10 trainer PCB. My IDE version is 5.013 . I have included a Zipped file of the C code.
This is my first request for help under the general computer forum.
Thank you for your help.
Mark A Carter, KD7PHW, markcarter57@yahoo.com.
_____________________________________________________________
:-?
Dear programmers.
I am trying to get the exercise B under the "USB Master Exercise Book" to function. Under the FURTHER STUDY section of the book to write a MACRO called "delay_seconds" from the CCS compiler company.
I am a novice C programmer just starting out.
It should turn on the Green LED D5 for five seconds then turn it off for five seconds then turn on the Yellow D1 LED for one second then turn it off for one second then finally turn the RED LED D0 on for five seconds then turn it off for five seconds then this program repeats this sequence. Please see my code below. I have attempted this exercise using an example code clip from a CCS compiler help topic. This work is done on the CCS Company PIC18F67J10 trainer PCB. My IDE version is 5.013 . I have included a Zipped file of the C code.
This is my first request for help under the general computer forum.
Thank you for your help.
Mark A Carter, KD7PHW, markcarter57@yahoo.com.
_____________________________________________________________
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
void delay_seconds(int n) {
for (;n!=0;n--) {
delay_ms (1000);
}
}
#define delay_seconds(n)
void main () {
while (TRUE) {
output_low (GREEN_LED);
delay_seconds (5);
output_high (GREEN_LED);
delay_seconds (5);
output_low (YELLOW_LED);
delay_seconds (1);
output_high (YELLOW_LED);
delay_seconds (1);
output_low (RED_LED);
delay_seconds (5);
output_high (RED_LED);
delay_seconds (5);
}
}
Attachments
Last edited by a moderator: