Sorry to be a pain but I'm checking out a bot with stepper motors using include mcp23017.h.
There was some discusion about it in the forum and which syntax was correct.
I've checked git hub under anobium demos but can't find the demos I have on one pc...it's not my code.
#chipmega328p,16
#include<MCP23017.h>
#optionExplicit
#defineI2C_MODEMaster
#defineI2C_DATAPORTC.4
#defineI2C_CLOCKPORTC.5
#defineI2C_DISABLE_INTERRUPTSON'Optionally, you can reduce the I2C timings.
#defineI2C_BIT_DELAY0us
#defineI2C_CLOCK_DELAY1us
#defineI2C_END_DELAY0usdirportc.0outT
#defineMCP23017_addr78;#define MCP23017_IODIRA 0; make porta output;MCP23017_sendbyte (MCP23017_addr,MCP23017_IODIRA,0) ;set port a to outMCP23017_sendbyte(MCP23017_addr,MCP23017_GPIOA,0)dimlmotforward,lmotor,rmotforward,rmotor,lmotval,rmotvalasbytelmotforward=255:lmotor=1:rmotforward=1:rmotor=1;interrupt drives motor 100 HzOnInterruptTimer0Match1CallmotorsDimOCR0ASbytealiasOCR0ADimTCCR0ASbytealiasTCCR0BWGM01=1'Timer in CTC mode - requiredOCR0=19TCCR0=0x28TCCR0=TCCR0or0x05';interrupt drives motors' On Interrupt Timer1Overflow Call motors''Initialisethetimer-thisisrequired''Setprescalerto1andthenstartthetimer' InitTimer1 Osc, PS_1_1''Startthetimer-thisisrequired' StartTimer 1''SetheretoinitialisebutyouneedtosetintheInterruptroutinehandler''UsetheTimerCalc' application that is part of Mister E PIC Mutl-calc tookset to calculate the value.''EnsureyousetthePrescalerintheInitTimer1shownabove' SetTimer 1, 25538;;do;your codeloop;----- end'This will be called when the Timer overflowsSubmotors' Set the register to 6 to give us the 10ms Interrupt.' Use the Timer Calc'applicationthatispartofMisterEPICMutl-calctooksettocalculatethevalue.
' Ensure you set the Prescaler in the InitTimer1 shown above; SetTimer 1, 25538 ;reset timer;left stepper motoriflmotforward=1Thenlmotor++iflmotor=9thenlmotor=1elselmotor---iflmotor=0thenlmotor=8endif;selectcaselmotorcase1lmotval=128case2lmotval=192case3lmotval=64case4lmotval=96case5lmotval=32case6lmotval=48case7lmotval=16case8lmotval=144EndSelect;right stepper motorifrmotforward=1Thenrmotor++ifrmotor=9thenrmotor=1elsermotor---ifrmotor=0thenrmotor=8endif;selectcasermotorcase1rmotval=1case2rmotval=3case3rmotval=2case4rmotval=6case5rmotval=4case6rmotval=12case7rmotval=8case8rmotval=9EndSelectMCP23017_sendbyte(MCP23017_addr,MCP23017_GPIOA,lmotval+rmotval);sets porta to lmotval+rmotvalportc.0=!portc.0EndSub
where are the mcp23017 demos please? I have looked but only found myself talking rubbish in the forum.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I found this https://sourceforge.net/p/gcbasic/discussion/629990/thread/d82cd72e/?limit=25#9d3a
it seems so unfamiliar after a short time.
really handy chip for running stepper motors via uln 2803.
16 io pins is handy but not sure how fast it is. driving a glcd comes to mind. they need lots of pins sometimes.
Any way,now to convert motor pulses to degrees using cheap 28BYJ-48 Stepper Motor.
Last edit: stan cartwright 2019-09-15
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It seems to be coming back..a bit.
The idea of running from interrupts is nice but speed could be adjusted by other ways than intrrupt speed.
I don't understand 4 pole stepper motors as far as do you send 4 bits or 8.
some files I found
Sorry to be a pain but I'm checking out a bot with stepper motors using include mcp23017.h.
There was some discusion about it in the forum and which syntax was correct.
I've checked git hub under anobium demos but can't find the demos I have on one pc...it's not my code.
where are the mcp23017 demos please? I have looked but only found myself talking rubbish in the forum.
No demo for these parts. I have them in extensive use with real solutions.
The only demo is here post by some fella called Stan. :-)
I have several demos but they not my style. so where they come from?old age?
so there are no demos for mcp23017 ?
I posted this at the time as some one else made the include file. https://www.youtube.com/watch?v=Td7yWYImjr4&list=UUwOlmqc5IB4FhvS5XKu1sLw&index=33&t=0s
I found this https://sourceforge.net/p/gcbasic/discussion/629990/thread/d82cd72e/?limit=25#9d3a
it seems so unfamiliar after a short time.
really handy chip for running stepper motors via uln 2803.
16 io pins is handy but not sure how fast it is. driving a glcd comes to mind. they need lots of pins sometimes.
Any way,now to convert motor pulses to degrees using cheap 28BYJ-48 Stepper Motor.
Last edit: stan cartwright 2019-09-15
When you get familiar .... a few demos would be good to put in the demo folder, and, some documentation.
It seems to be coming back..a bit.
The idea of running from interrupts is nice but speed could be adjusted by other ways than intrrupt speed.
I don't understand 4 pole stepper motors as far as do you send 4 bits or 8.
some files I found