Hello hu lee gan,
Welcome to the forum,
For starters, you could make our lives much easier if you were to post the link to the source code so we do not have to hunt and hope we are looking at the correct code. Thank You.
Ok the code as loaded into Microcode Studio should be something like this:
The computer before me right now does not have MCS installed so bear with me . . . in the tool bar at the top is a list box where you are supposed to select the PIC you are using. When you select the chip MCS automatically links the correct PIC.BAS files and PIC.INC files to your code, if the correct chip is not selected you will get compile errors.Code:' Olympic Timer ' ============= ' Melanie Newman ' 05/Aug/2004 ' Topical Program demonstrates use of Interrupt ' Driven Background TIMER, to time events down to ' one one-hundredth of a Second (1/100 Sec). ' ' Bonus CALIBRATION Feature allows simple adjustments ' in 360mS steps per hour. This calibration adjustment ' range is limited to +/- 36 seconds per Hour. ' ' This program is for 4MHz clock (1uS Timer Ticks). ' ' PIC Defines ' =========== ' ' Change these defines to suit your chosen PIC ' @ 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 ' ' Hardware Defines ' ================ ' ' LCD ' . . . . and so on and so forth . . .
In the toolbar there are Editor and Compiler options, I think under the view button. It is there where you can choose whether to use MPASM or PM assemblers, what kind of file to output, what programmer you want to use, and a host of other goodies. Again if something does not agree with your code, then you get errors.
Additionally, if you wish to include Config Fuse settings in you code, you will need to go to the PBP Root Directiory and open the " .inc " file, in this case P16F628.inc, and comment out the default config statements there, if you do not it will throw errors at you and disregard the configs in your code.
Required reading below:
http://www.picbasic.co.uk/forum/showthread.php?t=543
http://www.picbasic.co.uk/forum/showthread.php?t=561
Bookmarks