CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Machine Controllers Software and Solutions > Controller Cards



Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 03-03-2008, 02:07 PM
 
Join Date: Jan 2008
Location: UK
Posts: 6
rich200313 is on a distinguished road
Question PIC16f84A as stepper controller

I have been googling this for a while and trying to come up with a solution but so far no luck

I am trying to program a 16F84 to take stp pulses and dir inputs and then cycle through the correct outputs in the right order. I am using MikroC but so far i have been unable to find if a pin has been pulsed (instead of just being pulled high, so that i do not just repeat the port change every time that the code cycles).

Has anybody done this and if so could you show/explain some code so i can find out how to do this as it is driving me slowly insane (i plan to use a ULN 2804 connected to the output port BTW, and please do not use ASM, i really cant understand any of it, hope to learn it someday but havnt got the patients ATM)

Thanks,
Richard
Tweet this Post!Share on Facebook
Reply With Quote

  #2   Ban this user!
Old 03-09-2008, 06:31 PM
 
Join Date: Oct 2007
Location: Canada
Posts: 2
BkYrdMachine is on a distinguished road

Hello rich
I have done this by calling a table, containing the correct sequence of 1's / 0's
the table is then transfered to the output port of the pic.
for direction change, add or subtract from the table pointer
I also used one of the ports to drop the holding current after a short time, to stop over shoot but keep the average current level low... and the motor cool.
I use another port to spike the motor, to increase the speed & torque.
for testing the code, I used LEDs on a bread board.

I hope this helps you out.
Tweet this Post!Share on Facebook
Reply With Quote

  #3   Ban this user!
Old 03-10-2008, 09:09 AM
pminmo's Avatar  
Join Date: Jun 2003
Location: St. Peters, Mo USA
Age: 59
Posts: 3,325
pminmo is on a distinguished road

Is you problem needing the C code or a translator table or?
__________________
Phil, Still too many interests, too many projects, and not enough time!!!!!!!!
Vist my websites - http://pminmo.com & http://millpcbs.com
Tweet this Post!Share on Facebook
Reply With Quote

  #4   Ban this user!
Old 03-10-2008, 05:15 PM
 
Join Date: Apr 2005
Location: bih
Posts: 462
posix is on a distinguished road

I don't see how you hope to be able to play around with PICs without even trying to understand some of the assembler. There is one excellent tutorial out there that guides you through a few simple steps and by the end shows you basically how to build your own stepper controller in assembly on a 16f84. Then you can go and play with C on a PIC but you definitely want to learn at least some concepts (registers and pin assignments at least) if you want to be able to understand what's going on in your PIC. Assembler isn't THAT bad you know...trust me
Tweet this Post!Share on Facebook
Reply With Quote

  #5   Ban this user!
Old 03-12-2008, 04:28 AM
 
Join Date: Jan 2008
Location: UK
Posts: 6
rich200313 is on a distinguished road

Thanks for the replies, i am going to try to learn pic assembly because so far i have only tried for a snes and so pic will probably be easier. I will try to find the guide that posix mentioned and see what i can learn. I have decided to use a different design altogether however, but asm could be handy later, if i try robots etc.

Thanks again,
Rich
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 03-12-2008, 11:56 AM
pminmo's Avatar  
Join Date: Jun 2003
Location: St. Peters, Mo USA
Age: 59
Posts: 3,325
pminmo is on a distinguished road

Actyally I would disagree on learning assembler. Unless you want to do some critical timing, or push the processors limits, or get a more fundamental idea of how processors work, it's not necessary these days. The C compliers have become so good, that most of them are very efficient. PIC Basic is a really good tool also for the beginning programmer. I suspect if you did a google search on PIC, C and stepper you would get a lot of hits and compressed learning. I learned programming starting with assembler, it does give you a perspective on processor internals, but beyond that it has valid but limited usage these days.
__________________
Phil, Still too many interests, too many projects, and not enough time!!!!!!!!
Vist my websites - http://pminmo.com & http://millpcbs.com
Tweet this Post!Share on Facebook
Reply With Quote

  #7   Ban this user!
Old 03-18-2008, 04:39 PM
 
Join Date: Jan 2008
Location: UK
Posts: 6
rich200313 is on a distinguished road

I agree about how good some C/BASIC etc languages are these days but i would still like to learn ASM (i like to know how things work in detail), but i have had no luck in finding the tutorial that you refer to posix, do you remember the name of the author or have a link to the site?

Thanks,
Rich
Tweet this Post!Share on Facebook
Reply With Quote

  #8   Ban this user!
Old 03-20-2008, 01:41 PM
 
Join Date: Jan 2006
Location: USA
Posts: 1,495
keebler303 is on a distinguished road

Here is a really high quality course in assembly programming. I have gotten through about half of it in full depth and it really is very good.
Enjoy!

http://www.amqrp.org/elmer160/lessons/

Matt

Also there is a forum for pics in particular on the zone, FYI.

http://www.cnczone.com/forums/pic_programing_design/

Last edited by keebler303; 03-20-2008 at 01:42 PM. Reason: Added link
Tweet this Post!Share on Facebook
Reply With Quote

  #9   Ban this user!
Old 03-20-2008, 03:46 PM
 
Join Date: Jan 2008
Location: UK
Posts: 6
rich200313 is on a distinguished road

Thanks for the link, i knew about the PIC zone but i wasnt sure where to put the thread when it started, as it was origionally for a stepper controller, so here seemed more appropriate.

Thanks again,
Rich
Tweet this Post!Share on Facebook
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
My stepper controller iceblu3710 DIY-CNC Router Table Machines 11 10-02-2007 11:23 PM
stepper controller...need help DragnsBane General Electronics Discussion 2 09-10-2004 10:49 PM
Stepper controller itsme General Electronics Discussion 9 08-13-2004 12:30 AM
Anyone use this stepper controller? mvaughn DIY-CNC Router Table Machines 0 03-18-2004 06:41 PM
USB Stepper Controller High Seas General Electronics Discussion 1 12-23-2003 12:25 PM




All times are GMT -5. The time now is 03:13 AM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353