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

can't get ICD demo to work

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Thomas Umble
Guest







can't get ICD demo to work
PostPosted: Wed Jul 09, 2003 5:36 pm     Reply with quote

Can't understand why this will not compile. Any help would be appreciated. This is out of the Development Kit Exercise Book section 4 (EX4A.c)
tom

#include <16f877.h>
#device ICD=TRUE
#fuses HS,NOLVP,NOWDT,PUT
#use delay (clock=20000000)
#define GREEN_LED PIN_A5
#define YELLOW_LED PIN_B4
#define RED_LED PIN_B5
#define PUSH_BUTTON PIN_A4

typedef enum colors {GREEN, YELLOW, RED} ;

light_one_led(colors) {
output_high (GREEN_LED);
output_high (YELLOW_LED);
output_high (RED_LED);
switch (colors) {
case GREEN : output_low(GREEN_LED); break;
case YELLOW : output_low (YELLOW_LED); break;
case RED : output_low (RED_LED); break;
}
}

wait_for_one_press() {
while(input (PUSH_BUTTON));
delay_ms(100);
while(!input(PUSH_BUTTON));
}


main(){
while (true){
light_one_led (GREEN);
wait_for_one_press ();
light_one_led (YELLOW);
wait_for_one_press ();
light_one_led (RED);
wait_for_one_press ();
}
}
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515827
Bill Turnip
Guest







Re: can't get ICD demo to work
PostPosted: Wed Jul 09, 2003 6:31 pm     Reply with quote

Tom -

I don't have the book or kit you refer to, but exactly what error message do you get? Also, is the value of "true" defined somewhere?

Bill



:=Can't understand why this will not compile. Any help would be appreciated. This is out of the Development Kit Exercise Book section 4 (EX4A.c)
:=tom
:=
:=#include <16f877.h>
:=#device ICD=TRUE
:=#fuses HS,NOLVP,NOWDT,PUT
:=#use delay (clock=20000000)
:=#define GREEN_LED PIN_A5
:=#define YELLOW_LED PIN_B4
:=#define RED_LED PIN_B5
:=#define PUSH_BUTTON PIN_A4
:=
:=typedef enum colors {GREEN, YELLOW, RED} ;
:=
:=light_one_led(colors) {
:= output_high (GREEN_LED);
:= output_high (YELLOW_LED);
:= output_high (RED_LED);
:= switch (colors) {
:= case GREEN : output_low(GREEN_LED); break;
:= case YELLOW : output_low (YELLOW_LED); break;
:= case RED : output_low (RED_LED); break;
:= }
:=}
:=
:=wait_for_one_press() {
:= while(input (PUSH_BUTTON));
:= delay_ms(100);
:= while(!input(PUSH_BUTTON));
:=}
:=
:=
:=main(){
:= while (true){
:= light_one_led (GREEN);
:= wait_for_one_press ();
:= light_one_led (YELLOW);
:= wait_for_one_press ();
:= light_one_led (RED);
:= wait_for_one_press ();
:= }
:=}
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515828
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: can't get ICD demo to work
PostPosted: Wed Jul 09, 2003 7:34 pm     Reply with quote

:=Can't understand why this will not compile. Any help would be appreciated. This is out of the Development Kit Exercise Book section 4 (EX4A.c)
:=tom
:=
:=#include <16f877.h>
:=#device ICD=TRUE
:=#fuses HS,NOLVP,NOWDT,PUT
:=#use delay (clock=20000000)
:=#define GREEN_LED PIN_A5
:=#define YELLOW_LED PIN_B4
:=#define RED_LED PIN_B5
:=#define PUSH_BUTTON PIN_A4
:=

Change the line below to this:
typedef enum {GREEN, YELLOW, RED} colors;
:=typedef enum colors {GREEN, YELLOW, RED} ;

Change the line below to this:
light_one_led(colors value) {

:=light_one_led(colors) {
:= output_high (GREEN_LED);
:= output_high (YELLOW_LED);
:= output_high (RED_LED);

Change the next line to this:
switch (value) {

:= switch (colors) {
:= case GREEN : output_low(GREEN_LED); break;
:= case YELLOW : output_low (YELLOW_LED); break;
:= case RED : output_low (RED_LED); break;
:= }
:=}
:=
:=wait_for_one_press() {
:= while(input (PUSH_BUTTON));
:= delay_ms(100);
:= while(!input(PUSH_BUTTON));
:=}
:=
:=
:=main(){
:= while (true){
:= light_one_led (GREEN);
:= wait_for_one_press ();
:= light_one_led (YELLOW);
:= wait_for_one_press ();
:= light_one_led (RED);
:= wait_for_one_press ();
:= }
:=}
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515829
Thomas Umble
Guest







Re: can't get ICD demo to work
PostPosted: Thu Jul 10, 2003 2:11 pm     Reply with quote

Thankyou very much. IT WORKS! I don't understand it, but it works.

Tom




:=:=Can't understand why this will not compile. Any help would be appreciated. This is out of the Development Kit Exercise Book section 4 (EX4A.c)
:=:=tom
:=:=
:=:=#include <16f877.h>
:=:=#device ICD=TRUE
:=:=#fuses HS,NOLVP,NOWDT,PUT
:=:=#use delay (clock=20000000)
:=:=#define GREEN_LED PIN_A5
:=:=#define YELLOW_LED PIN_B4
:=:=#define RED_LED PIN_B5
:=:=#define PUSH_BUTTON PIN_A4
:=:=
:=
:=Change the line below to this:
:= typedef enum {GREEN, YELLOW, RED} colors;
:=:=typedef enum colors {GREEN, YELLOW, RED} ;
:=
:=Change the line below to this:
:= light_one_led(colors value) {
:=
:=:=light_one_led(colors) {
:=:= output_high (GREEN_LED);
:=:= output_high (YELLOW_LED);
:=:= output_high (RED_LED);
:=
:=Change the next line to this:
:= switch (value) {
:=
:=:= switch (colors) {
:=:= case GREEN : output_low(GREEN_LED); break;
:=:= case YELLOW : output_low (YELLOW_LED); break;
:=:= case RED : output_low (RED_LED); break;
:=:= }
:=:=}
:=:=
:=:=wait_for_one_press() {
:=:= while(input (PUSH_BUTTON));
:=:= delay_ms(100);
:=:= while(!input(PUSH_BUTTON));
:=:=}
:=:=
:=:=
:=:=main(){
:=:= while (true){
:=:= light_one_led (GREEN);
:=:= wait_for_one_press ();
:=:= light_one_led (YELLOW);
:=:= wait_for_one_press ();
:=:= light_one_led (RED);
:=:= wait_for_one_press ();
:=:= }
:=:=}
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515857
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion 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