View Single Post
  #2   Spotlight this post!  
Unread 19-05-2007, 14:43
Mike Bortfeldt Mike Bortfeldt is offline
Registered User
FRC #1126 (& 1511)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Rochester, NY
Posts: 119
Mike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud ofMike Bortfeldt has much to be proud of
Re: PIC Assembly Followup

Kit,

I haven't taken a good look at your code, but I was wondering how you know that your processor is running at a 4mhz clock speed? Specifically, what are your configuration bits set for and if you are using the internal clock, what is the setting for the oscillator post scaler. In the manual, this would be chapter 12.1 and chapter 4.5.3 (oscillator configuration). It appears that the default bit setup for OSCCON is for a 31.25 khz frequency, not 4mhz. That would make your 5 millisecond interrupt actually more like 640 milliseconds. While I am certainly no expert in assembly language PIC programming, I did play around with it a little last year. Code that I developed usually had a line such as the following at the top of the code to ensure the configuration bits were set correctly

__config _INTOSCIO & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF

These flags are usually found in the .h file for the specific processor (this is for a PIC 12F683). If this doesn't help, let me know and I'll take a closer look at your code.

Mike

Last edited by Mike Bortfeldt : 19-05-2007 at 14:56.