CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Working code for the exercise B in to USB Master book.

 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
Mark A Carter



Joined: 28 Aug 2011
Posts: 5
Location: Vail Arizona USA

View user's profile Send private message Send e-mail Yahoo Messenger

Working code for the exercise B in to USB Master book.
PostPosted: Wed Nov 06, 2013 11:54 pm     Reply with quote

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 Smile
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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group