Stepping motor coding on microchip

In summary, the conversation is about programming a microchip PIC18C452 and using it for various exercises such as making an LED blink, simulating a stop light, and creating a color box using pulse width modulation and RGB LEDs. The speaker also mentions the importance of not just copying and pasting code and instead learning through hands-on exercises. They also suggest considering using an Arduino for prototyping.
  • #1
readytolearn
7
0
Hello,
Trying to code a microchip PIC18C452.
Desired:
4 steps per rotations
pulses per second=1/15
t wait =15s

#define #define #define #define
clrf
STEP_ONE b’00100000’ STEP_TWO b’00010000’ STEP_THREE b’00001000’ STEP_FOUR b’00000100’
STEP_NUMBER
; PortB<5:2> are used to connect the ; switches
; Initialize start of step sequence
;*********************************************************************** Initialize here TMR0 module, enable TMR0 interrupt and load a value in TMR0
;***********************************************************************
;************************************************************************ ; Routine in TMR0 ISR which updates the current sequence for the next steps ;************************************************************************
org UPDATE_STEP incf
btfsc clrf movf call movwf return
OUTPUT_STEP addwf
retlw retlw retlw retlw
2000h
STEP_NUMBER,F STEP_NUMBER,2 STEP_NUMBER STEP_NUMBER,W OUTPUT_STEP PORTB
PCL,F STEP_ONE STEP_TWO STEP_THREE STEP_FOUR
; Increment step number ; If Step number = 4h then clear the count
; Load the step number to Working register ; Load the sequence from the table ; to Port B
; Add Wreg content to PC and ; return the corresponding sequence in Wreg




this is what microchip has on their website for name AN822

If someone could please advise me on how to fill this in, it would be great.
I have almost no experience but would really love to be able to do this.

Thank you so much.
 
Engineering news on Phys.org
  • #2
you have to crawl before you walk.
Can you use the pic to make an LED blink?
simulate a 'stop light'?
use pulse width modulation combined with a red, a green, and a blue LED to make a color box?
these exercises may seem like a waste of time, but they're more useful than copy/paste- if all you do is copy/paste code, then you aren't really doing engineering!
(also, consider using an arduino for prototyping purposes)
 

1. What is a stepping motor?

A stepping motor is a type of electric motor that rotates in small, precise increments rather than continuously. It is commonly used in robotics, CNC machines, and other applications where precise control over motor movement is necessary.

2. How does a stepping motor work?

A stepping motor works by using electromagnetic fields to attract and repel the motor's rotor, causing it to rotate in small steps. This movement is controlled by a series of electronic pulses sent to the motor.

3. What is microchip coding for stepping motors?

Microchip coding for stepping motors refers to the process of programming a microchip, a small integrated circuit, to control the movement of a stepping motor. This allows for precise and customizable control over the motor's movement.

4. What are the benefits of using microchip coding for stepping motors?

Using microchip coding for stepping motors allows for more precise and customizable control over the motor's movement compared to traditional methods. It also allows for easier integration with other electronic systems and can save space and reduce costs.

5. Are there any limitations or challenges with stepping motor coding on microchips?

One limitation of stepping motor coding on microchips is the maximum number of steps that can be achieved, which is determined by the resolution of the microchip. Additionally, challenges may arise in designing and debugging the code and ensuring compatibility with the specific stepping motor being used.

Similar threads

Replies
9
Views
2K
  • Programming and Computer Science
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Electrical Engineering
Replies
10
Views
3K
  • Electrical Engineering
Replies
2
Views
2K
  • Electrical Engineering
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
7K
Back
Top