|
|
View previous topic :: View next topic |
Author |
Message |
Thomas Umble Guest
|
can't get ICD demo to work |
Posted: Wed Jul 09, 2003 5:36 pm |
|
|
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 |
Posted: Wed Jul 09, 2003 6:31 pm |
|
|
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
|
Re: can't get ICD demo to work |
Posted: Wed Jul 09, 2003 7:34 pm |
|
|
:=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 |
Posted: Thu Jul 10, 2003 2:11 pm |
|
|
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 |
|
|
|
|
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
|