06.07.2013 Views

Lab 8 - Claymore - Grand Valley State University

Lab 8 - Claymore - Grand Valley State University

Lab 8 - Claymore - Grand Valley State University

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

}<br />

{<br />

}<br />

j = 0;<br />

count = 0;<br />

// -------------- The main program loop ------------------<br />

int main()<br />

{<br />

int c;<br />

sio_init();<br />

IO_setup();<br />

CLK_setup();<br />

for(;;)<br />

{<br />

while((c = input()) == -1){} // wait for a keypress<br />

if(c == 'd')<br />

{<br />

if(db_correct == 0)<br />

{<br />

db_correct = 1;<br />

outln("Deadband correction on");<br />

}<br />

else<br />

{<br />

db_correct = 0;<br />

outln("Deadband correction off");<br />

}<br />

}<br />

else if(c == 's')<br />

{<br />

count = 0;<br />

moving = 0;<br />

outint(count);<br />

outln(" = count, motor stopped");<br />

}<br />

else if(c == 'h')<br />

{<br />

outln(" d: enable (default) or disable deadband comp.");<br />

outln(" s: stop the motor");<br />

outln(" q: quit");<br />

}<br />

else if(c == '0')<br />

{<br />

count = 0;<br />

}<br />

else if(c == '1')<br />

{<br />

count = 28;<br />

}<br />

else if(c == '2')<br />

{<br />

count = 56;<br />

}<br />

18

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!