psoc 5lp and stepper motor serial control

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
mama_4621221
Level 1
Level 1

good day, i have a problem. i´m trying to drive my stepper by serial control.

i save the variable in UART_PutChar(datorecibido). the value of variable is sent to the stepper. the stepper does receive a number but does not execute the variable, does not run the number of degrees i want.

if you could help me modify my code.

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Primary problem is that main() ends. Usually one uses a while(1) loop to repeat all needed statements. When main() ends the chip will get initialized again.

Other provlem: Your interrupt handler is quite toolargr, just set a global flag in your handler which you check in the main-loop and act apon accordingly. And as a general rule: Do not use delays in an interrupt handler.

Bob

View solution in original post

0 Likes
1 Reply
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Primary problem is that main() ends. Usually one uses a while(1) loop to repeat all needed statements. When main() ends the chip will get initialized again.

Other provlem: Your interrupt handler is quite toolargr, just set a global flag in your handler which you check in the main-loop and act apon accordingly. And as a general rule: Do not use delays in an interrupt handler.

Bob

0 Likes