Click here to Skip to main content
15,887,340 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to write Binary data to a file???? Pin
Fiona101122-Apr-09 21:04
Fiona101122-Apr-09 21:04 
GeneralRe: How to write Binary data to a file???? Pin
Cedric Moonen22-Apr-09 20:12
Cedric Moonen22-Apr-09 20:12 
GeneralRe: How to write Binary data to a file???? Pin
David Crow23-Apr-09 2:58
David Crow23-Apr-09 2:58 
GeneralRe: How to write Binary data to a file???? Pin
Cedric Moonen23-Apr-09 3:08
Cedric Moonen23-Apr-09 3:08 
GeneralRe: How to write Binary data to a file???? Pin
David Crow23-Apr-09 3:20
David Crow23-Apr-09 3:20 
QuestionRe: How to write Binary data to a file???? Pin
David Crow23-Apr-09 2:57
David Crow23-Apr-09 2:57 
QuestionHow to determine the Width of a Multiline Rich edit Control Pin
ForNow22-Apr-09 14:06
ForNow22-Apr-09 14:06 
Questionswarm robot motor question Pin
ic3e22-Apr-09 13:19
ic3e22-Apr-09 13:19 
This program is for our motor engine.
include

int main(0)
while(1)
{

//do{

PORTA = 0xFF;
PORTB = 0xFF; //Turn all port D on



}

return(0);
}

void ioinit (void)
{
// 1 = output, 0 = input
DDRA = 0b11111111; //All outputs
DDRB = 0b11111111; //All outputs
return 0;
}




since me and my parter are relativly new to programming, we both looked at the sensor board program at the bottom of this page and made a few adjustments. what we want our engine to do is to just turn on and run. unlike the the program down below that had the lights on the sensor board flick on and off repeatedly. our circuit board only have 2 ports, A and B. so does this look correct?


5-10-07
Copyright Spark Fun Electronics© 2007
Nathan Seidle
nathan at sparkfun.com

ATmega168

Example Blink
Toggles all IO pins at 1Hz
*/

#include

//Define functions
//======================
void ioinit(void); //Initializes IO
void delay_ms(uint16_t x); //General purpose delay
//======================

int main (void)
{ int stepval=0;
ioinit(); //Setup IO pins and defaults

while(1)
{

do{
PORTC = 0xFF;
PORTB = 0xFF;
PORTD = stepval;
delay_ms(1000);
stepval+=(0x20);
}
while(stepval<0xE0);
do
{
PORTC = 0x00;
PORTB = 0x00;
PORTD = stepval;
delay_ms(1000);
stepval-=(0x20);
}
while(stepval>0);




}

return(0);
}

void ioinit (void)
{
//1 = output, 0 = input
DDRB = 0b11111111; //All outputs
DDRC = 0b11111111; //All outputs
DDRD = 0b11111110; //PORTD (RX on PD0)
}

//General short delays
void delay_ms(uint16_t x)
{
uint8_t y, z;
for (; x > 0; x--){
for ( y = 0; y < 90; y++){
for ( z = 0; z < 6; z++){
asm volatile ("nop");
}
}
}
}
AnswerRe: swarm robot motor question Pin
bulg23-Apr-09 5:50
bulg23-Apr-09 5:50 
GeneralRe: swarm robot motor question Pin
RTek2323-Apr-09 14:30
professionalRTek2323-Apr-09 14:30 
QuestionHelp referencing a list control in a tab control. Pin
FISH78622-Apr-09 8:59
FISH78622-Apr-09 8:59 
QuestionRe: Help referencing a list control in a tab control. Pin
David Crow22-Apr-09 9:24
David Crow22-Apr-09 9:24 
AnswerRe: Help referencing a list control in a tab control. Pin
FISH78622-Apr-09 9:25
FISH78622-Apr-09 9:25 
QuestionIObjectSafety Pin
siva45522-Apr-09 8:20
siva45522-Apr-09 8:20 
AnswerRe: IObjectSafety Pin
CPallini22-Apr-09 9:01
mveCPallini22-Apr-09 9:01 
QuestionMouse movements & MOUSEEVENTF_MOVE versus Scroll & Highlight Pin
THAQCD22-Apr-09 6:41
THAQCD22-Apr-09 6:41 
Questionhighlight words in text to speech Pin
Member 282845222-Apr-09 6:18
Member 282845222-Apr-09 6:18 
AnswerRe: highlight words in text to speech Pin
ThatsAlok22-Apr-09 21:41
ThatsAlok22-Apr-09 21:41 
Questionhow to change sound devices in C++ or C# Pin
wgh1689922-Apr-09 5:17
wgh1689922-Apr-09 5:17 
QuestionImplementing a Scroll in an MFC dialog with an OpenGL window Pin
yousuf_227922-Apr-09 4:29
professionalyousuf_227922-Apr-09 4:29 
QuestionSafe ActiveX control.. Pin
p_196022-Apr-09 4:04
p_196022-Apr-09 4:04 
AnswerRe: Safe ActiveX control.. Pin
frx9622-Apr-09 17:10
frx9622-Apr-09 17:10 
Questiontab control and property pages problem Pin
Mihai Andrei Dragnea22-Apr-09 2:40
Mihai Andrei Dragnea22-Apr-09 2:40 
AnswerRe: tab control and property pages problem Pin
_AnsHUMAN_ 22-Apr-09 2:57
_AnsHUMAN_ 22-Apr-09 2:57 
GeneralRe: tab control and property pages problem Pin
Mihai Andrei Dragnea22-Apr-09 3:39
Mihai Andrei Dragnea22-Apr-09 3:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.