All the DEFINE HS_OSC does is instruct the PIC to drive the Xtal or Resonator harder. As the frequency goes above 4MHz the xtals/resonators require increased drive. This doesn't mean that you HAVE to use XT_OSC at 4MHz and below. If you have multiple PICs connected to one Xtal for example, you may find that the additional loading requires the Master PIC to drive the Xtal at HS_OSC even if it is 4MHz.
Now the question is how fast is your PIC actually running?
The DEFINE OSC 20 tells PICBASIC that you've got a 20MHz circuit and to slow down it's internal timing accordingly - so TIME critical commands like PAUSE, SERIN, SEROUT etc work properly.
Do an experiment, Blink an LED at 1Hz with a simple program...
LED var PortB.1
Loop:
High LED
Pause 500
Low LED
Pause 500
Goto Loop
Compare it against your wristwatch... is it 1Hz WITH or WITHOUT the Define OSC 20 statement?
Bookmarks