How many proto-boards do you have on your bench? Or on a shelf somewhere? At the very least, just for trying out everyone elses programs you would need 2. 1 for 14-bit programs, and 1 for 18F's. Maybe even a 12F proto in the mix. Personaly, I have 7.
Now, how many times have you Cut&Pasted the hardware definition section from some other program you wrote, just to have all the __configs, crystal, and pinout information so you could try out some little piece of code thats only 10 lines. And how long did it take to find the program that had the right definitions in the first place.
What I'm suggesting is to have a Hardware Definition file for each proto-board which defines everthing required to initialize that device, the LCD, USART, EEPROM's and give meaningfull names to the pins, SDA, SCL etc.
Now whenever you want to try the program on a different chip, simply INCLUDE the file for the proto-board you want to use, and spend your time on the program, instead of trying to get it to run on that hardware. Then if you change the hardware (it is a proto-board), you only need to change 1 file. And, you won't be copying the wrong header from an old file.
Here's 1 of my definition files, it's nothing special, just the basics for a LAB-X2. This way all I need to do is <p>INCLUDE "\PBP\hardware\LAB-X2.DEF"</p>and everthings ready to go,
just add program.
Code:
'****************************************************************
'* Name : C:\LAB-X2.DEF *
'* Author : Darrel Taylor *
'* Date : 5/8/2003 *
'* Version : 1.0 *
'* Notes : Target is 18F452 *
'* : *
'****************************************************************
@ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HS_OSC_1H ' Set oscillator to High Speed (HS)
@ __CONFIG _CONFIG2H, _WDT_OFF_2H ' Turn off Watch Dog Timer (WDT)
Define OSC 10
CLEAR
' Define Hardware PWM channel 1
DEFINE CCP1_REG PORTC
DEFINE CCP1_BIT 2
' Define Hardware PWM channel 2
DEFINE CCP2_REG PORTC
DEFINE CCP2_BIT 1
AnalogPot VAR PORTA.0
AnalogPotAN CON 0
ADCON1 = $8E ' Right Justified, AN0 (RA0) Analog
INTCON2.7 = 0 ' Enable PORTB Pull-Ups
Button1 VAR PORTB.4
Button2 VAR PORTB.5
Button3 VAR PORTB.6
Servo VAR PORTB.3
LED1 VAR PORTB.0
LED2 VAR PORTB.1
LED3 VAR PORTB.2
LOW LED1
LOW LED2
LOW LED3
That's just one more reason. I have more.
Bookmarks