NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Using strcpy
December 19, 2012 by Nichben |
I got the following to work in Cywin C++ but not on my Atmega168. It stops at the conditional statment. Please have a look and see what's happening. this is section of code from my program to operate a bipolar stepper motor. I've modified it to leave out the strcopy and it works fine but I just want to get the strcpy to work on my atmega168. Thanks,JB
|
---|---|
December 19, 2012 by pcbolt |
JB - You might need "dc" to be 4 bytes long. I think "strcpy" adds the trailing '0' (string terminator) to the array. I've had trouble assigning quoted strings sometimes as well. You could try using the <avr/pgmspace.h> function "strcpy_P()" like this:
Haven't tried it but it might be worth a shot. There's also a line in your makefile that you could try changing...see This Thread for more details. |
December 20, 2012 by Nichben |
PC- I actually tried your second suggestion and followed the link 'This Thread'. One of the posts suggested substituting this line in the makefile:
with this one:
I suspected something in the Make and that's why I tried this first. It now works great. Many thanks! JB |
Please log in to post a reply.
Did you know that one NerdKits customer controlled a laser pointer with his computer using a microcontroller? Learn more...
|