Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Programming

Status
Not open for further replies.

lena2383

New Member
I am trying to write a program using the 68hc11 microcontroller to run a stepper motor clockwise or counter clockwise and full or half step. I am STUMPED :cry: It has been several years since I had this type programming. I know that it is very simple but I don't know where I am wrong. I am using PORT A
PA5 is either clock wise or counter clock wise
PA6 is either full or half step
PA7 is the clock

Here is what I have so far: ALL HELP IS GREATLY APPRECIATED :lol:

BCLR $26 $40 ;ENABLE I/O
BSET $26 $60 ;PA5,PA6, SET TO OUTPUT
BSET $00 $20 ;PA5 SET TO CLOCK WISE
BSET $00 $40 ;PA6 SET TO FULL STEP
LDAA #11 ;NUMBER OF STEPS
STAA $1000 ;LOCATION OF STEPS
STEP BSET $00 $80 ;PA7 SET FOR CLOCK
BSR DLY
BCLR $00 $10 ;CLEAR CLOCK
DEC $1000
BNE STEP
HERE BRA HERE


DLY bset $26 $03 ;SETS INTERVAL FOR 32.77msec
ldaa #30 ;MULTIPLIER 30*32.77msec = 1SEC bclr $24 $40 ;DISABLES INTERRUPT
rep bset $25 $40 ;CLEARS FLAG
mon brclr $25 $40 mon ;IF SET END OF INTERRUPT
deca
bne rep
rts
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top