Good Day All.
I have been looking around the internet this morning for a PIC related forum and found this one.
I do hope you might be able to help me.
I am looking for help and advice with a current project.
Upto now I have been using PicAxe PIC chips for my projects.
As the picaxe has it's own bootloader and software built into the chip, it runs much slower then a standard pic chip.
So I need to go down the route of using a true pic chip for my project.
I am trying to build my own stepper motor driver board to use with the Mach3 cnc software.
I am looking at using a pic chip something along the lines of PIC16F88 as I can pick thease up cheap atm.
I need a total of 14/15 usable io ports.
Input
Enable Pin.
Step Pin.
Dir Pin.
Mode Select Pin1.
Mode Select Pin2.
Output
Coil A.
Coil B.
Coil C.
Coil D.
Fan Control.
Enable LED.
Step LED.
Dir LED.
I want to be able to select the step modes via two side switchs, Full Step Mode, Wave Step Mode, and Half Step Mode.
The enable and dir pins are just switched high / low inputs no rapid changing.
The step pin only has a very small pulse, the Mach3 default pulse lengh is just 1us, but this can be adjust upto a max of 15us.
Here is the code that is used with the PicAxe chip.
Code:
#picaxe 28x2
setfreq em40
let dirsB = %11111111
let adcsetup = 0
let pinsB = %00000000
Main:
if pinA.0 = 0 then goto no_step
if pinA.0 = 1 and pinA.2 = 0 and pinA.1 = 1 then goto Step_CW
if pinA.0 = 1 and pinA.2 = 1 and pinA.1 = 1 then goto Step_CCW
goto main
no_step:
let pinsB = %00000000
goto main
step_CW:
let b1 = b1 + 1
goto step2
step_CCW:
let b1 = b1 - 1
goto step2
step2:
let b1 = b1 & %00000111
Read b1,b2
Eeprom 0, (%00000001,%00000011,%00000010,%00000110,%00000100,%00001100,%00001000,%00001001)
let pinsB = b2
do
if pinA.1 = 0 then goto main
loop
I know that true pic code looks nothing like the picaxe coding, but it might give you a better idea what I am trying to do.
Now that you might have some idea what I am trying to do here comes my questions.
(1) Am in the right forum to ask this question.
(2) What would be the best, cheapest, and smallest pin number chip that I can use.
(3) I understand that there are meny types of coding for true pic chips, whats going to be the easyest for a newbe.
(4) where do I start?
Thanks for your time.
Best Regards.
Bookmarks