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 10-23-2006, 01:49 AM
 
Join Date: Oct 2005
Location: United States
Posts: 21
Minesgeek is on a distinguished road
PIC16F627A Programming Problem

Hello,

I'm just getting into programming pic's, and I'm using a pic in my senior design project. I have an issue programming a PIC16F627A, the software has been tested on a PIC16F84, but I would like to use the '627A for the internal oscillator. I'm using an EPIC programmer with a PICBASIC PRO 2.45 compiler, and the MELABS Beta 4.0 loader software. Here is the code (hardly qualifies as programming):

output PORTA.0
input PORTA.1
dir1 var PORTA.1
led VAR PORTA.0
loop:
LED = DIR1
goto loop
end

This is just test code I'm trying to get to run, all it is meant to do is turn on an LED on PORTA.0, when I press a switch attached to PORTA.1. Works just fine with the 'F84, all I change is the compiler/loader option from 'F84 to the '627A, and change the configuration file to internal oscillator. I don't change the circuitry from 'F84 to the '627 except for removing the 2 caps and the crystal. With these same changes I can get both to run a simple blink program. Any suggestions and/or advice is greatly appreciated.

Thanks,

Minesgeek
Tweet this Post!Share on Facebook
Reply With Quote

  #2   Ban this user!
Old 10-23-2006, 10:03 AM
 
Join Date: Aug 2005
Location: USA
Posts: 1,622
One of Many is on a distinguished road
I'd ask if DIR1/LED is actually the same as dir1/led and could be case sensitive.

Second would be if there are any header settings to begin the code at a certain place in memory or clear old/random junk.

I have never used these chips or the software you mention, but I have done some large projects with Parallax SX and small ones with Basic Stamp products.

DC
__________________
Learn cause and effect through experience. Mastering those relationships is the "Common Sense" ability within the art of any trade.
Tweet this Post!Share on Facebook
Reply With Quote

  #3   Ban this user!
Old 10-23-2006, 01:21 PM
 
Join Date: Oct 2006
Location: USA
Posts: 4
JRinAZ/MN is on a distinguished road
I believe you forgot to address a few other things first:
1.you have to tell it to use the internal oscillator
Tweet this Post!Share on Facebook
Reply With Quote

  #4   Ban this user!
Old 10-23-2006, 01:23 PM
 
Join Date: Oct 2006
Location: USA
Posts: 4
JRinAZ/MN is on a distinguished road
Sorry for the erratic post...
Try thisinclude in the beginning of your code)
@ DEVICE PIC16F627, INT_OSC
Tweet this Post!Share on Facebook
Reply With Quote

  #5   Ban this user!
Old 10-23-2006, 01:28 PM
 
Join Date: Oct 2006
Location: USA
Posts: 4
JRinAZ/MN is on a distinguished road
Again... This time I won't hit tab
Add these lines in the beginning of your code:
@ DEVICE PIC16F627 INTRC_OSC_NOCLKOUT 'that tells it to use internal osc
CMCON=7 'turn comparators off
VRCON=0 'voltage ref disabled

This should make it work better

Cheers,
JR
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 10-24-2006, 08:39 PM
 
Join Date: Oct 2005
Location: United States
Posts: 21
Minesgeek is on a distinguished road
JRinAZ/MN,

Thanks, I'll try those, actually the programmer can set the chip to internal oscillator, but that code is much better. I just discovered the comparator functions in the data sheet (yeaahh...good idea to read those, huh?). These little chips rock...I just build some stepper drivers for my mill using the L6208, I may be redesigning the whole thing to use a pic chip and the new Infineon H-bridges TLE 5206 (these bridges are nice, check 'em out).

Thanks again for all your help!

Minesgeek

P.S. the caps in my code were my bad..it's case consistent in the program. Does anyone know of any free methods for programming these chips (or extremely cheap < $100)?
Tweet this Post!Share on Facebook
Reply With Quote

  #7   Ban this user!
Old 10-24-2006, 10:58 PM
 
Join Date: Oct 2006
Location: USA
Posts: 4
JRinAZ/MN is on a distinguished road
If you have a problem with the code, let me know... I write a great deal of PIC code (probably 150 pgms a year) for LCD panels, kiosks, and such.. I've done several unipolar programs for my own amusement....
Cheers,
JR
Tweet this Post!Share on Facebook
Reply With Quote

  #8   Ban this user!
Old 10-30-2006, 10:21 PM
 
Join Date: Aug 2005
Location: Canada
Posts: 36
niclatrique is on a distinguished road
you need to turn off comparator module beacause after a chip reset, the comparator inputs are analog and you won't be able to write on these pins.

this is why: CMCON = 0x07; // turn off comparator module

BTW, do you know C coding, because on HT-Soft web page http://www.htsoft.com/ you can downlod a free demo C compiler. the only thing is that you are limited to 1k byte of code size(which is a lot sufficient for a stepper driver including current control. You now have the compiler you now need the development environement get MP-LAB IDE from Microchip which is absolutely free on their site : http://www.microchip.com/stellent/id...&part=SW007002 There is project wizards in MP-LAB and you'll find how to select the ht-soft compiler from your MP-LAB project. You won't have to call the compiler separately.

Then, to program your chip get on: http://home.vrweb.de/~lotharstolz/st...vpc/index.html. cool hein ?? The 16F627A is LVP (Low Voltage Programming) It'll cost you 4 resistors and a DB9 connector !!! get IC-PROG (the link for ic-prog is on the page of the previous link)

questions ??

ask me

best regards,

nic

Last edited by niclatrique; 10-30-2006 at 10:41 PM.
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





All times are GMT -5. The time now is 11:19 PM.





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