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  
Old 09-07-2010, 03:38 PM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,544
Al_The_Man is on a distinguished road
Buy me a Beer?
32Khz crystal problem!

Anyone have problems of getting a Tim1 32khz Ext. Osc working?
I am having a frustrating time with getting the oscillator to run, on both a 62F628 and a 16F870.
I am using a popular Epson 32.768khz xtal.
I have gone from 12pf to 25pf for the caps, before I look for another Xtal, is there anything in particular I may have overlooked?
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

  #2  
Old 09-08-2010, 02:25 PM
Gold Member
 
Join Date: Oct 2005
Location: Australia
Posts: 2,251
RomanLini is on a distinguished road

Config settings?

Pop in a garden variety 4MHz xtal and see if it runs. That at least will confim config and T1CON settings.

Some of those 32kHz xtals are a little fussy as they are meant for micropower use, especially the tiny cylindrical type (watch xtals). I have had some results using a series resistor with the xtal I think about 1k but this is some years ago now.
Reply With Quote

  #3  
Old 09-08-2010, 03:56 PM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,544
Al_The_Man is on a distinguished road
Buy me a Beer?

Originally Posted by RomanLini View Post
Config settings?

Pop in a garden variety 4MHz xtal and see if it runs. That at least will confim config and T1CON settings.

Some of those 32kHz xtals are a little fussy as they are meant for micropower use, especially the tiny cylindrical type (watch xtals). I have had some results using a series resistor with the xtal I think about 1k but this is some years ago now.
Do any of the config settings apply to the T1OSO/T1OSI ?
I have ordered a different xtal and a range of caps, so hopefully I will have more luck.
I am using a pre-tested code from a tutorial as a test.
The only common thing so far is the xtal?? If all else fails I will try the 1k.
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

  #4   Ban this user!
Old 09-08-2010, 08:48 PM
 
Join Date: Jan 2007
Location: USA
Posts: 355
Eurisko is on a distinguished road

Al,

I don't have datasheets handy for the PICs you tried, but there are probably two different config bits that need to be set for the xtal to work properly.

In other PIC chips, the T1CON (timer 1 control register) has to have the T1OSCEN bit set (to enable the external oscillator) and the TMR1CS bit set ( to select the external clock).
__________________
Diplomacy is the art of saying "Nice doggie" until you can find a rock. - Will Rogers
Reply With Quote

  #5  
Old 09-08-2010, 09:18 PM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,544
Al_The_Man is on a distinguished road
Buy me a Beer?

I have set the T1CON register in the program, it is the config or configuration word that I was questioning, in the 16F628 it is register 14-1 or the __config instruction set at programming time.
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 09-08-2010, 10:37 PM
Iron-Man's Avatar  
Join Date: Jan 2009
Location: USA
Posts: 158
Iron-Man is on a distinguished road
PIC16F870

Al, the PIC16F870 can be operated in 4 different oscillator modes. Please see the data sheet here; http://melabs.picbasic.com/devicedata/30569a.pdf
For the 32Khz xtal, you need 33pf caps. Please see pages 91 and 92.

Also make sure that you have the proper mode set;

• LP Low Power Crystal
• XT Crystal/Resonator
• HS High Speed Crystal/Resonator
• RC Resistor/Capacitor

Hope this helps,

Iron-Man
Reply With Quote

  #7  
Old 09-09-2010, 10:03 AM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,544
Al_The_Man is on a distinguished road
Buy me a Beer?

Originally Posted by Iron-Man View Post
Al, the PIC16F870 can be operated in 4 different oscillator modes. Please see the data sheet here; http://melabs.picbasic.com/devicedata/30569a.pdf
For the 32Khz xtal, you need 33pf caps. Please see pages 91 and 92.
Also make sure that you have the proper mode set;

• LP Low Power Crystal
• XT Crystal/Resonator
• HS High Speed Crystal/Resonator
• RC Resistor/Capacitor

Hope this helps,

Iron-Man
But this appears to refer to the FOSCI/FOSCI, main system clock?
This is running OK as the program runs, it is the TI0SO/TIOSI, TIM1 clock, which appears to be LP type by default.
I get no 'scope signal at the 32khz xtal pins, I am testing with the x10 scope lead as is recommended.
As far as I have been able to tell in the documentation, the 16 bit configuration register does not apply to the TIM1 oscillator?
I will try more tests today, including the 33pf.
Thanks.
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

  #8   Ban this user!
Old 09-09-2010, 02:49 PM
Iron-Man's Avatar  
Join Date: Jan 2009
Location: USA
Posts: 158
Iron-Man is on a distinguished road

Al, I have searched for the, TI0SO/TIOSI, TIM1 clock and cannot find it listed any where in the data sheet for the 16F870. What data sheet are you working from. Can you post a picture of the board?

Iron-Man
Reply With Quote

  #9  
Old 09-09-2010, 02:55 PM
Gold Member
 
Join Date: Oct 2005
Location: Australia
Posts: 2,251
RomanLini is on a distinguished road

You didn't try the resistor like I suggested?

Re the configs, some of the later PICs have config bits that affect pin operation for the external TMR1 osc. I didn't check the 16F870 datasheet but since it's an earlier PIC there's probably no config needed.
Reply With Quote

  #10  
Old 09-09-2010, 04:02 PM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,544
Al_The_Man is on a distinguished road
Buy me a Beer?

Originally Posted by RomanLini View Post
You didn't try the resistor like I suggested?
I am going to see if I can get back to it tonight or tomorrow.
I even have a 7404 external xtal clock to mock up if all else fails.

Originally Posted by Iron-Man View Post
Al, I have searched for the, TI0SO/TIOSI, TIM1 clock and cannot find it listed any where in the data sheet for the 16F870.
Page 53 of the manual link you posted, pins 11 &12 of the 28 pin version, I really need it to work for the 16F628/A, I only mocked up the 870, as I had a proven Electronic Design that was close to what I was trying to do, and I wanted to see if the results were the same, which they were.
The F628 is practically the same set up for the 32.768khz clock xtal.
From what I have read so far, these watch xtal's are finicky to get started.
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
Reply With Quote

Sponsored Links
  #11   Ban this user!
Old 09-09-2010, 04:13 PM
 
Join Date: Jul 2004
Location: USA
Posts: 114
mcarvey is on a distinguished road
Buy me a Beer?

Al_The_Man,
Could you clarify exactly what you're trying to do? I need clarification on something. Also, I haven't used the 16 series in years, but am very familiar with the 18 series. Just took a look at the 16F628 data sheet though.
But this appears to refer to the FOSCI/FOSCI, main system clock?
This is running OK as the program runs, it is the TI0SO/TIOSI, TIM1 clock, which appears to be LP type by default.
Are you trying to run the microprocessor using 2 clocks (ie. 4MHz high speed for computations and 32KHz for low speed/sleep) or just 1 low speed clock (ie. main system clock is 32KHz for everything)? If the program is running, it is getting a FOSC from somewhere.
As far as I have been able to tell in the documentation, the 16 bit configuration register does not apply to the TIM1 oscillator?
I would agree with this, getting the 32Khz crystal working with timer1 should just be a matter of configuring the T1CON register correctly. In order to do this, it appears you have to set the following:
T1CON.0 -> 1 Timer1 enabled
T1CON.1 -> 1 external clock from in RB6/T1OSO
T1CON.2 -> 1 Do not synch external clock input. (if you are using this for sleep then you need to make sure that this is not synchronized)
T1CON.3-> 1 Oscillator enabled
T1CON.4-5 -> configure prescale value (1:1 -> 1:8)
T1CON.6,7 -> unimplemented- doesnt' matter.

Note that the datasheet suggests 15pF, but acknowledge that these values may need to be changed.

I may be (VERY possibly) remembering this incorrectly, but on some of the older chips (16F877?) I think putting a scope probe, even on 10X directly on the oscillator (this was the main external highest speed crystal oscillator, 20MHZ) caused it to not oscillate. Don't know what the inputs/outputs are like on the 628 when it's set up for T1osc mode. It may be worth the 15 minutes to hook up an HC04 or equivalent as a buffer so you can see it on the scope, or at least confirm that you can't see it on the scope...

Hope this helps.

-Matt
Reply With Quote

  #12  
Old 09-09-2010, 04:45 PM
Al_The_Man's Avatar
Community Moderator
 
Join Date: Dec 2003
Location: Canada
Posts: 16,544
Al_The_Man is on a distinguished road
Buy me a Beer?

Originally Posted by mcarvey View Post
Al_The_Man,
Could you clarify exactly what you're trying to do? I need clarification on something. Also, I haven't used the 16 series in years, but am very familiar with the 18 series. Just took a look at the 16F628 data sheet though.
Basically I picked the bones out of this article and want to use the basic functions from it, it is a very simple application so it is frustrating when it doesn't pan out, I just adapted it for my app. using the 16F628.
I need the precise 1 second clock, basically, to measure a low freq pulse.
System clock and Tim1 clk, the only difference is I am using the internal system clock to run the main code, the article uses an external xtal system clock also.
http://electronicdesign.com/article/...ncies8513.aspx
I have the code which is no longer available since E.D. moved their site.
Al.
__________________
CNC, Mechatronics Integration and Machine Design.
“Logic will get you from A to B. Imagination will take you everywhere.”
Albert E.
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 Help!- Optical Crystal adrianhdezch Laser Engraving & Cutting Machines 5 09-02-2010 01:26 AM
Surface finish problem - Could you please help me overcome this problem? DMBGO EMCO Lathe 5 08-04-2010 05:33 PM
Supply mini 2D/3D crystal laser subsurface engraving machine 3dlasermachine Product Announcements & Manufacturer News 1 09-07-2009 10:15 PM
Build Thread- laser cutting crystal Jiepu-Crystal Laser Engraving & Cutting Machines 0 08-07-2009 12:35 AM
Build Thread- laser crystal Jiepu-Crystal Laser Engraving & Cutting Machines 0 08-06-2009 09:50 PM




All times are GMT -5. The time now is 03:46 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