NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » what do these errors mean?

July 27, 2010
by cinta51
cinta51's Avatar

"make.exe" all make -C ../libnerdkits make[1]: Entering directory C:/Documents and Settings/HP_Administrator/My Documents/clockWithInputAndBuzzer/libnerdkits' make[1]: Nothing to be done forall'. make[1]: Leaving directory `C:/Documents and Settings/HP_Administrator/My Documents/clockWithInputAndBuzzer/libnerdkits' avr-gcc -g -Os -Wall -mmcu=atmega168 -Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm -o clockWithInputAndBuzzer.o clockWithInputAndBuzzer.c ../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o avr-objcopy -j .text -O ihex clockWithInputAndBuzzer.o clockWithInputAndBuzzer.hex avrdude -c avr109 -p m168 -b 115200 -P /dev/ttyUSB0 -U flash:w:clockWithInputAndBuzzer.hex:a avrdude: ser_open(): can't open device "/dev/ttyUSB0": The system cannot find the path specified.

make.exe: *** [clockWithInputAndBuzzer-upload] Error 1

July 27, 2010
by cinta51
cinta51's Avatar

sorry I should add in the other stuff lol.

here is the makefile: GCCFLAGS=-g -Os -Wall -mmcu=atmega168 LINKFLAGS=-Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm AVRDUDEFLAGS=-c avr109 -p m168 -b 115200 -P /dev/ttyUSB0 LINKOBJECTS=../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o

all: clockWithInputAndBuzzer-upload

clockWithInputAndBuzzer.hex: clockWithInputAndBuzzer.c make -C ../libnerdkits avr-gcc ${GCCFLAGS} ${LINKFLAGS} -o clockWithInputAndBuzzer.o clockWithInputAndBuzzer.c ${LINKOBJECTS} avr-objcopy -j .text -O ihex clockWithInputAndBuzzer.o clockWithInputAndBuzzer.hex

clockWithInputAndBuzzer.ass: clockWithInputAndBuzzer.hex avr-objdump -S -d clockWithInputAndBuzzer.o > clockWithInputAndBuzzer.ass

clockWithInputAndBuzzer-upload: clockWithInputAndBuzzer.hex avrdude ${AVRDUDEFLAGS} -U flash:w:clockWithInputAndBuzzer.hex:a

here is the program:

// clockWithInputAndBuzzer.c // for NerdKits with ATmega168 // mrobbins@mit.edu

define F_CPU 14745600

define FEED_HOUR_A 15

define FEED_MIN_A 0

define FEED_HOUR_B 18

define FEED_MIN_B 0

define FEED_HOUR_C 21

define FEED_MIN_C 0

define ALERT_SECONDS 10 /how many seconds should the buzzer sound /

include <stdio.h>

include <stdlib.h>

include <avr/io.h>

include <avr/interrupt.h>

include <avr/pgmspace.h>

include <inttypes.h>

include "../libnerdkits/delay.h"

include "../libnerdkits/lcd.h"

include "../libnerdkits/uart.h"

// PIN DEFINITIONS: void realtimeclock_setup() { // setup Timer0: // CTC (Clear Timer on Compare Match mode) // TOP set by OCR0A register TCCR0A |= (1<<WGM01); // clocked from CLK/1024 // which is 14745600/1024, or 14400 increments per second TCCR0B |= (1<<CS02) | (1<<CS00); // set TOP to 143 // because it counts 0, 1, 2, ... 142, 143, 0, 1, 2 ... // so 0 through 143 equals 144 events OCR0A = 143; // enable interrupt on compare event // (14400 / 144 = 100 per second) TIMSK0 |= (1<<OCIE0A); }

// the_time will store the elapsed time // in hundredths of a second. // (100 = 1 second) // // note that this will overflow in approximately 248 days! // // This variable is marked "volatile" because it is modified // by an interrupt handler. Without the "volatile" marking, // the compiler might just assume that it doesn't change in // the flow of any given function (if the compiler doesn't // see any code in that function modifying it -- sounds // reasonable, normally!). // // But with "volatile", it will always read it from memory // instead of making that assumption. volatile int32_t the_time;

SIGNAL(SIG_OUTPUT_COMPARE0A) { // when Timer0 gets to its Output Compare value, // one one-hundredth of a second has elapsed (0.01 seconds). the_time++; }

void speaker_off() { TCCR1A &= ~(1<<COM1A0); }

void speaker_on() { TCCR1A |= (1<<COM1A0); }

int main() { realtimeclock_setup(); uint8_t hours=0; uint8_t minutes=0; uint8_t seconds=0; // init lcd lcd_init(); FILE lcd_stream = FDEV_SETUP_STREAM(lcd_putchar, 0, _FDEV_SETUP_WRITE); lcd_home();

// init serial port uart_init(); FILE uart_stream = FDEV_SETUP_STREAM(uart_putchar, uart_getchar, _FDEV_SETUP_RW); stdin = stdout = &uart_stream;

// Set the 6 pins to input mode - Two 3 bit numbers

DDRC &= ~(1<<PC0); // set PC0 as input DDRC &= ~(1<<PC1); // set PC1 as input DDRC &= ~(1<<PC2); // set PC2 as input DDRC &= ~(1<<PC3); // set PC3 as input DDRC &= ~(1<<PC4); // set PC4 as input DDRC &= ~(1<<PC5); // set PC5 as input

// turn on the internal resistors for the pins

PORTC |= (1<<PC0); // turn on internal pull up resistor for PC0 PORTC |= (1<<PC1); // turn on internal pull up resistor for PC1 PORTC |= (1<<PC2); // turn on internal pull up resistor for PC2 PORTC |= (1<<PC3); // turn on internal pull up resistor for PC3 PORTC |= (1<<PC4); // turn on internal pull up resistor for PC4 PORTC |= (1<<PC5); // turn on internal pull up resistor for PC5

// declare the variables to represent each bit, of our two 3 bit numbers uint8_t h1n=0,h1p=0; uint8_t h2n=0,h2p=0; uint8_t m1n=0,m1p=0; uint8_t m2n=0,m2p=0; uint8_t s1n=0,s1p=0; uint8_t s2n=0,s2p=0;

uint8_t buzzer=0; / we set buzzer =1 when buzzer is active and 0 when inactive / /we use it to check when to turn off the buzzer /

// turn on interrupt handler sei();

while(1) {

/* CODE to set the time
When we set one pin on dip switch to ON
we are adding a digit to the position of the clock that it represends
For example h1 is the position of the first digit that represends the hours
For 19:07:01
h1 is 1
h2 is 9
We use h1n and h1p to check what was the previous state of the switch.
If we didn't use it then at every cycle of the while loop we would be increasing the hours
We only want to increase when the switch moves from OFF to ON and only once for this change.
To increase again the switch must go to OFF and then ON again.
*/
h1n = (PINC & (1<<PC0)) >> PC0;
if(h1n == 1 && h1p == 0){ /* switch went from OFF to ON */
    h1p=1;
    hours=hours+10; /* we add 10 instead of 1 because it is the first digit*/
}
if(h1n == 0 && h1p ==1) /* switch went from ON to OFF */
    h1p=0;

h2n = (PINC & (1<<PC1)) >> PC1;
if(h2n == 1 && h2p == 0){
    h2p=1;
    hours=hours+1;
}
if(h2n == 0 && h2p ==1)
    h2p=0;

m1n = (PINC & (1<<PC2)) >> PC2;
if(m1n == 1 && m1p == 0){
    m1p=1;
    minutes=minutes+10;
}
if(m1n == 0 && m1p ==1)
    m1p=0;

m2n = (PINC & (1<<PC3)) >> PC3;
if(m2n == 1 && m2p == 0){
    m2p=1;
    minutes=minutes+1;
}
if(m2n== 0 && m2p ==1)
    m2p=0;

s1n = (PINC & (1<<PC4)) >> PC4;
if(s1n == 1 && s1p == 0){
    s1p=1;
    seconds=seconds+10;
}
if(s1n == 0 && s1p ==1)
    s1p=0;

s2n = (PINC & (1<<PC5)) >> PC5;
if(s2n == 1 && s2p == 0){
    s2p=1;
    seconds=seconds+1;
}
if(s2n== 0 && s2p ==1)
    s2p=0;

/* END of dip switches code section for setting the time */

/* when the_time is equal to 100 then one second has passed */
if(the_time==100){
    seconds++;
    the_time=0; /* we reset in order to count up to 100 again for the next second */
}

if(seconds>=60){ /* we checks if seconds are >= 60 because the dip switch might increase over 60 */
    minutes++;
    seconds=seconds-60; /* we subtrace 60 in case seconds were 54 for example and we set dipswitch for s1 to ON and have added 10 seconds. 54+10=64. So we increase minutes by 1 and 64-60 we are back to 4 seconds*/
}
if(minutes>=60){
    hours++;
    minutes=minutes-60;
}
if(hours>=24){
    hours=hours-24;
}
lcd_home();
fprintf_P(&lcd_stream, PSTR("Time is %2d:%2d:2d\n"), hours,minutes,seconds);
if(!buzzer && (( hours == FEED_HOUR_A && minutes == FEED_MIN_A ) || ( hours == FEED_HOUR_B && minutes == FEED_MIN_B ) || ( hours == FEED_HOUR_C && minutes == FEED_MIN_C ) ) && seconds <= ALERT_SECONDS){
    buzzer=1;
    speaker_on();
    fprintf_P(&lcd_stream, PSTR("Feeding time!!!\n"));
}
else if( buzzer && seconds > ALERT_SECONDS){
    buzzer=0;
    speaker_off();
    fprintf_P(&lcd_stream, PSTR("Timer: %9.2f sec"), (double) the_time / 100.0);
}
else{
    fprintf_P(&lcd_stream, PSTR("Timer: %9.2f sec"), (double) the_time / 100.0);
}
//fprintf_P(&lcd_stream, PSTR("Time is %2d:%2d:2d"), hours,minutes,seconds);
//fprintf_P(&lcd_stream, PSTR("Timer: %9.2f sec"), (double) the_time / 100.0);

}

return 0; }

July 27, 2010
by hevans
(NerdKits Staff)

hevans's Avatar

Hi cinta51,

The error you are getting:

ser_open(): can't open device "/dev/ttyUSB0"

means that you have not selected the correct port for your USB programming cable in your Makefile. From the looks if it appears that you are on windows, so your Makefile should have something like COM2 or 3 depending on what your computer assigned the cable instead of "/dev/ttyUSB0". Hope that fixes it.

Humberto

July 27, 2010
by Ralphxyz
Ralphxyz's Avatar

This will also cause a problem:

"define ALERT_SECONDS 10 /how many seconds should the buzzer sound /"

I think you meant:

"define ALERT_SECONDS 10 /how many seconds should the buzzer sound /

Ralph

July 27, 2010
by bretm
bretm's Avatar

It's the forum software turning asterisks into italics, in both of your posts. It's clear he knows the syntax for comments.

July 27, 2010
by cinta51
cinta51's Avatar

OMG now I feel dumb lol, yeah I did add the COM4 and it worked fine. thankyou very much

July 28, 2010
by Ralphxyz
Ralphxyz's Avatar

I certainly did not mean to imply that cinta51 did not know the syntax for comments. I know for me a simple syntax error sometimes will slip by.

As for the idiosyncrasies of the forum software thanks for pointing that behavior out, it would be so nice to have a [code] facility.

Ralph

July 28, 2010
by bretm
bretm's Avatar

It looks like they just added a button to do that.

/* Let's try it out */
July 28, 2010
by Rick_S
Rick_S's Avatar

This is

AWESOME

This will make posting of code MUCH easier...

THANKS!!

July 28, 2010
by hevans
(NerdKits Staff)

hevans's Avatar

Hi Rick, Bret, Ralph, and cinta51,

I am glad you guys are enjoying the new magical indent button. Please send us an email at support <at> nerdkits <dot> com if you encounter any strange side effects or bugs with the new button.

Humberto

July 28, 2010
by Rick_S
Rick_S's Avatar

So far so good with the button, Already used it in another thread.

Post a Reply

Please log in to post a reply.

Did you know that NerdKits make a great parent/child activity? Learn more...