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.

Support Forum » Problems uploading

January 15, 2011
by Jalex
Jalex's Avatar

When I put my programming switch to program mode and type make in the command line I get a can't find device path error. I changed the make file to Com3 as per device manager. If I turn it on when it's plugged into the computer the original display comes on the LCD but it doesn't scroll. After I unplug it and switch back to run it works fine and scrolls like the fist run. If I change the programming switch when it's unplugged it goes to black lines and I think that's what it's supposed to do. If I boot the computer while it has the black lines they stay there but it still says Device path not found error.

January 15, 2011
by Jalex
Jalex's Avatar

I forgot to say I am running Windows 7. I also remember most my dos commands except how to access file and folder names longer than 8 characters so that's making a little hard as well.

January 16, 2011
by Rick_S
Rick_S's Avatar

Could you post a screenshot of what you are seeing? To do that, press (ALT PrtScrn) at the same time then open paint and paste it in.

As for DOS commands, Windows 7 uses a command shell interpretor, its really just a dos look alike shell. It understands filenames and folders longer than the old 8.3 layout.

Things to double check.

  1. Double check your com port to be sure it is still at com3
  2. When modifying the makefile for your com port be sure to replace the entire /dev/ttyUSB0 with your com port like this:

    AVRDUDEFLAGS=-c avr109 -p m168 -b 115200 -P /dev/ttyUSB0

    Would become

    AVRDUDEFLAGS=-c avr109 -p m168 -b 115200 -P com3

(assuming com3 is your port)

Also, to program the micro, you flip the switch to program mode, then disconnect power from the micro and re-connect power to the micro. At that point, you should see two black bars on your LCD indicating the micro is now in program mode. At that point, you would run make on your pc to compile and send the program to the micro. When it's finished, you flip the program switch back, again disconnect then reconnect power to run your program.

Rick

January 16, 2011
by Jalex
Jalex's Avatar

Hi Rick Well it looks like I did that wrong. That could be it. I just chnaged The '-P /dev/ttyUSB0 To '-P /dev/ttyUSB3 Like so. Thanks a lot. I do have to 2 black bard while running Make. I am running the micro from the 5V regulator while programming and the red wire from the USB cable is not connected to anything and the black wire is to the ground rail. This should work, right? Jim

January 16, 2011
by Jalex
Jalex's Avatar

Hi Again Rick Could you help with some code? I wrote this to read an external comparitor circuit that goes high when the voltage drops below .7 volts. There is an RC of 40pf trimmer and 1.5 meg ohn resistor on it's input. There is something wrong with the lase line and I don't see it.

Result = 0; // Turn on PC4 PORTC |= (1<<PC4); delay_ms(5); //turn PC4 back off PORTC &= ~(1<<PC4); // Count to 180 only when PC5 is low while (Result < 180) && (PINC & (1<<PC5)) { Result ++; } // If IR is on then add the difference to 180 // This should make it keep counting as the trimmer goes around the back side and the IR senses when the trimmer is fully meshed. if (PINC & (1<<PC6) = 1) { Result = (180 - Result) + 180; } I know the timimg may be way off but I just wanted to see if the idea would work.

January 16, 2011
by Rick_S
Rick_S's Avatar

I think this is what you posted:

Result = 0;

// Turn on PC4 
PORTC |= (1<<PC4); 
delay_ms(5);

//turn PC4 back off 
PORTC &= ~(1<<PC4);

// Count to 180 only when PC5 is low

while (Result < 180) && (PINC & (1<<PC5)) 
{ 
Result ++; } 
// If IR is on then add the difference to 180 
// This should make it keep counting as the trimmer goes around the back side and the IR senses when the trimmer is fully meshed.

if (PINC & (1<<PC6) = 1) 
{ Result = (180 - Result) + 180; 
}

You lost me at what you are trying to achieve with this.

If you are having trouble in your if statement, you might try putting the bitwise operation in it's own parenthesis like this:

if((PINC & (1<<PC6)) == 1)

That will ensure the bitwise and is done before the comparison to 1 - Plus I think you need the double equal there. For that matter, you could even reduce it to

if (PINC & (1<<PC6))

because if it equals 1 it is true otherwise false.

BTW, someone please correct me if I made any errors... As I've said before, I'm no expert, just try to help if I can. :)

January 16, 2011
by Jalex
Jalex's Avatar

Hi Rick I want to thank you for the help. That cured the upload problem. Now I am getting somewhere. Can I format that code better somehow so it's easier to read?

January 16, 2011
by Rick_S
Rick_S's Avatar

Yep, highlight the code you are posting, then click on the Indent Selection as Code Block button below.

January 16, 2011
by Jalex
Jalex's Avatar

Hi Rick Ok I am using 3 pins. 1 output and two input. I want it to charge the RC and count the time it takes to dischage. Hopefully it will be somewhere around 180. Then is the IR pin is high I want to add the difference(180-result)+180 giving me 180 to 360. Thanks again Jim

January 16, 2011
by Jalex
Jalex's Avatar

Ok Rick I won't post code like that again, Thank you I see what you say about the ()'s I think I tried the double -- and the compiler still said it was wrong. It could have been because the () was wrong too.

January 16, 2011
by Jalex
Jalex's Avatar

Hi again I have one more question. Can I run the make to test the compile without having the micro plugged into the USB just to see if the code is alright?

January 16, 2011
by Jalex
Jalex's Avatar

Thanks Rick for all your help. I am writing programs now and they are working. If I brush up a little more on my C I will have it. Jim

Post a Reply

Please log in to post a reply.

Did you know that multiple MOSFETs can be used in parallel to switch bigger currents on and off? Learn more...