View Single Post
readytolearn
#1
Feb24-12, 09:16 PM
P: 7
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 b00100000 STEP_TWO b00010000 STEP_THREE b00001000 STEP_FOUR b00000100
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.
Phys.Org News Partner Science news on Phys.org
'Smart material' chin strap harvests energy from chewing
King Richard III died painfully on battlefield
Capturing ancient Maya sites from both a rat's and a 'bat's eye view'