Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 21st, 2005, 5:49 PM   #1
HaZaRd2K5
Newbie
 
Join Date: Jan 2005
Posts: 1
Rep Power: 0 HaZaRd2K5 is on a distinguished road
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.
HaZaRd2K5 is offline   Reply With Quote
Old Feb 15th, 2005, 10:15 AM   #2
lgiordano
Newbie
 
Join Date: Feb 2005
Posts: 8
Rep Power: 0 lgiordano is on a distinguished road
Wrong instruction?

Actually the instruction 'movwf' only accepts one operand (the destination).
So, I think the compiler should say something about that.
lgiordano is offline   Reply With Quote
Old Mar 3rd, 2005, 11:33 AM   #3
brkstf
Programmer
 
brkstf's Avatar
 
Join Date: Feb 2005
Posts: 89
Rep Power: 4 brkstf is on a distinguished road
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
brkstf is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:54 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC