![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Jan 2005
Posts: 1
Rep Power: 0
![]() |
PIC16F684 and MC3479
I'm trying to get a PIC16F684 to output to an MC3479 stepper motor control chip. This is what I've got so far, but it's not working:
list R=DEC ; sets the default numbering system to decimal include "p16f684.inc" ; includes the header file __Config _FCMEN_OFF & _IESO_OFF & _BOD_OFF & _CPD_OFF & _CP_OFF & _MCLRE_ON & _PWRTE_ON & _WDT_OFF & _INTOSCIO ;********************************** ; SETUP org 0 clrf PORTC movlw 7 movwf CMCON0 ; turn off comparators bsf STATUS, RP0 movlw b'00000001' movwf ANSEL ^ 0x080 clrf TRISC ^ 0x080 bsf ADCON1^0x080, 4 bcf STATUS, RP0 movlw b'00000001' movwf ADCON0 ;Mainline of Stepper-LDR_Control.asm PAGE check: movlw 5 addlw -1 btfss STATUS, Z goto $ - 2 bsf ADCON0, GO btfsc ADCON0, GO goto $-1 loop: movf ADRESH, W movwf PORTC, 1 ; outputs to the stepper motors attached to PORTC goto check ; "bsf" will turn stepper on "1/0" will select CW/CCW ; "bcf" will turn stepper off END In particular, the part I can't get working is the code right after "loop:". The "movf ADRESH, W" is OK, but for some reason, it wont output to RC0. Any help would be appreciated. |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Feb 2005
Posts: 8
Rep Power: 0
![]() |
Wrong instruction?
Actually the instruction 'movwf' only accepts one operand (the destination).
So, I think the compiler should say something about that. |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Feb 2005
Posts: 89
Rep Power: 4
![]() |
I just got the mc3479 to interface with the pic16F628A yesterday and an "androsyn" micro stepper (400 steps/rotation).
if you're still interested in making it work, you can aim me at aim:theycallthiswork and i'll tell you what i can. the main thing is this: read and re-read the datasheet for the 3479. it's a little trickier than it should be, but it is a cool device that can save a lot of room on a circuit board. pay special attention to the resistor on pin6 and i think pin8. i just grounded pin8 and use a 200 ohm resistor to ground on pin6. this is a MUCH lower resistance value than the sheet suggests, but it works pretty well for this motor. remember too that the operating voltage on the 3479 is something like 8+ volts, so you'll need a secondary power bus apart from the 5ish volts you are using for the pic. also, remember that the next step is triggered by the rising edge on pin7. so, you have to switch from ground to high, then ground, then high again for two steps. a good test is to just program your pic to output a 100 HZ (approx) signal. use that to test the wiring of the 3479 and go from there. good luck |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|