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! > Electronics > PIC Programing / Design


PIC Programing / Design Discuss programing of PIC chips here and design of electronics using PIC chips.


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 11-09-2009, 07:12 AM
 
Join Date: Nov 2007
Location: SOUTH AFRICA
Posts: 31
anilam is on a distinguished road
newb needs advice on pic project

I don't know much about programming pic's, but would like to learn & build a pic timer with battery back up for my pool pump and later add on a few extra's.

I have a EASYPIC2 development board from MikroElectronika and would like some advice on choice of micro chips for such a project. Eventually I want to add things like temp sensors - rain sensor - day/night sensor - wind sensor etc.

Advice on choice of programming language & chips (16f628A/16f877A)would be great

thanks
anilam
Reply With Quote

  #2   Ban this user!
Old 11-09-2009, 05:47 PM
rdenis's Avatar  
Join Date: Nov 2009
Location: Canada
Posts: 21
rdenis is on a distinguished road

I was in the same boat as you a couple of years ago. I started with PIC Basic initially because I knew some Basic from the mid 80's (Commodore 64) and knew nothing about C let alone Assembly Language. I started with the 12F675 (6 pins) because they were cheap cheap cheap. My first project was a boost button for a battery powered rideon toy that would double the power output of the motors by switching from 12 volts to 24 volts on the fly.

The 12F675 monitored 3 internal timers/counters and three inputs (gas, gear position, and boost button press) and if the conditions were met would drive the output pins for an RGB LED circuit to inform the driver whether Boost was available (flashing red - stopped, red - in low gear or reverse, yellow - 10 second timer for "boost charging", green - BOOST AVAILABLE for six seconds when button pressed and held.)

PIC Basic is easy to learn and if your timers do not need to be accurate to clock cycle resolution, then this is an easy way to get introduced. In other words, if your timers only need to be accurate to say the second, minute, or hour, and you don't need to simultaneously monitor inputs via interrupt routines, PIC Basic is fantastic - especially on the 8 lane highway PICs (8 Bit).

I still use PIC Basic today for a lot of projects which are quick and dirty - but there is nothing like using assembly language to really control the power of the PIC - once I started getting into complex timing projects which required the use of interrupt routines, I quickly learned PIC Assembly language. I had never programmed in Assembly before but there are lots of online tutorials to help - Assembly will also force you to become intimately involved with your PIC datasheet which is where you learn the true power of a PIC.

If you understand basic electronic theory, basic binary math and basic boolean logic, you will master PIC based assembly in no time.

Once you learn PIC assembly, you will inherently understand C programming from reading a particular C command's description. The structure of C will also make way more sense.

The 8 Bit pics are extremely powerful for what they pack - the 12F675 may seem like an entry level PIC (and is) but it still has an onboard oscillator, 6 I/O pins, 128 Bytes of EEPROM, 2 timers, 1 comparator, and one A/D converter with 4 inputs. It will easily handle you project you describe.

Higher up the 8 Bit food chain you can look at the 16F9xx PICS which have more inputs, more timers, more AD converters, more comparators, more memory, LCD drivers, serial port communications, etc. - all with the same instruction set as the lowly 12F675!

If the 8 lane highway starts getting too crowded, jump over to the 16 or 32 lane PICS such as the 18F series or 24F series - want to start playing with High Speed BUSES like CAN, these are the PICS for you. The instruction sets add a few more cool commands which will make programming even easier.

Anyway, PICS are like heroin - once you use them, withdrawal symptoms are killer!
Reply With Quote

  #3   Ban this user!
Old 11-10-2009, 01:39 AM
 
Join Date: Nov 2007
Location: SOUTH AFRICA
Posts: 31
anilam is on a distinguished road

Originally Posted by rdenis View Post
I was in the same boat as you a couple of years ago. I started with PIC Basic initially because I knew some Basic from the mid 80's (Commodore 64) and knew nothing about C let alone Assembly Language. I started with the 12F675 (6 pins) because they were cheap cheap cheap. My first project was a boost button for a battery powered rideon toy that would double the power output of the motors by switching from 12 volts to 24 volts on the fly.

The 12F675 monitored 3 internal timers/counters and three inputs (gas, gear position, and boost button press) and if the conditions were met would drive the output pins for an RGB LED circuit to inform the driver whether Boost was available (flashing red - stopped, red - in low gear or reverse, yellow - 10 second timer for "boost charging", green - BOOST AVAILABLE for six seconds when button pressed and held.)

PIC Basic is easy to learn and if your timers do not need to be accurate to clock cycle resolution, then this is an easy way to get introduced. In other words, if your timers only need to be accurate to say the second, minute, or hour, and you don't need to simultaneously monitor inputs via interrupt routines, PIC Basic is fantastic - especially on the 8 lane highway PICs (8 Bit).

I still use PIC Basic today for a lot of projects which are quick and dirty - but there is nothing like using assembly language to really control the power of the PIC - once I started getting into complex timing projects which required the use of interrupt routines, I quickly learned PIC Assembly language. I had never programmed in Assembly before but there are lots of online tutorials to help - Assembly will also force you to become intimately involved with your PIC datasheet which is where you learn the true power of a PIC.

If you understand basic electronic theory, basic binary math and basic boolean logic, you will master PIC based assembly in no time.

Once you learn PIC assembly, you will inherently understand C programming from reading a particular C command's description. The structure of C will also make way more sense.

The 8 Bit pics are extremely powerful for what they pack - the 12F675 may seem like an entry level PIC (and is) but it still has an onboard oscillator, 6 I/O pins, 128 Bytes of EEPROM, 2 timers, 1 comparator, and one A/D converter with 4 inputs. It will easily handle you project you describe.

Higher up the 8 Bit food chain you can look at the 16F9xx PICS which have more inputs, more timers, more AD converters, more comparators, more memory, LCD drivers, serial port communications, etc. - all with the same instruction set as the lowly 12F675!

If the 8 lane highway starts getting too crowded, jump over to the 16 or 32 lane PICS such as the 18F series or 24F series - want to start playing with High Speed BUSES like CAN, these are the PICS for you. The instruction sets add a few more cool commands which will make programming even easier.

Anyway, PICS are like heroin - once you use them, withdrawal symptoms are killer!
wow ok some food for thought I think I'll stick with basic for now. I will have to source some of these 12f675's in the mean time I will just use my 16f628A to experiment with?

great thanks
till later
anilam
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
Need advice in my project elchip UHU Servo Controllers 1 10-31-2009 06:15 PM
Need motor advice for a project... kentrob11 General Electronics Discussion 0 03-21-2008 09:05 AM
Need advice, newb question here. DerHammer Fanuc 6 11-13-2007 12:23 AM
Need some advice on my project sigipa Mechanical Calculations/Engineering Design 9 09-16-2007 11:43 AM
Advice for a Complete Newb on DIY CNC waglo DIY-CNC Router Table Machines 2 04-05-2005 07:59 AM




All times are GMT -5. The time now is 03:49 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 354 355 356 357 358 359 360 361