PDA

View Full Version : About olympic timer..



Eng4444
- 4th June 2006, 06:38
first, am i obliged to write:

"
@ DEVICE pic16F876, XT_OSC ' System Clock Options
@ DEVICE pic16F876, WDT_ON ' Watchdog Timer
@ DEVICE pic16F876, PWRT_ON ' Power-On Timer
@ DEVICE pic16F876, BOD_ON ' Brown-Out Detect
@ DEVICE pic16F876, LVP_OFF ' Low-Voltage Programming
@ DEVICE pic16F876, CPD_OFF ' Data Memory Code Protect
@ DEVICE pic16F876, PROTECT_OFF
' Program Code Protection
@ DEVICE pic16F876, WRT_OFF ' Flash Memory Word Enable

"

or i can set them from icprog?

Melanie
- 4th June 2006, 08:19
No, you're not obliged to include the DEVICE Configuration Settings. You can set those manually within your programmer if it is capable of doing that.

Eng4444
- 4th June 2006, 08:39
should i change something concerning using this PIC? or i just download the program as it is in it?

i'm working on it right now and will give news soon..

Melanie
- 4th June 2006, 08:49
If your copy the HARDWARE and the SOFTWARE and you do so EXACTLY, WITHOUT CHANGES in either, then it WILL WORK as advertised.

The PIC16F876A is DIFFERENT to the normal PIC16F876. From memory it has COMPARATORS and a VOLTAGE REFERENCE that need to be disabled. Please download the Datasheet from the Microchip Website to see how to accomplish this.

I reitterate, copy the OLYMPIC TIMER example EXACTLY, without any change or deviation (not even with a simple 'A' on the end of the chip is allowed) and it will work.

Melanie
- 4th June 2006, 09:16
Since, thankfully, I'm about to go out and enjoy myself for the rest of the day (at the Bedfordshire School of Falconry in case anyone wanted to know), and I don't want to see you struggle with your 16F876A, I will tell you that you should add...


CMCON=%00000111 ' Disable Comparators
CVRCON=%00000000 ' Disable Reference Module

Insert these two lines after the OPTION_REG.7=0 statement in the Initialise Processor Section. Actually, thinking about it, the Olympic Timer doesn't use PORTA, so technically you don't need the above two lines to make it work.

But you will need to add an 'A' to the end of the processor designation in each of the eight lines in the PIC Defines section...



@ DEVICE pic16F876A, XT_OSC ' System Clock Options
@ DEVICE pic16F876A, WDT_ON ' Watchdog Timer
@ DEVICE pic16F876A, PWRT_ON ' Power-On Timer
@ DEVICE pic16F876A, BOD_ON ' Brown-Out Detect
@ DEVICE pic16F876A, LVP_OFF ' Low-Voltage Programming
@ DEVICE pic16F876A, CPD_OFF ' Data Memory Code Protect
@ DEVICE pic16F876A, PROTECT_OFF ' Program Code Protection
@ DEVICE pic16F876A, WRT_OFF ' Flash Memory Word Enable


It will compile with the command line (assuming you've called your file olympic.bas)...

PBPW -p16P876A olympic -v

If it doesn't compile, check your program. The -v will cause the compiler to point to your problem.

If it compiles but doesn't work, then you've done something wrong... check all your connections, Xtal/Resonator, MCLR pin, Hardware, Supply voltages. Not all LCD's like to have the Contrast pin connected to Vss... if yours is one of those, ensure you have a suitable Contrast connection (see LCDOUT in PICBasic Manual for an example schematic).

Have a nice day.